Removed callbacks from TxMempool#3410
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3410 +/- ##
==========================================
- Coverage 59.17% 59.14% -0.03%
==========================================
Files 2108 2108
Lines 173660 173575 -85
==========================================
- Hits 102770 102668 -102
- Misses 62008 62028 +20
+ Partials 8882 8879 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| err = txmp.addNewTransaction(wtx, res.ResponseCheckTx, txInfo) | ||
| if err != nil { | ||
| if !txmp.isPending(wtx) { | ||
| if err := txmp.addNewTransaction(wtx); err != nil { |
There was a problem hiding this comment.
addNewTransaction may return nil when the tx isn't really inserted because of capacity. This wasn't an issue before but becomes one now because we don't want to txmp.addNonce(wtx) below in such cases. I think we can just make addNewTransaction return error https://github.com/sei-protocol/sei-chain/pull/3410/changes#diff-91c10e3fa6ed77b7ad77bae9a7cfbc8b102e837fdf521fa96817ef134b65f05aR934
|
|
||
| func (txmp *TxMempool) EvmNextPendingNonce(addr common.Address) uint64 { | ||
| an := evmAddrNonce{addr, txmp.app.EvmNonce(addr)} | ||
| for byAddrNonce := range txmp.byAddrNonce.Lock() { |
There was a problem hiding this comment.
How often is this function called? We only need a read lock here right?
| err := txmp.checkResponseState(wtx) | ||
| if evm, ok := wtx.evm.Get(); ok { | ||
| evm.requiredBalance = new(big.Int).Set(res.EVMRequiredBalance) | ||
| wtx.evm = utils.Some(evm) |
There was a problem hiding this comment.
Could some other thread be reading this wtx.evm at the same time?
EVM keeper used to mirror mempool state to be able to track highest nonce per account in mempool, which required passing callbacks from EVM keeper to TxMempool. Additionally it passed a IsPending callback, so that TxMempool could verify if evm transaction is ready to be executed on demand. This pr is simplifying the execution flow as follows:
Additionally