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

Sequencer coordinator shouldn't want lockout if local blockchain is lagging too much behind transaction streamer #2437

Merged
merged 8 commits into from
Jun 28, 2024
4 changes: 4 additions & 0 deletions arbnode/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ type execClientWrapper struct {
func (w *execClientWrapper) Pause() { w.t.Error("not supported") }
func (w *execClientWrapper) Activate() { w.t.Error("not supported") }
func (w *execClientWrapper) ForwardTo(url string) error { w.t.Error("not supported"); return nil }
func (w *execClientWrapper) SyncProgressMap() map[string]interface{} {
w.t.Error("not supported")
return nil
}

func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (*gethexec.ExecutionEngine, *TransactionStreamer, ethdb.Database, *core.BlockChain) {
chainConfig := params.ArbitrumDevTestChainConfig()
Expand Down
7 changes: 3 additions & 4 deletions arbnode/seq_coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type SeqCoordinator struct {

redisutil.RedisCoordinator

sync *SyncMonitor
streamer *TransactionStreamer
sequencer execution.ExecutionSequencer
delayedSequencer *DelayedSequencer
Expand Down Expand Up @@ -150,7 +149,6 @@ func NewSeqCoordinator(
}
coordinator := &SeqCoordinator{
RedisCoordinator: *redisCoordinator,
sync: sync,
streamer: streamer,
sequencer: sequencer,
config: config,
Expand Down Expand Up @@ -607,7 +605,8 @@ func (c *SeqCoordinator) update(ctx context.Context) time.Duration {
return c.noRedisError()
}

syncProgress := c.sync.SyncProgressMap()
// Sequencer should want lockout if and only if- its synced, not avoiding lockout and execution processed every message that consensus had 1 second ago
syncProgress := c.sequencer.SyncProgressMap()
synced := len(syncProgress) == 0
if !synced {
var detailsList []interface{}
Expand Down Expand Up @@ -849,7 +848,7 @@ func (c *SeqCoordinator) SeekLockout(ctx context.Context) {
defer c.wantsLockoutMutex.Unlock()
c.avoidLockout--
log.Info("seeking lockout", "myUrl", c.config.Url())
if c.sync.Synced() {
if len(c.sequencer.SyncProgressMap()) == 0 {
// Even if this errors we still internally marked ourselves as wanting the lockout
err := c.wantsLockoutUpdateWithMutex(ctx)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,7 @@ func (n *ExecutionNode) MessageIndexToBlockNumber(messageNum arbutil.MessageInde
func (n *ExecutionNode) Maintenance() error {
return n.ChainDB.Compact(nil, nil)
}

func (n *ExecutionNode) SyncProgressMap() map[string]interface{} {
return n.SyncMonitor.SyncProgressMap()
}
2 changes: 1 addition & 1 deletion execution/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ type ExecutionSequencer interface {
SequenceDelayedMessage(message *arbostypes.L1IncomingMessage, delayedSeqNum uint64) error
NextDelayedMessageNumber() (uint64, error)
MarkFeedStart(to arbutil.MessageIndex)
SyncProgressMap() map[string]interface{}
ganeshvanahalli marked this conversation as resolved.
Show resolved Hide resolved
}

type FullExecutionClient interface {
ExecutionClient
ExecutionRecorder
ExecutionSequencer

Expand Down
Loading