mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
fix remaining broken tests
This commit is contained in:
parent
9c901e862b
commit
4a603a7fb3
1 changed files with 8 additions and 9 deletions
|
|
@ -627,7 +627,7 @@ func envFromLoggerConfig(api *API, config *logger.Config) *traceEnv {
|
||||||
|
|
||||||
func (api *API) retrieveBlockPrestate(ctx context.Context, block *types.Block, execOpt *traceExecOptions, readOnly, preferDisk bool) (db *state.StateDB, stateRelease StateReleaseFunc, err error) {
|
func (api *API) retrieveBlockPrestate(ctx context.Context, block *types.Block, execOpt *traceExecOptions, readOnly, preferDisk bool) (db *state.StateDB, stateRelease StateReleaseFunc, err error) {
|
||||||
if block.NumberU64() == 0 {
|
if block.NumberU64() == 0 {
|
||||||
return nil, nil, fmt.Errorf("cannot trace genesis block")
|
return nil, nil, fmt.Errorf("genesis is not traceable")
|
||||||
}
|
}
|
||||||
// Prepare base state
|
// Prepare base state
|
||||||
parent, err := api.blockByNumberAndHash(ctx, rpc.BlockNumber(block.NumberU64()-1), block.ParentHash())
|
parent, err := api.blockByNumberAndHash(ctx, rpc.BlockNumber(block.NumberU64()-1), block.ParentHash())
|
||||||
|
|
@ -689,9 +689,6 @@ func (api *API) traceBlockWithState(ctx context.Context, block *types.Block, sta
|
||||||
// executes all the transactions contained within. The return value will be one item
|
// executes all the transactions contained within. The return value will be one item
|
||||||
// per transaction, dependent on the requested tracer.
|
// per transaction, dependent on the requested tracer.
|
||||||
func (api *API) traceBlock(ctx context.Context, block *types.Block, env *traceEnv, execOpt *traceExecOptions, instantiateTracer func(*Context) (*Tracer, error)) ([]*txTraceResult, error) {
|
func (api *API) traceBlock(ctx context.Context, block *types.Block, env *traceEnv, execOpt *traceExecOptions, instantiateTracer func(*Context) (*Tracer, error)) ([]*txTraceResult, error) {
|
||||||
if block.NumberU64() == 0 {
|
|
||||||
return nil, fmt.Errorf("cannot trace genesis block")
|
|
||||||
}
|
|
||||||
statedb, release, err := api.retrieveBlockPrestate(ctx, block, execOpt, true, false)
|
statedb, release, err := api.retrieveBlockPrestate(ctx, block, execOpt, true, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -1094,6 +1091,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||||
defer release()
|
defer release()
|
||||||
|
|
||||||
vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
|
vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
|
||||||
|
var traceConfig TraceConfig
|
||||||
// Apply the customization rules if required.
|
// Apply the customization rules if required.
|
||||||
if config != nil {
|
if config != nil {
|
||||||
if overrideErr := config.BlockOverrides.Apply(&vmctx); overrideErr != nil {
|
if overrideErr := config.BlockOverrides.Apply(&vmctx); overrideErr != nil {
|
||||||
|
|
@ -1105,6 +1103,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||||
if err := config.StateOverrides.Apply(statedb, precompiles); err != nil {
|
if err := config.StateOverrides.Apply(statedb, precompiles); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
traceConfig = config.TraceConfig
|
||||||
}
|
}
|
||||||
// Execute the trace
|
// Execute the trace
|
||||||
if err := args.CallDefaults(api.backend.RPCGasCap(), vmctx.BaseFee, api.backend.ChainConfig().ChainID); err != nil {
|
if err := args.CallDefaults(api.backend.RPCGasCap(), vmctx.BaseFee, api.backend.ChainConfig().ChainID); err != nil {
|
||||||
|
|
@ -1113,7 +1112,6 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||||
var (
|
var (
|
||||||
msg = args.ToMessage(vmctx.BaseFee, true, true)
|
msg = args.ToMessage(vmctx.BaseFee, true, true)
|
||||||
tx = args.ToTransaction(types.LegacyTxType)
|
tx = args.ToTransaction(types.LegacyTxType)
|
||||||
traceConfig *TraceConfig
|
|
||||||
)
|
)
|
||||||
// Lower the basefee to 0 to avoid breaking EVM
|
// Lower the basefee to 0 to avoid breaking EVM
|
||||||
// invariants (basefee < feecap).
|
// invariants (basefee < feecap).
|
||||||
|
|
@ -1123,7 +1121,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||||
if msg.BlobGasFeeCap != nil && msg.BlobGasFeeCap.BitLen() == 0 {
|
if msg.BlobGasFeeCap != nil && msg.BlobGasFeeCap.BitLen() == 0 {
|
||||||
vmctx.BlobBaseFee = new(big.Int)
|
vmctx.BlobBaseFee = new(big.Int)
|
||||||
}
|
}
|
||||||
tracer, err := api.instantiateTracer(traceConfig, new(Context))
|
tracer, err := api.instantiateTracer(&traceConfig, new(Context))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -1134,6 +1132,7 @@ func (api *API) instantiateTracer(config *TraceConfig, txctx *Context) (*Tracer,
|
||||||
var tracer *Tracer
|
var tracer *Tracer
|
||||||
var err error
|
var err error
|
||||||
if config == nil {
|
if config == nil {
|
||||||
|
// TODO: use this case to simplify the code below
|
||||||
config = &TraceConfig{}
|
config = &TraceConfig{}
|
||||||
}
|
}
|
||||||
// Default tracer is the struct logger
|
// Default tracer is the struct logger
|
||||||
|
|
@ -1146,7 +1145,7 @@ func (api *API) instantiateTracer(config *TraceConfig, txctx *Context) (*Tracer,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chainConfig := api.backend.ChainConfig()
|
chainConfig := api.backend.ChainConfig()
|
||||||
if config.Config.Overrides != nil {
|
if config.Config != nil && config.Config.Overrides != nil {
|
||||||
chainConfig = config.Config.Overrides
|
chainConfig = config.Config.Overrides
|
||||||
}
|
}
|
||||||
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig, chainConfig)
|
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig, chainConfig)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue