-
Notifications
You must be signed in to change notification settings - Fork 841
chore(customrawdb): delete customrawdb package and switch to avalanchego imports #4626
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
base: master
Are you sure you want to change the base?
Conversation
…ego imports resolves #1302 Signed-off-by: Tsvetan Dimitrov ([email protected])
Handle database.ErrNotFound returned by ReadSyncRoot when there's no previous sync root. This is expected for fresh databases and should be treated as an empty hash (no previous sync) rather than an error.
Handle database.ErrNotFound from ReadAcceptorTip as expected case (empty hash) instead of error. This fixes VM initialization failures on fresh databases.
Update TestWipe to accept database.ErrNotFound as valid result after wipe, since ReadSnapshotBlockHash returns ErrNotFound when the marker doesn't exist.
- Move block number override fix before NewEVMBlockContext creation so GetHashFn can correctly resolve blockhash(n) when block number is overridden to n+1. This fixes TestTracingWithOverrides for Firewood scheme. - The bug was probably a pre-existing code issue where the header modification happened after creating the block context. Since GetHashFn creates a closure that captures the header reference, modifying the header afterward left the closure with stale values. This bug was exposed by the recent avalanchego update (3b08d61), which likely changed behavior that made the test fail specifically for Firewood scheme, while HashScheme continued to pass.
- Extract sentinel errors in journal.go for better error checking
and maintainability.
- Refactor loadSnapshot to use switch statements
for clearer control flow when validating snapshot block hash and root.
- Improve TestWipe validation logic:
- Use switch statements for consistent error handling patterns.
- Add context to error messages ("before wipe" / "after wipe").
96abb67 to
831d8f3
Compare
831d8f3 to
98a81dc
Compare
ceyonur
left a comment
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 some cleanup from this PR. otherwise lgtm
cbd8271 to
b77d79e
Compare
b77d79e to
17f9aa3
Compare
ceyonur
left a comment
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!
| switch { | ||
| case errors.Is(err, database.ErrNotFound): // Expected: marker was deleted. | ||
| case err != nil: | ||
| t.Errorf("unexpected error reading snapshot block hash after wipe: %v", err) | ||
| case blockHash != (common.Hash{}): | ||
| t.Errorf("snapshot block hash marker remained after wipe: %#x", blockHash) | ||
| } |
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 doesn't check the blockhash if the error is database.ErrNotFound. Is that expected? Just looks like a bug at first glance
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.
In either case, this definitely seems like it's a symptom of racy code. Will you add a comment describing why the error may or may not be nil?
Why this should be merged
Check #4569
How this works
graft/coreth/plugin/evm/customrawdb.github.com/ava-labs/avalanchego/vms/evm/sync/customrawdbimport instead.How this was tested
existing UT
Need to be documented?
no
Need to update RELEASES.md?
no
resolves #4569
Signed-off-by: Tsvetan Dimitrov ([email protected])