Skip to content

Commit

Permalink
Resolve all conflicts under eth/
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Aug 10, 2024
1 parent 527a3d8 commit f829b7b
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 426 deletions.
134 changes: 3 additions & 131 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ import (
"sync/atomic"
"time"

<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/common/dir"
"github.com/ledgerwatch/erigon-lib/common/disk"
"github.com/ledgerwatch/erigon-lib/common/mem"
"github.com/ledgerwatch/erigon-lib/diagnostics"

=======
>>>>>>> v3.0.0-alpha1
"github.com/erigontech/mdbx-go/mdbx"
lru "github.com/hashicorp/golang-lru/arc/v2"
"github.com/holiman/uint256"
Expand All @@ -54,90 +46,6 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/protobuf/types/known/emptypb"

<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/chain"
"github.com/ledgerwatch/erigon-lib/chain/networkname"
"github.com/ledgerwatch/erigon-lib/chain/snapcfg"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/datadir"
"github.com/ledgerwatch/erigon-lib/direct"
"github.com/ledgerwatch/erigon-lib/downloader"
"github.com/ledgerwatch/erigon-lib/downloader/downloadercfg"
"github.com/ledgerwatch/erigon-lib/downloader/downloadergrpc"
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
protodownloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
"github.com/ledgerwatch/erigon-lib/gointerfaces/grpcutil"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
rpcsentinel "github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
protosentry "github.com/ledgerwatch/erigon-lib/gointerfaces/sentry"
txpoolproto "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool"
prototypes "github.com/ledgerwatch/erigon-lib/gointerfaces/types"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/kvcache"
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
"github.com/ledgerwatch/erigon-lib/kv/remotedbserver"
libstate "github.com/ledgerwatch/erigon-lib/state"
"github.com/ledgerwatch/erigon-lib/txpool"
"github.com/ledgerwatch/erigon-lib/txpool/txpoolcfg"
"github.com/ledgerwatch/erigon-lib/txpool/txpooluitl"
libtypes "github.com/ledgerwatch/erigon-lib/types"
"github.com/ledgerwatch/erigon-lib/wrap"
"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cl/persistence/db_config"
"github.com/ledgerwatch/erigon/cl/persistence/format/snapshot_format/getters"
clcore "github.com/ledgerwatch/erigon/cl/phase1/core"
executionclient "github.com/ledgerwatch/erigon/cl/phase1/execution_client"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/cmd/caplin/caplin1"
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/erigon/common/debug"
"github.com/ledgerwatch/erigon/consensus"
"github.com/ledgerwatch/erigon/consensus/clique"
"github.com/ledgerwatch/erigon/consensus/ethash"
"github.com/ledgerwatch/erigon/consensus/merge"
"github.com/ledgerwatch/erigon/consensus/misc"
"github.com/ledgerwatch/erigon/core"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/rawdb/blockio"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/core/vm"
"github.com/ledgerwatch/erigon/crypto"
"github.com/ledgerwatch/erigon/eth/ethconfig"
"github.com/ledgerwatch/erigon/eth/ethconsensusconfig"
"github.com/ledgerwatch/erigon/eth/ethutils"
"github.com/ledgerwatch/erigon/eth/protocols/eth"
"github.com/ledgerwatch/erigon/eth/stagedsync"
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
"github.com/ledgerwatch/erigon/ethdb/privateapi"
"github.com/ledgerwatch/erigon/ethdb/prune"
"github.com/ledgerwatch/erigon/ethstats"
"github.com/ledgerwatch/erigon/node"
"github.com/ledgerwatch/erigon/p2p"
"github.com/ledgerwatch/erigon/p2p/enode"
"github.com/ledgerwatch/erigon/p2p/sentry"
"github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client"
"github.com/ledgerwatch/erigon/params"
"github.com/ledgerwatch/erigon/polygon/bor"
"github.com/ledgerwatch/erigon/polygon/bor/finality/flags"
"github.com/ledgerwatch/erigon/polygon/bor/valset"
"github.com/ledgerwatch/erigon/polygon/heimdall"
polygonsync "github.com/ledgerwatch/erigon/polygon/sync"
"github.com/ledgerwatch/erigon/rpc"
"github.com/ledgerwatch/erigon/turbo/builder"
"github.com/ledgerwatch/erigon/turbo/engineapi"
"github.com/ledgerwatch/erigon/turbo/engineapi/engine_block_downloader"
"github.com/ledgerwatch/erigon/turbo/engineapi/engine_helpers"
"github.com/ledgerwatch/erigon/turbo/execution/eth1"
"github.com/ledgerwatch/erigon/turbo/execution/eth1/eth1_chain_reader.go"
"github.com/ledgerwatch/erigon/turbo/jsonrpc"
"github.com/ledgerwatch/erigon/turbo/services"
"github.com/ledgerwatch/erigon/turbo/shards"
"github.com/ledgerwatch/erigon/turbo/silkworm"
"github.com/ledgerwatch/erigon/turbo/snapshotsync/freezeblocks"
"github.com/ledgerwatch/erigon/turbo/snapshotsync/snap"
stages2 "github.com/ledgerwatch/erigon/turbo/stages"
"github.com/ledgerwatch/erigon/turbo/stages/headerdownload"
=======
"github.com/erigontech/erigon-lib/chain"
"github.com/erigontech/erigon-lib/chain/networkname"
"github.com/erigontech/erigon-lib/chain/snapcfg"
Expand Down Expand Up @@ -230,7 +138,6 @@ import (
"github.com/erigontech/erigon/turbo/snapshotsync/snap"
stages2 "github.com/erigontech/erigon/turbo/stages"
"github.com/erigontech/erigon/turbo/stages/headerdownload"
>>>>>>> v3.0.0-alpha1
)

// Config contains the configuration options of the ETH protocol.
Expand Down Expand Up @@ -425,7 +332,6 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
backend.genesisBlock = genesis
backend.genesisHash = genesis.Hash()

<<<<<<< HEAD
if chainConfig.IsOptimism() {
if chainConfig.RegolithTime == nil {
log.Warn("Optimism RegolithTime has not been set")
Expand All @@ -441,8 +347,6 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
}
}

=======
>>>>>>> v3.0.0-alpha1
setBorDefaultMinerGasPrice(chainConfig, config, logger)
setBorDefaultTxPoolPriceLimit(chainConfig, config.TxPool, logger)

Expand Down Expand Up @@ -788,14 +692,9 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger

backend.newTxs = make(chan libtypes.Announcements, 1024)
//defer close(newTxs)
<<<<<<< HEAD
config.TxPool.Optimism = chainConfig.Optimism != nil
backend.txPoolDB, backend.txPool, backend.txPoolFetch, backend.txPoolSend, backend.txPoolGrpcServer, err = txpooluitl.AllComponents(
ctx, config.TxPool, kvcache.NewDummy(), backend.newTxs, backend.chainDB, backend.sentriesClient.Sentries(), stateDiffClient, misc.Eip1559FeeCalculator, logger,
=======
backend.txPoolDB, backend.txPool, backend.txPoolFetch, backend.txPoolSend, backend.txPoolGrpcServer, err = txpoolutil.AllComponents(
ctx, config.TxPool, kvcache.NewDummy(), backend.newTxs, chainKv, backend.sentriesClient.Sentries(), stateDiffClient, misc.Eip1559FeeCalculator, logger,
>>>>>>> v3.0.0-alpha1
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -826,12 +725,6 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
config.Sync,
stagedsync.MiningStages(backend.sentryCtx,
stagedsync.StageMiningCreateBlockCfg(backend.chainDB, miner, *backend.chainConfig, backend.engine, backend.txPoolDB, nil, tmpdir, backend.blockReader),
<<<<<<< HEAD
stagedsync.StageBorHeimdallCfg(backend.chainDB, snapDb, miner, *backend.chainConfig, heimdallClient, backend.blockReader, nil, nil, nil, recents, signatures, false, nil),
stagedsync.StageMiningExecCfg(backend.chainDB, miner, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, nil, 0, backend.txPool, backend.txPoolDB, false, blockReader),
stagedsync.StageHashStateCfg(backend.chainDB, dirs, config.HistoryV3),
stagedsync.StageTrieCfg(backend.chainDB, false, true, true, tmpdir, blockReader, nil, config.HistoryV3, backend.agg),
=======
stagedsync.StageBorHeimdallCfg(backend.chainDB, snapDb, miner, *backend.chainConfig, heimdallClient, backend.blockReader, nil, nil, nil, recents, signatures, false, nil), stagedsync.StageExecuteBlocksCfg(
backend.chainDB,
config.Prune,
Expand All @@ -851,8 +744,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
stages2.SilkwormForExecutionStage(backend.silkworm, config),
),
stagedsync.StageSendersCfg(backend.chainDB, chainConfig, config.Sync, false, dirs.Tmp, config.Prune, blockReader, backend.sentriesClient.Hd, loopBreakCheck),
stagedsync.StageMiningExecCfg(backend.chainDB, miner, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, nil, 0, backend.txPool, backend.txPoolDB, blockReader),
>>>>>>> v3.0.0-alpha1
stagedsync.StageMiningExecCfg(backend.chainDB, miner, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, nil, 0, backend.txPool, backend.txPoolDB, false, blockReader),
stagedsync.StageMiningFinishCfg(backend.chainDB, *backend.chainConfig, backend.engine, miner, backend.miningSealingQuit, backend.blockReader, latestBlockBuiltStore),
), stagedsync.MiningUnwindOrder, stagedsync.MiningPruneOrder,
logger)
Expand All @@ -874,14 +766,6 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
stagedsync.MiningStages(backend.sentryCtx,
stagedsync.StageMiningCreateBlockCfg(backend.chainDB, miningStatePos, *backend.chainConfig, backend.engine, backend.txPoolDB, param, tmpdir, backend.blockReader),
stagedsync.StageBorHeimdallCfg(backend.chainDB, snapDb, miningStatePos, *backend.chainConfig, heimdallClient, backend.blockReader, nil, nil, nil, recents, signatures, false, nil),
<<<<<<< HEAD
stagedsync.StageMiningExecCfg(backend.chainDB, miningStatePos, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, interrupt, param.PayloadId, backend.txPool, backend.txPoolDB, param.NoTxPool, blockReader),
stagedsync.StageHashStateCfg(backend.chainDB, dirs, config.HistoryV3),
stagedsync.StageTrieCfg(backend.chainDB, false, true, true, tmpdir, blockReader, nil, config.HistoryV3, backend.agg),
stagedsync.StageMiningFinishCfg(backend.chainDB, *backend.chainConfig, backend.engine, miningStatePos, backend.miningSealingQuit, backend.blockReader, latestBlockBuiltStore),
), stagedsync.MiningUnwindOrder, stagedsync.MiningPruneOrder,
logger)
=======
stagedsync.StageExecuteBlocksCfg(
backend.chainDB,
config.Prune,
Expand All @@ -901,9 +785,8 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
stages2.SilkwormForExecutionStage(backend.silkworm, config),
),
stagedsync.StageSendersCfg(backend.chainDB, chainConfig, config.Sync, false, dirs.Tmp, config.Prune, blockReader, backend.sentriesClient.Hd, loopBreakCheck),
stagedsync.StageMiningExecCfg(backend.chainDB, miningStatePos, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, interrupt, param.PayloadId, backend.txPool, backend.txPoolDB, blockReader),
stagedsync.StageMiningExecCfg(backend.chainDB, miningStatePos, backend.notifications.Events, *backend.chainConfig, backend.engine, &vm.Config{}, tmpdir, interrupt, param.PayloadId, backend.txPool, backend.txPoolDB, param.NoTxPool, blockReader),
stagedsync.StageMiningFinishCfg(backend.chainDB, *backend.chainConfig, backend.engine, miningStatePos, backend.miningSealingQuit, backend.blockReader, latestBlockBuiltStore)), stagedsync.MiningUnwindOrder, stagedsync.MiningPruneOrder, logger)
>>>>>>> v3.0.0-alpha1
// We start the mining step
if err := stages2.MiningStep(ctx, backend.chainDB, proposingSync, tmpdir, logger); err != nil {
return nil, err
Expand Down Expand Up @@ -1220,11 +1103,7 @@ func (s *Ethereum) Init(stack *node.Node, config *ethconfig.Config, chainConfig
}
}

<<<<<<< HEAD
s.apiList = jsonrpc.APIList(chainKv, ethRpcClient, txPoolRpcClient, miningRpcClient, ff, stateCache, blockReader, s.agg, &httpRpcCfg, s.engine, s.seqRPCService, s.historicalRPCService, s.logger)
=======
s.apiList = jsonrpc.APIList(chainKv, ethRpcClient, txPoolRpcClient, miningRpcClient, ff, stateCache, blockReader, &httpRpcCfg, s.engine, s.logger)
>>>>>>> v3.0.0-alpha1
s.apiList = jsonrpc.APIList(chainKv, ethRpcClient, txPoolRpcClient, miningRpcClient, ff, stateCache, blockReader, &httpRpcCfg, s.engine, s.seqRPCService, s.historicalRPCService, s.logger)

if config.SilkwormRpcDaemon && httpRpcCfg.Enabled {
interface_log_settings := silkworm.RpcInterfaceLogSettings{
Expand Down Expand Up @@ -1703,11 +1582,7 @@ func (s *Ethereum) Start() error {
nodeStages := s.stagedSync.StagesIdsList()

if params.IsChainPoS(s.chainConfig, currentTDProvider) {
<<<<<<< HEAD
nodeStages = s.pipelineStagedSync.StagesIdsList()
=======
diagnostics.Send(diagnostics.SyncStageList{StagesList: diagnostics.InitStagesFromList(s.pipelineStagedSync.StagesIdsList())})
>>>>>>> v3.0.0-alpha1
s.waitForStageLoopStop = nil // TODO: Ethereum.Stop should wait for execution_server shutdown
go s.eth1ExecutionServer.Start(s.sentryCtx)
} else if s.config.PolygonSync {
Expand Down Expand Up @@ -1938,8 +1813,6 @@ func setBorDefaultTxPoolPriceLimit(chainConfig *chain.Config, config txpoolcfg.C
config.MinFeeCap = txpoolcfg.BorDefaultTxPoolPriceLimit
}
}
<<<<<<< HEAD
=======

func polygonSyncSentry(sentries []direct.SentryClient) direct.SentryClient {
// TODO - pending sentry multi client refactor
Expand All @@ -1960,4 +1833,3 @@ func polygonSyncSentry(sentries []direct.SentryClient) direct.SentryClient {

return sentryClient
}
>>>>>>> v3.0.0-alpha1
3 changes: 0 additions & 3 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,12 @@ type Config struct {

OverridePragueTime *big.Int `toml:",omitempty"`

<<<<<<< HEAD
RollupSequencerHTTP string
RollupHistoricalRPC string
RollupHistoricalRPCTimeout time.Duration

ForcePartialCommit bool

=======
>>>>>>> v3.0.0-alpha1
// Embedded Silkworm support
SilkwormExecution bool
SilkwormRpcDaemon bool
Expand Down
28 changes: 3 additions & 25 deletions eth/gasprice/gasprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ import (
"math/big"

"github.com/holiman/uint256"
<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/chain"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/eth/gasprice/gaspricecfg"
"github.com/ledgerwatch/erigon/params"
"github.com/ledgerwatch/log/v3"
=======
>>>>>>> v3.0.0-alpha1

"github.com/erigontech/erigon-lib/chain"
libcommon "github.com/erigontech/erigon-lib/common"
Expand Down Expand Up @@ -76,11 +68,9 @@ type Oracle struct {
percentile int
maxHeaderHistory, maxBlockHistory int

<<<<<<< HEAD
minSuggestedPriorityFee *big.Int // for Optimism fee suggestion
=======
log log.Logger
>>>>>>> v3.0.0-alpha1

minSuggestedPriorityFee *big.Int // for Optimism fee suggestion
}

// NewOracle returns a new gasprice oracle which can recommend suitable
Expand Down Expand Up @@ -111,15 +101,9 @@ func NewOracle(backend OracleBackend, params gaspricecfg.Config, cache Cache, lo
log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
}

<<<<<<< HEAD
setBorDefaultGpoIgnorePrice(backend.ChainConfig(), params)

r := &Oracle{
=======
setBorDefaultGpoIgnorePrice(backend.ChainConfig(), params, log)

return &Oracle{
>>>>>>> v3.0.0-alpha1
r := &Oracle{
backend: backend,
lastPrice: params.Default,
maxPrice: maxPrice,
Expand Down Expand Up @@ -326,21 +310,15 @@ func (s *sortingHeap) Pop() interface{} {
return x
}

<<<<<<< HEAD
type bigIntArray []*big.Int

func (s bigIntArray) Len() int { return len(s) }
func (s bigIntArray) Less(i, j int) bool { return s[i].Cmp(s[j]) < 0 }
func (s bigIntArray) Swap(i, j int) { s[i], s[j] = s[j], s[i] }

// setBorDefaultGpoIgnorePrice enforces gpo IgnorePrice to be equal to BorDefaultGpoIgnorePrice (25gwei by default)
// only for polygon amoy network.
func setBorDefaultGpoIgnorePrice(chainConfig *chain.Config, gasPriceConfig gaspricecfg.Config) {
=======
// setBorDefaultGpoIgnorePrice enforces gpo IgnorePrice to be equal to BorDefaultGpoIgnorePrice (25gwei by default)
// only for polygon amoy network.
func setBorDefaultGpoIgnorePrice(chainConfig *chain.Config, gasPriceConfig gaspricecfg.Config, log log.Logger) {
>>>>>>> v3.0.0-alpha1
if chainConfig.Bor != nil && chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 && gasPriceConfig.IgnorePrice != gaspricecfg.BorDefaultGpoIgnorePrice {
log.Warn("Sanitizing invalid bor gasprice oracle ignore price", "provided", gasPriceConfig.IgnorePrice, "updated", gaspricecfg.BorDefaultGpoIgnorePrice)
gasPriceConfig.IgnorePrice = gaspricecfg.BorDefaultGpoIgnorePrice
Expand Down
21 changes: 0 additions & 21 deletions eth/protocols/eth/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ package eth
import (
"context"
"fmt"
<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/chain"

libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/rlp"
"github.com/ledgerwatch/erigon/turbo/services"
"github.com/ledgerwatch/log/v3"
=======
"github.com/erigontech/erigon-lib/chain"
libcommon "github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/kv"
Expand All @@ -43,7 +31,6 @@ import (
"github.com/erigontech/erigon/core/types"
"github.com/erigontech/erigon/rlp"
"github.com/erigontech/erigon/turbo/services"
>>>>>>> v3.0.0-alpha1
)

func AnswerGetBlockHeadersQuery(db kv.Tx, query *GetBlockHeadersPacket, blockReader services.HeaderAndCanonicalReader) ([]*types.Header, error) {
Expand Down Expand Up @@ -172,15 +159,11 @@ func AnswerGetBlockBodiesQuery(db kv.Tx, query GetBlockBodiesPacket, blockReader
return bodies
}

<<<<<<< HEAD
func AnswerGetReceiptsQuery(chainCfg *chain.Config, br services.FullBlockReader, db kv.Tx, query GetReceiptsPacket) ([]rlp.RawValue, error) { //nolint:unparam
=======
type ReceiptsGetter interface {
GetReceipts(ctx context.Context, cfg *chain.Config, tx kv.Tx, block *types.Block, senders []libcommon.Address) (types.Receipts, error)
}

func AnswerGetReceiptsQuery(ctx context.Context, cfg *chain.Config, receiptsGetter ReceiptsGetter, br services.FullBlockReader, db kv.Tx, query GetReceiptsPacket) ([]rlp.RawValue, error) { //nolint:unparam
>>>>>>> v3.0.0-alpha1
// Gather state data until the fetch or network limits is reached
var (
bytes int
Expand All @@ -204,16 +187,12 @@ func AnswerGetReceiptsQuery(ctx context.Context, cfg *chain.Config, receiptsGett
if b == nil {
return nil, nil
}
<<<<<<< HEAD
results := rawdb.ReadReceipts(chainCfg, db, b, s)
=======

results, err := receiptsGetter.GetReceipts(ctx, cfg, db, b, s)
if err != nil {
return nil, err
}

>>>>>>> v3.0.0-alpha1
if results == nil {
header, err := rawdb.ReadHeaderByHash(db, hash)
if err != nil {
Expand Down
Loading

0 comments on commit f829b7b

Please sign in to comment.