mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-12 06:53:46 +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 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) {
|
func (v *BlockValidator) validateCircuitRowConsumption(block *types.Block) (*types.RowConsumption, error) {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type TraceEnv struct {
|
type TraceEnv struct {
|
||||||
logConfig *vm.LogConfig
|
logConfig *vm.LogConfig
|
||||||
chainConfig *params.ChainConfig
|
commitAfterApply bool
|
||||||
|
chainConfig *params.ChainConfig
|
||||||
|
|
||||||
coinbase common.Address
|
coinbase common.Address
|
||||||
|
|
||||||
|
|
@ -58,7 +59,7 @@ type txTraceTask struct {
|
||||||
index int
|
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 coinbase common.Address
|
||||||
var err error
|
var err error
|
||||||
if chainConfig.Scroll.FeeVaultEnabled() {
|
if chainConfig.Scroll.FeeVaultEnabled() {
|
||||||
|
|
@ -75,11 +76,12 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext,
|
||||||
EnableMemory: false,
|
EnableMemory: false,
|
||||||
EnableReturnData: true,
|
EnableReturnData: true,
|
||||||
},
|
},
|
||||||
chainConfig: chainConfig,
|
commitAfterApply: commitAfterApply,
|
||||||
coinbase: coinbase,
|
chainConfig: chainConfig,
|
||||||
signer: types.MakeSigner(chainConfig, block.Number()),
|
coinbase: coinbase,
|
||||||
state: statedb,
|
signer: types.MakeSigner(chainConfig, block.Number()),
|
||||||
blockCtx: NewEVMBlockContext(block.Header(), chainContext, nil),
|
state: statedb,
|
||||||
|
blockCtx: NewEVMBlockContext(block.Header(), chainContext, nil),
|
||||||
StorageTrace: &types.StorageTrace{
|
StorageTrace: &types.StorageTrace{
|
||||||
RootBefore: parent.Root(),
|
RootBefore: parent.Root(),
|
||||||
RootAfter: block.Root(),
|
RootAfter: block.Root(),
|
||||||
|
|
@ -156,8 +158,9 @@ func (env *TraceEnv) GetBlockTrace(block *types.Block) (*types.BlockTrace, error
|
||||||
failed = err
|
failed = err
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// we'd better don't finalise
|
if env.commitAfterApply {
|
||||||
// env.state.Finalise(vmenv.chainConfig().IsEIP158(block.Number()))
|
env.state.Finalise(vmenv.ChainConfig().IsEIP158(block.Number()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(jobs)
|
close(jobs)
|
||||||
pend.Wait()
|
pend.Wait()
|
||||||
|
|
|
||||||
|
|
@ -65,5 +65,5 @@ func (api *API) createTraceEnv(ctx context.Context, config *TraceConfig, block *
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
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,
|
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
|
// new block with a placeholder tx, for traceEnv's ExecutionResults length & TxStorageTraces length
|
||||||
types.NewBlockWithHeader(header).WithBody([]*types.Transaction{types.NewTx(&types.LegacyTx{})}, nil),
|
types.NewBlockWithHeader(header).WithBody([]*types.Transaction{types.NewTx(&types.LegacyTx{})}, nil),
|
||||||
)
|
commitAfterApply)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 4 // Major version component of the current release
|
VersionMajor = 4 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor 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
|
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue