Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qbft/messages_encoding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ssv/spectest/all_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ var AllTests = []tests.TestF{

valcheckattestations.Slashable,
valcheckattestations.SourceHigherThanTarget,
valcheckattestations.FarFutureTarget,
valcheckattestations.UnmatchedTargetEpoch,
valcheckattestations.UnmatchedSourceEpoch,
valcheckattestations.BeaconVoteDataNil,
valcheckattestations.Valid,
valcheckattestations.MinoritySlashable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"RunnerRole": 2,
"DutySlot": "0",
"Input": "EAAAAAUAAAAAAAAAfAAAAAIAAAAAAAAAjoAGZVGoGzGCWHCe2vfdH2PNaGoOTbiym7t6z+ZWCGd69aUn2USO5Hg1SF4CtQvAACBxAAAAAAABAAAAAAAAAAMAAAAAAAAAgAAAAAAAAAAkAAAAAAAAAAsAAAAAAAAAbAAAAACJAwAAAAAAAgAAAAAAAAAAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/VAAAAAABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eXwABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fCgAAAAAAAAAgISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/iAEAACgDAAAsBQAAFwYAAO8KAAAAA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3ZQbqqWe8m9xQdxvG4jmww45yBkYn8tRXovLQXM9YGhZN7/5RpeVEWPEbPkUPr8ti5AQqpQ8s0qlextUToc0qPbrWhmT0GGoKhTIeHrcZIAgAAAAAAAAC4m+vGmXaXJqMYyOmXG9MXEpfGGupKZXinpPlLVH3LpbrBaokQi2tqH+NpXRqHSgsAAQIDBAUGBwgJCgsMDQ4PEBESEwABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX5XMUJm72EINjrreODwAojRtrOYKdgT3aM1xUBdXtNcu631UdKa2Fa8QN51pqp9Hj66fLSIXAT72H5lfkHT66tnsJOgEhEAWTsPWApuH1DaG3QyXwt+VVPyZfQ1mw6eJKQ==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "0",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "13",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAQAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": {
"5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9": [
"12"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAQAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": {
"5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIBAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAAAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "attestation data source \u003e= target",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Name": "attestation value check unmatched source epoch",
"Network": "now_test_network",
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAgAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "attestation data source/target epoch does not match expected",
"AnyError": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Name": "attestation value check unmatched target epoch",
"Network": "now_test_network",
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAgAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "1",
"ExpectedTargetEpoch": "2",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "attestation data source/target epoch does not match expected",
"AnyError": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAQAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAQAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": {
"48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AQIDBAUGBwgJCgECAwQFBgcICQoBAgMEBQYHCAkKAQIAAAAAAAAAAAECAwQFBgcICQoBAgMEBQYHCAkKAQIDBAUGBwgJCgECAQAAAAAAAAABAgMEBQYHCAkKAQIDBAUGBwgJCgECAwQFBgcICQoBAg==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": {
"5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"RunnerRole": 0,
"DutySlot": "12",
"Input": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"ExpectedSourceEpoch": "0",
"ExpectedTargetEpoch": "1",
"SlashableSlots": null,
"omitempty": null,
"ExpectedError": "attestation data source \u003e= target",
Expand Down
23 changes: 12 additions & 11 deletions ssv/spectest/tests/valcheck/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ import (
)

type SpecTest struct {
Name string
Network types.BeaconNetwork
RunnerRole types.RunnerRole
DutySlot phase0.Slot // DutySlot is used only for the RoleCommittee since the BeaconVoteValueCheckF requires the duty's slot
Input []byte
SlashableSlots map[string][]phase0.Slot // map share pk to a list of slashable slots
ShareValidatorsPK []types.ShareValidatorPK `json:"omitempty"` // Optional. Specify validators shares for beacon vote value check
ExpectedError string
AnyError bool
Name string
Network types.BeaconNetwork
RunnerRole types.RunnerRole
DutySlot phase0.Slot // DutySlot is used only for the RoleCommittee since the BeaconVoteValueCheckF requires the duty's slot
Input []byte
ExpectedSourceEpoch phase0.Epoch // Specify expected source epoch for beacon vote value check
ExpectedTargetEpoch phase0.Epoch // Specify expected target epoch for beacon vote value check
SlashableSlots map[string][]phase0.Slot // map share pk to a list of slashable slots
ShareValidatorsPK []types.ShareValidatorPK `json:"omitempty"` // Optional. Specify validators shares for beacon vote value check
ExpectedError string
AnyError bool
}

func (test *SpecTest) TestName() string {
Expand Down Expand Up @@ -60,8 +62,7 @@ func (test *SpecTest) valCheckF(signer types.BeaconSigner) qbft.ProposedValueChe
}
switch test.RunnerRole {
case types.RoleCommittee:
return ssv.BeaconVoteValueCheckF(signer, test.DutySlot, shareValidatorsPK,
testingutils.TestingDutyEpoch)
return ssv.BeaconVoteValueCheckF(signer, test.DutySlot, shareValidatorsPK, test.ExpectedSourceEpoch, test.ExpectedTargetEpoch)
case types.RoleProposer:
return ssv.ProposerValueCheckF(signer, test.Network, pubKeyBytes, testingutils.TestingValidatorIndex, nil)
case types.RoleAggregator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ func BeaconVoteDataNil() tests.SpecTest {
input, _ := consensusData.Encode()

return &valcheck.SpecTest{
Name: "consensus data value check nil",
Network: types.PraterNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "attestation data source >= target",
Name: "consensus data value check nil",
Network: types.PraterNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "attestation data source >= target",
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ func MajoritySlashable() tests.SpecTest {
}

return &valcheck.SpecTest{
Name: "attestation value check with slashable majority",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "slashable attestation",
SlashableSlots: slashableMap,
ShareValidatorsPK: sharesPKBytes,
Name: "attestation value check with slashable majority",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "slashable attestation",
SlashableSlots: slashableMap,
ShareValidatorsPK: sharesPKBytes,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ func MinoritySlashable() tests.SpecTest {
}

return &valcheck.SpecTest{
Name: "attestation value check with slashable minority",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "slashable attestation",
SlashableSlots: slashableMap,
ShareValidatorsPK: sharesPKBytes,
Name: "attestation value check with slashable minority",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "slashable attestation",
SlashableSlots: slashableMap,
ShareValidatorsPK: sharesPKBytes,
}
}
14 changes: 8 additions & 6 deletions ssv/spectest/tests/valcheck/valcheckattestations/slashable.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ func Slashable() tests.SpecTest {
shareString := hex.EncodeToString(sharePKBytes)

return &valcheck.SpecTest{
Name: "attestation value check slashable",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "slashable attestation",
Name: "attestation value check slashable",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "slashable attestation",
SlashableSlots: map[string][]phase0.Slot{
shareString: {
testingutils.TestingDutySlot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ func SourceHigherThanTarget() tests.SpecTest {
input, _ := data.Encode()

return &valcheck.SpecTest{
Name: "attestation value check source higher than target",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "attestation data source >= target",
Name: "attestation value check source higher than target",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "attestation data source >= target",
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package valcheckattestations

import (
spec "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ssvlabs/ssv-spec/ssv/spectest/tests"
"github.com/ssvlabs/ssv-spec/ssv/spectest/tests/valcheck"
"github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv-spec/types/testingutils"
)

// UnmatchedSourceEpoch tests AttestationData.Source.Epoch unmatched with expected
func UnmatchedSourceEpoch() tests.SpecTest {
data := types.BeaconVote{
BlockRoot: 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: 2,
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},
},
}

input, _ := data.Encode()

return &valcheck.SpecTest{
Name: "attestation value check unmatched source epoch",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
ExpectedError: "attestation data source/target epoch does not match expected",
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,30 @@ import (
"github.com/ssvlabs/ssv-spec/types/testingutils"
)

// FarFutureTarget tests AttestationData.Target.Epoch higher than expected
func FarFutureTarget() tests.SpecTest {
// UnmatchedEpochs tests AttestationData.Target.Epoch unmatched with expected
func UnmatchedTargetEpoch() tests.SpecTest {
data := types.BeaconVote{
BlockRoot: 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: 10000000,
Epoch: 2,
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},
},
}

input, _ := data.Encode()

return &valcheck.SpecTest{
Name: "attestation value check far future target",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedError: "attestation data target epoch is into far future",
Name: "attestation value check unmatched target epoch",
Network: types.BeaconTestNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: input,
ExpectedSourceEpoch: 1,
ExpectedTargetEpoch: 2,
ExpectedError: "attestation data source/target epoch does not match expected",
}
}
12 changes: 7 additions & 5 deletions ssv/spectest/tests/valcheck/valcheckattestations/valid.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
// Valid tests valid data
func Valid() tests.SpecTest {
return &valcheck.SpecTest{
Name: "attestation value check valid",
Network: types.PraterNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: testingutils.TestBeaconVoteByts,
Name: "attestation value check valid",
Network: types.PraterNetwork,
RunnerRole: types.RoleCommittee,
DutySlot: testingutils.TestingDutySlot,
Input: testingutils.TestBeaconVoteByts,
ExpectedSourceEpoch: 0,
ExpectedTargetEpoch: 1,
}
}
Loading