Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recordingDb: add config, metrics, and size limits #1741

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arbnode/execution/block_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ type RecordResult struct {
BatchInfo []validator.BatchInfo
}

func NewBlockRecorder(execEngine *ExecutionEngine, ethDb ethdb.Database) *BlockRecorder {
func NewBlockRecorder(config *arbitrum.RecordingDatabaseConfig, execEngine *ExecutionEngine, ethDb ethdb.Database) *BlockRecorder {
recorder := &BlockRecorder{
execEngine: execEngine,
recordingDatabase: arbitrum.NewRecordingDatabase(ethDb, execEngine.bc),
recordingDatabase: arbitrum.NewRecordingDatabase(config, ethDb, execEngine.bc),
}
execEngine.SetRecorder(recorder)
return recorder
Expand Down
3 changes: 2 additions & 1 deletion arbnode/execution/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ func CreateExecutionNode(
fwTarget string,
fwConfig *ForwarderConfig,
rpcConfig arbitrum.Config,
recordingDbConfig *arbitrum.RecordingDatabaseConfig,
seqConfigFetcher SequencerConfigFetcher,
precheckConfigFetcher TxPreCheckerConfigFetcher,
) (*ExecutionNode, error) {
execEngine, err := NewExecutionEngine(l2BlockChain)
if err != nil {
return nil, err
}
recorder := NewBlockRecorder(execEngine, chainDB)
recorder := NewBlockRecorder(recordingDbConfig, execEngine, chainDB)
var txPublisher TransactionPublisher
var sequencer *Sequencer
seqConfig := seqConfigFetcher()
Expand Down
49 changes: 26 additions & 23 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,28 +307,29 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b
}

type Config struct {
RPC arbitrum.Config `koanf:"rpc"`
Sequencer execution.SequencerConfig `koanf:"sequencer" reload:"hot"`
L1Reader headerreader.Config `koanf:"parent-chain-reader" reload:"hot"`
InboxReader InboxReaderConfig `koanf:"inbox-reader" reload:"hot"`
DelayedSequencer DelayedSequencerConfig `koanf:"delayed-sequencer" reload:"hot"`
BatchPoster BatchPosterConfig `koanf:"batch-poster" reload:"hot"`
MessagePruner MessagePrunerConfig `koanf:"message-pruner" reload:"hot"`
ForwardingTargetImpl string `koanf:"forwarding-target"`
Forwarder execution.ForwarderConfig `koanf:"forwarder"`
TxPreChecker execution.TxPreCheckerConfig `koanf:"tx-pre-checker" reload:"hot"`
BlockValidator staker.BlockValidatorConfig `koanf:"block-validator" reload:"hot"`
Feed broadcastclient.FeedConfig `koanf:"feed" reload:"hot"`
Staker staker.L1ValidatorConfig `koanf:"staker"`
SeqCoordinator SeqCoordinatorConfig `koanf:"seq-coordinator"`
DataAvailability das.DataAvailabilityConfig `koanf:"data-availability"`
SyncMonitor SyncMonitorConfig `koanf:"sync-monitor"`
Dangerous DangerousConfig `koanf:"dangerous"`
Caching execution.CachingConfig `koanf:"caching"`
Archive bool `koanf:"archive"`
TxLookupLimit uint64 `koanf:"tx-lookup-limit"`
TransactionStreamer TransactionStreamerConfig `koanf:"transaction-streamer" reload:"hot"`
Maintenance MaintenanceConfig `koanf:"maintenance" reload:"hot"`
RPC arbitrum.Config `koanf:"rpc"`
Sequencer execution.SequencerConfig `koanf:"sequencer" reload:"hot"`
L1Reader headerreader.Config `koanf:"parent-chain-reader" reload:"hot"`
InboxReader InboxReaderConfig `koanf:"inbox-reader" reload:"hot"`
DelayedSequencer DelayedSequencerConfig `koanf:"delayed-sequencer" reload:"hot"`
BatchPoster BatchPosterConfig `koanf:"batch-poster" reload:"hot"`
MessagePruner MessagePrunerConfig `koanf:"message-pruner" reload:"hot"`
ForwardingTargetImpl string `koanf:"forwarding-target"`
Forwarder execution.ForwarderConfig `koanf:"forwarder"`
TxPreChecker execution.TxPreCheckerConfig `koanf:"tx-pre-checker" reload:"hot"`
BlockValidator staker.BlockValidatorConfig `koanf:"block-validator" reload:"hot"`
RecordingDB arbitrum.RecordingDatabaseConfig `koanf:"recording-database"`
Feed broadcastclient.FeedConfig `koanf:"feed" reload:"hot"`
Staker staker.L1ValidatorConfig `koanf:"staker"`
SeqCoordinator SeqCoordinatorConfig `koanf:"seq-coordinator"`
DataAvailability das.DataAvailabilityConfig `koanf:"data-availability"`
SyncMonitor SyncMonitorConfig `koanf:"sync-monitor"`
Dangerous DangerousConfig `koanf:"dangerous"`
Caching execution.CachingConfig `koanf:"caching"`
Archive bool `koanf:"archive"`
TxLookupLimit uint64 `koanf:"tx-lookup-limit"`
TransactionStreamer TransactionStreamerConfig `koanf:"transaction-streamer" reload:"hot"`
Maintenance MaintenanceConfig `koanf:"maintenance" reload:"hot"`
}

func (c *Config) Validate() error {
Expand Down Expand Up @@ -392,6 +393,7 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet, feedInputEnable bool, feed
execution.AddOptionsForNodeForwarderConfig(prefix+".forwarder", f)
execution.TxPreCheckerConfigAddOptions(prefix+".tx-pre-checker", 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 @@ -418,6 +420,7 @@ var ConfigDefault = Config{
ForwardingTargetImpl: "",
TxPreChecker: execution.DefaultTxPreCheckerConfig,
BlockValidator: staker.DefaultBlockValidatorConfig,
RecordingDB: arbitrum.DefaultRecordingDatabaseConfig,
Feed: broadcastclient.FeedConfigDefault,
Staker: staker.DefaultL1ValidatorConfig,
SeqCoordinator: DefaultSeqCoordinatorConfig,
Expand Down Expand Up @@ -605,7 +608,7 @@ 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,
config.ForwardingTarget(), &config.Forwarder, config.RPC, &config.RecordingDB,
sequencerConfigFetcher, txprecheckConfigFetcher)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
1 change: 1 addition & 0 deletions staker/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ validationsLoop:
log.Error("failed writing new validated to database", "pos", pos, "err", err)
}
atomicStorePos(&v.validatedA, pos+1)
v.validations.Delete(pos)
nonBlockingTrigger(v.createNodesChan)
nonBlockingTrigger(v.sendRecordChan)
validatorMsgCountValidatedGauge.Update(int64(pos + 1))
Expand Down