Skip to content

Commit b796ead

Browse files
lupin012claude
andauthored
rpc: fix debug_traceCallMany global BlockOverrides and StateOverrides (#19547)
- Apply config.BlockOverrides to blockCtx before the bundle loop (it was silently ignored) - Compute real precompiles and pass them to StateOverrides.Override (nil was passed, breaking custom precompile overrides) - Pass precompiles (not nil) to each TraceTx call inside the loop Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7c13b94 commit b796ead

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

rpc/jsonrpc/tracing.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,21 @@ func (api *DebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bundle, si
551551
}
552552

553553
blockCtx = protocol.NewEVMBlockContext(header, getHash, api.engine(), accounts.NilAddress /* author */, chainConfig)
554+
// Apply global block overrides as the baseline for all bundles.
555+
if config.BlockOverrides != nil {
556+
if err := config.BlockOverrides.Override(&blockCtx); err != nil {
557+
return err
558+
}
559+
}
554560
// Get a new instance of the EVM
555561
evm = vm.NewEVM(blockCtx, txCtx, ibs, chainConfig, vm.Config{})
556562
rules := evm.ChainRules()
557563

564+
var precompiles vm.PrecompiledContracts
558565
// after replaying the txns, we want to overload the state
559566
if config.StateOverrides != nil {
560-
err = config.StateOverrides.Override(ibs, nil, rules)
567+
precompiles = vm.ActivePrecompiledContracts(rules)
568+
err = config.StateOverrides.Override(ibs, precompiles, rules)
561569
if err != nil {
562570
return err
563571
}
@@ -585,7 +593,7 @@ func (api *DebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bundle, si
585593
txCtx = protocol.NewEVMTxContext(msg)
586594
ibs := evm.IntraBlockState()
587595
ibs.SetTxContext(blockCtx.BlockNumber, txnIndex)
588-
_, err = transactions.TraceTx(ctx, api.engine(), transaction, msg, blockCtx, txCtx, nil, common.Hash{}, txnIndex, evm.IntraBlockState(), config, chainConfig, stream, api.evmCallTimeout, nil)
596+
_, err = transactions.TraceTx(ctx, api.engine(), transaction, msg, blockCtx, txCtx, nil, common.Hash{}, txnIndex, evm.IntraBlockState(), config, chainConfig, stream, api.evmCallTimeout, precompiles)
589597
if err != nil {
590598
return err
591599
}

0 commit comments

Comments
 (0)