feat(mempool): revert transactions after 3 failures#1832
Open
Mirko-von-Leipzig wants to merge 2 commits intomirko/mempool-v4from
Open
feat(mempool): revert transactions after 3 failures#1832Mirko-von-Leipzig wants to merge 2 commits intomirko/mempool-v4from
Mirko-von-Leipzig wants to merge 2 commits intomirko/mempool-v4from
Conversation
0ded389 to
ccecfa5
Compare
sergerad
approved these changes
Mar 25, 2026
sergerad
reviewed
Mar 25, 2026
| let count = self.failures.entry(tx).or_default(); | ||
| *count += 1; | ||
|
|
||
| if *count > Self::FAILURE_LIMIT { |
Collaborator
There was a problem hiding this comment.
Suggested change
| if *count > Self::FAILURE_LIMIT { | |
| if *count >= Self::FAILURE_LIMIT { |
Collaborator
Author
There was a problem hiding this comment.
I think its correct as > no? You're allowed to fail N times. Though I guess title and docs sort of conflict :D
sergerad
reviewed
Mar 25, 2026
| } | ||
| let failed_txs = block | ||
| .iter() | ||
| .flat_map(|batch| batch.transactions().as_slice().iter().map(TransactionHeader::id)); |
Collaborator
There was a problem hiding this comment.
Would it be possible / desirable for us to pinpoint which transactions actually failed rather than treating all as failed?
Collaborator
Author
There was a problem hiding this comment.
iiuc this is supposed to only occur if there is a bug in the proving system, or one of the kernels, or the batch was invalid. As in, this is a really unexpected outcome once we are at this stage.
But maybe there is some information that could be surfaced. cc @PhilippGackstatter
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
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.
This PR changes the mempool behaviour when rolling back blocks and batches. Transactions are now reverted once they have participated in more than three failed batches and blocks.
The current behaviour is that transactions are never reverted for batch failures, and always reverted for block failures.
The intention here is to weed out transactions which cause these failures e.g. due to a bug in the prover/mempool/node. The new implementation is a bit more forgiving and gives innocent bystander transactions a couple of chances to avoid the buggy one.
The limit of three is arbitrary, but I also don't see a good reason to make this more configurable. Fight me :)
This PR builds on the mempool refactor in #1820.
Closes #594