-
Notifications
You must be signed in to change notification settings - Fork 223
Refactoring: statedb interface #405
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
base: develop
Are you sure you want to change the base?
Changes from 5 commits
d7b97de
1c10123
53aa17b
390f3c3
9f571ce
3d81e42
5e4af78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,6 @@ import ( | |
| "github.com/ethereum/go-ethereum/common/hexutil" | ||
| "github.com/ethereum/go-ethereum/common/math" | ||
| "github.com/ethereum/go-ethereum/consensus/ethash" | ||
| "github.com/ethereum/go-ethereum/core/state" | ||
| "github.com/ethereum/go-ethereum/core/types" | ||
| "github.com/ethereum/go-ethereum/core/vm" | ||
| "github.com/ethereum/go-ethereum/crypto" | ||
|
|
@@ -710,8 +709,14 @@ type StorageResult struct { | |
|
|
||
| // GetProof returns the Merkle-proof for a given account and optionally some storage keys. | ||
| func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) { | ||
| state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) | ||
| if state == nil || err != nil { | ||
| statedb, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) | ||
| if statedb == nil || err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| state, ok := evmcore.IsMptStateDB(statedb) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for asking, was just looking into the code and the consensus and found PRs.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be an over-engineering for now. All we need is check here does the proofs complies with the legacy format. |
||
| if !ok { | ||
| err = errors.New("Proofs are not provided by current state db impl") | ||
| return nil, err | ||
| } | ||
|
|
||
|
|
@@ -912,7 +917,7 @@ type OverrideAccount struct { | |
| type StateOverride map[common.Address]OverrideAccount | ||
|
|
||
| // Apply overrides the fields of specified accounts into the given state. | ||
| func (diff *StateOverride) Apply(state *state.StateDB) error { | ||
| func (diff *StateOverride) Apply(state evmcore.StateDB) error { | ||
| if diff == nil { | ||
| return nil | ||
| } | ||
|
|
||
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.
We might wrap these into a function in
evmstore.Storeto avoid duplicate code?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.
Better I will add different error messages which explain each case.