Skip to content
8 changes: 5 additions & 3 deletions rpc/jsonrpc/eth_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ func (api *APIImpl) SimulateV1(ctx context.Context, req SimulationRequest, block

// Iterate over each given SimulatedBlock
parent := sim.base
blockHashOverrides := ethapi.BlockHashOverrides{}
for index, bsc := range simulatedBlocks {
blockResult, current, err := sim.simulateBlock(ctx, tx, sharedDomains, &bsc, headers[index], parent, headers[:index], blockNumber == latestBlockNumber)
blockResult, current, err := sim.simulateBlock(ctx, tx, sharedDomains, &bsc, headers[index], parent, headers[:index], blockNumber == latestBlockNumber, blockHashOverrides)
if err != nil {
return nil, err
}
blockHashOverrides[current.NumberU64()] = current.Hash()
simulatedBlockResults = append(simulatedBlockResults, blockResult)
headers[index] = current.Header()
parent = current.Header()
Expand Down Expand Up @@ -507,6 +509,7 @@ func (s *simulator) simulateBlock(
parent *types.Header,
ancestors []*types.Header,
latest bool,
blockHashOverrides ethapi.BlockHashOverrides,
) (SimulatedBlockResult, *types.Block, error) {
header.ParentHash = parent.Hash()
if s.chainConfig.IsLondon(header.Number.Uint64()) {
Expand All @@ -529,7 +532,6 @@ func (s *simulator) simulateBlock(

blockNumber := header.Number.Uint64()

blockHashOverrides := ethapi.BlockHashOverrides{}
txnList := make([]types.Transaction, 0, len(bsc.Calls))
receiptList := make(types.Receipts, 0, len(bsc.Calls))
tracer := rpchelper.NewLogTracer(s.traceTransfers, blockNumber, common.Hash{}, common.Hash{}, 0)
Expand Down Expand Up @@ -788,7 +790,7 @@ func (s *simulator) simulateCall(
if err != nil {
return nil, nil, nil, err
}
msg.SetCheckGas(s.validation)
msg.SetCheckGas(false) // EIP-7825 gas cap does not apply to simulated calls (matches Geth SkipTransactionChecks)
msg.SetCheckNonce(s.validation)
txCtx := protocol.NewEVMTxContext(msg)
txn, err := call.ToTransaction(s.gasPool.Gas(), &blockCtx.BaseFee)
Expand Down
Loading