mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 15:46:43 +00:00
fix(trace): fix commit state when tracing (#451)
* fix(trace): fix commit state when tracing * bump version
This commit is contained in:
parent
5c4530cd2a
commit
b428fa1339
5 changed files with 18 additions and 14 deletions
|
|
@ -266,7 +266,7 @@ func (v *BlockValidator) createTraceEnv(block *types.Block) (*TraceEnv, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return CreateTraceEnv(v.config, v.bc, v.engine, statedb, parent, block)
|
||||
return CreateTraceEnv(v.config, v.bc, v.engine, statedb, parent, block, true)
|
||||
}
|
||||
|
||||
func (v *BlockValidator) validateCircuitRowConsumption(block *types.Block) (*types.RowConsumption, error) {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ import (
|
|||
)
|
||||
|
||||
type TraceEnv struct {
|
||||
logConfig *vm.LogConfig
|
||||
chainConfig *params.ChainConfig
|
||||
logConfig *vm.LogConfig
|
||||
commitAfterApply bool
|
||||
chainConfig *params.ChainConfig
|
||||
|
||||
coinbase common.Address
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ type txTraceTask struct {
|
|||
index int
|
||||
}
|
||||
|
||||
func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext, engine consensus.Engine, statedb *state.StateDB, parent *types.Block, block *types.Block) (*TraceEnv, error) {
|
||||
func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext, engine consensus.Engine, statedb *state.StateDB, parent *types.Block, block *types.Block, commitAfterApply bool) (*TraceEnv, error) {
|
||||
var coinbase common.Address
|
||||
var err error
|
||||
if chainConfig.Scroll.FeeVaultEnabled() {
|
||||
|
|
@ -75,11 +76,12 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext,
|
|||
EnableMemory: false,
|
||||
EnableReturnData: true,
|
||||
},
|
||||
chainConfig: chainConfig,
|
||||
coinbase: coinbase,
|
||||
signer: types.MakeSigner(chainConfig, block.Number()),
|
||||
state: statedb,
|
||||
blockCtx: NewEVMBlockContext(block.Header(), chainContext, nil),
|
||||
commitAfterApply: commitAfterApply,
|
||||
chainConfig: chainConfig,
|
||||
coinbase: coinbase,
|
||||
signer: types.MakeSigner(chainConfig, block.Number()),
|
||||
state: statedb,
|
||||
blockCtx: NewEVMBlockContext(block.Header(), chainContext, nil),
|
||||
StorageTrace: &types.StorageTrace{
|
||||
RootBefore: parent.Root(),
|
||||
RootAfter: block.Root(),
|
||||
|
|
@ -156,8 +158,9 @@ func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error
|
|||
failed = err
|
||||
break
|
||||
}
|
||||
// we'd better don't finalise
|
||||
// env.state.Finalise(vmenv.chainConfig().IsEIP158(block.Number()))
|
||||
if env.commitAfterApply {
|
||||
env.state.Finalise(vmenv.ChainConfig().IsEIP158(block.Number()))
|
||||
}
|
||||
}
|
||||
close(jobs)
|
||||
pend.Wait()
|
||||
|
|
|
|||
|
|
@ -65,5 +65,5 @@ func (api *API) createTraceEnv(ctx context.Context, config *TraceConfig, block *
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return core.CreateTraceEnv(api.backend.ChainConfig(), api.chainContext(ctx), api.backend.Engine(), statedb, parent, block)
|
||||
return core.CreateTraceEnv(api.backend.ChainConfig(), api.chainContext(ctx), api.backend.Engine(), statedb, parent, block, true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -760,10 +760,11 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
|
|||
return err
|
||||
}
|
||||
|
||||
commitAfterApply := false // don't commit during tracing for circuit capacity checker, otherwise we cannot revert
|
||||
traceEnv, err := core.CreateTraceEnv(w.chainConfig, w.chain, w.engine, state, parent,
|
||||
// new block with a placeholder tx, for traceEnv's ExecutionResults length & TxStorageTraces length
|
||||
types.NewBlockWithHeader(header).WithBody([]*types.Transaction{types.NewTx(&types.LegacyTx{})}, nil),
|
||||
)
|
||||
commitAfterApply)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 4 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 29 // Patch version component of the current release
|
||||
VersionPatch = 30 // Patch version component of the current release
|
||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue