Skip to content
Open
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
44 changes: 22 additions & 22 deletions ethstorage/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (n *EsNode) initL2(ctx context.Context, cfg *Config) error {
}

func (n *EsNode) initL1(ctx context.Context, cfg *Config) error {
client, err := eth.Dial(cfg.L1.L1NodeAddr, cfg.Storage.L1Contract, cfg.L1.L1BlockTime, n.lg)
client, err := eth.Dial(cfg.L1.L1NodeAddr, cfg.Storage.L1Contract, 1, n.lg)
if err != nil {
return fmt.Errorf("failed to create L1 source: %w", err)
}
Expand All @@ -166,7 +166,7 @@ func (n *EsNode) initL1(ctx context.Context, cfg *Config) error {
return fmt.Errorf("no L1 beacon or DA URL provided")
}
if cfg.RandaoSourceURL != "" {
rc, err := eth.DialRandaoSource(ctx, cfg.RandaoSourceURL, cfg.L1.L1NodeAddr, cfg.L1.L1BlockTime, n.lg)
rc, err := eth.DialRandaoSource(ctx, cfg.RandaoSourceURL, cfg.L1.L1NodeAddr, 1, n.lg)
if err != nil {
return fmt.Errorf("failed to create randao source: %w", err)
}
Expand All @@ -191,26 +191,26 @@ func (n *EsNode) startL1(cfg *Config) {
}
n.lg.Error("L1 heads subscription error", "err", err)
}()

// Keep subscribed to the randao heads, which helps miner to get proper random seeds
n.randaoHeadsSub = event.ResubscribeErr(time.Second*10, func(ctx context.Context, err error) (event.Subscription, error) {
if err != nil {
n.lg.Warn("Resubscribing after failed randao head subscription", "err", err)
}
if n.randaoSource != nil {
return eth.WatchHeadChanges(n.resourcesCtx, n.randaoSource, n.OnNewRandaoSourceHead)
} else {
return eth.WatchHeadChanges(n.resourcesCtx, n.l1Source, n.OnNewRandaoSourceHead)
}
})
go func() {
err, ok := <-n.randaoHeadsSub.Err()
if !ok {
return
}
n.lg.Error("Randao heads subscription error", "err", err)
}()

if n.miner != nil {
// Keep subscribed to the randao heads, which helps miner to get proper random seeds
n.randaoHeadsSub = event.ResubscribeErr(time.Second*10, func(ctx context.Context, err error) (event.Subscription, error) {
if err != nil {
n.lg.Warn("Resubscribing after failed randao head subscription", "err", err)
}
if n.randaoSource != nil {
return eth.WatchHeadChanges(n.resourcesCtx, n.randaoSource, n.OnNewRandaoSourceHead)
} else {
return eth.WatchHeadChanges(n.resourcesCtx, n.l1Source, n.OnNewRandaoSourceHead)
}
})
go func() {
err, ok := <-n.randaoHeadsSub.Err()
if !ok {
return
}
n.lg.Error("Randao heads subscription error", "err", err)
}()
}
// Poll for the safe L1 block and finalized block,
// which only change once per epoch at most and may be delayed.
n.l1SafeSub = eth.PollBlockChanges(n.resourcesCtx, n.lg, n.l1Source, n.OnNewL1Safe, ethRPC.SafeBlockNumber,
Expand Down
Loading