Documentation
¶
Index ¶
- Constants
- Variables
- func ErrAsCheckTxResponse(err error) *abci.ResponseCheckTx
- func NewCosmosTransactionsByPriceAndNonce(txs map[string][]cosmosTxWithMetadata, bondDenom string, baseFee *uint256.Int) sdkmempool.Iterator
- func NewEVMMempoolIterator(evmIterator *miner.TransactionsByPriceAndNonce, ...) mempool.Iterator
- type Blockchain
- func (b *Blockchain) BeginCommit()
- func (b *Blockchain) BeginRead()
- func (b *Blockchain) Config() *params.ChainConfig
- func (b *Blockchain) CurrentBlock() *types.Header
- func (b *Blockchain) EndCommit()
- func (b *Blockchain) EndRead()
- func (b *Blockchain) GetBlock(_ common.Hash, _ uint64) *types.Block
- func (b *Blockchain) GetCoinDenom() string
- func (b *Blockchain) GetLatestContext() (sdk.Context, error)
- func (b *Blockchain) NotifyNewBlock()
- func (b *Blockchain) StateAt(hash common.Hash) (vm.StateDB, error)
- func (b *Blockchain) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
- type Config
- type CosmosTransactionsByPriceAndNonce
- type CosmosTxStore
- func (s *CosmosTxStore) AddTx(tx sdk.Tx)
- func (s *CosmosTxStore) InvalidateFrom(tx sdk.Tx) int
- func (s *CosmosTxStore) Iterator() sdkmempool.Iterator
- func (s *CosmosTxStore) Len() int
- func (s *CosmosTxStore) OrderedIterator(bondDenom string, baseFee *uint256.Int) sdkmempool.Iterator
- func (s *CosmosTxStore) Txs() []sdk.Tx
- type EVMMempoolIterator
- type EthSignerExtractionAdapter
- type FeeMarketKeeperI
- type Mempool
- func (m *Mempool) Close() error
- func (m *Mempool) CountTx() int
- func (m *Mempool) GetBlockchain() *Blockchain
- func (m *Mempool) GetTxPool() *txpool.TxPool
- func (m *Mempool) HasEventBus() bool
- func (m *Mempool) Insert(ctx context.Context, tx sdk.Tx) error
- func (m *Mempool) InsertAsync(tx sdk.Tx) error
- func (m *Mempool) NewCheckTxHandler(txDecoder sdk.TxDecoder, timeout time.Duration) sdk.CheckTxHandler
- func (m *Mempool) NewInsertTxHandler(txDecoder sdk.TxDecoder) sdk.InsertTxHandler
- func (m *Mempool) NewReapTxsHandler() sdk.ReapTxsHandler
- func (m *Mempool) NotifyNewBlock()
- func (m *Mempool) ReapNewValidTxs(maxBytes uint64, maxGas uint64) ([][]byte, error)
- func (m *Mempool) RecheckCosmosTxs(newHead *ethtypes.Header)
- func (m *Mempool) RecheckEVMTxs(newHead *ethtypes.Header)
- func (m *Mempool) Remove(tx sdk.Tx) error
- func (m *Mempool) RemoveWithReason(_ context.Context, tx sdk.Tx, reason sdkmempool.RemoveReason) error
- func (m *Mempool) Select(goCtx context.Context, i [][]byte) sdkmempool.Iterator
- func (m *Mempool) SelectBy(goCtx context.Context, txs [][]byte, filter func(sdk.Tx) bool)
- func (m *Mempool) SetClientCtx(clientCtx client.Context)
- func (m *Mempool) SetEventBus(eventBus *cmttypes.EventBus)
- func (m *Mempool) TrackTx(hash common.Hash) error
- type RecheckMempool
- func (m *RecheckMempool) Close() error
- func (m *RecheckMempool) CountTx() int
- func (m *RecheckMempool) Insert(_ context.Context, tx sdk.Tx) (err error)
- func (m *RecheckMempool) OrderedRecheckedTxs(ctx context.Context, height *big.Int, bondDenom string, baseFee *uint256.Int) sdkmempool.Iterator
- func (m *RecheckMempool) RecheckedTxs(ctx context.Context, height *big.Int) sdkmempool.Iterator
- func (m *RecheckMempool) Remove(tx sdk.Tx) error
- func (m *RecheckMempool) RemoveWithReason(_ context.Context, tx sdk.Tx, _ sdkmempool.RemoveReason) error
- func (m *RecheckMempool) Select(ctx context.Context, txs [][]byte) sdkmempool.Iterator
- func (m *RecheckMempool) Start(initialHead *ethtypes.Header)
- func (m *RecheckMempool) TriggerRecheck(newHead *ethtypes.Header) <-chan struct{}
- func (m *RecheckMempool) TriggerRecheckSync(newHead *ethtypes.Header)
- type Rechecker
- type TxConverter
- type TxEncoder
- type TxRechecker
- func (r *TxRechecker) GetContext() (sdk.Context, func())
- func (r *TxRechecker) RecheckCosmos(ctx sdk.Context, tx sdk.Tx) (sdk.Context, error)
- func (r *TxRechecker) RecheckEVM(ctx sdk.Context, tx *ethtypes.Transaction) (sdk.Context, error)
- func (r *TxRechecker) Update(ctx sdk.Context, header *ethtypes.Header)
- type VMKeeperI
Constants ¶
const (
CodeTypeNoRetry = uint32(1)
)
const (
// SubscriberName is the name of the event bus subscriber for the EVM mempool
SubscriberName = "evm"
)
Variables ¶
var ( ErrNoMessages = errors.New("transaction has no messages") ErrExpectedOneMessage = errors.New("expected 1 message") ErrExpectedOneError = errors.New("expected 1 error") ErrNotEVMTransaction = errors.New("transaction is not an EVM transaction") ErrMultiMsgEthereumTransaction = errors.New("transaction contains multiple messages with an EVM msg") ErrNonceGap = errors.New("tx nonce is higher than account nonce") ErrNonceLow = errors.New("tx nonce is lower than account nonce") // ErrQueueFull is aliased from the internal queue package so that external // packages (e.g. evmd) can check for this error without importing internal/. ErrQueueFull = queue.ErrQueueFull )
var AllowUnsafeSyncInsert = false
AllowUnsafeSyncInsert indicates whether to perform synchronous inserts into the mempool for testing purposes. When true, Insert will block until the transaction is fully processed. This should be used only in tests to ensure deterministic behavior
Functions ¶
func ErrAsCheckTxResponse ¶ added in v0.7.0
func ErrAsCheckTxResponse(err error) *abci.ResponseCheckTx
ErrAsCheckTxResponse converts an error to a ResponseCheckTx object, respecting error wrapping.
func NewCosmosTransactionsByPriceAndNonce ¶ added in v0.7.0
func NewEVMMempoolIterator ¶
func NewEVMMempoolIterator( evmIterator *miner.TransactionsByPriceAndNonce, cosmosIterator mempool.Iterator, logger log.Logger, txConfig client.TxConfig, blockchain *Blockchain, ) mempool.Iterator
NewEVMMempoolIterator creates a new unified iterator over EVM and Cosmos transactions. It combines iterators from both transaction pools and selects transactions based on fee priority. Returns nil if both iterators are empty or nil. The bondDenom parameter specifies the native token denomination for fee comparisons, and chainId is used for EVM transaction conversion.
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain implements the BlockChain interface required by Ethereum transaction pools. It bridges Cosmos SDK blockchain state with Ethereum's transaction pool system by providing access to block headers, chain configuration, and state databases. This implementation is specifically designed for instant finality chains where reorgs never occur.
func NewBlockchain ¶ added in v0.5.0
func NewBlockchain(ctx func(height int64, prove bool) (sdk.Context, error), logger log.Logger, vmKeeper VMKeeperI, feeMarketKeeper FeeMarketKeeperI, blockGasLimit uint64) *Blockchain
NewBlockchain creates a new Blockchain instance that bridges Cosmos SDK state with Ethereum mempools. The getCtxCallback function provides access to Cosmos SDK contexts at different heights, vmKeeper manages EVM state, and feeMarketKeeper handles fee market operations like base fee calculations.
func (*Blockchain) BeginCommit ¶ added in v0.7.0
func (b *Blockchain) BeginCommit()
BeginCommit acquires an exclusive lock to prevent mempool state reads during Commit. This avoids data races in the underlying storage (e.g., IAVL) when tests run with -race.
func (*Blockchain) BeginRead ¶ added in v0.7.0
func (b *Blockchain) BeginRead()
BeginRead acquires a shared lock for background readers (e.g., txpool reorg). This enables optional coordination with Commit without importing the type.
func (*Blockchain) Config ¶
func (b *Blockchain) Config() *params.ChainConfig
Config returns the Ethereum chain configuration. It should only be called after the chain is initialized. This provides the necessary parameters for EVM execution and transaction validation.
func (*Blockchain) CurrentBlock ¶
func (b *Blockchain) CurrentBlock() *types.Header
CurrentBlock returns the current block header for the app. It constructs an Ethereum-compatible header from the current Cosmos SDK context, including block height, timestamp, gas limits, and base fee (if London fork is active). Returns a zero header as placeholder if the context is not yet available.
func (*Blockchain) EndCommit ¶ added in v0.7.0
func (b *Blockchain) EndCommit()
EndCommit releases the exclusive lock acquired by BeginCommit.
func (*Blockchain) EndRead ¶ added in v0.7.0
func (b *Blockchain) EndRead()
EndRead releases the shared read lock acquired by BeginRead.
func (*Blockchain) GetBlock ¶
GetBlock retrieves a block by hash and number. Cosmos chains have instant finality, so this method should only be called for the genesis block (block 0) or block 1, as reorgs never occur. Any other call indicates a bug in the mempool logic. Panics if called for blocks beyond block 1, as this would indicate an attempted reorg.
func (*Blockchain) GetCoinDenom ¶ added in v0.7.0
func (b *Blockchain) GetCoinDenom() string
GetCoinDenom returns the coin denom used in the EVM. Note: return "" if height=0.
func (*Blockchain) GetLatestContext ¶ added in v0.5.0
func (b *Blockchain) GetLatestContext() (sdk.Context, error)
GetLatestContext returns the latest context as updated by the block, or attempts to retrieve it again if unavailable.
func (*Blockchain) NotifyNewBlock ¶
func (b *Blockchain) NotifyNewBlock()
NotifyNewBlock sends a chain head event when a new block is finalized
func (*Blockchain) StateAt ¶
StateAt returns the StateDB object for a given block hash. In practice, this always returns the most recent state since the mempool only needs current state for validation. Historical state access is not supported as it's never required by the txpool.
func (*Blockchain) SubscribeChainHeadEvent ¶
func (b *Blockchain) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
SubscribeChainHeadEvent allows subscribers to receive notifications when new blocks are finalized. Returns a subscription that will receive ChainHeadEvent notifications via the provided channel.
type Config ¶ added in v0.7.0
type Config struct {
LegacyPoolConfig *legacypool.Config
CosmosPoolConfig *sdkmempool.PriorityNonceMempoolConfig[math.Int]
AnteHandler sdk.AnteHandler
BroadCastTxFn func(txs []*ethtypes.Transaction) error
// Block gas limit from consensus parameters
BlockGasLimit uint64
MinTip *uint256.Int
// PendingTxProposalTimeout is the max amount of time to allocate to
// fetching (or waiting to fetch) pending txs from the evm mempool.
PendingTxProposalTimeout time.Duration
// InsertQueueSize is how many txs can be stored in the insert queue
// pending insertion into the mempool. Note the insert queue is only used
// for EVM txs.
InsertQueueSize int
// EnableTxTracker controls whether the mempool records per-tx lifecycle
// telemetry (queued/pending/included latencies). Defaults to false.
EnableTxTracker bool
}
Config defines the configuration for the EVM mempool.
type CosmosTransactionsByPriceAndNonce ¶ added in v0.7.0
type CosmosTransactionsByPriceAndNonce struct {
// contains filtered or unexported fields
}
CosmosTransactionsByPriceAndNonce returns Cosmos transactions in fee-priority order while still honoring nonce ordering within each signer bucket.
func (*CosmosTransactionsByPriceAndNonce) Next ¶ added in v0.7.0
func (t *CosmosTransactionsByPriceAndNonce) Next() sdkmempool.Iterator
func (*CosmosTransactionsByPriceAndNonce) Tx ¶ added in v0.7.0
func (t *CosmosTransactionsByPriceAndNonce) Tx() sdk.Tx
type CosmosTxStore ¶ added in v0.7.0
type CosmosTxStore struct {
// contains filtered or unexported fields
}
CosmosTxStore is a set of cosmos transactions that can be added to or removed from.
func NewCosmosTxStore ¶ added in v0.7.0
func NewCosmosTxStore(l log.Logger) *CosmosTxStore
NewCosmosTxStore creates a new CosmosTxStore.
func (*CosmosTxStore) AddTx ¶ added in v0.7.0
func (s *CosmosTxStore) AddTx(tx sdk.Tx)
AddTx adds a single tx to the store while constructing a validated snapshot.
func (*CosmosTxStore) InvalidateFrom ¶ added in v0.7.0
func (s *CosmosTxStore) InvalidateFrom(tx sdk.Tx) int
InvalidateFrom removes any stored tx that depends on the supplied tx's signer/nonces. It is used for live mempool replacements: once a tx at nonce N changes, any stored tx for the same signer(s) with nonce >= N can no longer be considered valid for proposal building.
func (*CosmosTxStore) Iterator ¶ added in v0.7.0
func (s *CosmosTxStore) Iterator() sdkmempool.Iterator
Iterator returns an sdkmempool.Iterator over the txs in the store.
func (*CosmosTxStore) Len ¶ added in v0.7.0
func (s *CosmosTxStore) Len() int
Len returns the number of txs in the store.
func (*CosmosTxStore) OrderedIterator ¶ added in v0.7.0
func (s *CosmosTxStore) OrderedIterator(bondDenom string, baseFee *uint256.Int) sdkmempool.Iterator
func (*CosmosTxStore) Txs ¶ added in v0.7.0
func (s *CosmosTxStore) Txs() []sdk.Tx
Txs returns a copy of the current set of txs in the store.
type EVMMempoolIterator ¶
type EVMMempoolIterator struct {
// contains filtered or unexported fields
}
EVMMempoolIterator provides a unified iterator over both EVM and Cosmos transactions in the mempool. It implements priority-based transaction selection, choosing between EVM and Cosmos transactions based on their fee values. The iterator maintains state to track transaction types and ensures proper sequencing during block building.
func (*EVMMempoolIterator) Next ¶
func (i *EVMMempoolIterator) Next() mempool.Iterator
Next advances the iterator to the next transaction and returns the updated iterator. It determines which iterator (EVM or Cosmos) provided the current transaction and advances that iterator accordingly. Returns nil when no more transactions are available.
func (*EVMMempoolIterator) Tx ¶
func (i *EVMMempoolIterator) Tx() sdk.Tx
Tx returns the current transaction from the iterator.
type EthSignerExtractionAdapter ¶
type EthSignerExtractionAdapter struct {
// contains filtered or unexported fields
}
EthSignerExtractionAdapter is the default implementation of SignerExtractionAdapter. It extracts the signers from a cosmos-sdk tx via GetSignaturesV2.
func NewEthSignerExtractionAdapter ¶
func NewEthSignerExtractionAdapter(fallback mempool.SignerExtractionAdapter) EthSignerExtractionAdapter
NewEthSignerExtractionAdapter constructs a new EthSignerExtractionAdapter instance
func (EthSignerExtractionAdapter) GetSigners ¶
func (s EthSignerExtractionAdapter) GetSigners(tx sdk.Tx) ([]mempool.SignerData, error)
GetSigners returns the EVM tx sender. EIP-7702 authorities are NOT enumerated: whether each authorization succeeds on chain (and therefore actually bumps the authority's nonce) is unverifiable without chain state — a failed authorization does not increment the nonce. Eagerly reporting auth.Nonce would falsely evict legitimate pending txs from authorities whose auths failed. Async reset catches authority nonce advances instead. Non-EVM cosmos txs fall through to the SDK default.
type FeeMarketKeeperI ¶
type Mempool ¶ added in v0.7.0
type Mempool struct {
// contains filtered or unexported fields
}
Mempool is an application side mempool implementation that operates in conjunction with the CometBFT 'app' configuration. The Mempool handles application side rechecking of txs and supports ABCI methods InesrtTx and ReapTxs.
func NewMempool ¶ added in v0.7.0
func (*Mempool) CountTx ¶ added in v0.7.0
CountTx returns the total number of transactions in both EVM and Cosmos pools. This provides a combined count across all mempool types.
func (*Mempool) GetBlockchain ¶ added in v0.7.0
func (m *Mempool) GetBlockchain() *Blockchain
GetBlockchain returns the blockchain interface used for chain head event notifications. This is primarily used to notify the mempool when new blocks are finalized.
func (*Mempool) GetTxPool ¶ added in v0.7.0
GetTxPool returns the underlying EVM txpool. This provides direct access to the EVM-specific transaction management functionality.
func (*Mempool) HasEventBus ¶ added in v0.7.0
HasEventBus returns true if the blockchain is configured to use an event bus for block notifications.
func (*Mempool) Insert ¶ added in v0.7.0
Insert adds a transaction to the appropriate mempool (EVM or Cosmos). EVM transactions are routed to the EVM transaction pool, while all other transactions are inserted into the Cosmos sdkmempool.
func (*Mempool) InsertAsync ¶ added in v0.7.0
InsertAsync adds a transaction to the appropriate mempool (EVM or Cosmos). EVM transactions are routed to the EVM transaction pool, while all other transactions are inserted into the Cosmos sdkmempool. EVM transactions are inserted async, i.e. they are scheduled for promotion only, we do not wait for it to complete.
func (*Mempool) NewCheckTxHandler ¶ added in v0.7.0
func (m *Mempool) NewCheckTxHandler(txDecoder sdk.TxDecoder, timeout time.Duration) sdk.CheckTxHandler
NewCheckTxHandler is the handler for ABCI.CheckTx. Note: it's async and doesn't expect the caller to acquire ABCI lock. Used ONLY to support BroadcastTxSync (cosmos rpc). All EVM txs should be inserted via InsertTx handler or EVM RPC.
func (*Mempool) NewInsertTxHandler ¶ added in v0.7.0
func (m *Mempool) NewInsertTxHandler(txDecoder sdk.TxDecoder) sdk.InsertTxHandler
NewInsertTxHandler is the handler for ABCI.InsertTx. Used by CometBFT to asynchronously insert a new tx into the mempool. Supersedes ABCI.CheckTx. Handles concurrent requests
func (*Mempool) NewReapTxsHandler ¶ added in v0.7.0
func (m *Mempool) NewReapTxsHandler() sdk.ReapTxsHandler
NewReapTxsHandler is the handler for ABCI.ReapTxs. It's used by CometBFT to reap valid txs from the mempool and share them with other peers. Handles concurrent requests.
func (*Mempool) NotifyNewBlock ¶ added in v0.7.0
func (m *Mempool) NotifyNewBlock()
NotifyNewBlock manually notifies that there has been a new block produced and it should update its internal data structures.
func (*Mempool) ReapNewValidTxs ¶ added in v0.7.0
ReapNewValidTxs removes and returns the oldest transactions from the reap list until maxBytes or maxGas limits are reached.
func (*Mempool) RecheckCosmosTxs ¶ added in v0.7.0
RecheckCosmosTxs triggers a synchronous recheck of cosmos transactions. This should only used for testing.
func (*Mempool) RecheckEVMTxs ¶ added in v0.7.0
RecheckEVMTxs triggers a synchronous recheck of evm transactions. This should only be used for testing.
func (*Mempool) RemoveWithReason ¶ added in v0.7.0
func (m *Mempool) RemoveWithReason(_ context.Context, tx sdk.Tx, reason sdkmempool.RemoveReason) error
RemoveWithReason removes a transaction from the appropriate sdkmempool.
NOTE #1: even if removal fails, side effects may have occurred like recording nonce increments.
NOTE #2: This method might be called multiple times for the same tx:
- during tx re-execution by BlockSTM
- during tx execution by OptimisticExecution that fails and then inside another finalizeBlock() (e.g. consensus round increment)
func (*Mempool) Select ¶ added in v0.7.0
Select returns a unified iterator over both EVM and Cosmos transactions. The iterator prioritizes transactions based on their fees and manages proper sequencing. The i parameter contains transaction hashes to exclude from selection.
func (*Mempool) SelectBy ¶ added in v0.7.0
SelectBy iterates through transactions until the provided filter function returns false. It uses the same unified iterator as Select but allows early termination based on custom criteria defined by the filter function.
func (*Mempool) SetClientCtx ¶ added in v0.7.0
SetClientCtx sets the client context provider for broadcasting transactions
func (*Mempool) SetEventBus ¶ added in v0.7.0
SetEventBus sets CometBFT event bus to listen for new block header event.
type RecheckMempool ¶ added in v0.7.0
type RecheckMempool struct {
sdkmempool.ExtMempool
// contains filtered or unexported fields
}
RecheckMempool wraps an ExtMempool and provides block-driven rechecking of transactions when new blocks are committed. It mirrors the legacypool pattern but simplified for Cosmos mempool behavior (no reorgs, no queued/pending management).
All pool mutations (Insert, Remove) and reads (Select, CountTx) are protected by a RWMutex to ensure thread-safety during recheck operations.
func NewRecheckMempool ¶ added in v0.7.0
func NewRecheckMempool( defaultCosmosPoolConfig *sdkmempool.PriorityNonceMempoolConfig[math.Int], maxTxs int, reserver *reserver.ReservationHandle, rechecker Rechecker, recheckedTxs *heightsync.HeightSync[CosmosTxStore], reapList *reaplist.ReapList, blockchain *Blockchain, logger log.Logger, ) *RecheckMempool
NewRecheckMempool creates a new RecheckMempool.
func (*RecheckMempool) Close ¶ added in v0.7.0
func (m *RecheckMempool) Close() error
Close gracefully shuts down the recheck loop.
func (*RecheckMempool) CountTx ¶ added in v0.7.0
func (m *RecheckMempool) CountTx() int
CountTx returns the number of transactions in the pool.
func (*RecheckMempool) Insert ¶ added in v0.7.0
Insert adds a transaction to the pool after running the ante handler. This is the main entry point for new cosmos transactions.
func (*RecheckMempool) OrderedRecheckedTxs ¶ added in v0.7.0
func (m *RecheckMempool) OrderedRecheckedTxs( ctx context.Context, height *big.Int, bondDenom string, baseFee *uint256.Int, ) sdkmempool.Iterator
OrderedRecheckedTxs returns the rechecked tx snapshot for a height using fee-priority ordering across signer buckets while still honoring nonce order within each bucket.
func (*RecheckMempool) RecheckedTxs ¶ added in v0.7.0
func (m *RecheckMempool) RecheckedTxs(ctx context.Context, height *big.Int) sdkmempool.Iterator
RecheckedTxs returns the txs that have been rechecked for a height. The RecheckMempool must be currently operating on this height (i.e. recheck has been triggered on this height via TriggerRecheck). If height is in the past (TriggerRecheck has been called on height + 1), this will panic. If height is in the future, this will block until TriggerReset is called for height, or the context times out.
func (*RecheckMempool) Remove ¶ added in v0.7.0
func (m *RecheckMempool) Remove(tx sdk.Tx) error
Remove is a noop for this pool. All removals are processed during the async recheck loop.
func (*RecheckMempool) RemoveWithReason ¶ added in v0.7.0
func (m *RecheckMempool) RemoveWithReason(_ context.Context, tx sdk.Tx, _ sdkmempool.RemoveReason) error
RemoveWithReason is a noop for this pool. All removals are processed during the async recheck loop. This must be explicitly defined to prevent Go from promoting the embedded ExtMempool's RemoveWithReason.
func (*RecheckMempool) Select ¶ added in v0.7.0
func (m *RecheckMempool) Select(ctx context.Context, txs [][]byte) sdkmempool.Iterator
Select returns an iterator over transactions in the pool.
func (*RecheckMempool) Start ¶ added in v0.7.0
func (m *RecheckMempool) Start(initialHead *ethtypes.Header)
Start begins the background recheck loop and initializes the rechecker's context to the latest chain state. The initialHead is used for the first Rechecker.Update call before any recheck has been triggered.
func (*RecheckMempool) TriggerRecheck ¶ added in v0.7.0
func (m *RecheckMempool) TriggerRecheck(newHead *ethtypes.Header) <-chan struct{}
TriggerRecheck signals that a new block arrived and returns a channel that closes when the recheck completes (or is superseded by another).
func (*RecheckMempool) TriggerRecheckSync ¶ added in v0.7.0
func (m *RecheckMempool) TriggerRecheckSync(newHead *ethtypes.Header)
TriggerRecheckSync triggers a recheck and blocks until complete.
type Rechecker ¶ added in v0.7.0
type Rechecker interface {
// GetContext gets a branch of the current context that transactions should
// be rechecked against. Changes to ctx will only be persisted back to the
// Rechecker once the write function is invoked.
GetContext() (ctx sdk.Context, write func())
// RecheckCosmos performs validation of a cosmos tx against a context, and
// returns an updated context.
RecheckCosmos(ctx sdk.Context, tx sdk.Tx) (sdk.Context, error)
// Update updates the recheckers context to be the ctx at headers height.
Update(ctx sdk.Context, header *ethtypes.Header)
}
Rechecker defines the minimal set of methods needed to recheck cosmos transactions and manage the context that the transactions are rechecked against.
type TxConverter ¶ added in v0.7.0
type TxConverter interface {
EVMTxToCosmosTx(tx *ethtypes.Transaction) (sdk.Tx, error)
}
type TxEncoder ¶ added in v0.7.0
type TxEncoder struct {
// contains filtered or unexported fields
}
func NewTxEncoder ¶ added in v0.7.0
func (*TxEncoder) EVMTx ¶ added in v0.7.0
func (e *TxEncoder) EVMTx(tx *ethtypes.Transaction) ([]byte, error)
EncodeEVMTx encodes an evm tx to its sdk representation as bytes.
func (*TxEncoder) EVMTxToCosmosTx ¶ added in v0.7.0
EVMTxToCosmosTx converts an evm transaction to a cosmos transaction
type TxRechecker ¶ added in v0.7.0
type TxRechecker struct {
// contains filtered or unexported fields
}
TxRechecker runs recheckFn on pending and queued txs in the pool, given an sdk context via UpdateCtx.
NOTE: None of the recheckers functions are thread safe.
func NewTxRechecker ¶ added in v0.7.0
func NewTxRechecker(anteHandler sdk.AnteHandler, txConverter TxConverter) *TxRechecker
NewTxRechecker creates a new rechecker that can recheck transactions.
func (*TxRechecker) GetContext ¶ added in v0.7.0
func (r *TxRechecker) GetContext() (sdk.Context, func())
GetContext returns a branched context. The caller can use the returned function in order to write updates applied to the returned context, back to the context stored by the rechecker for future callers to use.
NOTE: This function is not thread safe with itself or any other Rechecker functions.
func (*TxRechecker) RecheckCosmos ¶ added in v0.7.0
RecheckCosmos revalidates a Cosmos transaction against a context. It returns an updated context and an error that occurred while processing.
NOTE: This function is not thread safe with itself or any other Rechecker functions.
func (*TxRechecker) RecheckEVM ¶ added in v0.7.0
func (r *TxRechecker) RecheckEVM(ctx sdk.Context, tx *ethtypes.Transaction) (sdk.Context, error)
RecheckEVM revalidates an EVM transaction against a context. It returns an updated context and an error that occurred while processing.
NOTE: This function is not thread safe with itself or any other Rechecker functions.
func (*TxRechecker) Update ¶ added in v0.7.0
func (r *TxRechecker) Update(ctx sdk.Context, header *ethtypes.Header)
Update updates the base context for rechecks based on the latest chain state. The caller provides the context directly.
NOTE: This function is not thread safe with itself or any other Rechecker functions.
type VMKeeperI ¶
type VMKeeperI interface {
GetBaseFee(ctx sdk.Context) *big.Int
GetParams(ctx sdk.Context) (params vmtypes.Params)
GetEvmCoinInfo(ctx sdk.Context) (coinInfo vmtypes.EvmCoinInfo)
GetAccount(ctx sdk.Context, addr common.Address) *statedb.Account
GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash
GetCode(ctx sdk.Context, codeHash common.Hash) []byte
GetCodeHash(ctx sdk.Context, addr common.Address) common.Hash
ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key common.Hash, value common.Hash) bool)
SetAccount(ctx sdk.Context, addr common.Address, account statedb.Account) error
DeleteState(ctx sdk.Context, addr common.Address, key common.Hash)
SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte)
DeleteCode(ctx sdk.Context, codeHash []byte)
SetCode(ctx sdk.Context, codeHash []byte, code []byte)
DeleteAccount(ctx sdk.Context, addr common.Address) error
KVStoreKeys() map[string]storetypes.StoreKey
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
legacypool
Package legacypool implements the normal EVM execution transaction pool.
|
Package legacypool implements the normal EVM execution transaction pool. |
