Skip to content
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

chore(core/rawdb): use libevm core/rawdb #772

Draft
wants to merge 19 commits into
base: qdm12/core/types/block-libevm
Choose a base branch
from

Conversation

qdm12
Copy link
Collaborator

@qdm12 qdm12 commented Jan 29, 2025

Why this should be merged

  • First stage (see commits) was to get code as close to geth code (libevm main branch) as possible.
  • Second stage was identifying the differences: ReadBlock's use of extras and InspectDatabase
  • Third stage was implement libevm hooks and other change and use libevm core/rawdb (last commit)

How this works

You might want to review the PR commit by commit.

  • Add missing code
  • Modify existing code to be the same as geth, with tests passing
  • Move our code to _ext.go files
  • Figure out what to do with InspectDatabase: see ava-labs/libevm@c0f677c
  • Implement WithExtra block hook in libevm to inject body extras in block - see ava-labs/libevm@aca197a

How this was tested

CI passing

Need to be documented?

No

Need to update RELEASES.md?

No

Comment on lines -253 to -257
// DeletePruningDisabled deletes the marker indicating that the node has
// run with pruning disabled.
func DeletePruningDisabled(db ethdb.KeyValueStore) error {
return db.Delete(pruningDisabledKey)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is unused in the entire codebase, should it be removed?

@@ -276,17 +378,12 @@ func TestBlockReceiptStorage(t *testing.T) {
receipts := []*types.Receipt{receipt1, receipt2}

// Check that no receipt entries are in a pristine database
header := &types.Header{Number: big.NewInt(0), Extra: []byte("test header")}
hash := header.Hash()
hash := common.BytesToHash([]byte{0x03, 0x14})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is original geth code, testing less things - is this ok to remove the additional checks we had added? 🤔 I suppose worth it anyway, but I wanted to double check still.

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems fine, if in doubt we can replicate the tests in an ext package.

@qdm12 qdm12 force-pushed the qdm12/core/rawdb-geth-closer branch from bea1090 to 269a49b Compare January 29, 2025 16:55
@qdm12 qdm12 force-pushed the qdm12/core/rawdb-geth-closer branch from 269a49b to d49dee5 Compare January 29, 2025 16:59
qdm12 added 3 commits January 31, 2025 11:38
- Add geth switch cases
- Add geth ancient freezers checks
- Add geth only elements of accounted meta
- Keep geth-only stats entries removed
@qdm12 qdm12 force-pushed the qdm12/core/rawdb-geth-closer branch from a12a415 to f9ba5bf Compare January 31, 2025 14:59
@qdm12 qdm12 changed the title chore(core/rawdb): make code closer to geth code chore(core/rawdb): use libevm core/rawdb for most things Jan 31, 2025
@qdm12 qdm12 changed the title chore(core/rawdb): use libevm core/rawdb for most things chore(core/rawdb): use libevm core/rawdb Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants