-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
base: master
Are you sure you want to change the base?
Conversation
379059d
to
ed88ef0
Compare
ed88ef0
to
df45370
Compare
} | ||
|
||
// OverrideState applies the state overrides into the provided live state database. | ||
func OverrideState(state *StateDB, overrides map[common.Address]OverrideAccount) (*StateDB, error) { |
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.
Can we keep the StateOverride type alias? more cumbersome to type map[common.Address]OverrideAccount 😄
df45370
to
a86c1d0
Compare
3f1a846
to
460ba4d
Compare
460ba4d
to
6ac43e7
Compare
Ah, so this one is really a follow-up on #29761 ? |
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. |
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. |
6ac43e7
to
3232927
Compare
Needs a rebase |
I think the approach here is good.
I think that's a pretty hard criteria to judge by. That sounds like a pretty difficult thing to achieve, IMO. |
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) { |
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 pass *map
instead of just a map
?
No description provided.