Documentation ¶
Index ¶
- Constants
- Variables
- func DbEthTxAttemptToEthTxAttempt(dbEthTxAttempt DbEthTxAttempt, evmAttempt *EvmTxAttempt)
- func DbEthTxToEthTx(dbEthTx DbEthTx, evmEthTx *EvmTx)
- func DbReceiptFromEvmReceipt(evmReceipt *evmtypes.Receipt) dbReceipt
- func DbReceiptToEvmReceipt(receipt *dbReceipt) *evmtypes.Receipt
- func GetGethSignedTx(signedRawTx []byte) (*types.Transaction, error)
- func NewEvmTxAttemptBuilder(chainID big.Int, config Config, keystore TxAttemptSigner[common.Address], ...) *evmTxAttemptBuilder
- func NewEvmTxmClient(c evmclient.Client) *evmTxmClient
- func NewEvmTxmConfig(c Config) *evmTxmConfig
- func NewQueueingTxStrategy(subject uuid.UUID, queueSize uint32, queryTimeout time.Duration) (strategy txmgrtypes.TxStrategy)
- func NewSendEveryStrategy() txmgrtypes.TxStrategy
- func NewTxStore(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) *evmTxStore
- type CheckerFactory
- type Config
- type DatabaseConfig
- type DbEthTx
- type DbEthTxAttempt
- type DropOldestStrategy
- type EthTxMeta
- type EvmAccessList
- type EvmBroadcaster
- type EvmBroadcasterConfig
- type EvmConfirmer
- type EvmConfirmerConfig
- type EvmFwdMgr
- type EvmKeyStore
- type EvmNewTx
- type EvmNonceSyncer
- type EvmPriorAttempt
- type EvmReaper
- type EvmReaperConfig
- type EvmReceipt
- type EvmReceiptPlus
- type EvmResender
- type EvmResenderConfig
- type EvmTransmitChecker
- type EvmTransmitCheckerFactory
- type EvmTransmitCheckerSpec
- type EvmTx
- type EvmTxAttempt
- type EvmTxAttemptBuilder
- type EvmTxManager
- type EvmTxStore
- type EvmTxm
- type EvmTxmClient
- type EvmTxmConfig
- type ListenerConfig
- type NullEvmTxManager
- type SendEveryStrategy
- type SimulateChecker
- type TestEvmTxStore
- type TxAttemptSigner
- type VRFV1Checker
- type VRFV2Checker
Constants ¶
const ( // TransmitCheckerTypeSimulate is a checker that simulates the transaction before executing on // chain. TransmitCheckerTypeSimulate = txmgrtypes.TransmitCheckerType("simulate") // TransmitCheckerTypeVRFV1 is a checker that will not submit VRF V1 fulfillment requests that // have already been fulfilled. This could happen if the request was fulfilled by another node. TransmitCheckerTypeVRFV1 = txmgrtypes.TransmitCheckerType("vrf_v1") // TransmitCheckerTypeVRFV2 is a checker that will not submit VRF V2 fulfillment requests that // have already been fulfilled. This could happen if the request was fulfilled by another node. TransmitCheckerTypeVRFV2 = txmgrtypes.TransmitCheckerType("vrf_v2") )
Variables ¶
var ( ErrKeyNotUpdated = errors.New("evmTxStore: Key not updated") ErrInvalidQOpt = errors.New("evmTxStore: Invalid QOpt") // ErrCouldNotGetReceipt is the error string we save if we reach our finality depth for a confirmed transaction without ever getting a receipt // This most likely happened because an external wallet used the account for this nonce ErrCouldNotGetReceipt = "could not get receipt" )
Functions ¶
func DbEthTxAttemptToEthTxAttempt ¶ added in v2.1.0
func DbEthTxAttemptToEthTxAttempt(dbEthTxAttempt DbEthTxAttempt, evmAttempt *EvmTxAttempt)
func DbEthTxToEthTx ¶ added in v2.1.0
func DbReceiptFromEvmReceipt ¶ added in v2.1.0
func DbReceiptToEvmReceipt ¶ added in v2.1.0
func GetGethSignedTx ¶ added in v2.2.0
func GetGethSignedTx(signedRawTx []byte) (*types.Transaction, error)
GetGethSignedTx decodes the SignedRawTx into a types.Transaction struct
func NewEvmTxAttemptBuilder ¶
func NewEvmTxAttemptBuilder(chainID big.Int, config Config, keystore TxAttemptSigner[common.Address], estimator gas.EvmFeeEstimator) *evmTxAttemptBuilder
func NewEvmTxmClient ¶ added in v2.2.0
func NewEvmTxmConfig ¶ added in v2.1.0
func NewEvmTxmConfig(c Config) *evmTxmConfig
func NewQueueingTxStrategy ¶
func NewQueueingTxStrategy(subject uuid.UUID, queueSize uint32, queryTimeout time.Duration) (strategy txmgrtypes.TxStrategy)
NewQueueingTxStrategy creates a new TxStrategy that drops the oldest transactions after the queue size is exceeded if a queue size is specified, and otherwise does not drop transactions.
func NewSendEveryStrategy ¶
func NewSendEveryStrategy() txmgrtypes.TxStrategy
NewSendEveryStrategy creates a new TxStrategy that does not drop transactions.
Types ¶
type CheckerFactory ¶
CheckerFactory is a real implementation of TransmitCheckerFactory.
func (*CheckerFactory) BuildChecker ¶
func (c *CheckerFactory) BuildChecker(spec EvmTransmitCheckerSpec) (EvmTransmitChecker, error)
BuildChecker satisfies the TransmitCheckerFactory interface.
type Config ¶
type Config interface { gas.Config EthTxReaperInterval() time.Duration EthTxReaperThreshold() time.Duration EthTxResendAfterThreshold() time.Duration EvmGasBumpThreshold() uint64 EvmGasBumpTxDepth() uint32 EvmGasLimitDefault() uint32 EvmMaxInFlightTransactions() uint32 EvmMaxQueuedTransactions() uint64 EvmNonceAutoSync() bool EvmUseForwarders() bool EvmRPCDefaultBatchSize() uint32 KeySpecificMaxGasPriceWei(addr common.Address) *assets.Wei // Note: currently only TriggerFallbackDBPollInterval is needed // from here. Database() config.Database }
Config encompasses config used by txmgr package Unless otherwise specified, these should support changing at runtime
type DatabaseConfig ¶ added in v2.3.0
type DbEthTx ¶ added in v2.1.0
type DbEthTx struct { ID int64 Nonce *int64 FromAddress common.Address ToAddress common.Address EncodedPayload []byte Value assets.Eth // GasLimit on the EthTx is always the conceptual gas limit, which is not // necessarily the same as the on-chain encoded value (i.e. Optimism) GasLimit uint32 Error nullv4.String // BroadcastAt is updated every time an attempt for this eth_tx is re-sent // In almost all cases it will be within a second or so of the actual send time. BroadcastAt *time.Time // InitialBroadcastAt is recorded once, the first ever time this eth_tx is sent CreatedAt time.Time State txmgrtypes.TxState // Marshalled EthTxMeta // Used for additional context around transactions which you want to log // at send time. Meta *datatypes.JSON Subject uuid.NullUUID PipelineTaskRunID uuid.NullUUID MinConfirmations null.Uint32 EVMChainID utils.Big // AccessList is optional and only has an effect on DynamicFee transactions // on chains that support it (e.g. Ethereum Mainnet after London hard fork) AccessList EvmAccessList // TransmitChecker defines the check that should be performed before a transaction is submitted on // chain. TransmitChecker *datatypes.JSON InitialBroadcastAt *time.Time }
Directly maps to columns of database table "eth_txes". This is exported, as tests and other external code still directly reads DB using this schema.
func DbEthTxFromEthTx ¶ added in v2.1.0
type DbEthTxAttempt ¶ added in v2.1.0
type DbEthTxAttempt struct { ID int64 EthTxID int64 GasPrice *assets.Wei SignedRawTx []byte Hash common.Hash BroadcastBeforeBlockNum *int64 State txmgrtypes.TxAttemptState CreatedAt time.Time ChainSpecificGasLimit uint32 TxType int GasTipCap *assets.Wei GasFeeCap *assets.Wei }
Directly maps to columns of database table "eth_tx_attempts". This is exported, as tests and other external code still directly reads DB using this schema.
func DbEthTxAttemptFromEthTxAttempt ¶ added in v2.1.0
func DbEthTxAttemptFromEthTxAttempt(ethTxAttempt *EvmTxAttempt) DbEthTxAttempt
type DropOldestStrategy ¶
type DropOldestStrategy struct {
// contains filtered or unexported fields
}
DropOldestStrategy will send the newest N transactions, older ones will be removed from the queue
func NewDropOldestStrategy ¶
func NewDropOldestStrategy(subject uuid.UUID, queueSize uint32, queryTimeout time.Duration) DropOldestStrategy
NewDropOldestStrategy creates a new TxStrategy that drops the oldest transactions after the queue size is exceeded.
func (DropOldestStrategy) PruneQueue ¶
func (s DropOldestStrategy) PruneQueue(pruneService txmgrtypes.UnstartedTxQueuePruner, qopt pg.QOpt) (n int64, err error)
func (DropOldestStrategy) Subject ¶
func (s DropOldestStrategy) Subject() uuid.NullUUID
type EthTxMeta ¶
type EthTxMeta = txmgrtypes.TxMeta[common.Address, common.Hash] // TODO: change Eth prefix: https://smartcontract-it.atlassian.net/browse/BCI-1198
Type aliases for EVM
type EvmAccessList ¶ added in v2.2.0
type EvmAccessList struct { AccessList types.AccessList Valid bool }
EvmAccessList is a nullable EIP2930 access list Used in the AdditionalParameters field in Tx Is optional and only has an effect on DynamicFee transactions on chains that support it (e.g. Ethereum Mainnet after London hard fork)
func EvmAccessListFrom ¶ added in v2.2.0
func EvmAccessListFrom(al types.AccessList) (n EvmAccessList)
func (EvmAccessList) MarshalJSON ¶ added in v2.2.0
func (e EvmAccessList) MarshalJSON() ([]byte, error)
func (*EvmAccessList) Scan ¶ added in v2.2.0
func (e *EvmAccessList) Scan(value interface{}) error
Scan returns the selector from its serialization in the database
func (*EvmAccessList) UnmarshalJSON ¶ added in v2.2.0
func (e *EvmAccessList) UnmarshalJSON(input []byte) error
type EvmBroadcaster ¶ added in v2.1.0
type EvmBroadcaster = txmgr.Broadcaster[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList, *assets.Wei]
Type aliases for EVM
func NewEvmBroadcaster ¶ added in v2.2.0
func NewEvmBroadcaster( txStore EvmTxStore, evmClient EvmTxmClient, config txmgrtypes.BroadcasterConfig[*assets.Wei], listenerConfig txmgrtypes.BroadcasterListenerConfig, keystore EvmKeyStore, eventBroadcaster pg.EventBroadcaster, txAttemptBuilder EvmTxAttemptBuilder, nonceSyncer EvmNonceSyncer, logger logger.Logger, checkerFactory EvmTransmitCheckerFactory, autoSyncNonce bool, ) *EvmBroadcaster
NewEvmBroadcaster returns a new concrete EvmBroadcaster
type EvmBroadcasterConfig ¶ added in v2.1.0
type EvmBroadcasterConfig txmgrtypes.BroadcasterConfig[*assets.Wei]
type EvmConfirmer ¶ added in v2.1.0
type EvmConfirmer = txmgr.Confirmer[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList, *assets.Wei]
Type aliases for EVM
func NewEvmConfirmer ¶ added in v2.2.0
func NewEvmConfirmer( txStore EvmTxStore, evmClient EvmTxmClient, config txmgrtypes.ConfirmerConfig[*assets.Wei], dbConfig txmgrtypes.ConfirmerDatabaseConfig, keystore EvmKeyStore, txAttemptBuilder EvmTxAttemptBuilder, lggr logger.Logger, ) *EvmConfirmer
NewEvmConfirmer instantiates a new EVM confirmer
type EvmConfirmerConfig ¶ added in v2.1.0
type EvmConfirmerConfig txmgrtypes.ConfirmerConfig[*assets.Wei]
type EvmFwdMgr ¶ added in v2.1.0
type EvmFwdMgr = txmgrtypes.ForwarderManager[common.Address]
Type aliases for EVM
type EvmKeyStore ¶ added in v2.1.0
Type aliases for EVM
type EvmNonceSyncer ¶ added in v2.1.0
Type aliases for EVM
func NewNonceSyncer ¶
func NewNonceSyncer( txStore EvmTxStore, lggr logger.Logger, ethClient evmclient.Client, kst EvmKeyStore, ) EvmNonceSyncer
NewNonceSyncer returns a new syncer
type EvmPriorAttempt ¶ added in v2.1.0
type EvmPriorAttempt = txmgrtypes.PriorAttempt[gas.EvmFee, common.Hash]
Type aliases for EVM
type EvmReaper ¶ added in v2.2.0
Type aliases for EVM
func NewEvmReaper ¶ added in v2.2.0
func NewEvmReaper(lggr logger.Logger, store txmgrtypes.TxHistoryReaper[*big.Int], config EvmReaperConfig, chainID *big.Int) *EvmReaper
NewEvmReaper instantiates a new EVM-specific reaper object
type EvmReaperConfig ¶ added in v2.1.0
type EvmReaperConfig txmgrtypes.ReaperConfig
type EvmReceipt ¶
type EvmReceipt = dbReceipt // EvmReceipt is the exported DB table model for receipts
Type aliases for EVM
type EvmReceiptPlus ¶
type EvmReceiptPlus = txmgrtypes.ReceiptPlus[*evmtypes.Receipt]
Type aliases for EVM
type EvmResender ¶ added in v2.1.0
type EvmResender = txmgr.Resender[*big.Int, common.Address, common.Hash, common.Hash, evmtypes.Nonce, gas.EvmFee, *evmtypes.Receipt, EvmAccessList]
Type aliases for EVM
func NewEvmResender ¶ added in v2.2.0
func NewEvmResender( lggr logger.Logger, txStore EvmTxStore, evmClient EvmTxmClient, ks EvmKeyStore, pollInterval time.Duration, config EvmResenderConfig, ) *EvmResender
NewEvnResender creates a new concrete EvmResender
type EvmResenderConfig ¶ added in v2.1.0
type EvmResenderConfig txmgrtypes.ResenderConfig
type EvmTransmitChecker ¶ added in v2.1.0
type EvmTransmitChecker = txmgr.TransmitChecker[*big.Int, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
var ( // NoChecker is a TransmitChecker that always determines a transaction should be submitted. NoChecker EvmTransmitChecker = noChecker{} )
type EvmTransmitCheckerFactory ¶ added in v2.1.0
type EvmTransmitCheckerFactory = txmgr.TransmitCheckerFactory[*big.Int, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTransmitCheckerSpec ¶ added in v2.1.0
type EvmTransmitCheckerSpec = txmgrtypes.TransmitCheckerSpec[common.Address]
type EvmTx ¶ added in v2.1.0
type EvmTx = txmgrtypes.Tx[*big.Int, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTxAttempt ¶ added in v2.1.0
type EvmTxAttempt = txmgrtypes.TxAttempt[*big.Int, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTxAttemptBuilder ¶ added in v2.1.0
type EvmTxAttemptBuilder = txmgrtypes.TxAttemptBuilder[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTxManager ¶ added in v2.1.0
type EvmTxManager = txmgr.TxManager[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
func NewTxm ¶
func NewTxm( db *sqlx.DB, cfg Config, dbConfig DatabaseConfig, listenerConfig ListenerConfig, client evmclient.Client, lggr logger.Logger, logPoller logpoller.LogPoller, keyStore keystore.Eth, eventBroadcaster pg.EventBroadcaster, estimator gas.EvmFeeEstimator, ) (txm EvmTxManager, err error, )
NewTxm constructs the necessary dependencies for the EvmTxm (broadcaster, confirmer, etc) and returns a new EvmTxManager
type EvmTxStore ¶ added in v2.1.0
type EvmTxStore = txmgrtypes.TxStore[common.Address, *big.Int, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTxm ¶ added in v2.1.0
type EvmTxm = txmgr.Txm[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList, *assets.Wei]
Type aliases for EVM
func NewEvmTxm ¶ added in v2.3.0
func NewEvmTxm( chainId *big.Int, cfg txmgrtypes.TxmConfig[*assets.Wei], keyStore EvmKeyStore, lggr logger.Logger, checkerFactory EvmTransmitCheckerFactory, fwdMgr EvmFwdMgr, txAttemptBuilder EvmTxAttemptBuilder, txStore EvmTxStore, nonceSyncer EvmNonceSyncer, broadcaster *EvmBroadcaster, confirmer *EvmConfirmer, resender *EvmResender, ) *EvmTxm
NewEvmTxm creates a new concrete EvmTxm
type EvmTxmClient ¶ added in v2.2.0
type EvmTxmClient = txmgrtypes.TxmClient[*big.Int, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type EvmTxmConfig ¶ added in v2.1.0
type EvmTxmConfig txmgrtypes.TxmConfig[*assets.Wei]
type ListenerConfig ¶ added in v2.3.0
type NullEvmTxManager ¶ added in v2.1.0
type NullEvmTxManager = txmgr.NullTxManager[*big.Int, *evmtypes.Head, common.Address, common.Hash, common.Hash, *evmtypes.Receipt, evmtypes.Nonce, gas.EvmFee, EvmAccessList]
Type aliases for EVM
type SendEveryStrategy ¶
type SendEveryStrategy struct{}
SendEveryStrategy will always send the tx
func (SendEveryStrategy) PruneQueue ¶
func (SendEveryStrategy) PruneQueue(pruneService txmgrtypes.UnstartedTxQueuePruner, qopt pg.QOpt) (int64, error)
func (SendEveryStrategy) Subject ¶
func (SendEveryStrategy) Subject() uuid.NullUUID
type SimulateChecker ¶
SimulateChecker simulates transactions, producing an error if they revert on chain.
func (*SimulateChecker) Check ¶
func (s *SimulateChecker) Check( ctx context.Context, l logger.Logger, tx EvmTx, a EvmTxAttempt, ) error
Check satisfies the TransmitChecker interface.
type TestEvmTxStore ¶ added in v2.3.0
type TestEvmTxStore interface { EvmTxStore InsertEthReceipt(receipt *evmtypes.Receipt) (int64, error) // only used for testing purposes }
type TxAttemptSigner ¶
type TxAttemptSigner[ADDR commontypes.Hashable] interface { SignTx(fromAddress ADDR, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) }
type VRFV1Checker ¶
type VRFV1Checker struct { // Callbacks checks whether a VRF V1 request has already been fulfilled on the VRFCoordinator // Solidity contract Callbacks func(opts *bind.CallOpts, reqID [32]byte) (v1.Callbacks, error) Client evmclient.Client }
VRFV1Checker is an implementation of TransmitChecker that checks whether a VRF V1 fulfillment has already been fulfilled.
func (*VRFV1Checker) Check ¶
func (v *VRFV1Checker) Check( ctx context.Context, l logger.Logger, tx EvmTx, _ EvmTxAttempt, ) error
Check satisfies the TransmitChecker interface.
type VRFV2Checker ¶
type VRFV2Checker struct { // GetCommitment checks whether a VRF V2 request has been fulfilled on the VRFCoordinatorV2 // Solidity contract. GetCommitment func(opts *bind.CallOpts, requestID *big.Int) ([32]byte, error) // HeadByNumber fetches the head given the number. If nil is provided, // the latest header is fetched. HeadByNumber func(ctx context.Context, n *big.Int) (*types.Head, error) // RequestBlockNumber is the block number of the VRFV2 request. RequestBlockNumber *big.Int }
VRFV2Checker is an implementation of TransmitChecker that checks whether a VRF V2 fulfillment has already been fulfilled.
func (*VRFV2Checker) Check ¶
func (v *VRFV2Checker) Check( ctx context.Context, l logger.Logger, tx EvmTx, _ EvmTxAttempt, ) error
Check satisfies the TransmitChecker interface.