-
Notifications
You must be signed in to change notification settings - Fork 40
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 🚀
There was a problem hiding this 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.
x/finality/keeper/msg_server.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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 ?
No description provided.