-
Notifications
You must be signed in to change notification settings - Fork 809
feat(sync/customrawdb): migrate customrawdb package from coreth #4387
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
- Move `plugin/evm/customrawdb` in `coreth` to `vms/evm/sync` in `avalanchego` as part of state sync code migration effort. resolves #4386 Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov23@gmail.com)
296bb75
to
fff1df9
Compare
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.
Why do we have this file? This contains dead code/a function that isn't actually a test.
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.
Yes, I agree with this. I will check why this was historically added in the first place, but we can definitely remove it from here.
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.
What does the _ext
suffix on these files mean? Should we remove it?
… assertions - Add tests: - Time markers (offline_pruning, populate_missing_tries): missing marker and bad-encoding cases. - Pruning disabled flag: presence toggling. - Acceptor tip: invalid length error and write/read behavior (table-driven: none, single_write, overwrite). - State sync: sync root read/write, code-to-fetch iterate/delete, segments/storage tries iterate/unpack/clear, sync performed latest (empty/increasing/unsorted). - Snapshot: block hash read/write/delete and account iterator key-length filtering. - ParseStateSchemeExt: Firewood on empty DB, conflict on existing scheme, passthrough for "hash". - Refactor/behavioral tightening (internal-only): - Add unexported sentinels: errMarkerNotFound, errMarkerInvalid, errAcceptorTipInvalid. - Normalize time marker reads: use `Has()` for presence and return `errMarkerNotFound` when absent/empty. Wrap decode errors with `errMarkerInvalid`. - Wrap acceptor tip invalid-length with `errAcceptorTipInvalid`. - Tests assert with `require.ErrorIs` for known sentinels. - Schema organization: - Group all package-level globals in a single var block in schema_ext.go - Add clear section headers to improve readability
@joshua-kim I added lots of new tests that enable having the following coverage for the package:
I fixed most of the minor comments and will get back on the rest of your points once I have more historical context from the team. |
Why this should be merged
Check #4386
How this works
plugin/evm/customrawdb
incoreth
tovms/evm/sync
inavalanchego
as part of state sync code migration effort.How this was tested
Existing UT that come with the migrated code.
Need to be documented in RELEASES.md?
no
resolves #4386
Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov23@gmail.com)