diff --git a/status_merge.txt b/merge_status.txt similarity index 97% rename from status_merge.txt rename to merge_status.txt index ad3f664dc40..d41ddb7cbe9 100644 --- a/status_merge.txt +++ b/merge_status.txt @@ -2395,59 +2395,7 @@ Unmerged paths: both modified: polygon/sync/execution_client.go both modified: rpc/http.go both modified: tests/erigon-ext-test/go.mod.template - both modified: turbo/adapter/ethapi/api.go - both modified: turbo/app/snapshots_cmd.go - both modified: turbo/cli/default_flags.go - both modified: turbo/cli/flags.go - both modified: turbo/engineapi/engine_server.go - both modified: turbo/engineapi/interface.go - both modified: turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go - both modified: turbo/execution/eth1/ethereum_execution.go - both modified: turbo/execution/eth1/forkchoice.go - both modified: turbo/execution/eth1/getters.go - both modified: turbo/jsonrpc/call_traces_test.go - both modified: turbo/jsonrpc/corner_cases_support_test.go - both modified: turbo/jsonrpc/daemon.go - both modified: turbo/jsonrpc/debug_api_test.go - both modified: turbo/jsonrpc/erigon_receipts_test.go - both modified: turbo/jsonrpc/eth_accounts.go - both modified: turbo/jsonrpc/eth_api.go - both modified: turbo/jsonrpc/eth_api_test.go - both modified: turbo/jsonrpc/eth_block.go - both modified: turbo/jsonrpc/eth_block_test.go - both modified: turbo/jsonrpc/eth_call.go - both modified: turbo/jsonrpc/eth_callMany.go - both modified: turbo/jsonrpc/eth_callMany_test.go - both modified: turbo/jsonrpc/eth_call_test.go - both modified: turbo/jsonrpc/eth_filters.go - both modified: turbo/jsonrpc/eth_filters_test.go - both modified: turbo/jsonrpc/eth_mining_test.go - both modified: turbo/jsonrpc/eth_receipts.go - both modified: turbo/jsonrpc/eth_system_test.go - both modified: turbo/jsonrpc/gen_traces_test.go - both modified: turbo/jsonrpc/otterscan_api.go - both modified: turbo/jsonrpc/otterscan_contract_creator.go - both modified: turbo/jsonrpc/otterscan_generic_tracer.go - both modified: turbo/jsonrpc/otterscan_search_trace.go - both modified: turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce_test.go - both modified: turbo/jsonrpc/parity_api_test.go - both modified: turbo/jsonrpc/send_transaction.go - both modified: turbo/jsonrpc/send_transaction_test.go - both modified: turbo/jsonrpc/trace_adhoc.go - both modified: turbo/jsonrpc/trace_adhoc_test.go - both modified: turbo/jsonrpc/trace_api.go - both modified: turbo/jsonrpc/trace_filtering.go - both modified: turbo/jsonrpc/tracing.go - both modified: turbo/jsonrpc/txpool_api_test.go - both modified: turbo/node/node.go - both modified: turbo/snapshotsync/freezeblocks/block_reader.go - both modified: turbo/snapshotsync/freezeblocks/block_snapshots.go - both modified: turbo/snapshotsync/freezeblocks/bor_snapshots.go - both modified: turbo/snapshotsync/snapshotsync.go - both modified: turbo/stages/mock/mock_sentry.go - both modified: turbo/transactions/call.go - both modified: turbo/transactions/tracing.go - + Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) diff --git a/turbo/adapter/ethapi/api.go b/turbo/adapter/ethapi/api.go index 61b636d2dba..4eeb3847b3d 100644 --- a/turbo/adapter/ethapi/api.go +++ b/turbo/adapter/ethapi/api.go @@ -594,13 +594,8 @@ func newRPCTransactionFromBlockIndex(b *types.Block, index uint64) *RPCTransacti */ // newRPCTransactionFromBlockAndTxGivenIndex returns a transaction that will serialize to the RPC representation. -<<<<<<< HEAD -func newRPCTransactionFromBlockAndTxGivenIndex(b *types.Block, tx types.Transaction, index uint64, receipt *types.Receipt) *RPCTransaction { - return newRPCTransaction(tx, b.Hash(), b.NumberU64(), index, b.BaseFee(), receipt) -======= -func newRPCTransactionFromBlockAndTxGivenIndex(b *types.Block, txn types.Transaction, index uint64) *RPCTransaction { - return newRPCTransaction(txn, b.Hash(), b.NumberU64(), index, b.BaseFee()) ->>>>>>> v3.0.0-alpha1 +func newRPCTransactionFromBlockAndTxGivenIndex(b *types.Block, txn types.Transaction, index uint64, receipt *types.Receipt) *RPCTransaction { + return newRPCTransaction(txn, b.Hash(), b.NumberU64(), index, b.BaseFee(), receipt) } /* diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index 2ad04d38ce0..d06d4ec7243 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -86,15 +86,10 @@ func joinFlags(lists ...[]cli.Flag) (res []cli.Flag) { var snapshotCommand = cli.Command{ Name: "snapshots", Usage: `Managing snapshots (historical data partitions)`, -<<<<<<< HEAD - Before: func(context *cli.Context) error { - _, _, _, err := debug.Setup(context, true /* rootLogger */) -======= Before: func(cliCtx *cli.Context) error { go mem.LogMemStats(cliCtx.Context, log.New()) go disk.UpdateDiskStats(cliCtx.Context, log.New()) _, _, _, err := debug.Setup(cliCtx, true /* rootLogger */) ->>>>>>> v3.0.0-alpha1 if err != nil { return err } @@ -373,11 +368,7 @@ var ( } ) -<<<<<<< HEAD -func doIntegrity(cliCtx *cli.Context) error { -======= func doBtSearch(cliCtx *cli.Context) error { ->>>>>>> v3.0.0-alpha1 logger, _, _, err := debug.Setup(cliCtx, true /* root logger */) if err != nil { return err @@ -627,37 +618,7 @@ func doDecompressSpeed(cliCtx *cli.Context) error { return nil } -<<<<<<< HEAD -func doRam(cliCtx *cli.Context) error { - var logger log.Logger - var err error - if logger, _, _, err = debug.Setup(cliCtx, true /* rootLogger */); err != nil { - return err - } - defer logger.Info("Done") - args := cliCtx.Args() - if args.Len() < 1 { - return fmt.Errorf("expecting file path as a first argument") - } - f := args.First() - var m runtime.MemStats - dbg.ReadMemStats(&m) - before := m.Alloc - logger.Info("RAM before open", "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys)) - decompressor, err := seg.NewDecompressor(f) - if err != nil { - return err - } - defer decompressor.Close() - dbg.ReadMemStats(&m) - logger.Info("RAM after open", "alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys), "diff", common.ByteCount(m.Alloc-before)) - return nil -} - -func doIndicesCommand(cliCtx *cli.Context) error { -======= func doIndicesCommand(cliCtx *cli.Context, dirs datadir.Dirs) error { ->>>>>>> v3.0.0-alpha1 logger, _, _, err := debug.Setup(cliCtx, true /* rootLogger */) if err != nil { return err @@ -750,16 +711,7 @@ func openSnaps(ctx context.Context, cfg ethconfig.BlocksFreezing, dirs datadir.D csn.LogStat("caplin") } -<<<<<<< HEAD - csn = freezeblocks.NewCaplinSnapshots(cfg, beaconConfig, dirs, logger) - if err = csn.ReopenFolder(); err != nil { - return - } - - borSnaps.LogStat("bor:open") -======= borSnaps.LogStat("bor") ->>>>>>> v3.0.0-alpha1 agg = openAgg(ctx, dirs, chainDB, logger) err = chainDB.View(ctx, func(tx kv.Tx) error { ac := agg.BeginFilesRo() @@ -899,16 +851,9 @@ func doCompress(cliCtx *cli.Context) error { return nil } -<<<<<<< HEAD -func doRetireCommand(cliCtx *cli.Context) error { - var logger log.Logger - var err error - if logger, _, _, err = debug.Setup(cliCtx, true /* rootLogger */); err != nil { -======= func doRetireCommand(cliCtx *cli.Context, dirs datadir.Dirs) error { logger, _, _, err := debug.Setup(cliCtx, true /* rootLogger */) if err != nil { ->>>>>>> v3.0.0-alpha1 return err } defer logger.Info("Done") diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index e229d4e69dc..0bca90284b8 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -17,14 +17,9 @@ package cli import ( -<<<<<<< HEAD - "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/urfave/cli/v2" -======= "github.com/urfave/cli/v2" "github.com/erigontech/erigon/cmd/utils" ->>>>>>> v3.0.0-alpha1 ) // DefaultFlags contains all flags that are used and supported by Erigon binary. diff --git a/turbo/cli/flags.go b/turbo/cli/flags.go index 45ac0cea604..f46b2e16d3a 100644 --- a/turbo/cli/flags.go +++ b/turbo/cli/flags.go @@ -519,16 +519,6 @@ func setEmbeddedRpcDaemon(ctx *cli.Context, cfg *nodecfg.Config, logger log.Logg RpcStreamingDisable: ctx.Bool(utils.RpcStreamingDisableFlag.Name), DBReadConcurrency: ctx.Int(utils.DBReadConcurrencyFlag.Name), RpcAllowListFilePath: ctx.String(utils.RpcAccessListFlag.Name), -<<<<<<< HEAD - Gascap: ctx.Uint64(utils.RpcGasCapFlag.Name), - Feecap: ctx.Float64(utils.RPCGlobalTxFeeCapFlag.Name), - MaxTraces: ctx.Uint64(utils.TraceMaxtracesFlag.Name), - TraceCompatibility: ctx.Bool(utils.RpcTraceCompatFlag.Name), - BatchLimit: ctx.Int(utils.RpcBatchLimit.Name), - ReturnDataLimit: ctx.Int(utils.RpcReturnDataLimit.Name), - AllowUnprotectedTxs: ctx.Bool(utils.AllowUnprotectedTxs.Name), - MaxGetProofRewindBlockCount: ctx.Int(utils.RpcMaxGetProofRewindBlockCount.Name), -======= RpcFiltersConfig: rpchelper.FiltersConfig{ RpcSubscriptionFiltersMaxLogs: ctx.Int(RpcSubscriptionFiltersMaxLogsFlag.Name), RpcSubscriptionFiltersMaxHeaders: ctx.Int(RpcSubscriptionFiltersMaxHeadersFlag.Name), @@ -544,7 +534,6 @@ func setEmbeddedRpcDaemon(ctx *cli.Context, cfg *nodecfg.Config, logger log.Logg ReturnDataLimit: ctx.Int(utils.RpcReturnDataLimit.Name), AllowUnprotectedTxs: ctx.Bool(utils.AllowUnprotectedTxs.Name), MaxGetProofRewindBlockCount: ctx.Int(utils.RpcMaxGetProofRewindBlockCount.Name), ->>>>>>> v3.0.0-alpha1 OtsMaxPageSize: ctx.Uint64(utils.OtsSearchMaxCapFlag.Name), diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index f13489bb5e5..6aec14f982b 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -36,38 +36,6 @@ import ( "github.com/erigontech/erigon-lib/kv/kvcache" "github.com/erigontech/erigon-lib/log/v3" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon-lib/chain" - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon-lib/gointerfaces" - "github.com/ledgerwatch/erigon-lib/gointerfaces/execution" - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - libstate "github.com/ledgerwatch/erigon-lib/state" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/ledgerwatch/erigon/common" - "github.com/ledgerwatch/erigon/common/math" - "github.com/ledgerwatch/erigon/consensus" - "github.com/ledgerwatch/erigon/consensus/merge" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/eth/ethconfig" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/engineapi/engine_block_downloader" - "github.com/ledgerwatch/erigon/turbo/engineapi/engine_helpers" - "github.com/ledgerwatch/erigon/turbo/engineapi/engine_types" - "github.com/ledgerwatch/erigon/turbo/execution/eth1/eth1_chain_reader.go" - "github.com/ledgerwatch/erigon/turbo/jsonrpc" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/services" - "github.com/ledgerwatch/erigon/turbo/stages/headerdownload" -======= "github.com/erigontech/erigon/cl/clparams" "github.com/erigontech/erigon/cmd/rpcdaemon/cli" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" @@ -86,7 +54,6 @@ import ( "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/services" "github.com/erigontech/erigon/turbo/stages/headerdownload" ->>>>>>> v3.0.0-alpha1 ) var caplinEnabledLog = "Caplin is enabled, so the engine API cannot be used. for external CL use --externalcl" @@ -114,11 +81,7 @@ const fcuTimeout = 1000 // according to mathematics: 1000 millisecods = 1 second func NewEngineServer(logger log.Logger, config *chain.Config, executionService execution.ExecutionClient, hd *headerdownload.HeaderDownload, -<<<<<<< HEAD - blockDownloader *engine_block_downloader.EngineBlockDownloader, test bool, proposing bool, ethConfig *ethconfig.Config, nodeCloser func() error) *EngineServer { -======= - blockDownloader *engine_block_downloader.EngineBlockDownloader, caplin, test, proposing bool) *EngineServer { ->>>>>>> v3.0.0-alpha1 + blockDownloader *engine_block_downloader.EngineBlockDownloader, caplin, test, proposing bool, ethConfig *ethconfig.Config, nodeCloser func() error) *EngineServer { chainRW := eth1_chain_reader.NewChainReaderEth1(config, executionService, fcuTimeout) return &EngineServer{ logger: logger, @@ -129,11 +92,8 @@ func NewEngineServer(logger log.Logger, config *chain.Config, executionService e chainRW: chainRW, proposing: proposing, hd: hd, -<<<<<<< HEAD nodeCloser: nodeCloser, -======= caplin: caplin, ->>>>>>> v3.0.0-alpha1 } } @@ -149,11 +109,8 @@ func (e *EngineServer) Start( txPool txpool.TxpoolClient, mining txpool.MiningClient, ) { -<<<<<<< HEAD - base := jsonrpc.NewBaseApi(filters, stateCache, blockReader, agg, httpConfig.WithDatadir, httpConfig.EvmCallTimeout, engineReader, httpConfig.Dirs, nil, nil) -======= - base := jsonrpc.NewBaseApi(filters, stateCache, blockReader, httpConfig.WithDatadir, httpConfig.EvmCallTimeout, engineReader, httpConfig.Dirs) ->>>>>>> v3.0.0-alpha1 + + base := jsonrpc.NewBaseApi(filters, stateCache, blockReader, httpConfig.WithDatadir, httpConfig.EvmCallTimeout, engineReader, httpConfig.Dirs, nil, nil) ethImpl := jsonrpc.NewEthAPI(base, db, eth, txPool, mining, httpConfig.Gascap, httpConfig.Feecap, httpConfig.ReturnDataLimit, httpConfig.AllowUnprotectedTxs, httpConfig.MaxGetProofRewindBlockCount, httpConfig.WebsocketSubscribeLogsChannelSize, e.logger) @@ -532,14 +489,10 @@ func (s *EngineServer) getPayload(ctx context.Context, payloadId uint64, version data := resp.Data ts := data.ExecutionPayload.Timestamp -<<<<<<< HEAD - if s.config.IsCancun(ts) && version < clparams.DenebVersion { -======= if (!s.config.IsCancun(ts) && version >= clparams.DenebVersion) || (s.config.IsCancun(ts) && version < clparams.DenebVersion) || (!s.config.IsPrague(ts) && version >= clparams.ElectraVersion) || (s.config.IsPrague(ts) && version < clparams.ElectraVersion) { ->>>>>>> v3.0.0-alpha1 return nil, &rpc.UnsupportedForkError{Message: "Unsupported fork"} } @@ -562,9 +515,14 @@ func (s *EngineServer) getPayload(ctx context.Context, payloadId uint64, version // engineForkChoiceUpdated either states new block head or request the assembling of a new block func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *engine_types.ForkChoiceState, payloadAttributes *engine_types.PayloadAttributes, version clparams.StateVersion, ) (*engine_types.ForkChoiceUpdatedResponse, error) { -<<<<<<< HEAD var status *engine_types.PayloadStatus var err error + + if s.caplin { + s.logger.Crit("[NewPayload] caplin is enabled") + return nil, errCaplinEnabled + } + // In the Optimism case, we allow arbitrary rewinding of the safe block // hash, so we skip the path which might short-circuit that if s.config.Optimism == nil { @@ -572,15 +530,6 @@ func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *e if err != nil { return nil, err } -======= - if s.caplin { - s.logger.Crit("[NewPayload] caplin is enabled") - return nil, errCaplinEnabled - } - status, err := s.getQuickPayloadStatusIfPossible(ctx, forkchoiceState.HeadHash, 0, libcommon.Hash{}, forkchoiceState, false) - if err != nil { - return nil, err ->>>>>>> v3.0.0-alpha1 } s.lock.Lock() defer s.lock.Unlock() diff --git a/turbo/engineapi/interface.go b/turbo/engineapi/interface.go index 7abed502e21..416e1a07c2a 100644 --- a/turbo/engineapi/interface.go +++ b/turbo/engineapi/interface.go @@ -18,19 +18,11 @@ package engineapi import ( "context" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/turbo/engineapi/engine_types" -======= "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon/turbo/engineapi/engine_types" ->>>>>>> v3.0.0-alpha1 ) // EngineAPI Beacon chain communication endpoint @@ -47,14 +39,9 @@ type EngineAPI interface { GetPayloadV3(ctx context.Context, payloadID hexutility.Bytes) (*engine_types.GetPayloadResponse, error) GetPayloadV4(ctx context.Context, payloadID hexutility.Bytes) (*engine_types.GetPayloadResponse, error) ExchangeTransitionConfigurationV1(ctx context.Context, transitionConfiguration *engine_types.TransitionConfiguration) (*engine_types.TransitionConfiguration, error) -<<<<<<< HEAD - GetPayloadBodiesByHashV1(ctx context.Context, hashes []common.Hash) ([]*engine_types.ExecutionPayloadBodyV1, error) - GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBodyV1, error) - SignalSuperchainV1(ctx context.Context, signal *engine_types.SuperchainSignal) (params.ProtocolVersion, error) -======= GetPayloadBodiesByHashV1(ctx context.Context, hashes []common.Hash) ([]*engine_types.ExecutionPayloadBody, error) GetPayloadBodiesByHashV2(ctx context.Context, hashes []common.Hash) ([]*engine_types.ExecutionPayloadBody, error) GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error) GetPayloadBodiesByRangeV2(ctx context.Context, start, count hexutil.Uint64) ([]*engine_types.ExecutionPayloadBody, error) ->>>>>>> v3.0.0-alpha1 + SignalSuperchainV1(ctx context.Context, signal *engine_types.SuperchainSignal) (params.ProtocolVersion, error) } diff --git a/turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go b/turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go index 43c18a7bb2e..d920ff08578 100644 --- a/turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go +++ b/turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go @@ -300,13 +300,6 @@ func (c ChainReaderWriterEth1) InsertBlocksAndWait(ctx context.Context, blocks [ if err != nil { return err } -<<<<<<< HEAD - - // limit the number of retries - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() -======= ->>>>>>> v3.0.0-alpha1 for response.Result == execution.ExecutionStatus_Busy { const retryDelay = 100 * time.Millisecond diff --git a/turbo/execution/eth1/ethereum_execution.go b/turbo/execution/eth1/ethereum_execution.go index fb4d16d4332..8f0f45a4573 100644 --- a/turbo/execution/eth1/ethereum_execution.go +++ b/turbo/execution/eth1/ethereum_execution.go @@ -23,22 +23,9 @@ import ( "math/big" "sync/atomic" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" "golang.org/x/sync/semaphore" "google.golang.org/protobuf/types/known/emptypb" - "github.com/ledgerwatch/erigon-lib/chain" - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/gointerfaces" - "github.com/ledgerwatch/erigon-lib/gointerfaces/execution" - "github.com/ledgerwatch/erigon-lib/kv/dbutils" - "github.com/ledgerwatch/erigon-lib/wrap" -======= - "golang.org/x/sync/semaphore" - "google.golang.org/protobuf/types/known/emptypb" ->>>>>>> v3.0.0-alpha1 - "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon-lib/chain" diff --git a/turbo/execution/eth1/forkchoice.go b/turbo/execution/eth1/forkchoice.go index 8e9f65890b7..a64ed75affb 100644 --- a/turbo/execution/eth1/forkchoice.go +++ b/turbo/execution/eth1/forkchoice.go @@ -144,15 +144,6 @@ func writeForkChoiceHashes(tx kv.RwTx, blockHash, safeHash, finalizedHash common func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, originalBlockHash, safeHash, finalizedHash common.Hash, outcomeCh chan forkchoiceOutcome) { if !e.semaphore.TryAcquire(1) { -<<<<<<< HEAD - if e.config.IsOptimism() { - // op-node does not handle SYNCING as asynchronous forkChoiceUpdated. - // return an error and make op-node retry - sendForkchoiceErrorWithoutWaiting(outcomeCh, errors.New("cannot update forkchoice. execution service is busy")) - return - } -======= ->>>>>>> v3.0.0-alpha1 e.logger.Trace("ethereumExecutionModule.updateForkChoice: ExecutionStatus_Busy") sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ LatestValidHash: gointerfaces.ConvertHashToH256(common.Hash{}), @@ -230,7 +221,6 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original sendForkchoiceErrorWithoutWaiting(outcomeCh, err) return } -<<<<<<< HEAD unwindingToCanonical := false if e.config.IsOptimism() { @@ -240,16 +230,6 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original e.logger.Info("Optimism ForkChoice is choosing to unwind to a previously canonical block", "blockHash", blockHash, "blockNumber", fcuHeader.Number.Uint64(), "headHash", headHash) } } - if canonicalHash == blockHash { - // if block hash is part of the canonical chain treat it as no-op. - writeForkChoiceHashes(tx, blockHash, safeHash, finalizedHash) - valid, err := e.verifyForkchoiceHashes(ctx, tx, blockHash, finalizedHash, safeHash) - if err != nil { - sendForkchoiceErrorWithoutWaiting(outcomeCh, err) - return - } - if !valid { -======= if fcuHeader.Number.Uint64() > 0 { if canonicalHash == blockHash { // if block hash is part of the canonical chain treat it as no-op. @@ -266,62 +246,18 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original }) return } ->>>>>>> v3.0.0-alpha1 - sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ - LatestValidHash: gointerfaces.ConvertHashToH256(blockHash), - Status: execution.ExecutionStatus_Success, - }) - return - } -<<<<<<< HEAD - if !unwindingToCanonical { - sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ - LatestValidHash: gointerfaces.ConvertHashToH256(blockHash), - Status: execution.ExecutionStatus_Success, - }) - return - } - } - // If we don't have it, too bad - if fcuHeader == nil { - sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ - LatestValidHash: gointerfaces.ConvertHashToH256(libcommon.Hash{}), - Status: execution.ExecutionStatus_MissingSegment, - }) - return - } - currentParentHash := fcuHeader.ParentHash - currentParentNumber := fcuHeader.Number.Uint64() - 1 - isCanonicalHash, err := rawdb.IsCanonicalHash(tx, currentParentHash, currentParentNumber) - if err != nil { - sendForkchoiceErrorWithoutWaiting(outcomeCh, err) - return - } - // Find such point, and collect all hashes - newCanonicals := make([]*canonicalEntry, 0, 64) - if !unwindingToCanonical { - newCanonicals = append(newCanonicals, &canonicalEntry{ - hash: fcuHeader.Hash(), - number: fcuHeader.Number.Uint64(), - }) - } - for !isCanonicalHash && !unwindingToCanonical { - newCanonicals = append(newCanonicals, &canonicalEntry{ - hash: currentParentHash, - number: currentParentNumber, - }) - currentHeader, err := e.blockReader.Header(ctx, tx, currentParentHash, currentParentNumber) - if err != nil { - sendForkchoiceErrorWithoutWaiting(outcomeCh, err) - return + if !unwindingToCanonical { + sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ + LatestValidHash: gointerfaces.ConvertHashToH256(blockHash), + Status: execution.ExecutionStatus_Success, + }) + return + } } - if currentHeader == nil { -======= // If we don't have it, too bad if fcuHeader == nil { ->>>>>>> v3.0.0-alpha1 sendForkchoiceReceiptWithoutWaiting(outcomeCh, &execution.ForkChoiceReceipt{ LatestValidHash: gointerfaces.ConvertHashToH256(common.Hash{}), Status: execution.ExecutionStatus_MissingSegment, @@ -338,10 +274,12 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original } // Find such point, and collect all hashes newCanonicals := make([]*canonicalEntry, 0, 64) - newCanonicals = append(newCanonicals, &canonicalEntry{ - hash: fcuHeader.Hash(), - number: fcuHeader.Number.Uint64(), - }) + if !unwindingToCanonical { + newCanonicals = append(newCanonicals, &canonicalEntry{ + hash: fcuHeader.Hash(), + number: fcuHeader.Number.Uint64(), + }) + } for !isCanonicalHash { newCanonicals = append(newCanonicals, &canonicalEntry{ hash: currentParentHash, @@ -371,17 +309,12 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original } } -<<<<<<< HEAD - unwindToNumber := currentParentNumber - if unwindingToCanonical { - unwindToNumber = fcuHeader.Number.Uint64() - } - e.executionPipeline.UnwindTo(unwindToNumber, stagedsync.ForkChoice) - if e.historyV3 { - if err := rawdbv3.TxNums.Truncate(tx, unwindToNumber); err != nil { -======= - if err := e.executionPipeline.UnwindTo(currentParentNumber, stagedsync.ForkChoice, tx); err != nil { ->>>>>>> v3.0.0-alpha1 + unwindToNumber := currentParentNumber + if unwindingToCanonical { + unwindToNumber = fcuHeader.Number.Uint64() + } + + if err := e.executionPipeline.UnwindTo(unwindToNumber, stagedsync.ForkChoice, tx); err != nil { sendForkchoiceErrorWithoutWaiting(outcomeCh, err) return } @@ -391,46 +324,15 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original return } } -<<<<<<< HEAD - } - - // Run the unwind - if err := e.executionPipeline.RunUnwind(e.db, wrap.TxContainer{Tx: tx}); err != nil { - err = fmt.Errorf("updateForkChoice: %w", err) - sendForkchoiceErrorWithoutWaiting(outcomeCh, err) - return - } - - // Truncate tx nums - if e.historyV3 { - if err := rawdbv3.TxNums.Truncate(tx, unwindToNumber); err != nil { - sendForkchoiceErrorWithoutWaiting(outcomeCh, err) - return - } - } - // Mark all new canonicals as canonicals - for _, canonicalSegment := range newCanonicals { - chainReader := stagedsync.NewChainReaderImpl(e.config, tx, e.blockReader, e.logger) - - b, _, _ := rawdb.ReadBody(tx, canonicalSegment.hash, canonicalSegment.number) - h := rawdb.ReadHeader(tx, canonicalSegment.hash, canonicalSegment.number) - - if b == nil || h == nil { - sendForkchoiceErrorWithoutWaiting(outcomeCh, fmt.Errorf("unexpected chain cap: %d", canonicalSegment.number)) - return - } - if err := e.engine.VerifyHeader(chainReader, h, true); err != nil { -======= // Run the unwind if err := e.executionPipeline.RunUnwind(e.db, wrap.TxContainer{Tx: tx}); err != nil { err = fmt.Errorf("updateForkChoice: %w", err) ->>>>>>> v3.0.0-alpha1 sendForkchoiceErrorWithoutWaiting(outcomeCh, err) return } - if err := rawdbv3.TxNums.Truncate(tx, currentParentNumber+1); err != nil { + if err := rawdbv3.TxNums.Truncate(tx, unwindToNumber+1); err != nil { sendForkchoiceErrorWithoutWaiting(outcomeCh, err) return } diff --git a/turbo/execution/eth1/getters.go b/turbo/execution/eth1/getters.go index 41c031d8fd8..a0e5964c2f8 100644 --- a/turbo/execution/eth1/getters.go +++ b/turbo/execution/eth1/getters.go @@ -22,13 +22,6 @@ import ( "fmt" "google.golang.org/protobuf/types/known/emptypb" -<<<<<<< HEAD - - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/gointerfaces" - "github.com/ledgerwatch/erigon-lib/kv" -======= ->>>>>>> v3.0.0-alpha1 libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/gointerfaces" @@ -166,14 +159,11 @@ func (e *EthereumExecutionModule) GetBodiesByHashes(ctx context.Context, req *ex txs, err := types.MarshalTransactionsBinary(body.Transactions) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByHashes: MarshalTransactionsBinary error %w", err) -<<<<<<< HEAD -======= } reqs, err := types.MarshalRequestsBinary(body.Requests) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByHashes: MarshalRequestsBinary error %w", err) ->>>>>>> v3.0.0-alpha1 } bodies = append(bodies, &execution.BlockBody{ Transactions: txs, @@ -217,14 +207,11 @@ func (e *EthereumExecutionModule) GetBodiesByRange(ctx context.Context, req *exe txs, err := types.MarshalTransactionsBinary(body.Transactions) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByRange: MarshalTransactionsBinary error %w", err) -<<<<<<< HEAD -======= } reqs, err := types.MarshalRequestsBinary(body.Requests) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByHashes: MarshalRequestsBinary error %w", err) ->>>>>>> v3.0.0-alpha1 } bodies = append(bodies, &execution.BlockBody{ Transactions: txs, diff --git a/turbo/jsonrpc/call_traces_test.go b/turbo/jsonrpc/call_traces_test.go index f9cd2f7b93e..91529fe7051 100644 --- a/turbo/jsonrpc/call_traces_test.go +++ b/turbo/jsonrpc/call_traces_test.go @@ -27,21 +27,12 @@ import ( "github.com/stretchr/testify/require" "github.com/valyala/fastjson" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func blockNumbersFromTraces(t *testing.T, b []byte) []int { diff --git a/turbo/jsonrpc/corner_cases_support_test.go b/turbo/jsonrpc/corner_cases_support_test.go index 57516bb9c5a..e3dc5828732 100644 --- a/turbo/jsonrpc/corner_cases_support_test.go +++ b/turbo/jsonrpc/corner_cases_support_test.go @@ -22,21 +22,12 @@ import ( "github.com/stretchr/testify/require" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common" - - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/rpc" -======= "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" "github.com/erigontech/erigon/rpc" ->>>>>>> v3.0.0-alpha1 ) // TestNotFoundMustReturnNil - next methods - when record not found in db - must return nil instead of error diff --git a/turbo/jsonrpc/daemon.go b/turbo/jsonrpc/daemon.go index f1a141815ea..365a8a34c8b 100644 --- a/turbo/jsonrpc/daemon.go +++ b/turbo/jsonrpc/daemon.go @@ -17,22 +17,6 @@ package jsonrpc import ( -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - libstate "github.com/ledgerwatch/erigon-lib/state" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/ledgerwatch/erigon/consensus" - "github.com/ledgerwatch/erigon/consensus/clique" - "github.com/ledgerwatch/erigon/polygon/bor" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/services" -======= "github.com/erigontech/erigon-lib/log/v3" txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" @@ -45,24 +29,16 @@ import ( "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/services" ->>>>>>> v3.0.0-alpha1 ) // APIList describes the list of available RPC apis func APIList(db kv.RoDB, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, mining txpool.MiningClient, filters *rpchelper.Filters, stateCache kvcache.Cache, -<<<<<<< HEAD - blockReader services.FullBlockReader, agg *libstate.Aggregator, cfg *httpcfg.HttpCfg, engine consensus.EngineReader, - seqRPCService *rpc.Client, historicalRPCService *rpc.Client, - logger log.Logger, -) (list []rpc.API) { - base := NewBaseApi(filters, stateCache, blockReader, agg, cfg.WithDatadir, cfg.EvmCallTimeout, engine, cfg.Dirs, seqRPCService, historicalRPCService) -======= blockReader services.FullBlockReader, cfg *httpcfg.HttpCfg, engine consensus.EngineReader, + seqRPCService *rpc.Client, historicalRPCService *rpc.Client, logger log.Logger, ) (list []rpc.API) { - base := NewBaseApi(filters, stateCache, blockReader, cfg.WithDatadir, cfg.EvmCallTimeout, engine, cfg.Dirs) ->>>>>>> v3.0.0-alpha1 + base := NewBaseApi(filters, stateCache, blockReader, cfg.WithDatadir, cfg.EvmCallTimeout, engine, cfg.Dirs, seqRPCService, historicalRPCService) ethImpl := NewEthAPI(base, db, eth, txPool, mining, cfg.Gascap, cfg.Feecap, cfg.ReturnDataLimit, cfg.AllowUnprotectedTxs, cfg.MaxGetProofRewindBlockCount, cfg.WebsocketSubscribeLogsChannelSize, logger) erigonImpl := NewErigonAPI(base, db, eth) txpoolImpl := NewTxPoolAPI(base, db, txPool) diff --git a/turbo/jsonrpc/debug_api_test.go b/turbo/jsonrpc/debug_api_test.go index ac9891eea66..180e2396abf 100644 --- a/turbo/jsonrpc/debug_api_test.go +++ b/turbo/jsonrpc/debug_api_test.go @@ -24,22 +24,6 @@ import ( "github.com/davecgh/go-spew/spew" jsoniter "github.com/json-iterator/go" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - "github.com/stretchr/testify/require" - - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/iter" - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - "github.com/ledgerwatch/erigon-lib/kv/order" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/rpc/rpccfg" - "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" -======= "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/log/v3" @@ -56,7 +40,6 @@ import ( "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/turbo/adapter/ethapi" ->>>>>>> v3.0.0-alpha1 ) var dumper = spew.ConfigState{Indent: " "} @@ -86,11 +69,8 @@ var debugTraceTransactionNoRefundTests = []struct { func TestTraceBlockByNumber(t *testing.T) { m, _, _ := rpcdaemontest.CreateTestSentry(t) stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + + baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) ethApi := NewEthAPI(baseApi, m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) api := NewPrivateDebugAPI(baseApi, m.DB, 0) for _, tt := range debugTraceTransactionTests { diff --git a/turbo/jsonrpc/erigon_receipts_test.go b/turbo/jsonrpc/erigon_receipts_test.go index 3bebeb700b7..8549f07d84c 100644 --- a/turbo/jsonrpc/erigon_receipts_test.go +++ b/turbo/jsonrpc/erigon_receipts_test.go @@ -26,23 +26,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/kv" - - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/common" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/eth/filters" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" @@ -58,7 +41,6 @@ import ( "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func TestGetLogs(t *testing.T) { diff --git a/turbo/jsonrpc/eth_accounts.go b/turbo/jsonrpc/eth_accounts.go index 9a2671d5abd..ba056f12e42 100644 --- a/turbo/jsonrpc/eth_accounts.go +++ b/turbo/jsonrpc/eth_accounts.go @@ -43,7 +43,6 @@ func (api *APIImpl) GetBalance(ctx context.Context, address libcommon.Address, b return nil, fmt.Errorf("getBalance cannot open tx: %w", err1) } defer tx.Rollback() -<<<<<<< HEAD // Handle pre-bedrock blocks blockNum, err := api.blockNumberFromBlockNumberOrHash(tx, &blockNrOrHash) @@ -65,10 +64,7 @@ func (api *APIImpl) GetBalance(ctx context.Context, address libcommon.Address, b return &result, nil } - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, api.historyV3(tx), "") -======= reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -104,7 +100,6 @@ func (api *APIImpl) GetTransactionCount(ctx context.Context, address libcommon.A return nil, fmt.Errorf("getTransactionCount cannot open tx: %w", err1) } defer tx.Rollback() -<<<<<<< HEAD // Handle pre-bedrock blocks blockNum, err := api.blockNumberFromBlockNumberOrHash(tx, &blockNrOrHash) @@ -126,10 +121,7 @@ func (api *APIImpl) GetTransactionCount(ctx context.Context, address libcommon.A return &result, nil } - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, api.historyV3(tx), "") -======= reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -158,7 +150,7 @@ func (api *APIImpl) GetCode(ctx context.Context, address libcommon.Address, bloc if err != nil { return nil, fmt.Errorf("read chain config: %v", err) } -<<<<<<< HEAD + if chainConfig.IsOptimismPreBedrock(blockNum) { if api.historicalRPCService == nil { return nil, rpc.ErrNoHistoricalFallback @@ -170,10 +162,7 @@ func (api *APIImpl) GetCode(ctx context.Context, address libcommon.Address, bloc return result, nil } - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, api.historyV3(tx), chainConfig.ChainName) -======= reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -199,7 +188,6 @@ func (api *APIImpl) GetStorageAt(ctx context.Context, address libcommon.Address, } defer tx.Rollback() -<<<<<<< HEAD // Handle pre-bedrock blocks blockNum, err := api.blockNumberFromBlockNumberOrHash(tx, &blockNrOrHash) if err != nil { @@ -220,10 +208,7 @@ func (api *APIImpl) GetStorageAt(ctx context.Context, address libcommon.Address, return hexutility.Encode(common.LeftPadBytes(result, 32)), nil } - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, api.historyV3(tx), "") -======= reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") ->>>>>>> v3.0.0-alpha1 if err != nil { return hexutility.Encode(common.LeftPadBytes(empty, 32)), err } diff --git a/turbo/jsonrpc/eth_api.go b/turbo/jsonrpc/eth_api.go index cf08d5dea14..00060d2f6ee 100644 --- a/turbo/jsonrpc/eth_api.go +++ b/turbo/jsonrpc/eth_api.go @@ -32,22 +32,8 @@ import ( lru "github.com/hashicorp/golang-lru/v2" "github.com/holiman/uint256" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/datadir" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - "github.com/ledgerwatch/erigon-lib/kv/kvcfg" - libstate "github.com/ledgerwatch/erigon-lib/state" - types2 "github.com/ledgerwatch/erigon-lib/types" - "github.com/ledgerwatch/log/v3" -======= "github.com/erigontech/erigon-lib/log/v3" ->>>>>>> v3.0.0-alpha1 "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" @@ -154,24 +140,16 @@ type BaseAPI struct { _txnReader services.TxnReader _engine consensus.EngineReader -<<<<<<< HEAD - evmCallTimeout time.Duration - dirs datadir.Dirs - - // Optimism specific field - seqRPCService *rpc.Client - historicalRPCService *rpc.Client -} - -func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, agg *libstate.Aggregator, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs, seqRPCService *rpc.Client, historicalRPCService *rpc.Client) *BaseAPI { -======= evmCallTimeout time.Duration dirs datadir.Dirs receiptsGenerator *receipts.Generator + + // Optimism specific field + seqRPCService *rpc.Client + historicalRPCService *rpc.Client } -func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs) *BaseAPI { ->>>>>>> v3.0.0-alpha1 +func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs, seqRPCService *rpc.Client, historicalRPCService *rpc.Client) *BaseAPI { var ( blocksLRUSize = 128 // ~32Mb receiptsCacheLimit = 32 @@ -193,20 +171,6 @@ func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader serv receiptsGenerator := receipts.NewGenerator(receiptsCache, blockReader, engine) return &BaseAPI{ -<<<<<<< HEAD - filters: f, - stateCache: stateCache, - blocksLRU: blocksLRU, - receiptsCache: receiptsCache, - _blockReader: blockReader, - _txnReader: blockReader, - _agg: agg, - evmCallTimeout: evmCallTimeout, - _engine: engine, - dirs: dirs, - seqRPCService: seqRPCService, - historicalRPCService: historicalRPCService, -======= filters: f, stateCache: stateCache, blocksLRU: blocksLRU, @@ -217,7 +181,8 @@ func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader serv _engine: engine, receiptsGenerator: receiptsGenerator, dirs: dirs, ->>>>>>> v3.0.0-alpha1 + seqRPCService: seqRPCService, + historicalRPCService: historicalRPCService, } } @@ -444,37 +409,6 @@ func (api *APIImpl) relayToHistoricalBackend(ctx context.Context, result interfa // RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction type RPCTransaction struct { -<<<<<<< HEAD - BlockHash *common.Hash `json:"blockHash"` - BlockNumber *hexutil.Big `json:"blockNumber"` - From common.Address `json:"from"` - Gas hexutil.Uint64 `json:"gas"` - GasPrice *hexutil.Big `json:"gasPrice,omitempty"` - Tip *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` - FeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` - Hash common.Hash `json:"hash"` - Input hexutility.Bytes `json:"input"` - Nonce hexutil.Uint64 `json:"nonce"` - To *common.Address `json:"to,omitempty"` - TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` - Value *hexutil.Big `json:"value"` - Type hexutil.Uint64 `json:"type"` - Accesses *types2.AccessList `json:"accessList,omitempty"` - ChainID *hexutil.Big `json:"chainId,omitempty"` - MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` - BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` - V *hexutil.Big `json:"v,omitempty"` - YParity *hexutil.Big `json:"yParity,omitempty"` - R *hexutil.Big `json:"r,omitempty"` - S *hexutil.Big `json:"s,omitempty"` - - // deposit-tx only - SourceHash *common.Hash `json:"sourceHash,omitempty"` - Mint *hexutil.Big `json:"mint,omitempty"` - IsSystemTx *bool `json:"isSystemTx,omitempty"` - // deposit-tx post-Canyon only - DepositReceiptVersion *hexutil.Uint64 `json:"depositReceiptVersion,omitempty"` -======= BlockHash *common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From common.Address `json:"from"` @@ -498,17 +432,18 @@ type RPCTransaction struct { YParity *hexutil.Big `json:"yParity,omitempty"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` ->>>>>>> v3.0.0-alpha1 + + // deposit-tx only + SourceHash *common.Hash `json:"sourceHash,omitempty"` + Mint *hexutil.Big `json:"mint,omitempty"` + IsSystemTx *bool `json:"isSystemTx,omitempty"` + // deposit-tx post-Canyon only + DepositReceiptVersion *hexutil.Uint64 `json:"depositReceiptVersion,omitempty"` } // NewRPCTransaction returns a transaction that will serialize to the RPC // representation, with the given location metadata set (if available). -<<<<<<< HEAD -func NewRPCTransaction(tx types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int, - receipt *types.Receipt) *RPCTransaction { -======= -func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction { ->>>>>>> v3.0.0-alpha1 +func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int, receipt *types.Receipt) *RPCTransaction { // Determine the signer. For replay-protected transactions, use the most permissive // signer, because we assume that signers are backwards-compatible with old // transactions. For non-protected transactions, the homestead signer is used @@ -526,17 +461,6 @@ func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber if t, ok := txn.(*types.BlobTxWrapper); ok { txn = &t.Tx } -<<<<<<< HEAD - switch t := tx.(type) { - case *types.LegacyTx: - // avoid overflow by not calling DeriveChainId. chain id not included when v = 0 - if !t.V.IsZero() { - chainId = types.DeriveChainId(&t.V) - // if a legacy transaction has an EIP-155 chain id, include it explicitly, otherwise chain id is not included - if !chainId.IsZero() { - result.ChainID = (*hexutil.Big)(chainId.ToBig()) - } -======= v, r, s := txn.RawSignatureValues() result.V = (*hexutil.Big)(v.ToBig()) @@ -548,72 +472,18 @@ func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber // if a legacy transaction has an EIP-155 chain id, include it explicitly, otherwise chain id is not included if !chainId.IsZero() { result.ChainID = (*hexutil.Big)(chainId.ToBig()) ->>>>>>> v3.0.0-alpha1 } result.GasPrice = (*hexutil.Big)(txn.GetPrice().ToBig()) } else { chainId.Set(txn.GetChainID()) result.ChainID = (*hexutil.Big)(chainId.ToBig()) -<<<<<<< HEAD - result.GasPrice = (*hexutil.Big)(t.GasPrice.ToBig()) - result.YParity = (*hexutil.Big)(t.V.ToBig()) - result.V = (*hexutil.Big)(t.V.ToBig()) - result.R = (*hexutil.Big)(t.R.ToBig()) - result.S = (*hexutil.Big)(t.S.ToBig()) - result.Accesses = &t.AccessList - case *types.DynamicFeeTransaction: - chainId.Set(t.ChainID) - result.ChainID = (*hexutil.Big)(chainId.ToBig()) - result.Tip = (*hexutil.Big)(t.Tip.ToBig()) - result.FeeCap = (*hexutil.Big)(t.FeeCap.ToBig()) - result.YParity = (*hexutil.Big)(t.V.ToBig()) - result.V = (*hexutil.Big)(t.V.ToBig()) - result.R = (*hexutil.Big)(t.R.ToBig()) - result.S = (*hexutil.Big)(t.S.ToBig()) - result.Accesses = &t.AccessList - result.GasPrice = computeGasPrice(tx, blockHash, baseFee) - case *types.DepositTx: - if t.Mint != nil { - result.Mint = (*hexutil.Big)(t.Mint.ToBig()) - } - result.ChainID = nil - result.SourceHash = &t.SourceHash - if t.IsSystemTransaction { - result.IsSystemTx = &t.IsSystemTransaction - } - if receipt != nil && receipt.DepositNonce != nil { - result.Nonce = hexutil.Uint64(*receipt.DepositNonce) - if receipt.DepositReceiptVersion != nil { - result.DepositReceiptVersion = new(hexutil.Uint64) - *result.DepositReceiptVersion = hexutil.Uint64(*receipt.DepositReceiptVersion) - } - } - result.GasPrice = (*hexutil.Big)(common.Big0) - // must contain v, r, s values for backwards compatibility. - result.V = (*hexutil.Big)(common.Big0) - result.R = (*hexutil.Big)(common.Big0) - result.S = (*hexutil.Big)(common.Big0) - case *types.BlobTx: - chainId.Set(t.ChainID) - result.ChainID = (*hexutil.Big)(chainId.ToBig()) - result.Tip = (*hexutil.Big)(t.Tip.ToBig()) - result.FeeCap = (*hexutil.Big)(t.FeeCap.ToBig()) - result.YParity = (*hexutil.Big)(t.V.ToBig()) - result.V = (*hexutil.Big)(t.V.ToBig()) - result.R = (*hexutil.Big)(t.R.ToBig()) - result.S = (*hexutil.Big)(t.S.ToBig()) - result.Accesses = &t.AccessList - result.GasPrice = computeGasPrice(tx, blockHash, baseFee) - result.MaxFeePerBlobGas = (*hexutil.Big)(t.MaxFeePerBlobGas.ToBig()) - result.BlobVersionedHashes = t.BlobVersionedHashes -======= result.YParity = (*hexutil.Big)(v.ToBig()) acl := txn.GetAccessList() result.Accesses = &acl if txn.Type() == types.AccessListTxType { result.GasPrice = (*hexutil.Big)(txn.GetPrice().ToBig()) - } else { + } else txn.Type() != types.DepositTxType { result.GasPrice = computeGasPrice(txn, blockHash, baseFee) result.Tip = (*hexutil.Big)(txn.GetTip().ToBig()) result.FeeCap = (*hexutil.Big)(txn.GetFeeCap().ToBig()) @@ -632,7 +502,25 @@ func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber } result.Authorizations = &ats } ->>>>>>> v3.0.0-alpha1 + + if txn.Type() == types.DepositTxType { + if t.Mint != nil { + result.Mint = (*hexutil.Big)(t.Mint.ToBig()) + } + result.ChainID = nil + result.SourceHash = &t.SourceHash + if t.IsSystemTransaction { + result.IsSystemTx = &t.IsSystemTransaction + } + if receipt != nil && receipt.DepositNonce != nil { + result.Nonce = hexutil.Uint64(*receipt.DepositNonce) + if receipt.DepositReceiptVersion != nil { + result.DepositReceiptVersion = new(hexutil.Uint64) + *result.DepositReceiptVersion = hexutil.Uint64(*receipt.DepositReceiptVersion) + } + } + result.GasPrice = (*hexutil.Big)(common.Big0) + } } signer := types.LatestSignerForChainID(chainId.ToBig()) @@ -693,11 +581,8 @@ func newRPCPendingTransaction(txn types.Transaction, current *types.Header, conf if current != nil { baseFee = misc.CalcBaseFee(config, current, current.Time+1) } -<<<<<<< HEAD - return NewRPCTransaction(tx, common.Hash{}, 0, 0, baseFee, nil) -======= - return NewRPCTransaction(txn, common.Hash{}, 0, 0, baseFee) ->>>>>>> v3.0.0-alpha1 + + return NewRPCTransaction(txn, common.Hash{}, 0, 0, baseFee, nil) } // newRPCRawTransactionFromBlockIndex returns the bytes of a transaction given a block and a transaction index. diff --git a/turbo/jsonrpc/eth_api_test.go b/turbo/jsonrpc/eth_api_test.go index 36a4ae64609..41917c6c0cc 100644 --- a/turbo/jsonrpc/eth_api_test.go +++ b/turbo/jsonrpc/eth_api_test.go @@ -23,12 +23,7 @@ import ( "math/big" "testing" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" -======= "github.com/erigontech/erigon-lib/common/hexutil" ->>>>>>> v3.0.0-alpha1 "github.com/holiman/uint256" "github.com/stretchr/testify/assert" @@ -36,19 +31,6 @@ import ( "github.com/ledgerwatch/erigon-lib/common" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/rpc/rpccfg" - "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" - "github.com/ledgerwatch/erigon/turbo/stages/mock" - - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" -======= "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv/kvcache" @@ -61,16 +43,11 @@ import ( "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" ->>>>>>> v3.0.0-alpha1 ) func newBaseApiForTest(m *mock.MockSentry) *BaseAPI { stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - return NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - return NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + return NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) } func TestGetBalanceChangesInBlock(t *testing.T) { @@ -99,11 +76,7 @@ func TestGetTransactionReceipt(t *testing.T) { m, _, _ := rpcdaemontest.CreateTestSentry(t) db := m.DB stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= - api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) // Call GetTransactionReceipt for transaction which is not in the database if _, err := api.GetTransactionReceipt(context.Background(), common.Hash{}); err != nil { t.Errorf("calling GetTransactionReceipt with empty hash: %v", err) diff --git a/turbo/jsonrpc/eth_block.go b/turbo/jsonrpc/eth_block.go index 34349e58582..baeef6baf24 100644 --- a/turbo/jsonrpc/eth_block.go +++ b/turbo/jsonrpc/eth_block.go @@ -22,12 +22,7 @@ import ( "math/big" "time" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/opstack" - "github.com/ledgerwatch/log/v3" -======= "github.com/erigontech/erigon-lib/log/v3" ->>>>>>> v3.0.0-alpha1 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" diff --git a/turbo/jsonrpc/eth_block_test.go b/turbo/jsonrpc/eth_block_test.go index 8b3277d583e..fa75b11b2e9 100644 --- a/turbo/jsonrpc/eth_block_test.go +++ b/turbo/jsonrpc/eth_block_test.go @@ -25,20 +25,6 @@ import ( "github.com/stretchr/testify/assert" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/rlp" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/rpc/rpccfg" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/stages/mock" - "github.com/ledgerwatch/log/v3" -======= "github.com/erigontech/erigon-lib/common" txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/kv/kvcache" @@ -53,7 +39,6 @@ import ( "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) // Gets the latest block number with the latest tag @@ -119,11 +104,7 @@ func TestGetBlockByNumberWithPendingTag(t *testing.T) { RplBlock: rlpBlock, }) -<<<<<<< HEAD - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) b, err := api.GetBlockByNumber(context.Background(), rpc.PendingBlockNumber, false) if err != nil { t.Errorf("error getting block number with pending tag: %s", err) diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index 557144cd756..711d1a3121d 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -23,20 +23,6 @@ import ( "math/big" "github.com/holiman/uint256" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - "google.golang.org/grpc" - - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon-lib/gointerfaces" - txpool_proto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/membatchwithdb" - "github.com/ledgerwatch/erigon-lib/opstack" - types2 "github.com/ledgerwatch/erigon-lib/types" -======= "google.golang.org/grpc" libcommon "github.com/erigontech/erigon-lib/common" @@ -47,7 +33,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" types2 "github.com/erigontech/erigon-lib/types" ->>>>>>> v3.0.0-alpha1 "github.com/erigontech/erigon/core" "github.com/erigontech/erigon/core/state" @@ -375,81 +360,9 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs // GetProof is partially implemented; no Storage proofs, and proofs must be for // blocks within maxGetProofRewindBlockCount blocks of the head. func (api *APIImpl) GetProof(ctx context.Context, address libcommon.Address, storageKeys []libcommon.Hash, blockNrOrHash rpc.BlockNumberOrHash) (*accounts.AccProofResult, error) { -<<<<<<< HEAD - - tx, err := api.db.BeginRo(ctx) - if err != nil { - return nil, err - } - defer tx.Rollback() - if api.historyV3(tx) { - return nil, fmt.Errorf("not supported by Erigon3") - } - - // Handle pre-bedrock blocks - blockNum, err := api.blockNumberFromBlockNumberOrHash(tx, &blockNrOrHash) - if err != nil { - return nil, err - } - chainConfig, err := api.chainConfig(ctx, tx) - if err != nil { - return nil, fmt.Errorf("read chain config: %v", err) - } - if chainConfig.IsOptimismPreBedrock(blockNum) { - if api.historicalRPCService == nil { - return nil, rpc.ErrNoHistoricalFallback - } - var result accounts.AccProofResult - if err := api.relayToHistoricalBackend(ctx, &result, "eth_getProof", address, storageKeys, hexutil.EncodeUint64(blockNum)); err != nil { - return nil, fmt.Errorf("historical backend error: %w", err) - } - return &result, nil - } - - blockNr, _, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) - if err != nil { - return nil, err - } - - header, err := api._blockReader.HeaderByNumber(ctx, tx, blockNr) - if err != nil { - return nil, err - } - - latestBlock, err := rpchelper.GetLatestBlockNumber(tx) - if err != nil { - return nil, err - } - - if latestBlock < blockNr { - // shouldn't happen, but check anyway - return nil, fmt.Errorf("block number is in the future latest=%d requested=%d", latestBlock, blockNr) - } - - rl := trie.NewRetainList(0) - var loader *trie.FlatDBTrieLoader - if blockNr < latestBlock { - if latestBlock-blockNr > uint64(api.MaxGetProofRewindBlockCount) { - return nil, fmt.Errorf("requested block is too old, block must be within %d blocks of the head block number (currently %d)", uint64(api.MaxGetProofRewindBlockCount), latestBlock) - } - batch := membatchwithdb.NewMemoryBatch(tx, api.dirs.Tmp, api.logger) - defer batch.Rollback() - - unwindState := &stagedsync.UnwindState{UnwindPoint: blockNr} - stageState := &stagedsync.StageState{BlockNumber: latestBlock} - - hashStageCfg := stagedsync.StageHashStateCfg(nil, api.dirs, api.historyV3(batch)) - if err := stagedsync.UnwindHashStateStage(unwindState, stageState, batch, hashStageCfg, ctx, api.logger); err != nil { - return nil, err - } - - interHashStageCfg := stagedsync.StageTrieCfg(nil, false, false, false, api.dirs.Tmp, api._blockReader, nil, api.historyV3(batch), api._agg) - loader, err = stagedsync.UnwindIntermediateHashesForTrieLoader("eth_getProof", rl, unwindState, stageState, batch, interHashStageCfg, nil, nil, ctx.Done(), api.logger) -======= return nil, fmt.Errorf("not supported by Erigon3") /* tx, err := api.db.BeginRo(ctx) ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } diff --git a/turbo/jsonrpc/eth_callMany.go b/turbo/jsonrpc/eth_callMany.go index 6a27366bb6d..f0ae9defc2c 100644 --- a/turbo/jsonrpc/eth_callMany.go +++ b/turbo/jsonrpc/eth_callMany.go @@ -173,12 +173,8 @@ func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateCont return hash } -<<<<<<< HEAD - blockCtx = core.NewEVMBlockContext(header, getHash, api.engine(), nil /* author */) - blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, st) -======= blockCtx = core.NewEVMBlockContext(header, getHash, api.engine(), nil /* author */, chainConfig) ->>>>>>> v3.0.0-alpha1 + blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, st) // Get a new instance of the EVM evm = vm.NewEVM(blockCtx, txCtx, st, chainConfig, vm.Config{Debug: false}) diff --git a/turbo/jsonrpc/eth_callMany_test.go b/turbo/jsonrpc/eth_callMany_test.go index 26aefe21080..17341e050bc 100644 --- a/turbo/jsonrpc/eth_callMany_test.go +++ b/turbo/jsonrpc/eth_callMany_test.go @@ -29,19 +29,6 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" "github.com/erigontech/erigon-lib/kv/kvcache" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/accounts/abi/bind" - "github.com/ledgerwatch/erigon/accounts/abi/bind/backends" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/rpc/rpccfg" - "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" - "github.com/ledgerwatch/erigon/turbo/jsonrpc/contracts" -======= "github.com/erigontech/erigon-lib/common/datadir" "github.com/erigontech/erigon-lib/log/v3" @@ -54,7 +41,6 @@ import ( "github.com/erigontech/erigon/rpc/rpccfg" "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/jsonrpc/contracts" ->>>>>>> v3.0.0-alpha1 ) // block 1 contains 3 Transactions @@ -115,12 +101,7 @@ func TestCallMany(t *testing.T) { db := contractBackend.DB() engine := contractBackend.Engine() -<<<<<<< HEAD - api := NewEthAPI(NewBaseApi(nil, stateCache, contractBackend.BlockReader(), contractBackend.Agg(), false, rpccfg.DefaultEvmCallTimeout, engine, - datadir.New(t.TempDir()), nil, nil), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= - api := NewEthAPI(NewBaseApi(nil, stateCache, contractBackend.BlockReader(), false, rpccfg.DefaultEvmCallTimeout, engine, datadir.New(t.TempDir())), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(nil, stateCache, contractBackend.BlockReader(), false, rpccfg.DefaultEvmCallTimeout, engine, datadir.New(t.TempDir()), nil, nil), db, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) callArgAddr1 := ethapi.CallArgs{From: &address, To: &tokenAddr, Nonce: &nonce, MaxPriorityFeePerGas: (*hexutil.Big)(big.NewInt(1e9)), diff --git a/turbo/jsonrpc/eth_call_test.go b/turbo/jsonrpc/eth_call_test.go index 01defdfd395..1611741e880 100644 --- a/turbo/jsonrpc/eth_call_test.go +++ b/turbo/jsonrpc/eth_call_test.go @@ -35,26 +35,6 @@ import ( "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/kv/kvcache" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/common/math" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/state" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/types/accounts" - "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/rpc/rpccfg" - "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" - ethapi2 "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/stages/mock" - "github.com/ledgerwatch/erigon/turbo/trie" -======= "github.com/erigontech/erigon-lib/log/v3" "github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest" @@ -71,7 +51,6 @@ import ( "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" "github.com/erigontech/erigon/turbo/trie" ->>>>>>> v3.0.0-alpha1 ) func TestEstimateGas(t *testing.T) { @@ -79,13 +58,8 @@ func TestEstimateGas(t *testing.T) { stateCache := kvcache.New(kvcache.DefaultCoherentConfig) ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, mock.Mock(t)) mining := txpool.NewMiningClient(conn) -<<<<<<< HEAD - ff := rpchelper.New(ctx, nil, nil, mining, func() {}, m.Log) - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, nil, mining, func() {}, m.Log) - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) var from = libcommon.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") var to = libcommon.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e") if _, err := api.EstimateGas(context.Background(), ðapi.CallArgs{ @@ -158,11 +132,8 @@ func TestEstimateGasHistoricalRPC(t *testing.T) { func TestEthCallNonCanonical(t *testing.T) { m, _, _ := rpcdaemontest.CreateTestSentry(t) stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= - api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + + api := NewEthAPI(NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) var from = libcommon.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") var to = libcommon.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e") if _, err := api.Call(context.Background(), ethapi.CallArgs{ diff --git a/turbo/jsonrpc/eth_filters.go b/turbo/jsonrpc/eth_filters.go index b1ac4c5a5e5..27b723934fe 100644 --- a/turbo/jsonrpc/eth_filters.go +++ b/turbo/jsonrpc/eth_filters.go @@ -20,12 +20,7 @@ import ( "context" "strings" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/log/v3" -======= "github.com/erigontech/erigon-lib/log/v3" ->>>>>>> v3.0.0-alpha1 "github.com/erigontech/erigon/common/debug" "github.com/erigontech/erigon/core/types" diff --git a/turbo/jsonrpc/eth_filters_test.go b/turbo/jsonrpc/eth_filters_test.go index edee2e672c2..2ab9720c4a3 100644 --- a/turbo/jsonrpc/eth_filters_test.go +++ b/turbo/jsonrpc/eth_filters_test.go @@ -29,18 +29,6 @@ import ( "github.com/stretchr/testify/assert" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/eth/filters" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" "github.com/erigontech/erigon-lib/kv/kvcache" @@ -50,7 +38,6 @@ import ( "github.com/erigontech/erigon/eth/filters" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func TestNewFilters(t *testing.T) { @@ -59,13 +46,8 @@ func TestNewFilters(t *testing.T) { stateCache := kvcache.New(kvcache.DefaultCoherentConfig) ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, mock.Mock(t)) mining := txpool.NewMiningClient(conn) -<<<<<<< HEAD - ff := rpchelper.New(ctx, nil, nil, mining, func() {}, m.Log) - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, nil, mining, func() {}, m.Log) - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ptf, err := api.NewPendingTransactionFilter(ctx) assert.Nil(err) diff --git a/turbo/jsonrpc/eth_mining_test.go b/turbo/jsonrpc/eth_mining_test.go index fe319552cc4..b5c4cb10c18 100644 --- a/turbo/jsonrpc/eth_mining_test.go +++ b/turbo/jsonrpc/eth_mining_test.go @@ -24,19 +24,6 @@ import ( "github.com/erigontech/erigon/consensus/ethash" "github.com/erigontech/erigon/rpc/rpccfg" -<<<<<<< HEAD - "github.com/ledgerwatch/log/v3" - "github.com/stretchr/testify/require" - - "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" - - "github.com/ledgerwatch/erigon-lib/kv/kvcache" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/rlp" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= "github.com/stretchr/testify/require" "github.com/erigontech/erigon-lib/log/v3" @@ -48,7 +35,6 @@ import ( "github.com/erigontech/erigon/rlp" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func TestPendingBlock(t *testing.T) { @@ -58,12 +44,7 @@ func TestPendingBlock(t *testing.T) { ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, nil, mining, func() {}, m.Log) stateCache := kvcache.New(kvcache.DefaultCoherentConfig) engine := ethash.NewFaker() -<<<<<<< HEAD - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, nil, false, rpccfg.DefaultEvmCallTimeout, engine, - m.Dirs, nil, nil), nil, nil, nil, mining, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) -======= - api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, engine, m.Dirs), nil, nil, nil, mining, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) ->>>>>>> v3.0.0-alpha1 + api := NewEthAPI(NewBaseApi(ff, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, engine, m.Dirs, nil, nil), nil, nil, nil, mining, 5000000, 1e18, 100_000, false, 100_000, 128, log.New()) expect := uint64(12345) b, err := rlp.EncodeToBytes(types.NewBlockWithHeader(&types.Header{Number: new(big.Int).SetUint64(expect)})) require.NoError(t, err) diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index c212ef11cf1..a8c1fc52a46 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -43,27 +43,10 @@ import ( // getReceipts - checking in-mem cache, or else fallback to db, or else fallback to re-exec of block to re-gen receipts func (api *BaseAPI) getReceipts(ctx context.Context, tx kv.Tx, block *types.Block, senders []common.Address) (types.Receipts, error) { -<<<<<<< HEAD - if receipts, ok := api.receiptsCache.Get(block.Hash()); ok { - return receipts, nil - } - -======= ->>>>>>> v3.0.0-alpha1 chainConfig, err := api.chainConfig(ctx, tx) if err != nil { return nil, err } -<<<<<<< HEAD - - if receipts := rawdb.ReadReceipts(chainConfig, tx, block, senders); receipts != nil { - api.receiptsCache.Add(block.Hash(), receipts) - return receipts, nil - } - - engine := api.engine() -======= ->>>>>>> v3.0.0-alpha1 return api.receiptsGenerator.GetReceipts(ctx, chainConfig, tx, block, senders) } diff --git a/turbo/jsonrpc/eth_system_test.go b/turbo/jsonrpc/eth_system_test.go index 5558ed2d21e..d95df57615d 100644 --- a/turbo/jsonrpc/eth_system_test.go +++ b/turbo/jsonrpc/eth_system_test.go @@ -23,17 +23,6 @@ import ( "testing" "github.com/holiman/uint256" -<<<<<<< HEAD - - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/log/v3" - - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/crypto" - "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= libcommon "github.com/erigontech/erigon-lib/common" @@ -44,7 +33,6 @@ import ( "github.com/erigontech/erigon/crypto" "github.com/erigontech/erigon/params" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func TestGasPrice(t *testing.T) { diff --git a/turbo/jsonrpc/gen_traces_test.go b/turbo/jsonrpc/gen_traces_test.go index 00bf45c690e..ce116d51c38 100644 --- a/turbo/jsonrpc/gen_traces_test.go +++ b/turbo/jsonrpc/gen_traces_test.go @@ -45,11 +45,7 @@ Testing tracing RPC API by generating patters of contracts invoking one another func TestGeneratedDebugApi(t *testing.T) { m := rpcdaemontest.CreateTestSentryForTraces(t) stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) api := NewPrivateDebugAPI(baseApi, m.DB, 0) var buf bytes.Buffer stream := jsoniter.NewStream(jsoniter.ConfigDefault, &buf, 4096) @@ -136,11 +132,7 @@ func TestGeneratedDebugApi(t *testing.T) { func TestGeneratedTraceApi(t *testing.T) { m := rpcdaemontest.CreateTestSentryForTraces(t) stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + baseApi := NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) api := NewTraceAPI(baseApi, m.DB, &httpcfg.HttpCfg{}) traces, err := api.Block(context.Background(), rpc.BlockNumber(1), new(bool), nil) if err != nil { diff --git a/turbo/jsonrpc/otterscan_api.go b/turbo/jsonrpc/otterscan_api.go index a8699b7cd6a..7bef5aa0f8a 100644 --- a/turbo/jsonrpc/otterscan_api.go +++ b/turbo/jsonrpc/otterscan_api.go @@ -24,29 +24,6 @@ import ( "github.com/holiman/uint256" "golang.org/x/sync/errgroup" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - "github.com/ledgerwatch/erigon-lib/common" - hexutil2 "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/iter" - "github.com/ledgerwatch/erigon-lib/kv/order" - "github.com/ledgerwatch/erigon-lib/kv/rawdbv3" - "github.com/ledgerwatch/erigon/core/vm/evmtypes" - "github.com/ledgerwatch/erigon/eth/tracers" - - "github.com/ledgerwatch/erigon/consensus" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/eth/ethutils" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/adapter/ethapi" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/transactions" -======= "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" hexutil2 "github.com/erigontech/erigon-lib/common/hexutil" @@ -64,7 +41,6 @@ import ( "github.com/erigontech/erigon/turbo/adapter/ethapi" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/transactions" ->>>>>>> v3.0.0-alpha1 ) // API_LEVEL Must be incremented every time new additions are made @@ -152,7 +128,6 @@ func (api *OtterscanAPIImpl) getTransactionByHash(ctx context.Context, tx kv.Tx, return txn, block, blockHash, blockNum, txnIndex, nil } -<<<<<<< HEAD func (api *OtterscanAPIImpl) relayToHistoricalBackend(ctx context.Context, result interface{}, method string, args ...interface{}) error { return api.historicalRPCService.CallContext(ctx, result, method, args...) } @@ -314,10 +289,7 @@ func (api *OtterscanAPIImpl) translateRelayTraceResult(gethTrace *GethTrace, tra return nil } -func (api *OtterscanAPIImpl) runTracer(ctx context.Context, tx kv.Tx, hash common.Hash, tracer vm.EVMLogger) (*core.ExecutionResult, error) { -======= func (api *OtterscanAPIImpl) runTracer(ctx context.Context, tx kv.Tx, hash common.Hash, tracer vm.EVMLogger) (*evmtypes.ExecutionResult, error) { ->>>>>>> v3.0.0-alpha1 txn, block, _, _, txIndex, err := api.getTransactionByHash(ctx, tx, hash) if err != nil { return nil, err @@ -424,177 +396,7 @@ func (api *OtterscanAPIImpl) SearchTransactionsBefore(ctx context.Context, addr } defer dbtx.Rollback() -<<<<<<< HEAD - if api.historyV3(dbtx) { - return api.searchTransactionsBeforeV3(dbtx.(kv.TemporalTx), ctx, addr, blockNum, pageSize) - } - - callFromCursor, err := dbtx.Cursor(kv.CallFromIndex) - if err != nil { - return nil, err - } - defer callFromCursor.Close() - - callToCursor, err := dbtx.Cursor(kv.CallToIndex) - if err != nil { - return nil, err - } - defer callToCursor.Close() - - chainConfig, err := api.chainConfig(ctx, dbtx) - if err != nil { - return nil, err - } - - isFirstPage := false - if blockNum == 0 { - isFirstPage = true - } else { - // Internal search code considers blockNum [including], so adjust the value - blockNum-- - } - - // Initialize search cursors at the first shard >= desired block number - callFromProvider := NewCallCursorBackwardBlockProvider(callFromCursor, addr, blockNum) - callToProvider := NewCallCursorBackwardBlockProvider(callToCursor, addr, blockNum) - callFromToProvider := newCallFromToBlockProvider(false, callFromProvider, callToProvider) - - txs := make([]*RPCTransaction, 0, pageSize) - receipts := make([]map[string]interface{}, 0, pageSize) - - resultCount := uint16(0) - hasMore := true - for { - if resultCount >= pageSize || !hasMore { - break - } - - var results []*TransactionsWithReceipts - results, hasMore, err = api.traceBlocks(ctx, addr, chainConfig, pageSize, resultCount, callFromToProvider) - if err != nil { - return nil, err - } - - for _, r := range results { - if r == nil { - return nil, errors.New("internal error during search tracing") - } - - for i := len(r.Txs) - 1; i >= 0; i-- { - txs = append(txs, r.Txs[i]) - } - for i := len(r.Receipts) - 1; i >= 0; i-- { - receipts = append(receipts, r.Receipts[i]) - } - - resultCount += uint16(len(r.Txs)) - if resultCount >= pageSize { - break - } - } - } - - return &TransactionsWithReceipts{txs, receipts, isFirstPage, !hasMore}, nil -} - -func (api *OtterscanAPIImpl) searchTransactionsBeforeV3(tx kv.TemporalTx, ctx context.Context, addr common.Address, fromBlockNum uint64, pageSize uint16) (*TransactionsWithReceipts, error) { - chainConfig, err := api.chainConfig(ctx, tx) - if err != nil { - return nil, err - } - - isFirstPage := false - if fromBlockNum == 0 { - isFirstPage = true - } else { - // Internal search code considers blockNum [including], so adjust the value - fromBlockNum-- - } - fromTxNum, err := rawdbv3.TxNums.Max(tx, fromBlockNum) - if err != nil { - return nil, err - } - itTo, err := tx.IndexRange(kv.TracesToIdx, addr[:], int(fromTxNum), -1, order.Desc, kv.Unlim) - if err != nil { - return nil, err - } - itFrom, err := tx.IndexRange(kv.TracesFromIdx, addr[:], int(fromTxNum), -1, order.Desc, kv.Unlim) - if err != nil { - return nil, err - } - txNums := iter.Union[uint64](itFrom, itTo, order.Desc, kv.Unlim) - txNumsIter := MapDescendTxNum2BlockNum(tx, txNums) - - exec := txnExecutor(tx, chainConfig, api.engine(), api._blockReader, nil) - var blockHash common.Hash - var header *types.Header - txs := make([]*RPCTransaction, 0, pageSize) - receipts := make([]map[string]interface{}, 0, pageSize) - resultCount := uint16(0) - - for txNumsIter.HasNext() { - txNum, blockNum, txIndex, isFinalTxn, blockNumChanged, err := txNumsIter.Next() - if err != nil { - return nil, err - } - if isFinalTxn { - continue - } - - if blockNumChanged { // things which not changed within 1 block - if header, err = api._blockReader.HeaderByNumber(ctx, tx, blockNum); err != nil { - return nil, err - } - if header == nil { - log.Warn("[rpc] header is nil", "blockNum", blockNum) - continue - } - blockHash = header.Hash() - exec.changeBlock(header) - } - - //fmt.Printf("txNum=%d, blockNum=%d, txIndex=%d, maxTxNumInBlock=%d,mixTxNumInBlock=%d\n", txNum, blockNum, txIndex, maxTxNumInBlock, minTxNumInBlock) - txn, err := api._txnReader.TxnByIdxInBlock(ctx, tx, blockNum, txIndex) - if err != nil { - return nil, err - } - if txn == nil { - continue - } - rawLogs, res, err := exec.execTx(txNum, txIndex, txn) - if err != nil { - return nil, err - } - var rpcTx *RPCTransaction - var receipt *types.Receipt - if chainConfig.IsOptimism() { - receipts := rawdb.ReadRawReceipts(tx, blockNum) - if len(receipts) <= txIndex { - return nil, fmt.Errorf("block has less receipts than expected: %d <= %d, block: %d", len(receipts), txIndex, blockNum) - } - receipt = receipts[txIndex] - } - rpcTx = NewRPCTransaction(txn, blockHash, blockNum, uint64(txIndex), header.BaseFee, receipt) - txs = append(txs, rpcTx) - receipt = &types.Receipt{ - Type: txn.Type(), CumulativeGasUsed: res.UsedGas, - TransactionIndex: uint(txIndex), - BlockNumber: header.Number, BlockHash: blockHash, Logs: rawLogs, - } - mReceipt := ethutils.MarshalReceipt(receipt, txn, chainConfig, header, txn.Hash(), true) - mReceipt["timestamp"] = header.Time - receipts = append(receipts, mReceipt) - - resultCount++ - if resultCount >= pageSize { - break - } - } - hasMore := txNumsIter.HasNext() - return &TransactionsWithReceipts{txs, receipts, isFirstPage, !hasMore}, nil -======= return api.searchTransactionsBeforeV3(dbtx.(kv.TemporalTx), ctx, addr, blockNum, pageSize) ->>>>>>> v3.0.0-alpha1 } // Search transactions that touch a certain address. diff --git a/turbo/jsonrpc/otterscan_contract_creator.go b/turbo/jsonrpc/otterscan_contract_creator.go index c1a41a627bb..79f0f13e404 100644 --- a/turbo/jsonrpc/otterscan_contract_creator.go +++ b/turbo/jsonrpc/otterscan_contract_creator.go @@ -164,13 +164,6 @@ func (api *OtterscanAPIImpl) GetContractCreator(ctx context.Context, addr common return nil, fmt.Errorf("binary search between %d-%d doesn't find anything", nextTxnID, prevTxnID) } -<<<<<<< HEAD - // TODO: check if precompiled contract - if !tracer.Found() { - return nil, nil - } - -======= ok, bn, err := rawdbv3.TxNums.FindBlockNum(tx, creationTxnID) if err != nil { return nil, err @@ -189,10 +182,15 @@ func (api *OtterscanAPIImpl) GetContractCreator(ctx context.Context, addr common // Trace block, find txn and contract creator tracer := NewCreateTracer(ctx, addr) + + // TODO: check if precompiled contract + if !tracer.Found() { + return nil, nil + } + if err := api.genericTracer(tx, ctx, bn, creationTxnID, txIndex, chainConfig, tracer); err != nil { return nil, err } ->>>>>>> v3.0.0-alpha1 return &ContractCreatorData{ Tx: tracer.Tx.Hash(), Creator: tracer.Creator, diff --git a/turbo/jsonrpc/otterscan_generic_tracer.go b/turbo/jsonrpc/otterscan_generic_tracer.go index a12a73cfcc4..13a5dc27077 100644 --- a/turbo/jsonrpc/otterscan_generic_tracer.go +++ b/turbo/jsonrpc/otterscan_generic_tracer.go @@ -58,41 +58,40 @@ func (api *OtterscanAPIImpl) genericTracer(dbtx kv.Tx, ctx context.Context, bloc log.Warn("[rpc genericTracer] txn is nil", "blockNum", blockNum, "txIndex", txIndex) return nil } -<<<<<<< HEAD - header := block.Header() - rules := chainConfig.Rules(block.NumberU64(), header.Time) - signer := types.MakeSigner(chainConfig, blockNum, header.Time) - for idx, tx := range block.Transactions() { - select { - case <-ctx.Done(): - return ctx.Err() - default: - } + // FIXME: V3_MERGE + // header := block.Header() + // rules := chainConfig.Rules(block.NumberU64(), header.Time) + // signer := types.MakeSigner(chainConfig, blockNum, header.Time) + // for idx, tx := range block.Transactions() { + // select { + // case <-ctx.Done(): + // return ctx.Err() + // default: + // } - ibs.SetTxContext(tx.Hash(), block.Hash(), idx) + // ibs.SetTxContext(tx.Hash(), block.Hash(), idx) - msg, _ := tx.AsMessage(*signer, header.BaseFee, rules) + // msg, _ := tx.AsMessage(*signer, header.BaseFee, rules) - BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil) - BlockContext.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) - TxContext := core.NewEVMTxContext(msg) + // BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil) + // BlockContext.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) + // TxContext := core.NewEVMTxContext(msg) - vmenv := vm.NewEVM(BlockContext, TxContext, ibs, chainConfig, vm.Config{Debug: true, Tracer: tracer}) - if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.GetGas()).AddBlobGas(tx.GetBlobGas()), true /* refunds */, false /* gasBailout */); err != nil { - return err - } - _ = ibs.FinalizeTx(rules, cachedWriter) + // vmenv := vm.NewEVM(BlockContext, TxContext, ibs, chainConfig, vm.Config{Debug: true, Tracer: tracer}) + // if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.GetGas()).AddBlobGas(tx.GetBlobGas()), true /* refunds */, false /* gasBailout */); err != nil { + // return err + // } + // _ = ibs.FinalizeTx(rules, cachedWriter) - if tracer.Found() { - tracer.SetTransaction(tx) - return nil - } -======= + // if tracer.Found() { + // tracer.SetTransaction(tx) + // return nil + // } + // } _, err = executor.ExecTxn(txnID, txIndex, txn) if err != nil { return err ->>>>>>> v3.0.0-alpha1 } return nil } diff --git a/turbo/jsonrpc/otterscan_search_trace.go b/turbo/jsonrpc/otterscan_search_trace.go index 1d3b5f1fa7a..d03196f055f 100644 --- a/turbo/jsonrpc/otterscan_search_trace.go +++ b/turbo/jsonrpc/otterscan_search_trace.go @@ -22,19 +22,6 @@ import ( "github.com/erigontech/erigon-lib/log/v3" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/opstack" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/state" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/eth/ethutils" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/shards" -======= "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" @@ -44,7 +31,6 @@ import ( "github.com/erigontech/erigon/core/vm" "github.com/erigontech/erigon/eth/ethutils" "github.com/erigontech/erigon/turbo/rpchelper" ->>>>>>> v3.0.0-alpha1 ) func (api *OtterscanAPIImpl) searchTraceBlock(ctx context.Context, addr common.Address, chainConfig *chain.Config, idx int, bNum uint64, results []*TransactionsWithReceipts) error { @@ -133,12 +119,10 @@ func (api *OtterscanAPIImpl) traceBlock(dbtx kv.Tx, ctx context.Context, blockNu msg, _ := txn.AsMessage(*signer, header.BaseFee, rules) tracer := NewTouchTracer(searchAddr) -<<<<<<< HEAD - BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil) - BlockContext.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) -======= + BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil, chainConfig) ->>>>>>> v3.0.0-alpha1 + BlockContext.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) + TxContext := core.NewEVMTxContext(msg) vmenv := vm.NewEVM(BlockContext, TxContext, ibs, chainConfig, vm.Config{Debug: true, Tracer: tracer}) @@ -160,13 +144,9 @@ func (api *OtterscanAPIImpl) traceBlock(dbtx kv.Tx, ctx context.Context, blockNu } return false, nil, fmt.Errorf("requested receipt idx %d, but have only %d", idx, len(blockReceipts)) // otherwise return some error for debugging } -<<<<<<< HEAD - rpcTx := NewRPCTransaction(tx, block.Hash(), blockNum, uint64(idx), block.BaseFee(), receipt) - mReceipt := ethutils.MarshalReceipt(blockReceipts[idx], tx, chainConfig, block.HeaderNoCopy(), tx.Hash(), true) -======= - rpcTx := NewRPCTransaction(txn, block.Hash(), blockNum, uint64(idx), block.BaseFee()) + + rpcTx := NewRPCTransaction(txn, block.Hash(), blockNum, uint64(idx), block.BaseFee(), receipt) mReceipt := ethutils.MarshalReceipt(blockReceipts[idx], txn, chainConfig, block.HeaderNoCopy(), txn.Hash(), true) ->>>>>>> v3.0.0-alpha1 mReceipt["timestamp"] = block.Time() rpcTxs = append(rpcTxs, rpcTx) receipts = append(receipts, mReceipt) diff --git a/turbo/jsonrpc/otterscan_search_v3.go b/turbo/jsonrpc/otterscan_search_v3.go index 72183c16d4d..523950faaf9 100644 --- a/turbo/jsonrpc/otterscan_search_v3.go +++ b/turbo/jsonrpc/otterscan_search_v3.go @@ -102,9 +102,18 @@ func (api *OtterscanAPIImpl) buildSearchResults(ctx context.Context, tx kv.Tempo return nil, nil, false, err } rawLogs := exec.GetLogs(txIndex, txn) - rpcTx := NewRPCTransaction(txn, blockHash, blockNum, uint64(txIndex), header.BaseFee) + + var receipt *types.Receipt + if chainConfig.IsOptimism() { + receipts := rawdb.ReadRawReceipts(tx, blockNum) + if len(receipts) <= txIndex { + return nil, nil, false, fmt.Errorf("block has less receipts than expected: %d <= %d, block: %d", len(receipts), txIndex, blockNum) + } + receipt = receipts[txIndex] + } + rpcTx := NewRPCTransaction(txn, blockHash, blockNum, uint64(txIndex), header.BaseFee, receipt) txs = append(txs, rpcTx) - receipt := &types.Receipt{ + receipt = &types.Receipt{ Type: txn.Type(), GasUsed: res.UsedGas, CumulativeGasUsed: res.UsedGas, // TODO: cumulative gas is wrong, wait for cumulative gas index fix diff --git a/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce_test.go b/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce_test.go index 9df7cd6b7ee..451c3573f46 100644 --- a/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce_test.go +++ b/turbo/jsonrpc/otterscan_transaction_by_sender_and_nonce_test.go @@ -27,12 +27,7 @@ import ( func TestGetTransactionBySenderAndNonce(t *testing.T) { m, _, _ := rpcdaemontest.CreateTestSentry(t) -<<<<<<< HEAD - agg := m.HistoryV3Components() - api := NewOtterscanAPI(NewBaseApi(nil, nil, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, 25) -======= - api := NewOtterscanAPI(NewBaseApi(nil, nil, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, 25) ->>>>>>> v3.0.0-alpha1 + api := NewOtterscanAPI(NewBaseApi(nil, nil, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, 25) addr := common.HexToAddress("0x537e697c7ab75a26f9ecf0ce810e3154dfcaaf44") expectCreator := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7") diff --git a/turbo/jsonrpc/parity_api_test.go b/turbo/jsonrpc/parity_api_test.go index 587c5ffe6ef..674eea81442 100644 --- a/turbo/jsonrpc/parity_api_test.go +++ b/turbo/jsonrpc/parity_api_test.go @@ -37,12 +37,7 @@ var latestBlock = rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber) func TestParityAPIImpl_ListStorageKeys_NoOffset(t *testing.T) { assert := assert.New(t) m, _, _ := rpcdaemontest.CreateTestSentry(t) -<<<<<<< HEAD - agg := m.HistoryV3Components() - baseApi := NewBaseApi(nil, nil, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - baseApi := NewBaseApi(nil, nil, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + baseApi := NewBaseApi(nil, nil, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) api := NewParityAPIImpl(baseApi, m.DB) answers := []string{ "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/turbo/jsonrpc/send_transaction.go b/turbo/jsonrpc/send_transaction.go index 16fe95acaaa..047a7d780a7 100644 --- a/turbo/jsonrpc/send_transaction.go +++ b/turbo/jsonrpc/send_transaction.go @@ -11,14 +11,8 @@ import ( "github.com/erigontech/erigon-lib/common/hexutility" txPoolProto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/params" -======= "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/params" ->>>>>>> v3.0.0-alpha1 ) // SendRawTransaction implements eth_sendRawTransaction. Creates new message call transaction or a contract creation for previously-signed transactions. diff --git a/turbo/jsonrpc/send_transaction_test.go b/turbo/jsonrpc/send_transaction_test.go index 7d0fa501f42..2c94fc04b68 100644 --- a/turbo/jsonrpc/send_transaction_test.go +++ b/turbo/jsonrpc/send_transaction_test.go @@ -54,11 +54,7 @@ import ( func newBaseApiForTest(m *mock.MockSentry) *jsonrpc.BaseAPI { stateCache := kvcache.New(kvcache.DefaultCoherentConfig) -<<<<<<< HEAD - return jsonrpc.NewBaseApi(nil, stateCache, m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) -======= - return jsonrpc.NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs) ->>>>>>> v3.0.0-alpha1 + return jsonrpc.NewBaseApi(nil, stateCache, m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil) } // Do 1 step to start txPool @@ -109,11 +105,7 @@ func TestSendRawTransaction(t *testing.T) { ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, mockSentry) txPool := txpool.NewTxpoolClient(conn) -<<<<<<< HEAD - ff := rpchelper.New(ctx, nil, txPool, txpool.NewMiningClient(conn), func() {}, mockSentry.Log) -======= ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, txPool, txpool.NewMiningClient(conn), func() {}, mockSentry.Log) ->>>>>>> v3.0.0-alpha1 api := jsonrpc.NewEthAPI(newBaseApiForTest(mockSentry), mockSentry.DB, nil, txPool, nil, 5000000, 1e18, 100_000, false, 100_000, 128, logger) buf := bytes.NewBuffer(nil) @@ -165,11 +157,7 @@ func TestSendRawTransactionUnprotected(t *testing.T) { ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, mockSentry) txPool := txpool.NewTxpoolClient(conn) -<<<<<<< HEAD - ff := rpchelper.New(ctx, nil, txPool, txpool.NewMiningClient(conn), func() {}, mockSentry.Log) -======= ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, txPool, txpool.NewMiningClient(conn), func() {}, mockSentry.Log) ->>>>>>> v3.0.0-alpha1 api := jsonrpc.NewEthAPI(newBaseApiForTest(mockSentry), mockSentry.DB, nil, txPool, nil, 5000000, 1e18, 100_000, false, 100_000, 128, logger) // Enable unproteced txs flag diff --git a/turbo/jsonrpc/trace_adhoc.go b/turbo/jsonrpc/trace_adhoc.go index 5ea8e91ebe6..460179a4c61 100644 --- a/turbo/jsonrpc/trace_adhoc.go +++ b/turbo/jsonrpc/trace_adhoc.go @@ -26,26 +26,6 @@ import ( "github.com/holiman/uint256" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/common/hexutility" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/opstack" - types2 "github.com/ledgerwatch/erigon-lib/types" - math2 "github.com/ledgerwatch/erigon/common/math" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/state" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/types/accounts" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/polygon/tracer" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/shards" - "github.com/ledgerwatch/erigon/turbo/transactions" -======= libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/common/hexutility" @@ -64,7 +44,6 @@ import ( "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/transactions" ->>>>>>> v3.0.0-alpha1 ) const ( @@ -262,11 +241,7 @@ func (args *TraceCallParam) ToMessage(globalGasCap uint64, baseFee *uint256.Int) return msg, nil } -<<<<<<< HEAD -func parseOeTracerConfig(traceConfig *tracers.TraceConfig) (OeTracerConfig, error) { -======= func parseOeTracerConfig(traceConfig *config.TraceConfig) (OeTracerConfig, error) { ->>>>>>> v3.0.0-alpha1 if traceConfig == nil || traceConfig.TracerConfig == nil || *traceConfig.TracerConfig == nil { return OeTracerConfig{}, nil } @@ -775,11 +750,7 @@ func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState) { } } -<<<<<<< HEAD -func (api *TraceAPIImpl) ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *tracers.TraceConfig) (*TraceCallResult, error) { -======= func (api *TraceAPIImpl) ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) (*TraceCallResult, error) { ->>>>>>> v3.0.0-alpha1 if gasBailOut == nil { gasBailOut = new(bool) // false by default } @@ -879,11 +850,7 @@ func (api *TraceAPIImpl) ReplayTransaction(ctx context.Context, txHash libcommon return result, nil } -<<<<<<< HEAD -func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, traceTypes []string, gasBailOut *bool, traceConfig *tracers.TraceConfig) ([]*TraceCallResult, error) { -======= func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) ([]*TraceCallResult, error) { ->>>>>>> v3.0.0-alpha1 if gasBailOut == nil { gasBailOut = new(bool) // false by default } @@ -926,11 +893,7 @@ func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrH signer := types.MakeSigner(chainConfig, blockNumber, block.Time()) // Returns an array of trace arrays, one trace array for each transaction -<<<<<<< HEAD - traces, _, err := api.callManyTransactions(ctx, tx, block, traceTypes, -1 /* all tx indices */, *gasBailOut, signer, chainConfig, traceConfig) -======= traces, _, err := api.callManyTransactions(ctx, tx, block, traceTypes, -1 /* all txn indices */, *gasBailOut, signer, chainConfig, traceConfig) ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -958,11 +921,7 @@ func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrH } // Call implements trace_call. -<<<<<<< HEAD -func (api *TraceAPIImpl) Call(ctx context.Context, args TraceCallParam, traceTypes []string, blockNrOrHash *rpc.BlockNumberOrHash, traceConfig *tracers.TraceConfig) (*TraceCallResult, error) { -======= func (api *TraceAPIImpl) Call(ctx context.Context, args TraceCallParam, traceTypes []string, blockNrOrHash *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) (*TraceCallResult, error) { ->>>>>>> v3.0.0-alpha1 tx, err := api.kv.BeginRo(ctx) if err != nil { return nil, err @@ -1101,11 +1060,7 @@ func (api *TraceAPIImpl) Call(ctx context.Context, args TraceCallParam, traceTyp } // CallMany implements trace_callMany. -<<<<<<< HEAD -func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, parentNrOrHash *rpc.BlockNumberOrHash, traceConfig *tracers.TraceConfig) ([]*TraceCallResult, error) { -======= func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, parentNrOrHash *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) ([]*TraceCallResult, error) { ->>>>>>> v3.0.0-alpha1 dbtx, err := api.kv.BeginRo(ctx) if err != nil { return nil, err @@ -1185,21 +1140,13 @@ func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, pa return nil, fmt.Errorf("convert callParam to msg: %w", err) } } -<<<<<<< HEAD - results, _, err := api.doCallMany(ctx, dbtx, msgs, callParams, parentNrOrHash, nil, true /* gasBailout */, -1 /* all tx indices */, traceConfig) -======= results, _, err := api.doCallMany(ctx, dbtx, msgs, callParams, parentNrOrHash, nil, true /* gasBailout */, -1 /* all txn indices */, traceConfig) ->>>>>>> v3.0.0-alpha1 return results, err } func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []types.Message, callParams []TraceCallParam, parentNrOrHash *rpc.BlockNumberOrHash, header *types.Header, gasBailout bool, txIndexNeeded int, -<<<<<<< HEAD - traceConfig *tracers.TraceConfig, -======= traceConfig *config.TraceConfig, ->>>>>>> v3.0.0-alpha1 ) ([]*TraceCallResult, *state.IntraBlockState, error) { chainConfig, err := api.chainConfig(ctx, dbtx) if err != nil { @@ -1255,15 +1202,13 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type useParent = true } -<<<<<<< HEAD l1CostFunc := opstack.NewL1CostFunc(chainConfig, ibs) -======= + var baseTxNum uint64 historicalStateReader, isHistoricalStateReader := stateReader.(state.HistoricalStateReader) if isHistoricalStateReader { baseTxNum = historicalStateReader.GetTxNum() } ->>>>>>> v3.0.0-alpha1 for txIndex, msg := range msgs { if isHistoricalStateReader { historicalStateReader.SetTxNum(baseTxNum + uint64(txIndex)) diff --git a/turbo/jsonrpc/trace_adhoc_test.go b/turbo/jsonrpc/trace_adhoc_test.go index b860e7d8ac9..1d3adcdaaf0 100644 --- a/turbo/jsonrpc/trace_adhoc_test.go +++ b/turbo/jsonrpc/trace_adhoc_test.go @@ -28,24 +28,6 @@ import ( "github.com/holiman/uint256" "github.com/stretchr/testify/require" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/dir" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest" - "github.com/ledgerwatch/erigon/common" - "github.com/ledgerwatch/erigon/common/math" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/core/vm/evmtypes" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/tests" - "github.com/ledgerwatch/erigon/turbo/stages/mock" -======= libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/dir" "github.com/erigontech/erigon-lib/common/hexutil" @@ -63,7 +45,6 @@ import ( "github.com/erigontech/erigon/rpc" "github.com/erigontech/erigon/tests" "github.com/erigontech/erigon/turbo/stages/mock" ->>>>>>> v3.0.0-alpha1 ) func TestEmptyQuery(t *testing.T) { @@ -196,11 +177,7 @@ func TestOeTracer(t *testing.T) { signer := types.MakeSigner(test.Genesis.Config, uint64(test.Context.Number), uint64(test.Context.Time)) context := evmtypes.BlockContext{ CanTransfer: core.CanTransfer, -<<<<<<< HEAD - Transfer: core.Transfer, -======= Transfer: consensus.Transfer, ->>>>>>> v3.0.0-alpha1 Coinbase: test.Context.Miner, BlockNumber: uint64(test.Context.Number), Time: uint64(test.Context.Time), @@ -217,11 +194,7 @@ func TestOeTracer(t *testing.T) { require.NoError(t, err) defer dbTx.Rollback() -<<<<<<< HEAD - statedb, _ := tests.MakePreState(rules, dbTx, test.Genesis.Alloc, context.BlockNumber) -======= statedb, _ := tests.MakePreState(rules, dbTx, test.Genesis.Alloc, context.BlockNumber, m.HistoryV3) ->>>>>>> v3.0.0-alpha1 msg, err := tx.AsMessage(*signer, (*big.Int)(test.Context.BaseFee), rules) require.NoError(t, err) txContext := core.NewEVMTxContext(msg) @@ -229,11 +202,7 @@ func TestOeTracer(t *testing.T) { traceResult := &TraceCallResult{Trace: []*ParityTrace{}} tracer := OeTracer{} tracer.r = traceResult -<<<<<<< HEAD - tracer.config, err = parseOeTracerConfig(&tracers.TraceConfig{TracerConfig: &test.TracerConfig}) -======= tracer.config, err = parseOeTracerConfig(&config.TraceConfig{TracerConfig: &test.TracerConfig}) ->>>>>>> v3.0.0-alpha1 require.NoError(t, err) evm := vm.NewEVM(context, txContext, statedb, test.Genesis.Config, vm.Config{Debug: true, Tracer: &tracer}) diff --git a/turbo/jsonrpc/trace_api.go b/turbo/jsonrpc/trace_api.go index e18210797a0..b3c3bf743da 100644 --- a/turbo/jsonrpc/trace_api.go +++ b/turbo/jsonrpc/trace_api.go @@ -22,53 +22,30 @@ import ( jsoniter "github.com/json-iterator/go" -<<<<<<< HEAD - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/rpc" -======= libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon/cmd/rpcdaemon/cli/httpcfg" "github.com/erigontech/erigon/eth/tracers/config" "github.com/erigontech/erigon/rpc" ->>>>>>> v3.0.0-alpha1 ) // TraceAPI RPC interface into tracing API type TraceAPI interface { // Ad-hoc (see ./trace_adhoc.go) -<<<<<<< HEAD - ReplayBlockTransactions(ctx context.Context, blockNr rpc.BlockNumberOrHash, traceTypes []string, gasBailOut *bool, traceConfig *tracers.TraceConfig) ([]*TraceCallResult, error) - ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *tracers.TraceConfig) (*TraceCallResult, error) - Call(ctx context.Context, call TraceCallParam, types []string, blockNr *rpc.BlockNumberOrHash, traceConfig *tracers.TraceConfig) (*TraceCallResult, error) - CallMany(ctx context.Context, calls json.RawMessage, blockNr *rpc.BlockNumberOrHash, traceConfig *tracers.TraceConfig) ([]*TraceCallResult, error) -======= ReplayBlockTransactions(ctx context.Context, blockNr rpc.BlockNumberOrHash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) ([]*TraceCallResult, error) ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) (*TraceCallResult, error) Call(ctx context.Context, call TraceCallParam, types []string, blockNr *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) (*TraceCallResult, error) CallMany(ctx context.Context, calls json.RawMessage, blockNr *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) ([]*TraceCallResult, error) ->>>>>>> v3.0.0-alpha1 RawTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) ([]interface{}, error) // Filtering (see ./trace_filtering.go) -<<<<<<< HEAD - Transaction(ctx context.Context, txHash libcommon.Hash, gasBailOut *bool, traceConfig *tracers.TraceConfig) (ParityTraces, error) - Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64, gasBailOut *bool, traceConfig *tracers.TraceConfig) (*ParityTrace, error) - Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool, traceConfig *tracers.TraceConfig) (ParityTraces, error) - Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *tracers.TraceConfig, stream *jsoniter.Stream) error -======= Transaction(ctx context.Context, txHash libcommon.Hash, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error) Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64, gasBailOut *bool, traceConfig *config.TraceConfig) (*ParityTrace, error) Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *config.TraceConfig, stream *jsoniter.Stream) error ->>>>>>> v3.0.0-alpha1 } // TraceAPIImpl is implementation of the TraceAPI interface based on remote Db access diff --git a/turbo/jsonrpc/trace_filtering.go b/turbo/jsonrpc/trace_filtering.go index 986cdf1faf2..0d510c28ede 100644 --- a/turbo/jsonrpc/trace_filtering.go +++ b/turbo/jsonrpc/trace_filtering.go @@ -24,35 +24,6 @@ import ( jsoniter "github.com/json-iterator/go" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/kv/bitmapdb" - "github.com/ledgerwatch/erigon-lib/kv/iter" - "github.com/ledgerwatch/erigon-lib/kv/order" - "github.com/ledgerwatch/erigon-lib/kv/rawdbv3" - "github.com/ledgerwatch/erigon/consensus" - "github.com/ledgerwatch/erigon/consensus/ethash" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/state" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/eth/stagedsync" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/ethdb" - bortypes "github.com/ledgerwatch/erigon/polygon/bor/types" - "github.com/ledgerwatch/erigon/rpc" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/shards" - "github.com/ledgerwatch/erigon/turbo/transactions" -) - -// Transaction implements trace_transaction -func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash, gasBailOut *bool, traceConfig *tracers.TraceConfig) (ParityTraces, error) { -======= "github.com/erigontech/erigon-lib/chain" "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" @@ -80,7 +51,6 @@ func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash, ga // Transaction implements trace_transaction func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error) { ->>>>>>> v3.0.0-alpha1 if gasBailOut == nil { gasBailOut = new(bool) // false by default } @@ -171,11 +141,7 @@ func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash, ga } // Get implements trace_get -<<<<<<< HEAD -func (api *TraceAPIImpl) Get(ctx context.Context, txHash common.Hash, indicies []hexutil.Uint64, gasBailOut *bool, traceConfig *tracers.TraceConfig) (*ParityTrace, error) { -======= func (api *TraceAPIImpl) Get(ctx context.Context, txHash common.Hash, indicies []hexutil.Uint64, gasBailOut *bool, traceConfig *config.TraceConfig) (*ParityTrace, error) { ->>>>>>> v3.0.0-alpha1 // Parity fails if it gets more than a single index. It returns nothing in this case. Must we? if len(indicies) > 1 { return nil, nil @@ -211,11 +177,7 @@ func rewardKindToString(kind consensus.RewardKind) string { } // Block implements trace_block -<<<<<<< HEAD -func (api *TraceAPIImpl) Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool, traceConfig *tracers.TraceConfig) (ParityTraces, error) { -======= func (api *TraceAPIImpl) Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error) { ->>>>>>> v3.0.0-alpha1 if gasBailOut == nil { gasBailOut = new(bool) // false by default } @@ -247,11 +209,7 @@ func (api *TraceAPIImpl) Block(ctx context.Context, blockNr rpc.BlockNumber, gas return nil, err } signer := types.MakeSigner(cfg, blockNum, block.Time()) -<<<<<<< HEAD - traces, syscall, err := api.callManyTransactions(ctx, tx, block, []string{TraceTypeTrace}, -1 /* all tx indices */, *gasBailOut /* gasBailOut */, signer, cfg, traceConfig) -======= traces, syscall, err := api.callManyTransactions(ctx, tx, block, []string{TraceTypeTrace}, -1 /* all txn indices */, *gasBailOut /* gasBailOut */, signer, cfg, traceConfig) ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -342,11 +300,7 @@ func traceFilterBitmapsV3(tx kv.TemporalTx, req TraceFilterRequest, from, to uin // Filter implements trace_filter // NOTE: We do not store full traces - we just store index for each address // Pull blocks which have txs with matching address -<<<<<<< HEAD -func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *tracers.TraceConfig, stream *jsoniter.Stream) error { -======= func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *config.TraceConfig, stream *jsoniter.Stream) error { ->>>>>>> v3.0.0-alpha1 if gasBailOut == nil { //nolint gasBailOut = new(bool) // false by default @@ -375,176 +329,10 @@ func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gas return fmt.Errorf("invalid parameters: fromBlock cannot be greater than toBlock") } -<<<<<<< HEAD - if api.historyV3(dbtx) { - return api.filterV3(ctx, dbtx.(kv.TemporalTx), fromBlock, toBlock, req, traceConfig, stream) - } - toBlock++ //+1 because internally Erigon using semantic [from, to), but some RPC have different semantic - fromAddresses, toAddresses, allBlocks, err := traceFilterBitmaps(dbtx, req, fromBlock, toBlock) - if err != nil { - return err - } - - chainConfig, err := api.chainConfig(ctx, dbtx) - if err != nil { - return err - } - - var json = jsoniter.ConfigCompatibleWithStandardLibrary - stream.WriteArrayStart() - first := true - // Execute all transactions in picked blocks - - count := uint64(^uint(0)) // this just makes it easier to use below - if req.Count != nil { - count = *req.Count - } - after := uint64(0) // this just makes it easier to use below - if req.After != nil { - after = *req.After - } - nSeen := uint64(0) - nExported := uint64(0) - - it := allBlocks.Iterator() - for it.HasNext() { - b := it.Next() - // Extract transactions from block - block, bErr := api.blockByNumberWithSenders(ctx, dbtx, b) - if bErr != nil { - if first { - first = false - } else { - stream.WriteMore() - } - stream.WriteObjectStart() - rpc.HandleError(bErr, stream) - stream.WriteObjectEnd() - continue - } - if block == nil { - if first { - first = false - } else { - stream.WriteMore() - } - stream.WriteObjectStart() - rpc.HandleError(fmt.Errorf("could not find block %d", b), stream) - stream.WriteObjectEnd() - continue - } - - blockHash := block.Hash() - blockNumber := block.NumberU64() - signer := types.MakeSigner(chainConfig, b, block.Time()) - t, syscall, tErr := api.callManyTransactions(ctx, dbtx, block, []string{TraceTypeTrace}, -1 /* all tx indices */, *gasBailOut, signer, chainConfig, traceConfig) - if tErr != nil { - if first { - first = false - } else { - stream.WriteMore() - } - stream.WriteObjectStart() - rpc.HandleError(tErr, stream) - stream.WriteObjectEnd() - continue - } - isIntersectionMode := req.Mode == TraceFilterModeIntersection - includeAll := len(fromAddresses) == 0 && len(toAddresses) == 0 - for i, trace := range t { - txPosition := uint64(i) - // Check if transaction concerns any of the addresses we wanted - for _, pt := range trace.Trace { - if includeAll || filterTrace(pt, fromAddresses, toAddresses, isIntersectionMode) { - nSeen++ - pt.BlockHash = &blockHash - pt.BlockNumber = &blockNumber - pt.TransactionHash = trace.TransactionHash - pt.TransactionPosition = &txPosition - b, err := json.Marshal(pt) - if err != nil { - if first { - first = false - } else { - stream.WriteMore() - } - stream.WriteObjectStart() - rpc.HandleError(err, stream) - stream.WriteObjectEnd() - continue - } - if nSeen > after && nExported < count { - if first { - first = false - } else { - stream.WriteMore() - } - if _, err := stream.Write(b); err != nil { - return err - } - nExported++ - } - } - } - } - - rewards, err := api.engine().CalculateRewards(chainConfig, block.Header(), block.Uncles(), syscall) - if err != nil { - return err - } - - for _, r := range rewards { - if _, ok := toAddresses[r.Beneficiary]; ok || includeAll { - nSeen++ - var tr ParityTrace - rewardAction := &RewardTraceAction{} - rewardAction.Author = r.Beneficiary - rewardAction.RewardType = rewardKindToString(r.Kind) - rewardAction.Value.ToInt().Set(r.Amount.ToBig()) - tr.Action = rewardAction - tr.BlockHash = &common.Hash{} - copy(tr.BlockHash[:], block.Hash().Bytes()) - tr.BlockNumber = new(uint64) - *tr.BlockNumber = block.NumberU64() - tr.Type = "reward" // nolint: goconst - tr.TraceAddress = []int{} - b, err := json.Marshal(tr) - if err != nil { - if first { - first = false - } else { - stream.WriteMore() - } - stream.WriteObjectStart() - rpc.HandleError(err, stream) - stream.WriteObjectEnd() - continue - } - if nSeen > after && nExported < count { - if first { - first = false - } else { - stream.WriteMore() - } - if _, err := stream.Write(b); err != nil { - return err - } - nExported++ - } - } - } - } - stream.WriteArrayEnd() - return stream.Flush() -} - -func (api *TraceAPIImpl) filterV3(ctx context.Context, dbtx kv.TemporalTx, fromBlock, toBlock uint64, req TraceFilterRequest, traceConfig *tracers.TraceConfig, stream *jsoniter.Stream) error { -======= return api.filterV3(ctx, dbtx.(kv.TemporalTx), fromBlock, toBlock, req, stream, *gasBailOut, traceConfig) } func (api *TraceAPIImpl) filterV3(ctx context.Context, dbtx kv.TemporalTx, fromBlock, toBlock uint64, req TraceFilterRequest, stream *jsoniter.Stream, gasBailOut bool, traceConfig *config.TraceConfig) error { ->>>>>>> v3.0.0-alpha1 var fromTxNum, toTxNum uint64 var err error if fromBlock > 0 { @@ -922,11 +710,7 @@ func (api *TraceAPIImpl) callManyTransactions( gasBailOut bool, signer *types.Signer, cfg *chain.Config, -<<<<<<< HEAD - traceConfig *tracers.TraceConfig, -======= traceConfig *config.TraceConfig, ->>>>>>> v3.0.0-alpha1 ) ([]*TraceCallResult, consensus.SystemCall, error) { blockNumber := block.NumberU64() pNo := blockNumber diff --git a/turbo/jsonrpc/tracing.go b/turbo/jsonrpc/tracing.go index 78c72a5416f..91c84e730a2 100644 --- a/turbo/jsonrpc/tracing.go +++ b/turbo/jsonrpc/tracing.go @@ -26,13 +26,7 @@ import ( "github.com/holiman/uint256" jsoniter "github.com/json-iterator/go" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/common/hexutil" - "github.com/ledgerwatch/erigon-lib/opstack" -======= "github.com/erigontech/erigon-lib/log/v3" ->>>>>>> v3.0.0-alpha1 "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/common/hexutil" @@ -390,11 +384,7 @@ func (api *PrivateDebugAPIImpl) TraceCall(ctx context.Context, args ethapi.CallA var stateReader state.StateReader if config == nil || config.TxIndex == nil || isLatest { -<<<<<<< HEAD - stateReader, err = rpchelper.CreateStateReader(ctx, dbtx, blockNrOrHash, 0, api.filters, api.stateCache, api.historyV3(dbtx), chainConfig.ChainName) -======= stateReader, err = rpchelper.CreateStateReader(ctx, dbtx, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) ->>>>>>> v3.0.0-alpha1 } else { stateReader, err = rpchelper.CreateHistoryStateReader(dbtx, blockNumber, int(*config.TxIndex), chainConfig.ChainName) } @@ -541,12 +531,9 @@ func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bun return hash } -<<<<<<< HEAD - blockCtx = core.NewEVMBlockContext(header, getHash, api.engine(), nil /* author */) - blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, st) -======= blockCtx = core.NewEVMBlockContext(header, getHash, api.engine(), nil /* author */, chainConfig) ->>>>>>> v3.0.0-alpha1 + blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, st) + // Get a new instance of the EVM evm = vm.NewEVM(blockCtx, txCtx, st, chainConfig, vm.Config{Debug: false}) signer := types.MakeSigner(chainConfig, blockNum, block.Time()) diff --git a/turbo/jsonrpc/txpool_api_test.go b/turbo/jsonrpc/txpool_api_test.go index 6f6fcffb4c9..c46cb1a67fa 100644 --- a/turbo/jsonrpc/txpool_api_test.go +++ b/turbo/jsonrpc/txpool_api_test.go @@ -54,14 +54,8 @@ func TestTxPoolContent(t *testing.T) { ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, m) txPool := txpool.NewTxpoolClient(conn) -<<<<<<< HEAD - ff := rpchelper.New(ctx, nil, txPool, txpool.NewMiningClient(conn), func() {}, m.Log) - agg := m.HistoryV3Components() - api := NewTxPoolAPI(NewBaseApi(ff, kvcache.New(kvcache.DefaultCoherentConfig), m.BlockReader, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, txPool) -======= ff := rpchelper.New(ctx, rpchelper.DefaultFiltersConfig, nil, txPool, txpool.NewMiningClient(conn), func() {}, m.Log) api := NewTxPoolAPI(NewBaseApi(ff, kvcache.New(kvcache.DefaultCoherentConfig), m.BlockReader, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, txPool) ->>>>>>> v3.0.0-alpha1 expectValue := uint64(1234) txn, err := types.SignTx(types.NewTransaction(0, libcommon.Address{1}, uint256.NewInt(expectValue), params.TxGas, uint256.NewInt(10*params.GWei), nil), *types.LatestSignerForChainID(m.ChainConfig.ChainID), m.Key) diff --git a/turbo/node/node.go b/turbo/node/node.go index 10caab18f00..e27ced8e1d4 100644 --- a/turbo/node/node.go +++ b/turbo/node/node.go @@ -20,19 +20,6 @@ package node import ( "context" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain/networkname" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon/cmd/utils" - "github.com/ledgerwatch/erigon/eth" - "github.com/ledgerwatch/erigon/eth/ethconfig" - "github.com/ledgerwatch/erigon/node" - "github.com/ledgerwatch/erigon/node/nodecfg" - "github.com/ledgerwatch/erigon/params" - erigoncli "github.com/ledgerwatch/erigon/turbo/cli" - "github.com/ledgerwatch/log/v3" - "github.com/urfave/cli/v2" -======= "github.com/urfave/cli/v2" "github.com/erigontech/erigon-lib/chain/networkname" @@ -46,7 +33,6 @@ import ( "github.com/erigontech/erigon/node/nodecfg" "github.com/erigontech/erigon/params" erigoncli "github.com/erigontech/erigon/turbo/cli" ->>>>>>> v3.0.0-alpha1 ) // ErigonNode represents a single node, that runs sync and p2p network. diff --git a/turbo/snapshotsync/freezeblocks/block_reader.go b/turbo/snapshotsync/freezeblocks/block_reader.go index aabc6dc4fb3..31dd57058f8 100644 --- a/turbo/snapshotsync/freezeblocks/block_reader.go +++ b/turbo/snapshotsync/freezeblocks/block_reader.go @@ -541,18 +541,7 @@ func (r *BlockReader) BodyWithTransactions(ctx context.Context, tx kv.Getter, ha var baseTxnID uint64 var txCount uint32 var buf []byte -<<<<<<< HEAD - seg, ok := view.BodiesSegment(blockHeight) - if !ok { - if dbgLogs { - log.Info(dbgPrefix + "no bodies file for this block num") - } - return nil, nil - } - body, baseTxnID, txsAmount, buf, err = r.bodyFromSnapshot(blockHeight, seg, buf) -======= body, baseTxnID, txCount, buf, err = r.bodyFromSnapshot(blockHeight, seg, buf) ->>>>>>> v3.0.0-alpha1 if err != nil { return nil, err } @@ -612,13 +601,8 @@ func (r *BlockReader) Body(ctx context.Context, tx kv.Getter, hash common.Hash, if tx == nil { return nil, 0, nil } -<<<<<<< HEAD - body, _, txAmount = rawdb.ReadBody(tx, hash, blockHeight) - return body, txAmount, nil -======= body, _, txCount = rawdb.ReadBody(tx, hash, blockHeight) return body, txCount, nil ->>>>>>> v3.0.0-alpha1 } seg, ok, release := r.sn.ViewSingleFile(coresnaptype.Bodies, blockHeight) diff --git a/turbo/snapshotsync/freezeblocks/block_snapshots.go b/turbo/snapshotsync/freezeblocks/block_snapshots.go index 2f3cf7684fa..93c85b2dfda 100644 --- a/turbo/snapshotsync/freezeblocks/block_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/block_snapshots.go @@ -389,21 +389,6 @@ func (s *RoSnapshots) EnableMadvWillNeed() *RoSnapshots { return s } -<<<<<<< HEAD -func (s *RoSnapshots) EnableMadvNormal() *RoSnapshots { - s.segments.Scan(func(segtype snaptype.Enum, value *segments) bool { - value.lock.RLock() - defer value.lock.RUnlock() - for _, sn := range value.segments { - sn.EnableMadvNormal() - } - return true - }) - return s -} - -======= ->>>>>>> v3.0.0-alpha1 // minimax of existing indices func (s *RoSnapshots) idxAvailability() uint64 { // Use-Cases: @@ -1425,14 +1410,9 @@ func (br *BlockRetire) retireBlocks(ctx context.Context, minBlockNum uint64, max return ok, err } -<<<<<<< HEAD - if err := snapshots.removeOverlapsAfterMerge(); err != nil { - return ok, err -======= // remove old garbage files if err := snapshots.removeOverlapsAfterMerge(); err != nil { return false, err ->>>>>>> v3.0.0-alpha1 } return ok, nil } diff --git a/turbo/snapshotsync/freezeblocks/bor_snapshots.go b/turbo/snapshotsync/freezeblocks/bor_snapshots.go index 450c5de598d..3a2371b6aa0 100644 --- a/turbo/snapshotsync/freezeblocks/bor_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/bor_snapshots.go @@ -124,11 +124,7 @@ func (br *BlockRetire) retireBorBlocks(ctx context.Context, minBlockNum uint64, // this is one off code to fix an issue in 2.49.x->2.52.x which missed // removal of intermediate segments after a merge operation -<<<<<<< HEAD - removeBorOverlapsAfterMerge(br.borSnapshots().dir, files, br.borSnapshots().BlocksAvailable()) -======= removeBorOverlaps(br.borSnapshots().dir, files, br.borSnapshots().BlocksAvailable()) ->>>>>>> v3.0.0-alpha1 } return blocksRetired, nil diff --git a/turbo/snapshotsync/snapshotsync.go b/turbo/snapshotsync/snapshotsync.go index c723d54c467..e22cda4b884 100644 --- a/turbo/snapshotsync/snapshotsync.go +++ b/turbo/snapshotsync/snapshotsync.go @@ -457,8 +457,6 @@ func WaitForDownloader(ctx context.Context, logPrefix string, headerchain, blobs func logStats(ctx context.Context, stats *proto_downloader.StatsReply, startTime time.Time, stagesIdsList []string, logPrefix string, headerchain bool) { var m runtime.MemStats -<<<<<<< HEAD -======= logReason := "download" if headerchain { logReason = "downloading header-chain" @@ -468,7 +466,6 @@ func logStats(ctx context.Context, stats *proto_downloader.StatsReply, startTime logEnd = "header-chain download finished" } ->>>>>>> v3.0.0-alpha1 diagnostics.Send(diagnostics.SnapshotDownloadStatistics{ Downloaded: stats.BytesCompleted, Total: stats.BytesTotal, diff --git a/turbo/stages/mock/mock_sentry.go b/turbo/stages/mock/mock_sentry.go index 59ad1f3f844..d6d3f67e319 100644 --- a/turbo/stages/mock/mock_sentry.go +++ b/turbo/stages/mock/mock_sentry.go @@ -335,11 +335,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK cancunTime := mock.ChainConfig.CancunTime pragueTime := mock.ChainConfig.PragueTime maxBlobsPerBlock := mock.ChainConfig.GetMaxBlobsPerBlock() -<<<<<<< HEAD - mock.TxPool, err = txpool.New(newTxs, mock.DB, poolCfg, kvcache.NewDummy(), *chainID, shanghaiTime, nil /* agraBlock */, cancunTime, nil, nil, nil, nil, maxBlobsPerBlock, nil, logger) -======= - mock.TxPool, err = txpool.New(newTxs, mock.DB, poolCfg, kvcache.NewDummy(), *chainID, shanghaiTime, nil /* agraBlock */, cancunTime, pragueTime, maxBlobsPerBlock, nil, logger) ->>>>>>> v3.0.0-alpha1 + mock.TxPool, err = txpool.New(newTxs, mock.DB, poolCfg, kvcache.NewDummy(), *chainID, shanghaiTime, nil /* agraBlock */, cancunTime, pragueTime, nil, nil, nil, nil, maxBlobsPerBlock, nil, logger) if err != nil { tb.Fatal(err) } @@ -455,84 +451,6 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK recents = bor.Recents signatures = bor.Signatures } -<<<<<<< HEAD - // proof-of-stake mining - assembleBlockPOS := func(param *core.BlockBuilderParameters, interrupt *int32) (*types.BlockWithReceipts, error) { - miningStatePos := stagedsync.NewProposingState(&cfg.Miner) - miningStatePos.MiningConfig.Etherbase = param.SuggestedFeeRecipient - proposingSync := stagedsync.New( - cfg.Sync, - stagedsync.MiningStages(mock.Ctx, - stagedsync.StageMiningCreateBlockCfg(mock.DB, miningStatePos, *mock.ChainConfig, mock.Engine, mock.txPoolDB, param, tmpdir, mock.BlockReader), - stagedsync.StageBorHeimdallCfg(mock.DB, snapDb, miningStatePos, *mock.ChainConfig, nil, mock.BlockReader, nil, nil, nil, recents, signatures, false, nil), - stagedsync.StageMiningExecCfg(mock.DB, miningStatePos, mock.Notifications.Events, *mock.ChainConfig, mock.Engine, &vm.Config{}, tmpdir, interrupt, param.PayloadId, mock.TxPool, mock.txPoolDB, false, mock.BlockReader), - stagedsync.StageHashStateCfg(mock.DB, dirs, cfg.HistoryV3), - stagedsync.StageTrieCfg(mock.DB, false, true, true, tmpdir, mock.BlockReader, nil, histV3, mock.agg), - stagedsync.StageMiningFinishCfg(mock.DB, *mock.ChainConfig, mock.Engine, miningStatePos, nil, mock.BlockReader, latestBlockBuiltStore), - ), stagedsync.MiningUnwindOrder, stagedsync.MiningPruneOrder, - logger) - // We start the mining step - if err := stages2.MiningStep(ctx, mock.DB, proposingSync, tmpdir, logger); err != nil { - return nil, err - } - block := <-miningStatePos.MiningResultPOSCh - return block, nil - } - - blockRetire := freezeblocks.NewBlockRetire(1, dirs, mock.BlockReader, blockWriter, mock.DB, mock.ChainConfig, mock.Notifications.Events, logger) - mock.Sync = stagedsync.New( - cfg.Sync, - stagedsync.DefaultStages(mock.Ctx, - stagedsync.StageSnapshotsCfg(mock.DB, *mock.ChainConfig, cfg.Sync, dirs, blockRetire, snapshotsDownloader, mock.BlockReader, mock.Notifications, mock.HistoryV3, mock.agg, false, false, nil), - stagedsync.StageHeadersCfg(mock.DB, mock.sentriesClient.Hd, mock.sentriesClient.Bd, *mock.ChainConfig, cfg.Sync, sendHeaderRequest, propagateNewBlockHashes, penalize, cfg.BatchSize, false, mock.BlockReader, blockWriter, dirs.Tmp, mock.Notifications, nil), - stagedsync.StageBorHeimdallCfg(mock.DB, snapDb, stagedsync.MiningState{}, *mock.ChainConfig, nil /* heimdallClient */, mock.BlockReader, nil, nil, nil, recents, signatures, false, nil), - stagedsync.StageBlockHashesCfg(mock.DB, mock.Dirs.Tmp, mock.ChainConfig, blockWriter), - stagedsync.StageBodiesCfg(mock.DB, mock.sentriesClient.Bd, sendBodyRequest, penalize, blockPropagator, cfg.Sync.BodyDownloadTimeoutSeconds, *mock.ChainConfig, mock.BlockReader, cfg.HistoryV3, blockWriter, nil), - stagedsync.StageSendersCfg(mock.DB, mock.ChainConfig, false, dirs.Tmp, prune, mock.BlockReader, mock.sentriesClient.Hd, nil), - stagedsync.StageExecuteBlocksCfg( - mock.DB, - prune, - cfg.BatchSize, - nil, - mock.ChainConfig, - mock.Engine, - &vm.Config{}, - mock.Notifications.Accumulator, - cfg.StateStream, - /*stateStream=*/ false, - /*exec22=*/ cfg.HistoryV3, - dirs, - mock.BlockReader, - mock.sentriesClient.Hd, - mock.gspec, - ethconfig.Defaults.Sync, - mock.agg, - nil, - ), - stagedsync.StageHashStateCfg(mock.DB, mock.Dirs, cfg.HistoryV3), - stagedsync.StageTrieCfg(mock.DB, checkStateRoot, true, false, dirs.Tmp, mock.BlockReader, mock.sentriesClient.Hd, cfg.HistoryV3, mock.agg), - stagedsync.StageHistoryCfg(mock.DB, prune, dirs.Tmp), - stagedsync.StageLogIndexCfg(mock.DB, prune, dirs.Tmp, nil), - stagedsync.StageCallTracesCfg(mock.DB, prune, 0, dirs.Tmp), - stagedsync.StageTxLookupCfg(mock.DB, prune, dirs.Tmp, mock.ChainConfig.Bor, mock.BlockReader), - stagedsync.StageFinishCfg(mock.DB, dirs.Tmp, forkValidator), - !withPosDownloader), - stagedsync.DefaultUnwindOrder, - stagedsync.DefaultPruneOrder, - logger, - ) - - cfg.Genesis = gspec - pipelineStages := stages2.NewPipelineStages(mock.Ctx, db, &cfg, p2p.Config{}, mock.sentriesClient, mock.Notifications, - snapshotsDownloader, mock.BlockReader, blockRetire, mock.agg, nil, forkValidator, logger, checkStateRoot) - mock.posStagedSync = stagedsync.New(cfg.Sync, pipelineStages, stagedsync.PipelineUnwindOrder, stagedsync.PipelinePruneOrder, logger) - - mock.Eth1ExecutionService = eth1.NewEthereumExecutionModule(mock.BlockReader, mock.DB, mock.posStagedSync, forkValidator, mock.ChainConfig, assembleBlockPOS, nil, mock.Notifications.Accumulator, mock.Notifications.StateChangesConsumer, logger, engine, histV3, ctx) - - mock.sentriesClient.Hd.StartPoSDownloader(mock.Ctx, sendHeaderRequest, penalize) - -======= ->>>>>>> v3.0.0-alpha1 miningConfig := cfg.Miner miningConfig.Enabled = true miningConfig.Noverify = false @@ -575,7 +493,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK nil, ), stagedsync.StageSendersCfg(mock.DB, mock.ChainConfig, cfg.Sync, false, dirs.Tmp, prune, mock.BlockReader, mock.sentriesClient.Hd, nil), - stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, mock.BlockReader), + stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, false, mock.BlockReader), stagedsync.StageMiningFinishCfg(mock.DB, *mock.ChainConfig, mock.Engine, miner, miningCancel, mock.BlockReader, latestBlockBuiltStore), ), stagedsync.MiningUnwindOrder, stagedsync.MiningPruneOrder, logger) @@ -631,11 +549,6 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK stagedsync.MiningStages(mock.Ctx, stagedsync.StageMiningCreateBlockCfg(mock.DB, miner, *mock.ChainConfig, mock.Engine, nil, nil, dirs.Tmp, mock.BlockReader), stagedsync.StageBorHeimdallCfg(mock.DB, snapDb, miner, *mock.ChainConfig, nil /*heimdallClient*/, mock.BlockReader, nil, nil, nil, recents, signatures, false, nil), -<<<<<<< HEAD - stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, false, mock.BlockReader), - stagedsync.StageHashStateCfg(mock.DB, dirs, cfg.HistoryV3), - stagedsync.StageTrieCfg(mock.DB, false, true, false, dirs.Tmp, mock.BlockReader, mock.sentriesClient.Hd, cfg.HistoryV3, mock.agg), -======= stagedsync.StageExecuteBlocksCfg( mock.DB, prune, @@ -655,8 +568,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK nil, ), stagedsync.StageSendersCfg(mock.DB, mock.ChainConfig, cfg.Sync, false, dirs.Tmp, prune, mock.BlockReader, mock.sentriesClient.Hd, nil), - stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, mock.BlockReader), ->>>>>>> v3.0.0-alpha1 + stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, false, mock.BlockReader), stagedsync.StageMiningFinishCfg(mock.DB, *mock.ChainConfig, mock.Engine, miner, miningCancel, mock.BlockReader, latestBlockBuiltStore), ), stagedsync.MiningUnwindOrder, diff --git a/turbo/transactions/call.go b/turbo/transactions/call.go index 9fae4c1fc0a..2975bc2979a 100644 --- a/turbo/transactions/call.go +++ b/turbo/transactions/call.go @@ -23,17 +23,11 @@ import ( "github.com/holiman/uint256" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/opstack" -======= "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" "github.com/erigontech/erigon-lib/log/v3" ->>>>>>> v3.0.0-alpha1 + "github.com/ledgerwatch/erigon-lib/opstack" "github.com/erigontech/erigon/consensus" "github.com/erigontech/erigon/core" @@ -238,12 +232,8 @@ func NewReusableCaller( return nil, err } -<<<<<<< HEAD - blockCtx := NewEVMBlockContext(engine, header, blockNrOrHash.RequireCanonical, tx, headerReader) - blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) -======= blockCtx := NewEVMBlockContext(engine, header, blockNrOrHash.RequireCanonical, tx, headerReader, chainConfig) ->>>>>>> v3.0.0-alpha1 + blockCtx.L1CostFunc = opstack.NewL1CostFunc(chainConfig, ibs) txCtx := core.NewEVMTxContext(msg) evm := vm.NewEVM(blockCtx, txCtx, ibs, chainConfig, vm.Config{NoBaseFee: true}) diff --git a/turbo/transactions/tracing.go b/turbo/transactions/tracing.go index c8b6b4734f0..f763f67ff25 100644 --- a/turbo/transactions/tracing.go +++ b/turbo/transactions/tracing.go @@ -26,24 +26,6 @@ import ( jsoniter "github.com/json-iterator/go" -<<<<<<< HEAD - "github.com/ledgerwatch/erigon-lib/chain" - libcommon "github.com/ledgerwatch/erigon-lib/common" - "github.com/ledgerwatch/erigon-lib/kv" - "github.com/ledgerwatch/erigon-lib/opstack" - - "github.com/ledgerwatch/erigon/consensus" - "github.com/ledgerwatch/erigon/core" - "github.com/ledgerwatch/erigon/core/state" - "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/core/vm" - "github.com/ledgerwatch/erigon/core/vm/evmtypes" - "github.com/ledgerwatch/erigon/eth/stagedsync" - "github.com/ledgerwatch/erigon/eth/tracers" - "github.com/ledgerwatch/erigon/eth/tracers/logger" - "github.com/ledgerwatch/erigon/turbo/rpchelper" - "github.com/ledgerwatch/erigon/turbo/services" -======= "github.com/erigontech/erigon-lib/chain" libcommon "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" @@ -59,7 +41,6 @@ import ( "github.com/erigontech/erigon/eth/tracers/logger" "github.com/erigontech/erigon/turbo/rpchelper" "github.com/erigontech/erigon/turbo/services" ->>>>>>> v3.0.0-alpha1 ) type BlockGetter interface { @@ -89,12 +70,8 @@ func ComputeTxEnv(ctx context.Context, engine consensus.EngineReader, block *typ } header := block.HeaderNoCopy() -<<<<<<< HEAD - blockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil) - blockContext.L1CostFunc = opstack.NewL1CostFunc(cfg, statedb) -======= blockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil, cfg) ->>>>>>> v3.0.0-alpha1 + blockContext.L1CostFunc = opstack.NewL1CostFunc(cfg, statedb) // Recompute transactions up to the target index. signer := types.MakeSigner(cfg, block.NumberU64(), block.Time())