-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Local Head Tracking ; Bug Fixes #11991
Closed
Closed
Conversation
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
axelKingsley
changed the title
Draft: Supervisor DB Bug Fixes
Local Head Tracking ; Bug Fixes
Sep 19, 2024
// create a mock storage which stubs out lastLogInBlock | ||
store := &MockStorage{ | ||
lastLogInBlock: 1234, | ||
lastLogInBlockErr: fmt.Errorf("error"), |
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.
No fmt.Errorf
invocations without fmt arguments allowed
this code was superseded by: #12154 |
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.
Tracking Ticket: #11983
This PR builds on the Emitter Contract PR because it enables testing: #11956
Local Heads
This PR features the changes required to track the Local Heads of a chain. There were existing locations to integrate into, but nothing written already to update the Head Storage when new blocks were processed.
HeadPointerProcessor
Head Pointer Processors are a new kind of
HeadProcessor
. They do the following:Head Pointer Processors are now created with a Chain Monitor, and added to the list of processors invoked during new subscribed ethereum events.
Other Changes
To support this feature, I had to make some bug fixes along the way. this could change considerably with changes @protolambda is making to the Iterator:
https://github.com/ethereum-optimism/optimism/pull/11989/files
Storage instead of LogStorage for ChainMonitor
Chain monitors previously only passed a LogStorage, which meant that they could not access or update the Heads Storage. I expanded the interface they use, and implemented any functions required.
Exposing LastEntryIdx
When updating cross-heads, it's possible to reach an EOF, meaning you've read to the end of the database and never found another Executing Message. When this happens, the x-head would optimistically be the end of the database. So, I exposed LastEntryIndex to appropriate Interfaces from ChainsDB down to LogsDB.
Fixing some DB Access Logic
Two changes are made to support correct finding of indexes:
LastLogInBlock
, if it scans and finds future blocks, but never found the target block, it returns that first index which passed the target. This is to support cases where there are no entries for a block, and the presence of a future-block implies its existence.LastLogInBlock
instead of a nil one when EOF happens.Current Results
With these changes, all 6 head types (Local, Cross).(Unsafe, Safe, Finalized) are staying updated in what appears to be a sane way.
Hacks
4
at the moment so I can see more realistic behaviorfmt.Println
is in place so I can see the Heads Storage during runtimeTest
Other Known Issues
Despite these changes, it seems the lookup still encounters issues:
failed to check Block 0xffdde99def42f5a0a83822f469f064e814788d197aa78d5c3647769b0a59db84:1 (chain 900201): unrecognized safety level: "cross-finalized"
OP Supervisor is complaining
failed to check Block 0x8a4212b7cc14eafcc1b6d7404f112ef3b71553dc27783a850bc8bb0e0d9b77f3:37 (chain 900200): failed to scan block: block 37 not found in chain 900200
I think both of these issues get fixed up considerably when every block has a guaranteed entry in the database.