polaris
polaris copied to clipboard
feat(txpool): Nonce cache
similar, but simpler impl of #350
@davidterpay just for ref
Codecov Report
Merging #571 (ad16e90) into main (5bf5173) will decrease coverage by
0.69%
. The diff coverage is8.98%
.
Additional details and impacted files
@@ Coverage Diff @@
## main #571 +/- ##
==========================================
- Coverage 63.79% 63.11% -0.69%
==========================================
Files 100 100
Lines 4259 4316 +57
==========================================
+ Hits 2717 2724 +7
- Misses 1444 1494 +50
Partials 98 98
Impacted Files | Coverage Δ | |
---|---|---|
cosmos/x/evm/plugins/txpool/mempool/mempool.go | 0.00% <0.00%> (ø) |
|
cosmos/x/evm/plugins/txpool/plugin.go | 0.00% <0.00%> (ø) |
|
eth/core/chain_reader.go | 0.00% <0.00%> (ø) |
|
eth/core/chain_subscriber.go | 0.00% <0.00%> (ø) |
|
eth/core/state/statedb.go | 56.25% <ø> (+1.14%) |
:arrow_up: |
cosmos/x/evm/plugins/state/plugin.go | 74.18% <50.00%> (-0.82%) |
:arrow_down: |
cosmos/x/evm/keeper/host.go | 100.00% <100.00%> (ø) |
|
eth/core/state/journal/suicides.go | 100.00% <100.00%> (ø) |
current version is the logic used by geth’s light client txpool. now have to support pending and queued txs from geths core txpool
Light client doesn't support queued
Also adding support for the .Error check, I think we should do this (as Geth does) whenever accessing anything that could have caused an error (nonce, balance specifically)
Also we are now exposing the state plugin to be read from multiple threads, so do we need to lock there?
This PR should just introduce read-only changes, namely enabling RPC methods: GetPoolNonce
, SubscribeNewTxsEvent
@corduroybera can u make ticket bls
So I don’t think we need to merge this one. Implementing it via geth’s txpool provides more features and more testing, we just have to configure it correctly
I still think that approach is hood, but if you can find a way to make it seamless I'm on board.
If anything we should build a wrapper that lives in the eth folder.
I was originally doing a wrapper in eth/core/ but I realized there’s no need for it. It works without the wrapper. Either you have the geth TxPool in the blockchain object or you have the plug-in import it directly. The former involves ugly duplication of state
Here its in the blockchain: https://github.com/berachain/polaris/pull/580/files#diff-732b1d3ebcc7a1ce9c153310d8f40fbd45cbc54b72627b3d298727e6643cf318
Here is the (unused) wrapper PolarisTxPool
: https://github.com/berachain/polaris/pull/580/files#diff-f2bae00423d965dd5d83cb38ea73ba24ca6560730a3b1abc828ffa9eec2f441b