babylonlabs-io / finality-provider

Other
4 stars 3 forks source link

OP: fast sync got constantly triggered #55

Open lesterli opened 1 week ago

lesterli commented 1 week ago

Problem

In our deployed L2 OP devnet, we found fast sync got constantly triggered every interval (20s), we have below configurations:

Root cause analysis

After debugging we found the root cause is: within the fast sync interval-20s, there are 10 new blocks, but each EOTS sig submission takes 5 sec, FP can only manage to submit 4 blocks, so 6 blocks got left behind, and the fast sync gap is 6. so fast sync got triggered every time.

So this means for chains that produce blocks very fast, fast sync will be constantly triggered.

Proposed fix

Batch processing all queued blocks in the finalitySigSubmissionLoop instead of processing them one by one.

func (fp *FinalityProviderInstance) finalitySigSubmissionLoop() {
    for {
        select {
        case b := <-fp.poller.GetBlockInfoChan():
        // res, err := fp.retrySubmitFinalitySignatureUntilBlockFinalized(&nextBlock)
        res, err := fp.retryBatchSubmitFinalitySignatureUntilBlockFinalized(&queuedBlocks)
bap2pecs commented 1 week ago

follow-up tasks: