Skip to content

Commit

Permalink
chore: add check in finality loop if activation height is reached
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Oct 24, 2024
1 parent e03994d commit 7175eba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions finality-provider/service/fp_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ func (fp *FinalityProviderInstance) finalitySigSubmissionLoop() {
if fp.hasProcessed(b) {
continue
}

activationBlkHeight, err := fp.cc.QueryFinalityActivationBlockHeight()
if err != nil {
fp.reportCriticalErr(fmt.Errorf("failed to get activation height during fast sync %w", err))
continue
}

// check if it is allowed to send finality
if b.Height < activationBlkHeight {
continue
}

// check whether the finality provider has voting power
hasVp, err := fp.hasVotingPower(b)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions finality-provider/service/fp_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func FuzzStatusUpdate(f *testing.F) {
mockClientController.EXPECT().QueryLatestFinalizedBlocks(gomock.Any()).Return(nil, nil).AnyTimes()
mockClientController.EXPECT().QueryBestBlock().Return(currentBlockRes, nil).AnyTimes()
mockClientController.EXPECT().QueryActivatedHeight().Return(uint64(1), nil).AnyTimes()
mockClientController.EXPECT().QueryFinalityActivationBlockHeight().Return(uint64(0), nil).AnyTimes()
mockClientController.EXPECT().QueryBlock(gomock.Any()).Return(currentBlockRes, nil).AnyTimes()
mockClientController.EXPECT().QueryLastCommittedPublicRand(gomock.Any(), uint64(1)).Return(nil, nil).AnyTimes()

Expand Down

0 comments on commit 7175eba

Please sign in to comment.