-
Notifications
You must be signed in to change notification settings - Fork 104
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
Open
mattac21
wants to merge
9
commits into
main
Choose a base branch
from
ma/fix/subpool-reset-panic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
reinject = lost | ||
} | ||
} | ||
// this is a strange reorg check from geth, it is possible for cosmos |
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.
can you ref this PR in this comment so we can easily link back to it if we need to?
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
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.Reset
will panic if it is called withnewHead=oldHead+2
. Based on comments,reset
thinks that this is a reorg, making the assumption thatreset
be never be called with a skipped header in betweenoldHead
andnewHead
. However this is possible for Cosmos chains as demonstrated by the test that reproduces the behavior.In the test we use the
legacypool.BroadcastFn
to 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 tonewHeadCh
and processed in thetxpool.loop()
, then the next timelegacypool.Reset
is called, it will be called wherenewHead.ParentHash != oldhead.Hash
, causing a panic sinceGetBlock
will 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...
main
branch