Skip to content

Commit

Permalink
fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahee committed Jul 10, 2023
1 parent 36d3bca commit 6981654
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 55 deletions.
58 changes: 15 additions & 43 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
flag "github.com/spf13/pflag"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -371,7 +370,6 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet, feedInputEnable bool, feed
BatchPosterConfigAddOptions(prefix+".batch-poster", f)
MessagePrunerConfigAddOptions(prefix+".message-pruner", f)
staker.BlockValidatorConfigAddOptions(prefix+".block-validator", f)
arbitrum.RecordingDatabaseConfigAddOptions(prefix+".recording-database", f)
broadcastclient.FeedConfigAddOptions(prefix+".feed", f, feedInputEnable, feedOutputEnable)
staker.L1ValidatorConfigAddOptions(prefix+".staker", f)
SeqCoordinatorConfigAddOptions(prefix+".seq-coordinator", f)
Expand All @@ -380,32 +378,22 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet, feedInputEnable bool, feed
DangerousConfigAddOptions(prefix+".dangerous", f)
TransactionStreamerConfigAddOptions(prefix+".transaction-streamer", f)
MaintenanceConfigAddOptions(prefix+".maintenance", f)

archiveMsg := fmt.Sprintf("retain past block state (deprecated, please use %v.caching.archive)", prefix)
f.Bool(prefix+".archive", ConfigDefault.Archive, archiveMsg)
}

var ConfigDefault = Config{
RPC: arbitrum.DefaultConfig,
Sequencer: execution.DefaultSequencerConfig,
L1Reader: headerreader.DefaultConfig,
InboxReader: DefaultInboxReaderConfig,
DelayedSequencer: DefaultDelayedSequencerConfig,
BatchPoster: DefaultBatchPosterConfig,
MessagePruner: DefaultMessagePrunerConfig,
ForwardingTargetImpl: "",
TxPreChecker: execution.DefaultTxPreCheckerConfig,
BlockValidator: staker.DefaultBlockValidatorConfig,
Feed: broadcastclient.FeedConfigDefault,
Staker: staker.DefaultL1ValidatorConfig,
SeqCoordinator: DefaultSeqCoordinatorConfig,
DataAvailability: das.DefaultDataAvailabilityConfig,
SyncMonitor: DefaultSyncMonitorConfig,
Dangerous: DefaultDangerousConfig,
Archive: false,
TxLookupLimit: 126_230_400, // 1 year at 4 blocks per second
Caching: execution.DefaultCachingConfig,
TransactionStreamer: DefaultTransactionStreamerConfig,
L1Reader: headerreader.DefaultConfig,
InboxReader: DefaultInboxReaderConfig,
DelayedSequencer: DefaultDelayedSequencerConfig,
BatchPoster: DefaultBatchPosterConfig,
MessagePruner: DefaultMessagePrunerConfig,
BlockValidator: staker.DefaultBlockValidatorConfig,
Feed: broadcastclient.FeedConfigDefault,
Staker: staker.DefaultL1ValidatorConfig,
SeqCoordinator: DefaultSeqCoordinatorConfig,
DataAvailability: das.DefaultDataAvailabilityConfig,
SyncMonitor: DefaultSyncMonitorConfig,
Dangerous: DefaultDangerousConfig,
TransactionStreamer: DefaultTransactionStreamerConfig,
}

func ConfigDefaultL1Test() *Config {
Expand Down Expand Up @@ -579,15 +567,6 @@ func createNodeImpl(
}
}

sequencerConfigFetcher := func() *execution.SequencerConfig { return &configFetcher.Get().Sequencer }
txprecheckConfigFetcher := func() *execution.TxPreCheckerConfig { return &configFetcher.Get().TxPreChecker }
exec, err := execution.CreateExecutionNode(stack, chainDb, l2BlockChain, l1Reader, syncMonitor,
config.ForwardingTarget(), &config.Forwarder, config.RPC,
sequencerConfigFetcher, txprecheckConfigFetcher)
if err != nil {
return nil, err
}

var broadcastServer *broadcaster.Broadcaster
if config.Feed.Output.Enable {
var maybeDataSigner signature.DataSignerFunc
Expand Down Expand Up @@ -797,7 +776,7 @@ func createNodeImpl(
}

notifiers := make([]staker.LatestStakedNotifier, 0)
if config.MessagePruner.Enable && !config.Caching.Archive {
if config.MessagePruner.Enable {
messagePruner = NewMessagePruner(txStreamer, inboxTracker, func() *MessagePrunerConfig { return &configFetcher.Get().MessagePruner })
notifiers = append(notifiers, messagePruner)
}
Expand Down Expand Up @@ -834,10 +813,7 @@ func createNodeImpl(
return nil, err
}
}
var messagePruner *MessagePruner
if config.MessagePruner.Enable && !config.Caching.Archive && stakerObj != nil {
messagePruner = NewMessagePruner(txStreamer, inboxTracker, stakerObj, func() *MessagePrunerConfig { return &configFetcher.Get().MessagePruner })
}

// always create DelayedSequencer, it won't do anything if it is disabled
delayedSequencer, err = NewDelayedSequencer(l1Reader, inboxReader, exec, coordinator, func() *DelayedSequencerConfig { return &configFetcher.Get().DelayedSequencer })
if err != nil {
Expand Down Expand Up @@ -973,10 +949,6 @@ func (n *Node) Start(ctx context.Context) error {
return fmt.Errorf("error starting inbox reader: %w", err)
}
}
err = n.Execution.TxPublisher.Start(ctx)
if err != nil {
return fmt.Errorf("error starting transaction puiblisher: %w", err)
}
if n.SeqCoordinator != nil {
n.SeqCoordinator.Start(ctx)
}
Expand Down
27 changes: 15 additions & 12 deletions execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ func DangerousConfigAddOptions(prefix string, f *flag.FlagSet) {
}

type Config struct {
L1Reader headerreader.Config `koanf:"l1-reader" reload:"hot"`
Sequencer SequencerConfig `koanf:"sequencer" reload:"hot"`
TxPreChecker TxPreCheckerConfig `koanf:"tx-pre-checker" reload:"hot"`
Forwarder ForwarderConfig `koanf:"forwarder"`
ForwardingTargetImpl string `koanf:"forwarding-target"`
Caching CachingConfig `koanf:"caching"`
RPC arbitrum.Config `koanf:"rpc"`
Archive bool `koanf:"archive"`
TxLookupLimit uint64 `koanf:"tx-lookup-limit"`
Dangerous DangerousConfig `koanf:"dangerous"`
L1Reader headerreader.Config `koanf:"l1-reader" reload:"hot"`
Sequencer SequencerConfig `koanf:"sequencer" reload:"hot"`
RecordingDB arbitrum.RecordingDatabaseConfig `koanf:"recording-database"`
TxPreChecker TxPreCheckerConfig `koanf:"tx-pre-checker" reload:"hot"`
Forwarder ForwarderConfig `koanf:"forwarder"`
ForwardingTargetImpl string `koanf:"forwarding-target"`
Caching CachingConfig `koanf:"caching"`
RPC arbitrum.Config `koanf:"rpc"`
Archive bool `koanf:"archive"`
TxLookupLimit uint64 `koanf:"tx-lookup-limit"`
Dangerous DangerousConfig `koanf:"dangerous"`
}

func (c *Config) ForwardingTarget() string {
Expand All @@ -68,12 +69,12 @@ func (c *Config) Validate() error {
func ConfigAddOptions(prefix string, f *flag.FlagSet) {
arbitrum.ConfigAddOptions(prefix+".rpc", f)
SequencerConfigAddOptions(prefix+".sequencer", f)
arbitrum.RecordingDatabaseConfigAddOptions(prefix+".recording-database", f)
f.String(prefix+".forwarding-target", ConfigDefault.ForwardingTargetImpl, "transaction forwarding target URL, or \"null\" to disable forwarding (iff not sequencer)")
AddOptionsForNodeForwarderConfig(prefix+".forwarder", f)
TxPreCheckerConfigAddOptions(prefix+".tx-pre-checker", f)
CachingConfigAddOptions(prefix+".caching", f)
f.Uint64(prefix+".tx-lookup-limit", ConfigDefault.TxLookupLimit, "retain the ability to lookup transactions by hash for the past N blocks (0 = all blocks)")

archiveMsg := fmt.Sprintf("retain past block state (deprecated, please use %v.caching.archive)", prefix)
f.Bool(prefix+".archive", ConfigDefault.Archive, archiveMsg)
DangerousConfigAddOptions(prefix+".dangerous", f)
Expand All @@ -82,11 +83,13 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet) {
var ConfigDefault = Config{
RPC: arbitrum.DefaultConfig,
Sequencer: DefaultSequencerConfig,
RecordingDB: arbitrum.DefaultRecordingDatabaseConfig,
ForwardingTargetImpl: "",
TxPreChecker: DefaultTxPreCheckerConfig,
Archive: false,
TxLookupLimit: 126_230_400, // 1 year at 4 blocks per second
Caching: DefaultCachingConfig,
Dangerous: DefaultDangerousConfig,
}

func ConfigDefaultNonSequencerTest() *Config {
Expand Down Expand Up @@ -132,7 +135,7 @@ func CreateExecutionNode(
if err != nil {
return nil, err
}
recorder := NewBlockRecorder(execEngine, chainDB)
recorder := NewBlockRecorder(&config.RecordingDB, execEngine, chainDB)
var txPublisher TransactionPublisher
var sequencer *Sequencer

Expand Down

0 comments on commit 6981654

Please sign in to comment.