Commit 566be7c4 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into 03-30-create_OptimistAllowlist_contract

parents 70ef4746 4b144088
---
'@eth-optimism/data-transport-layer': patch
---
Add better logging to DTL about shutoff block
...@@ -202,11 +202,18 @@ type SyncClient struct { ...@@ -202,11 +202,18 @@ type SyncClient struct {
results chan syncResult results chan syncResult
receivePayload receivePayloadFn
// resource context: all peers and mainLoop tasks inherit this, and start shutting down once resCancel() is called.
resCtx context.Context resCtx context.Context
resCancel context.CancelFunc resCancel context.CancelFunc
receivePayload receivePayloadFn // wait group: wait for the resources to close. Adding to this is only safe if the peersLock is held.
wg sync.WaitGroup wg sync.WaitGroup
// Don't allow anything to be added to the wait-group while, or after, we are shutting down.
// This is protected by peersLock.
closingPeers bool
} }
func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rcv receivePayloadFn, metrics SyncClientMetrics) *SyncClient { func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rcv receivePayloadFn, metrics SyncClientMetrics) *SyncClient {
...@@ -239,7 +246,9 @@ func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rc ...@@ -239,7 +246,9 @@ func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rc
} }
func (s *SyncClient) Start() { func (s *SyncClient) Start() {
s.peersLock.Lock()
s.wg.Add(1) s.wg.Add(1)
s.peersLock.Unlock()
go s.mainLoop() go s.mainLoop()
} }
...@@ -250,6 +259,9 @@ func (s *SyncClient) AddPeer(id peer.ID) { ...@@ -250,6 +259,9 @@ func (s *SyncClient) AddPeer(id peer.ID) {
s.log.Warn("cannot register peer for sync duties, peer was already registered", "peer", id) s.log.Warn("cannot register peer for sync duties, peer was already registered", "peer", id)
return return
} }
if s.closingPeers {
return
}
s.wg.Add(1) s.wg.Add(1)
// add new peer routine // add new peer routine
ctx, cancel := context.WithCancel(s.resCtx) ctx, cancel := context.WithCancel(s.resCtx)
...@@ -269,7 +281,12 @@ func (s *SyncClient) RemovePeer(id peer.ID) { ...@@ -269,7 +281,12 @@ func (s *SyncClient) RemovePeer(id peer.ID) {
delete(s.peers, id) delete(s.peers, id)
} }
// Close will shut down the sync client and all attached work, and block until shutdown is complete.
// This will block if the Start() has not created the main background loop.
func (s *SyncClient) Close() error { func (s *SyncClient) Close() error {
s.peersLock.Lock()
s.closingPeers = true
s.peersLock.Unlock()
s.resCancel() s.resCancel()
s.wg.Wait() s.wg.Wait()
return nil return nil
......
...@@ -277,6 +277,12 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { ...@@ -277,6 +277,12 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
depositTargetL1Block, depositTargetL1Block,
handleEventsTransactionEnqueued handleEventsTransactionEnqueued
) )
} else {
this.logger.info('Deposit shutoff reached', {
depositTargetL1Block,
highestSyncedL1Block,
depositShutoffBlock,
})
} }
await this._syncEvents( await this._syncEvents(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment