forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 278
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
(wip) Zz/feat/flattenproof plus txbytxtraces #1025
Draft
lispc
wants to merge
26
commits into
develop
Choose a base branch
from
zz/feat/flattenproof-plus-txbytxtraces
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0a0e396
WIP: flatten storageproof
noel2004 330ad97
WIP: for testing
noel2004 623cbe2
Merge remote-tracking branch 'origin/develop' into develop
noel2004 06fdc8c
fix: init map
noel2004 11a21da
fix lock issue
noel2004 2238551
add deletion proof
noel2004 d56e002
Merge remote-tracking branch 'scroll/develop' into feat/flattenproof
noel2004 7abeb46
fix endian represent of key
noel2004 84b00d2
add flatten proof for coinbase
noel2004 49151d4
WIP: preimage for key
noel2004 4e7a02f
Merge remote-tracking branch 'origin/develop' into feat/flattenproof
noel2004 8c2611c
key hash records
noel2004 a290561
Merge remote-tracking branch 'origin/develop' into feat/flattenproof
noel2004 3a805b4
filter for l2trace
noel2004 11b45dc
Merge remote-tracking branch 'origin/develop' into feat/flattenproof
noel2004 2a2b2b8
add union mode
noel2004 164adae
fix typo
noel2004 da019ee
fix go imports
noel2004 a85536a
Merge remote-tracking branch 'origin/develop' into feat/flattenproof
noel2004 13e46cf
set default format to legacy
noel2004 7968829
++
omerfirmak 5ec1a25
Merge remote-tracking branch 'origin/omerfirmak/tx-by-tx-tracer' into…
lispc 78e6f64
Merge remote-tracking branch 'origin/develop' into zz/feat/flattenpro…
lispc 903a85a
Merge remote-tracking branch 'origin/develop' into zz/feat/flattenpro…
lispc e565e14
induce partial trace mode
noel2004 9ce5c5a
disable trace filter
noel2004 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,11 @@ func NewTracerWrapper() *TracerWrapper { | |
return &TracerWrapper{} | ||
} | ||
|
||
func (tw *TracerWrapper) CreateTraceEnv(chainConfig *params.ChainConfig, chainContext core.ChainContext, engine consensus.Engine, chaindb ethdb.Database, statedb *state.StateDB, parent *types.Block, block *types.Block, commitAfterApply bool) (tracers.TracerEnv, error) { | ||
traceEnv, err := CreateTraceEnv(chainConfig, chainContext, engine, chaindb, statedb, parent, block, commitAfterApply) | ||
return traceEnv, err | ||
} | ||
|
||
// CreateTraceEnvAndGetBlockTrace wraps the whole block tracing logic for a block | ||
func (tw *TracerWrapper) CreateTraceEnvAndGetBlockTrace(chainConfig *params.ChainConfig, chainContext core.ChainContext, engine consensus.Engine, chaindb ethdb.Database, statedb *state.StateDB, parent *types.Block, block *types.Block, commitAfterApply bool) (*types.BlockTrace, error) { | ||
traceEnv, err := CreateTraceEnv(chainConfig, chainContext, engine, chaindb, statedb, parent, block, commitAfterApply) | ||
|
@@ -192,6 +197,41 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext core.ChainCont | |
return env, nil | ||
} | ||
|
||
func (env *TraceEnv) ResetForPartialTrace(partialBlk *types.Block) error { | ||
|
||
if env.StorageTrace == nil { | ||
return fmt.Errorf("not init") | ||
} | ||
|
||
// TODO: can we chained the RootBefore / After? | ||
oldStorage := env.StorageTrace | ||
|
||
// only reset which can be reset | ||
env.signer = types.MakeSigner(env.chainConfig, partialBlk.Number()) | ||
env.StorageTrace = &types.StorageTrace{ | ||
RootBefore: oldStorage.RootBefore, | ||
RootAfter: partialBlk.Root(), | ||
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. is this line O(1): yes. read only. |
||
Proofs: make(map[string][]hexutil.Bytes), | ||
StorageProofs: make(map[string]map[string][]hexutil.Bytes), | ||
FlattenProofs: make(map[common.Hash]hexutil.Bytes), | ||
AddressHashes: make(map[common.Address]common.Hash), | ||
StoreKeyHashes: make(map[common.Hash]common.Hash), | ||
} | ||
env.Codes = make(map[common.Hash]vm.CodeInfo) | ||
env.ExecutionResults = make([]*types.ExecutionResult, partialBlk.Transactions().Len()) | ||
env.TxStorageTraces = make([]*types.StorageTrace, partialBlk.Transactions().Len()) | ||
|
||
// still need to restore coinbase's proof .... | ||
proof, addrHash, err := env.state.GetFullProof(env.coinbase) | ||
if err == nil { | ||
env.AddressHashes[env.coinbase] = addrHash | ||
env.fillFlattenStorageProof(nil, proof) | ||
env.Proofs[env.coinbase.String()] = types.WrapProof(proof.GetData()) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error) { | ||
// Execute all the transaction contained within the block concurrently | ||
var ( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 reset env.signer?