Skip to content

Commit

Permalink
allow empty signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Jan 8, 2025
1 parent 141d1a2 commit 94b8fd6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions internal/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,9 +1317,11 @@ func (cs *State) createProposalBlock(ctx context.Context) (*types.Block, error)
// because votes are different.
_, blsKey := cs.privValidatorPubKey.(*bls12381.PubKey)
canBeAggregated := blsKey &&
cs.state.Validators.AllKeysHaveSameType() &&
!cs.isVoteExtensionsEnabled(cs.Height)
cs.state.Validators.AllKeysHaveSameType()
if canBeAggregated {
if cs.isVoteExtensionsEnabled(cs.Height) {
panic("Wanted to aggregate LastCommit, but VoteExtensions are enabled for height " + strconv.FormatInt(cs.Height, 10))
}
if !cs.isPBTSEnabled(cs.Height) {
panic("Wanted to aggregate LastCommit, but PBTS is not enabled for height " + strconv.FormatInt(cs.Height, 10))
}
Expand Down
4 changes: 1 addition & 3 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,7 @@ func (cs CommitSig) ValidateBasic() error {
)
}
// NOTE: Timestamp validation is subtle and handled elsewhere.
if len(cs.Signature) == 0 {
return errors.New("signature is missing")
}
// NOTE: Signature can be empty when using BLS aggregation.
if len(cs.Signature) > MaxSignatureSize {
return fmt.Errorf("signature is too big (max: %d)", MaxSignatureSize)
}
Expand Down
6 changes: 1 addition & 5 deletions types/vote_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,7 @@ func (voteSet *VoteSet) MakeBLSCommit() *ExtendedCommit {
sigs := make([]ExtendedCommitSig, len(voteSet.votes))
for i, v := range voteSet.votes {
cSig := v.CommitSig()
if cSig.BlockIDFlag != BlockIDFlagAbsent {
cSig.Signature = []byte{0x00} // clear the signature
} else {
cSig.Signature = []byte{} // clear the signature
}
cSig.Signature = []byte{} // clear the signature
sig := ExtendedCommitSig{
CommitSig: cSig,
}
Expand Down

0 comments on commit 94b8fd6

Please sign in to comment.