Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

chore(customrawdb): delete customrawdb package and switch to avalanchego imports#1319

Open
powerslider wants to merge 28 commits intomasterfrom
powerslider/1302-delete-customrawdb-package
Open

chore(customrawdb): delete customrawdb package and switch to avalanchego imports#1319
powerslider wants to merge 28 commits intomasterfrom
powerslider/1302-delete-customrawdb-package

Conversation

@powerslider
Copy link
Copy Markdown
Contributor

Why this should be merged

Check ava-labs/avalanchego#4569

How this works

  • Delete plugin/evm/customrawdb.
  • Switch dependent code to using github.com/ava-labs/avalanchego/vms/evm/sync/customrawdb import instead.

How this was tested

successful build

Need to be documented?

no

Need to update RELEASES.md?

no

resolves ava-labs/avalanchego#4569

Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov23@gmail.com)

…ego imports

resolves #1302

Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov23@gmail.com)
@powerslider powerslider self-assigned this Oct 3, 2025
@powerslider powerslider requested a review from a team as a code owner October 3, 2025 12:56
@powerslider powerslider force-pushed the powerslider/1302-delete-customrawdb-package branch from e96e06d to faad5d5 Compare October 6, 2025 11:01
@powerslider powerslider requested a review from maru-ava as a code owner October 6, 2025 11:12
Copy link
Copy Markdown
Contributor

@JonathanOppenheimer JonathanOppenheimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difference in this repository looks good - IMO, should not be merged until there's master commit that can be referenced.

@powerslider
Copy link
Copy Markdown
Contributor Author

Added a DO NOT MERGE label until ava-labs/avalanchego#4387 is merged.

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor

I will review post AvalancheGo merger and when this PR is updated!

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor

@powerslider that PR is merged!

@JonathanOppenheimer JonathanOppenheimer dismissed their stale review November 21, 2025 17:25

No longer approve in it's current state.

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 (3b08d6131a00bd55349321a58ae7e6cfcff8635e),
which likely changed behavior that made the test fail specifically
for Firewood scheme, while HashScheme continued to pass.
Copy link
Copy Markdown
Contributor

@JonathanOppenheimer JonathanOppenheimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@powerslider powerslider force-pushed the powerslider/1302-delete-customrawdb-package branch from e4b219d to 428048f Compare November 24, 2025 09:58
- 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").
h := block.Header()
// Apply block number override fix before creating block context so GetHashFn
// can correctly resolve blockhash(n) when block number is overridden to n+1.
if config != nil && config.BlockOverrides != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change necessary? What does it do? I suspect you have may have found a solution to a persistent flake (see #1345)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the commit message here 755fda0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd defer this to @ARR4N as he put up the fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cherry-picked these changes locally, and it didn't fix the flake.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd defer this to @ARR4N as he put up the fix.

This was a pseudo-cherry-pick (#1301) from an upstream security fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defer to @ceyonur for this, but I think we should avoid making unnecessary changes in this package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were needed, because the test broke, but I also addressed some stylistic comments from @JonathanOppenheimer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah minimal changes are ok, but I don't think you should make the stylistic changes he suggested

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete customrawdb package after migration to avalanchego

5 participants