-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Define spec test [skip ci] * Drop duplicated test [skip ci] * Add case in run test [skip ci] * Add tests * Drop duplicated test. Change name to encompass 2 scenarios --------- Co-authored-by: Gal Rogozinski <galrogogit@gmail.com>
- Loading branch information
1 parent
1b367a0
commit fe5b9b4
Showing
15 changed files
with
262 additions
and
42 deletions.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,24 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
"github.com/herumi/bls-eth-go-binary/bls" | ||
) | ||
|
||
// HasQuorum tests msg with unique 2f+1 signers | ||
func HasQuorum() *SpecTest { | ||
panic("implement") | ||
func HasQuorum() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := testingutils.TestingCommitMultiSignerMessage([]*bls.SecretKey{ks.Shares[1], ks.Shares[2], ks.Shares[3]}, []types.OperatorID{1, 2, 3}) | ||
|
||
return &ShareTest{ | ||
Name: "has quorum", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: true, | ||
ExpectedFullCommittee: false, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,24 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
"github.com/herumi/bls-eth-go-binary/bls" | ||
) | ||
|
||
// HasQuorum3f1 tests msg with unique 3f+1 signers | ||
func HasQuorum3f1() *SpecTest { | ||
panic("implement") | ||
func HasQuorum3f1() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := testingutils.TestingCommitMultiSignerMessage([]*bls.SecretKey{ks.Shares[1], ks.Shares[2], ks.Shares[3], ks.Shares[4]}, []types.OperatorID{1, 2, 3, 4}) | ||
|
||
return &ShareTest{ | ||
Name: "has quorum 3f1", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: true, | ||
ExpectedFullCommittee: true, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,22 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// NoPartialQuorum tests msg with < unique f+1 signers | ||
func NoPartialQuorum() *SpecTest { | ||
panic("implement") | ||
func NoPartialQuorum() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := testingutils.TestingCommitMessage(ks.Shares[1], 1) | ||
|
||
return &ShareTest{ | ||
Name: "no partial quorum", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: false, | ||
ExpectedHasQuorum: false, | ||
ExpectedFullCommittee: false, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,34 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/qbft" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// NoPartialQuorumDuplicate tests msg with < unique f+1 signers (but f+1 signers including duplicates) | ||
func NoPartialQuorumDuplicate() *SpecTest { | ||
panic("implement") | ||
func NoPartialQuorumDuplicate() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := &qbft.SignedMessage{ | ||
Message: qbft.Message{ | ||
MsgType: qbft.CommitMsgType, | ||
Height: qbft.FirstHeight, | ||
Round: qbft.FirstRound, | ||
Identifier: testingutils.TestingIdentifier, | ||
Root: testingutils.TestingQBFTRootData, | ||
}, | ||
Signers: []types.OperatorID{1, 1}, | ||
} | ||
|
||
return &ShareTest{ | ||
Name: "no partial quorum duplicate", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: false, | ||
ExpectedHasQuorum: false, | ||
ExpectedFullCommittee: false, | ||
ExpectedError: "non unique signer", | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,34 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/qbft" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// NoQuorumDuplicate tests msg with < unique 2f+1 signers (but 2f+1 signers including duplicates) | ||
func NoQuorumDuplicate() *SpecTest { | ||
panic("implement") | ||
func NoQuorumDuplicate() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := &qbft.SignedMessage{ | ||
Message: qbft.Message{ | ||
MsgType: qbft.CommitMsgType, | ||
Height: qbft.FirstHeight, | ||
Round: qbft.FirstRound, | ||
Identifier: testingutils.TestingIdentifier, | ||
Root: testingutils.TestingQBFTRootData, | ||
}, | ||
Signers: []types.OperatorID{1, 1, 2}, | ||
} | ||
|
||
return &ShareTest{ | ||
Name: "no quorum duplicate", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: false, | ||
ExpectedFullCommittee: false, | ||
ExpectedError: "non unique signer", | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
"github.com/herumi/bls-eth-go-binary/bls" | ||
) | ||
|
||
// HasPartialQuorumButNoQuorum tests msg with unique f+1 signers | ||
func HasPartialQuorumButNoQuorum() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := testingutils.TestingCommitMultiSignerMessage([]*bls.SecretKey{ks.Shares[1], ks.Shares[2]}, []types.OperatorID{1, 2}) | ||
|
||
return &ShareTest{ | ||
Name: "has partial quorum but no quorum", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: false, | ||
ExpectedFullCommittee: false, | ||
} | ||
} |
32 changes: 30 additions & 2 deletions
32
types/spectest/tests/share/partial_quorum_with_duplicate.go
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 |
---|---|---|
@@ -1,6 +1,34 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/qbft" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// PartialQuorumWithDuplicate tests msg with unique f+1 signers (but also including duplicates) | ||
func PartialQuorumWithDuplicate() *SpecTest { | ||
panic("implement") | ||
func PartialQuorumWithDuplicate() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := &qbft.SignedMessage{ | ||
Message: qbft.Message{ | ||
MsgType: qbft.CommitMsgType, | ||
Height: qbft.FirstHeight, | ||
Round: qbft.FirstRound, | ||
Identifier: testingutils.TestingIdentifier, | ||
Root: testingutils.TestingQBFTRootData, | ||
}, | ||
Signers: []types.OperatorID{1, 1, 2}, | ||
} | ||
|
||
return &ShareTest{ | ||
Name: "partial quorum with duplicate", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: false, | ||
ExpectedFullCommittee: false, | ||
ExpectedError: "non unique signer", | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,34 @@ | ||
package share | ||
|
||
import ( | ||
"github.com/bloxapp/ssv-spec/qbft" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// QuorumWithDuplicate tests msg with unique 2f+1 signers (but also including duplicates) | ||
func QuorumWithDuplicate() *SpecTest { | ||
panic("implement") | ||
func QuorumWithDuplicate() *ShareTest { | ||
ks := testingutils.Testing4SharesSet() | ||
share := testingutils.TestingShare(ks) | ||
|
||
msg := &qbft.SignedMessage{ | ||
Message: qbft.Message{ | ||
MsgType: qbft.CommitMsgType, | ||
Height: qbft.FirstHeight, | ||
Round: qbft.FirstRound, | ||
Identifier: testingutils.TestingIdentifier, | ||
Root: testingutils.TestingQBFTRootData, | ||
}, | ||
Signers: []types.OperatorID{1, 1, 2, 3}, | ||
} | ||
|
||
return &ShareTest{ | ||
Name: "quorum with duplicate", | ||
Share: *share, | ||
Message: *msg, | ||
ExpectedHasPartialQuorum: true, | ||
ExpectedHasQuorum: true, | ||
ExpectedFullCommittee: false, | ||
ExpectedError: "non unique signer", | ||
} | ||
} |
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