-
Notifications
You must be signed in to change notification settings - Fork 24
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
Partial Signature Verification Aggregation #369
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
3ea4b69
Add SignedSSVMessage
MatheusFranco99 3aebee8
Add SSZ encoding
MatheusFranco99 0fc89ba
Test structures for SignedSSVMessage
MatheusFranco99 f919fda
Test utils and encoding test
MatheusFranco99 5d151fb
Tests
MatheusFranco99 7965ba8
Generate tests
MatheusFranco99 1c3ace2
Adapt message validation
MatheusFranco99 e67c4b5
Fix expected error; Bring back commented tests
MatheusFranco99 e2e279b
Add comment on signature
MatheusFranco99 43da24c
Merge branch 'main' into signed-ssv-msg
MatheusFranco99 9b1750d
Adjust ssz-max in SignedSSVMessage
MatheusFranco99 c74a5c1
Include RSA check in test
MatheusFranco99 b9469eb
Generate JSONs
MatheusFranco99 399dd77
Optimistic approach in pre-consensus messages
MatheusFranco99 86ac7df
Extend optimistic approach to pre-consensus
MatheusFranco99 21f4d47
Extend to post-consensus
MatheusFranco99 97765fd
Add approach to validator reg. and exit duties
MatheusFranco99 f229766
Add errors
MatheusFranco99 6da8d6d
Rename fall back function
MatheusFranco99 1f8b1b0
Check duplicated signature case
MatheusFranco99 15f5e31
Add in-committee check
MatheusFranco99 a9d1580
Fix unknown signer error messages
MatheusFranco99 a7d3d15
Drop expected error in invalid signature since it's deprecated
MatheusFranco99 cfa6c21
Change invalid beacon sig test to trigger error once quorum is reached
MatheusFranco99 b45fd73
Drop errors in invalid then quorum test
MatheusFranco99 836a06b
GenerateTests
MatheusFranco99 ad95766
Fall back and verify for all roots
MatheusFranco99 464b763
Test: Invalid quorum then valid quorum
MatheusFranco99 aaa0b28
Test: invalid quorum then valid quorum for pre-consensus
MatheusFranco99 603a7ab
Fix name
MatheusFranco99 fdcf38c
Generate tests
MatheusFranco99 db72966
Fix lint
MatheusFranco99 03fa670
remove commits from signed ssv message branch
MatheusFranco99 6f407fb
Fix revert issues. Generate tests
MatheusFranco99 5e592ba
Simplify if clause
MatheusFranco99 96807d4
Merge branch 'main' into reduce_signatures_partial_sig
MatheusFranco99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ package ssv | |
|
||
import ( | ||
"bytes" | ||
"sort" | ||
|
||
spec "github.com/attestantio/go-eth2-client/spec/phase0" | ||
"github.com/bloxapp/ssv-spec/types" | ||
ssz "github.com/ferranbt/fastssz" | ||
"github.com/pkg/errors" | ||
"sort" | ||
) | ||
|
||
func (b *BaseRunner) ValidatePreConsensusMsg(runner Runner, signedMsg *types.SignedPartialSignatureMessage) error { | ||
|
@@ -26,6 +27,18 @@ func (b *BaseRunner) ValidatePreConsensusMsg(runner Runner, signedMsg *types.Sig | |
return b.verifyExpectedRoot(runner, signedMsg, roots, domain) | ||
} | ||
|
||
// Verify each signature in container removing the invalid ones | ||
func (b *BaseRunner) FallBackAndVerifyEachSignature(container *PartialSigContainer, root [32]byte) { | ||
|
||
signatures := container.GetSignatures(root) | ||
|
||
for operatorID, signature := range signatures { | ||
if err := b.verifyBeaconPartialSignature(operatorID, signature, root); err != nil { | ||
container.Remove(operatorID, root) | ||
} | ||
} | ||
Comment on lines
+33
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
func (b *BaseRunner) ValidatePostConsensusMsg(runner Runner, signedMsg *types.SignedPartialSignatureMessage) error { | ||
if !b.hasRunningDuty() { | ||
return errors.New("no running duty") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
hmmm
This is currently checked by MsgValidation
ERR_PSIG_INVALID_SIG_ID
?Since MsgValidation isn't part of spec it is fine that you added this..
But now I made up my mind that MsgValidation should be an inseperable part of spec.
Once we add tests for this, we won't have to do those double checks
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.
I agree that message validation should belong to the spec