Skip to content

Commit

Permalink
[Audit Issue F] Add missing Check on Quorum for the RoundChange Justi…
Browse files Browse the repository at this point in the history
…fication (ssvlabs#1099)

* Add missing Check on Quorum for the RoundChange Justification

* spec alignment

* Remove differ binary

---------

Co-authored-by: moshe-blox <[email protected]>
  • Loading branch information
nkryuchkov and moshe-blox authored Aug 15, 2023
1 parent 6b15ac2 commit 2482de5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 53 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ bin/
/scripts/spec_align_report/data
/scripts/spec_align_report/ssv-spec
.vscode/
patches/
patches/

differ
7 changes: 7 additions & 0 deletions protocol/v2/qbft/instance/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func (i *Instance) uponPrepare(
return nil
}

// getRoundChangeJustification returns the round change justification for the current round.
// The justification is a quorum of signed prepare messages that agree on state.LastPreparedValue
func getRoundChangeJustification(state *specqbft.State, config qbft.IConfig, prepareMsgContainer *specqbft.MsgContainer) ([]*specqbft.SignedMessage, error) {
if state.LastPreparedValue == nil {
return nil, nil
Expand All @@ -95,6 +97,11 @@ func getRoundChangeJustification(state *specqbft.State, config qbft.IConfig, pre
ret = append(ret, msg)
}
}

if !specqbft.HasQuorum(state.Share, ret) {
return nil, nil
}

return ret, nil
}

Expand Down
3 changes: 2 additions & 1 deletion scripts/differ/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
output.html
output.diff
config.yaml
.vscode
.vscode
differ
47 changes: 0 additions & 47 deletions scripts/spec-alignment/approved.differ.config.yaml

This file was deleted.

6 changes: 2 additions & 4 deletions scripts/spec-alignment/differ.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ ApprovedChanges: ["256a3dc0f1eb7abf","22b66e9a63ba145b","12c1c3a1622fb7cc","1c44
"17a1cf958f2b3b06","be53b04b01612f32","a5d3405074af9f39","374be3ca8e029b32","86f0ead2480383f","576a7230fab694d7","d6e610032cfaa0c",
"db32f358b6e8e2bb","f372e174e1f34c3b","bc47b3d202e8cd0d","86a6abca1a1c16d6","1655d21d5a4cad4","ac4e427097fc5533","6b4d5a114f8066ff",
"9482fb9b6a953c48","5778a05e0976a6eb","24e2c7f54d5dd1d","2a8937e50d20faa9","587c629a67ef07ed","9d06d8e0ee4e1113","e624ec802068e711",
"943be3ce709a99d3", "5b3bb2d2262fe8be", "5b3bb2d2262fe8be","e12b17f3910be26b","17cf3119ac6879f2","b10c6fc7dd9eee7","7aa380d0261f7286",
"c20c4c7ed8d1711d", "c121cdaab6c1c698","3f31546191c9e6b2","e47bf52e962c90af","e8292a58d2eb08ab",
# Temporary approval, pending merge of PR on ssv-spec: https://github.com/bloxapp/ssv-spec/pull/267
"90b8a0c8d2c30e95"]
"943be3ce709a99d3","5b3bb2d2262fe8be","c20c4c7ed8d1711d","b10c6fc7dd9eee7","c121cdaab6c1c698","e12b17f3910be26b","e47bf52e962c90af",
"90b8a0c8d2c30e95","e8292a58d2eb08ab","17cf3119ac6879f2","3f31546191c9e6b2"]
IgnoredIdentifiers:
- logger
ReducedPackageNames:
Expand Down

0 comments on commit 2482de5

Please sign in to comment.