From f948fb4a3b2487924e480f54c1e10d320d0c7ccb Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Wed, 6 Nov 2024 15:16:33 +0700 Subject: [PATCH] `eth_getLogs` to fix `fee cap less than block base fee` error (#12640) --- .github/workflows/lint.yml | 2 +- .github/workflows/qa-rpc-integration-tests.yml | 5 ++--- cmd/state/exec3/trace_worker.go | 5 +++-- core/vm/evm.go | 5 +++++ go.mod | 2 +- turbo/jsonrpc/eth_receipts.go | 4 ---- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3efd756d7e5..31cb5b4a28d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: Install golangci-lint if: runner.os == 'Linux' diff --git a/.github/workflows/qa-rpc-integration-tests.yml b/.github/workflows/qa-rpc-integration-tests.yml index ecbcb404a35..bc6def09f5a 100644 --- a/.github/workflows/qa-rpc-integration-tests.yml +++ b/.github/workflows/qa-rpc-integration-tests.yml @@ -87,6 +87,8 @@ jobs: # Run RPC integration test runner via http python3 ./run_tests.py -p 8545 --continue -f --json-diff -x \ +# Erigon2 and Erigon3 never supported this api methods + trace_rawTransaction,\ # false positives: Erigon return expected response. but rpc-test somehow doesn't see 1 field. erigon_getHeaderByHash,erigon_getHeaderByNumber,eth_feeHistory,\ # total difficulty field was removed, then added back @@ -109,9 +111,6 @@ jobs: engine_getClientVersionV1/test_1.json,\ erigon_getBalanceChangesInBlock,\ eth_createAccessList/test_16.json,\ - trace_filter/test_16.json,\ - trace_rawTransaction/test_01.json,\ - trace_rawTransaction/test_03.json,\ admin_nodeInfo/test_01.json,\ admin_peers/test_01.json,\ erigon_nodeInfo/test_1.json,\ diff --git a/cmd/state/exec3/trace_worker.go b/cmd/state/exec3/trace_worker.go index 7c9ceeb8e79..7b80c49992b 100644 --- a/cmd/state/exec3/trace_worker.go +++ b/cmd/state/exec3/trace_worker.go @@ -74,11 +74,12 @@ func NewTraceWorker(tx kv.TemporalTx, cc *chain.Config, engine consensus.EngineR stateReader: stateReader, tracer: tracer, evm: vm.NewEVM(evmtypes.BlockContext{}, evmtypes.TxContext{}, nil, cc, vm.Config{}), - vmConfig: &vm.Config{}, + vmConfig: &vm.Config{NoBaseFee: true}, ibs: state.New(stateReader), } if tracer != nil { - ie.vmConfig = &vm.Config{Debug: true, Tracer: tracer} + ie.vmConfig.Debug = true + ie.vmConfig.Tracer = tracer } return ie } diff --git a/core/vm/evm.go b/core/vm/evm.go index 1ec0c0ff645..fb46915fed3 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -134,6 +134,11 @@ func (evm *EVM) Reset(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState) { } func (evm *EVM) ResetBetweenBlocks(blockCtx evmtypes.BlockContext, txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState, vmConfig Config, chainRules *chain.Rules) { + if vmConfig.NoBaseFee { + if txCtx.GasPrice.IsZero() { + blockCtx.BaseFee = new(uint256.Int) + } + } evm.Context = blockCtx evm.TxContext = txCtx evm.intraBlockState = ibs diff --git a/go.mod b/go.mod index e3aef287de0..be8789ea804 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/Giulio2002/bls v0.0.0-20241013174947-019133587795 github.com/Masterminds/sprig/v3 v3.2.3 github.com/RoaringBitmap/roaring v1.9.4 - github.com/alecthomas/atomic v0.1.0-alpha2 github.com/alecthomas/kong v0.8.1 github.com/anacrolix/sync v0.5.1 github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 @@ -107,6 +106,7 @@ require ( ) require ( + github.com/alecthomas/atomic v0.1.0-alpha2 // indirect github.com/elastic/go-freelru v0.13.0 // indirect github.com/erigontech/speedtest v0.0.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index 3dbb7b5b69a..ba23694e56a 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -303,10 +303,6 @@ func (api *BaseAPI) getLogsV3(ctx context.Context, tx kv.TemporalTx, begin, end continue } blockHash = header.Hash() - - if err != nil { - return nil, err - } exec.ChangeBlock(header) }