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

[Non-breaking changes] Refactor trie interfaces #378

Closed
wants to merge 45 commits into from
Closed

[Non-breaking changes] Refactor trie interfaces #378

wants to merge 45 commits into from

Conversation

trinhdn2
Copy link

@trinhdn2 trinhdn2 commented Aug 4, 2023

This PR focus on separating some ambiguous methods of the Trie interface from

type Trie interface {
    TryGet(key []byte) ([]byte, error)
    TryUpdate(key, value []byte) error
    TryDelete(key []byte) error
}

into clearer methods, indicating their usages

type Trie interface {
    GetStorage(addr common.Address, key []byte) ([]byte, error)
    GetAccount(address common.Address) (*types.StateAccount, error)
    UpdateStorage(addr common.Address, key, value []byte) error
    UpdateAccount(address common.Address, account *types.StateAccount) error
    UpdateContractCode(address common.Address, codeHash common.Hash, code []byte) error
    DeleteStorage(addr common.Address, key []byte) error
    DeleteAccount(address common.Address) error
}

This PR also separates the preimage logic to a standalone struct called preimageStore. It should simplify the code a bit.

Another big change in this PR: the preimage recording is disabled by default now.

These PRs must be merged first:

Refs:

@trinhdn2 trinhdn2 marked this pull request as ready for review August 4, 2023 07:17
@trinhdn2 trinhdn2 closed this Dec 20, 2023
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.

3 participants