-
Notifications
You must be signed in to change notification settings - Fork 138
fix(mempool): duplicate tx check and gossipping systemtests #897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #897 +/- ##
==========================================
- Coverage 64.97% 64.73% -0.25%
==========================================
Files 317 317
Lines 21634 21651 +17
==========================================
- Hits 14056 14015 -41
- Misses 6375 6390 +15
- Partials 1203 1246 +43
🚀 New features to boost your workflow:
|
| "github.com/test-go/testify/require" | ||
| ) | ||
|
|
||
| func RunTxRebroadcasting(t *testing.T, base *suite.BaseTestSuite) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this test. It doesn't actually test for rebroadcasting, and instead it waits for transactions to be committed.
|
|
||
| // Has returns true if the transaction with the given hash is already in the mempool. | ||
| // This checks both the legacy pool and the main tx pool for EVM transactions. | ||
| func (m *ExperimentalEVMMempool) Has(hash common.Hash) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fn allows us to get tx existence on the rpc
This reverts commit ed90439.
548c6f9 to
5b86d5a
Compare
closes: #895, #896, #898
In #890, we fixed transaction rebroadcasting by ignoring the "already found" error in the mempool. Completely ignoring the error will still fail out transaction duplicates when sent from the client, but the RPC returns an erroneous Comet mempool cache error instead:
"failed to send eth legacy tx: failed to broadcast transaction: : tx already in mempool [cosmossdk.io/[email protected]/errors.go:77]". This PR fixes that and emits the correct "already" found error by checking for txpool existence on the JSON-RPC side. Since rebroadcasting is done via a Cosmos transaction, this means that we can have the best of both worlds—correct erroring on the JSON-RPC side, as well as proper transaction gossipping of promoted queued transactions.This PR also fixes the systemtests that check for broadcasting of queued transactions. For each broadcasted transaction, we ensure that every node in the systemtest receives each pending transaction through gossipping. Previous tests were passing because transactions were being propagated via committed blocks. This is incorrect, and hid our rebroadcasting errors found in #889. This is fixed by enforcing that each test case completes within the same block.
We also test the rebroadcasting function by first submitting a queued transaction that gets promoted only after a nonce gap is filled. The test ensures that the previously queued transactions becomes available to every other node via gossip after being promoted.