Skip to content

Commit

Permalink
Re: Add block creation rate control feature
Browse files Browse the repository at this point in the history
  • Loading branch information
k930503 committed Feb 3, 2025
1 parent 4095f20 commit 48fe473
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ func newFinalizer(
dataToStream chan interface{},
sequencerPrivateKey *ecdsa.PrivateKey,
) *finalizer {
sbbClient := sbbclient.New()
ethClient, _ := ethclient.Dial(cfg.PlatformUrl) // TODO: error handling

f := finalizer{
cfg: cfg,
Expand Down Expand Up @@ -175,19 +173,21 @@ func newFinalizer(
// stream server
streamServer: streamServer,
dataToStream: dataToStream,
}

// sbb
sbbClient: sbbClient,
ethClient: ethClient,
sequencerRpcUrls: make([]string, 0),
sequencerAddresses: make([]string, 0),
leaderSequencerIndex: 0,
preparedTxsBlockNumber: 0, // TODO: check if this is correct

sequencerPrivateKey: sequencerPrivateKey,

blockTransactions: make(map[uint64]types.Transactions),
isFinalizingActive: true,
if f.cfg.UseExternalSequencer {
sbbClient := sbbclient.New()
ethClient, _ := ethclient.Dial(cfg.PlatformUrl) // TODO: error handling

f.sbbClient = sbbClient
f.ethClient = ethClient
f.sequencerRpcUrls = make([]string, 0)
f.sequencerAddresses = make([]string, 0)
f.leaderSequencerIndex = 0
f.preparedTxsBlockNumber = 0
f.sequencerPrivateKey = sequencerPrivateKey
f.blockTransactions = make(map[uint64]types.Transactions)
f.isFinalizingActive = true
}

lastL2Block, err := f.stateIntf.GetLastL2Block(context.Background(), nil)
Expand Down Expand Up @@ -247,7 +247,6 @@ func (f *finalizer) requestFinalizeBlockAndGetRawTransactions(ctx context.Contex
loopTime := f.cfg.L2BlockMaxDeltaTimestamp.Milliseconds()

for {

if !f.isFinalizingActive {
if len(f.blockTransactions) == 0 {

Expand Down

0 comments on commit 48fe473

Please sign in to comment.