diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 330ee5f295..391e6393be 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1268,7 +1268,7 @@ func (api *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockN // // Note, this function doesn't make any changes in the state/blockchain and is // useful to execute and retrieve values. -func (s *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrOrHash *rpc.BlockNumberOrHash) ([]map[string]interface{}, error) { +func (api *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrOrHash *rpc.BlockNumberOrHash) ([]map[string]interface{}, error) { if len(opts.BlockStateCalls) == 0 { return nil, &invalidParamsError{message: "empty input"} } else if len(opts.BlockStateCalls) > maxSimulateBlocks { @@ -1278,17 +1278,17 @@ func (s *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrOrH n := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber) blockNrOrHash = &n } - state, base, err := s.b.StateAndHeaderByNumberOrHash(ctx, *blockNrOrHash) + state, base, err := api.b.StateAndHeaderByNumberOrHash(ctx, *blockNrOrHash) if state == nil || err != nil { return nil, err } sim := &simulator{ - b: s.b, + b: api.b, state: state, base: base, - chainConfig: s.b.ChainConfig(), + chainConfig: api.b.ChainConfig(), // Each tx and all the series of txes shouldn't consume more gas than cap - gp: new(core.GasPool).AddGas(s.b.RPCGasCap()), + gp: new(core.GasPool).AddGas(api.b.RPCGasCap()), traceTransfers: opts.TraceTransfers, validate: opts.Validation, fullTx: opts.ReturnFullTransactions, diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 202b573fc0..53620bf29d 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -3324,7 +3324,7 @@ func TestStateOverrideMovePrecompile(t *testing.T) { if len(cpy) != len(tt.expectedPrecompiles) { t.Errorf("test %d: precompile mismatch, want %d, have %d", i, len(tt.expectedPrecompiles), len(cpy)) } - for k, _ := range tt.expectedPrecompiles { + for k := range tt.expectedPrecompiles { if _, ok := cpy[k]; !ok { t.Errorf("test %d: precompile not found: %s", i, k.String()) } diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index 9b053f69bd..7a0d6f2bc3 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -245,7 +245,6 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, b := types.NewBlock(header, &types.Body{Transactions: txes, Withdrawals: withdrawals}, receipts, trie.NewStackTrie(nil)) repairLogs(callResults, b.Hash()) return b, callResults, nil - } // repairLogs updates the block hash in the logs present in the result of @@ -272,7 +271,6 @@ func (sim *simulator) sanitizeCall(call *TransactionArgs, state *state.StateDB, if *gasUsed+uint64(*call.Gas) > blockContext.GasLimit { return &blockGasLimitReachedError{fmt.Sprintf("block gas limit reached: %d >= %d", gasUsed, blockContext.GasLimit)} } - if err := call.CallDefaults(sim.gp.Gas(), header.BaseFee, sim.chainConfig.ChainID); err != nil { return err }