Skip to content

Commit

Permalink
Resolve all conflicts under turbo/
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Aug 4, 2024
1 parent 245d355 commit 45aa005
Show file tree
Hide file tree
Showing 54 changed files with 146 additions and 1,710 deletions.
54 changes: 1 addition & 53 deletions status_merge.txt → merge_status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
Expand Down
9 changes: 2 additions & 7 deletions turbo/adapter/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/*
Expand Down
55 changes: 0 additions & 55 deletions turbo/app/snapshots_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 0 additions & 5 deletions turbo/cli/default_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions turbo/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),

Expand Down
69 changes: 9 additions & 60 deletions turbo/engineapi/engine_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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
}
}

Expand All @@ -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)

Expand Down Expand Up @@ -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"}
}

Expand All @@ -562,25 +515,21 @@ 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 {
status, err = s.getQuickPayloadStatusIfPossible(ctx, forkchoiceState.HeadHash, 0, libcommon.Hash{}, forkchoiceState, false)
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()
Expand Down
15 changes: 1 addition & 14 deletions turbo/engineapi/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
7 changes: 0 additions & 7 deletions turbo/execution/eth1/eth1_chain_reader.go/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 45aa005

Please sign in to comment.