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

chore(adr-39): Reject out-dated finality votes #365

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

gitferry
Copy link
Member

No description provided.

@gitferry gitferry marked this pull request as ready for review December 20, 2024 15:43
@gitferry gitferry requested a review from a team as a code owner December 20, 2024 15:43
@gitferry gitferry requested review from KonradStaniec, RafilxTenfen, Lazar955 and a team and removed request for a team December 20, 2024 15:43
Copy link
Member

@Lazar955 Lazar955 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🚀

Copy link
Collaborator

@KonradStaniec KonradStaniec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking suggestiong to avoid unnecessary read from db.

@@ -210,6 +218,24 @@ func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinal
return &types.MsgAddFinalitySigResponse{}, nil
}

func (ms msgServer) ShouldAcceptSigForHeight(ctx context.Context, height uint64) (bool, error) {
// check if the block is finalized and timestamped
indexedBlock, err := ms.GetBlock(ctx, height)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when verifying sig we retrieve block:

	// the public randomness is good, set the public randomness
	ms.SetPubRand(ctx, req.FpBtcPk, req.BlockHeight, *req.PubRand)
	// verify whether the voted block is a fork or not
	indexedBlock, err := ms.GetBlock(ctx, req.BlockHeight)
	if err != nil {
		return nil, err
	}

later for different purposes.

Maybe we can pass indexed block to this function to avoid one db read ?

@gitferry gitferry merged commit bf53a4a into main Dec 20, 2024
21 checks passed
@gitferry gitferry deleted the gai/adr-39-reject-votes branch December 20, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants