-
Notifications
You must be signed in to change notification settings - Fork 21
/
slot_mistmatch.go
53 lines (48 loc) · 1.76 KB
/
slot_mistmatch.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package valcheckattestations
import (
goEthSpec "github.com/attestantio/go-eth2-client/spec"
spec "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests/valcheck"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
)
// SlotMismatch tests Duty.Slot != AttestationData.Slot
func SlotMismatch() tests.SpecTest {
attestationData := &spec.AttestationData{
Slot: 2,
Index: 3,
BeaconBlockRoot: spec.Root{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2},
Source: &spec.Checkpoint{
Epoch: 0,
Root: spec.Root{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2},
},
Target: &spec.Checkpoint{
Epoch: 1,
Root: spec.Root{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2},
},
}
attestationDataBytes, _ := attestationData.MarshalSSZ()
data := &types.ConsensusData{
Duty: types.Duty{
Type: types.BNRoleAttester,
PubKey: testingutils.TestingValidatorPubKey,
Slot: 1,
ValidatorIndex: testingutils.TestingValidatorIndex,
CommitteeIndex: 3,
CommitteesAtSlot: 36,
CommitteeLength: 128,
ValidatorCommitteeIndex: 11,
},
DataSSZ: attestationDataBytes,
Version: goEthSpec.DataVersionPhase0,
}
input, _ := data.Encode()
return &valcheck.SpecTest{
Name: "attestation value check slot mismatch",
Network: types.PraterNetwork,
BeaconRole: types.BNRoleAttester,
Input: input,
ExpectedError: "attestation data slot != duty slot",
}
}