8000 Small improvements in #1806 not present in #1750 by sergio-mena · Pull Request #1808 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Small improvements in #1806 not present in #1750 #1808

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

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions types/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ func VerifyCommitLight(

// VerifyCommitLightAllSignatures verifies +2/3 of the set had signed the given commit.
//
// This method is primarily used by the light client and DOES check all the
// signatures.
// This method DOES check all the signatures.
func VerifyCommitLightAllSignatures(
chainID string,
vals *ValidatorSet,
Expand Down Expand Up @@ -137,8 +136,7 @@ func VerifyCommitLightTrusting(
// NOTE the given validators do not necessarily correspond to the validator set
// for this commit, but there may be some intersection.
//
// This method is primarily used by the light client and DOES check all the
// signatures.
// This method DOES check all the signatures.
func VerifyCommitLightTrustingAllSignatures(
chainID string,
vals *ValidatorSet,
Expand Down
10 changes: 10 additions & 0 deletions types/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajOfVotingPowerSignedIff
commit := extCommit.ToCommit()
require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit))

err = valSet.VerifyCommitLightAllSignatures(chainID, blockID, h, commit)
assert.NoError(t, err)

// malleate 4th signature (3 signatures are enough for 2/3+)
vote := voteSet.GetByIndex(3)
v := vote.ToProto()
Expand Down Expand Up @@ -222,6 +225,13 @@ func TestValidatorSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelSignedI
commit := extCommit.ToCommit()
require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit))

err = valSet.VerifyCommitLightTrustingAllSignatures(
chainID,
commit,
cmtmath.Fraction{Numerator: 1, Denominator: 3},
)
assert.NoError(t, err)

// malleate 3rd signature (2 signatures are enough for 1/3+ trust level)
vote := voteSet.GetByIndex(2)
v := vote.ToProto()
Expand Down
0