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

all: re-implement state overriding #29950

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rjl493456442
Copy link
Member

No description provided.

@rjl493456442 rjl493456442 force-pushed the override-reader branch 3 times, most recently from 379059d to ed88ef0 Compare June 12, 2024 03:08
@rjl493456442 rjl493456442 changed the title WIP Override reader all: re-implement state overriding Jun 12, 2024
}

// OverrideState applies the state overrides into the provided live state database.
func OverrideState(state *StateDB, overrides map[common.Address]OverrideAccount) (*StateDB, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the StateOverride type alias? more cumbersome to type map[common.Address]OverrideAccount 😄

@holiman
Copy link
Contributor

holiman commented Aug 26, 2024

Ah, so this one is really a follow-up on #29761 ?

@s1na
Copy link
Contributor

s1na commented Aug 26, 2024

We had a triage discussion about this. As it stands the PR doesn't let us compute the state root off of the overridden state. This feature is desired for #27720.

@rjl493456442
Copy link
Member Author

But I think this branch is still better than the existing solution for state override. e.g. we can use this feature to override the states for "read-only" purposes.

For multicall, it's a bit different. It feels like a call simulation which may have the state mutations (but they are never persisted). In this case, we can use the existing solution to apply the overrides as mutation.

@holiman
Copy link
Contributor

holiman commented Sep 13, 2024

Needs a rebase

@holiman
Copy link
Contributor

holiman commented Oct 11, 2024

I think the approach here is good.

the PR doesn't let us compute the state root off of the overridden state.

I think that's a pretty hard criteria to judge by. That sounds like a pretty difficult thing to achieve, IMO.

@rjl493456442
Copy link
Member Author

I can rebase it

@@ -356,6 +356,14 @@ func (bc *BlockChain) StateAt(root common.Hash) (*state.StateDB, error) {
return state.New(root, bc.statedb)
}

// StateWithOverrides returns a new mutable state with provided state overrides.
func (bc *BlockChain) StateWithOverrides(root common.Hash, overrides *map[common.Address]state.OverrideAccount) (*state.StateDB, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why pass *map instead of just a map?

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