Skip to content

Commit

Permalink
freeze refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed Nov 12, 2024
1 parent a299a20 commit 9cfdbd5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
3 changes: 0 additions & 3 deletions block/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ func (m *Manager) MonitorForkUpdateLoop(ctx context.Context) error {
if err := m.checkForkUpdate(ctx); err != nil {
continue
}
if m.isFrozen() {
return nil
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (m *Manager) ValidateConfigWithRollappParams() error {
return err
}
if uint32(currentDRS) != m.State.RollappParams.DrsVersion {

Check failure on line 374 in block/manager.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)
return fmt.Errorf("DRS version mismatch. rollapp param: %d binary used:%d", m.State.RollappParams.DrsVersion, drsVersion)
return fmt.Errorf("DRS version mismatch. rollapp param: %d binary used:%d", m.State.RollappParams.DrsVersion, currentDRS)
}

if da.Client(m.State.RollappParams.Da) != m.DAClient.GetClientType() {
Expand Down
5 changes: 0 additions & 5 deletions block/produce.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func (m *Manager) ProduceBlockLoop(ctx context.Context, bytesProducedC chan int)
continue
}

// finish the block production loop in case the node is frozen
if m.isFrozen() {
return nil
}

// if empty blocks are configured to be enabled, and one is scheduled...
produceEmptyBlock := firstBlock || m.Conf.MaxIdleTime == 0 || nextEmptyBlock.Before(time.Now())
firstBlock = false
Expand Down
6 changes: 1 addition & 5 deletions block/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (m *Manager) SubmitLoop(ctx context.Context,
m.Conf.BatchSubmitTime,
m.Conf.BatchSubmitBytes,
m.CreateAndSubmitBatchGetSizeBlocksCommits,
m.isFrozen,
)
}

Expand All @@ -49,7 +48,6 @@ func SubmitLoopInner(
maxBatchTime time.Duration, // max time to allow between batches
maxBatchBytes uint64, // max size of serialised batch in bytes
createAndSubmitBatch func(maxSizeBytes uint64) (sizeBlocksCommits uint64, err error),
frozen func() bool,
) error {
eg, ctx := errgroup.WithContext(ctx)

Expand Down Expand Up @@ -97,9 +95,7 @@ func SubmitLoopInner(
case <-ticker.C:
case <-submitter.C:
}
if frozen() {
return nil
}

pending := pendingBytes.Load()
types.RollappPendingSubmissionsSkewBytes.Set(float64(pendingBytes.Load()))
types.RollappPendingSubmissionsSkewBlocks.Set(float64(unsubmittedBlocks()))
Expand Down
6 changes: 2 additions & 4 deletions block/submit_loop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ func testSubmitLoopInner(
accumulatedBlocks := func() uint64 {
return pendingBlocks.Load()
}
frozen := func() bool {
return false
}
block.SubmitLoopInner(ctx, log.NewNopLogger(), producedBytesC, args.batchSkew, accumulatedBlocks, args.maxTime, args.batchBytes, submitBatch, frozen)

block.SubmitLoopInner(ctx, log.NewNopLogger(), producedBytesC, args.batchSkew, accumulatedBlocks, args.maxTime, args.batchBytes, submitBatch)
}

// Make sure the producer does not get too far ahead
Expand Down

0 comments on commit 9cfdbd5

Please sign in to comment.