-
Notifications
You must be signed in to change notification settings - Fork 22
/
duplicatequorum.go
36 lines (30 loc) · 1.32 KB
/
duplicatequorum.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package partialsigcontainer
import (
"github.com/bloxapp/ssv-spec/qbft"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
)
func DuplicateQuorum() tests.SpecTest {
// Create a test key set
ks := testingutils.Testing4SharesSet()
// Create PartialSignatureMessage for testing
msg1 := testingutils.PostConsensusAttestationMsg(ks.Shares[1], 1, qbft.FirstHeight)
msg12 := testingutils.PostConsensusAttestationMsg(ks.Shares[1], 1, qbft.FirstHeight)
msg2 := testingutils.PostConsensusAttestationMsg(ks.Shares[2], 2, qbft.FirstHeight)
msg3 := testingutils.PostConsensusAttestationMsg(ks.Shares[3], 3, qbft.FirstHeight)
msgs := []*types.PartialSignatureMessage{msg1.Message.Messages[0], msg12.Message.Messages[0], msg2.Message.Messages[0], msg3.Message.Messages[0]}
// Verify the reconstructed signature
expectedSig, err := types.ReconstructSignatures(map[types.OperatorID][]byte{1: msgs[0].PartialSignature, 2: msgs[2].PartialSignature, 3: msgs[3].PartialSignature})
if err != nil {
panic(err.Error())
}
return &PartialSigContainerTest{
Name: "duplicate quorum",
Quorum: ks.Threshold,
ValidatorPubKey: ks.ValidatorPK.Serialize(),
SignatureMsgs: msgs,
ExpectedResult: expectedSig.Serialize(),
ExpectedQuorum: true,
}
}