-
Notifications
You must be signed in to change notification settings - Fork 113
fix(mempool): legacy subpool panic on skipped header during reset #668
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mattac21
commented
Sep 25, 2025
…when reset was called with a skipped header
aljo242
reviewed
Sep 26, 2025
aljo242
approved these changes
Sep 26, 2025
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.
LGTM with small nit
vladjdk
approved these changes
Oct 9, 2025
3 tasks
zsystm
pushed a commit
to zsystm/evm
that referenced
this pull request
Nov 2, 2025
…smos#668) * add test to demonstrate subpool reset being called with invalid block hashes * make test fail on hash mismatch * update txpool cosmos reorg test to use real legacypool as the subpool * update comment * fix chan pointer madness * remove logic that would only panic for cosmos chains from legacypool when reset was called with a skipped header * remove unnecessary long sleep from test for success case * fix race in test * changelog * reference pr link in log
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When load testing the EVM mempool with BlockSTM, I encountered the following panic (on the main branch):
Upon further investigation,
legacypool.Resetwill panic if it is called withnewHead=oldHead+2. Based on comments,resetthinks that this is a reorg, making the assumption thatresetbe never be called with a skipped header in betweenoldHeadandnewHead. However this is possible for Cosmos chains as demonstrated by the test that reproduces the behavior.In the test we use the
legacypool.BroadcastFnto simulate slow processing duringrunReorg, however it could be anything slows that function down. If at the same time during this processing, multiple new headers are pushed tonewHeadChand processed in thetxpool.loop(), then the next timelegacypool.Resetis called, it will be called wherenewHead.ParentHash != oldhead.Hash, causing a panic sinceGetBlockwill be called on a Cosmos chain, which is not expected.Since this function would only panic on this condition (and we are already replacing the function during tests), I simply removed the contents of the inner if statement that would panic if we encountered it with this state. From my understanding this is a valid state and there is no need to panic here.
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch