-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
feat: prune BlsToExecutionChange opPool with head state #6252
Merged
twoeths
merged 2 commits into
unstable
from
tuyen/prune_bls_to_execution_change_with_head_state
Jan 9, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 check looks insufficient. The prune handler is only called once per finalization event ~1 time / epoch. Then only the execution changes included in that block will be pruned, with all remaining changes staying there.
A more complete solution, using our state caches:
Attach new cache to the state:
During block processing you register the validator index of applied execution changes. During epoch transition you rotate the caches. Then to prune you use the
appliedBlsToExecutionChangesPreviousEpoch
list to prune those. This will give you the complete list of items to prune if there are no re-orgs deeper than 1 epoch, which is an okay compromise.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.
just to clarify, execution changes in the head block is not pruned, others will be pruned. So we store BLSToExecutionChange messages in max 33 slots
the solution works, however I think it's too much for this feature since we have to apply ImmutableJS to maintain these 2 arrays like in EIP-6110 implementation #6042 Also it's tricky in the edge case
I think there are pros and cons for these 2 solutions:
I prefer the no state cache approach as it's worked for lighthouse since capella and in the worse case if the reorg happen, it'll not affect block reward (if it's the bn's turn to propose block) and messages will be added back once gossip
seenTTL
passes anyway, I'd like to know others' opinions cc @wemeetagain @g11techThere 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.
I think what @tuyennhv proposed here is sufficient and his reasoning is sound.
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.
Sounds good, thanks for the table! please monitor metrics after deploying to check the pool is not growing
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.
the heuristic is fine i guess, since no one is anyway producing these messages and deep reorgs are rare on mainnet