Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions ssv/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ func (r *ProposerRunner) ProcessPreConsensus(signedMsg *types.SignedPartialSigna
var obj ssz.Marshaler
if r.ProducesBlindedBlocks {
// get block data
obj, ver, err = r.GetBeaconNode().GetBlindedBeaconBlock(duty.Slot, duty.CommitteeIndex, r.GetShare().Graffiti, fullSig)
obj, ver, err = r.GetBeaconNode().GetBlindedBeaconBlock(duty.Slot, r.GetShare().Graffiti, fullSig)
if err != nil {
return errors.Wrap(err, "failed to get Beacon block")
}
} else {
// get block data
obj, ver, err = r.GetBeaconNode().GetBeaconBlock(duty.Slot, duty.CommitteeIndex, r.GetShare().Graffiti, fullSig)
obj, ver, err = r.GetBeaconNode().GetBeaconBlock(duty.Slot, r.GetShare().Graffiti, fullSig)
if err != nil {
return errors.Wrap(err, "failed to get Beacon block")
}
Expand Down
2 changes: 2 additions & 0 deletions ssv/spectest/all_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/bloxapp/ssv-spec/ssv/spectest/tests/runner/preconsensus"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests/valcheck/valcheckattestations"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests/valcheck/valcheckduty"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests/valcheck/valcheckproposer"
)

var AllTests = []tests.TestF{
Expand Down Expand Up @@ -145,4 +146,5 @@ var AllTests = []tests.TestF{
valcheckattestations.SlotMismatch,
valcheckattestations.ConsensusDataNil,
valcheckattestations.Valid,
valcheckproposer.BlindedBlock,
}
2 changes: 1 addition & 1 deletion ssv/spectest/generate/tests.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion ssv/spectest/tests/runner/consensus/valid_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ func ValidMessage() tests.SpecTest {
testingutils.TestAttesterConsensusDataByts,
), nil),
},
PostDutyRunnerStateRoot: "f36c8b537afaba0894dbc8c87cb94466d8ac2623e9283f1c584e3d544b5f2b88",
PostDutyRunnerStateRoot: "ec573732e70b70808972c43acb5ead6443cff06ba30d8abb51e37ac82ffe0727",
Comment thread
alonmuroch marked this conversation as resolved.
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
BeaconBroadcastedRoots: []string{
testingutils.GetSSZRootNoError(testingutils.TestingValidatorRegistration),
},
ExpectedError: "no consensus phase for validator registration",
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
package proposer

import (
"encoding/hex"

"github.com/attestantio/go-eth2-client/spec"
ssz "github.com/ferranbt/fastssz"
"github.com/herumi/bls-eth-go-binary/bls"

"github.com/bloxapp/ssv-spec/ssv/spectest/tests"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
)

func getSSZRootNoError(obj ssz.HashRoot) string {
r, _ := obj.HashTreeRoot()
return hex.EncodeToString(r[:])
}

// ProposeBlindedBlockDecidedRegular tests proposing a blinded block but the decided block is a regular block. Full flow
func ProposeBlindedBlockDecidedRegular() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
Expand Down Expand Up @@ -47,7 +39,7 @@ func ProposeBlindedBlockDecidedRegular() tests.SpecTest {
testingutils.PostConsensusProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func ProposeRegularBlockDecidedBlinded() tests.SpecTest {
testingutils.PostConsensusProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
}
}
30 changes: 12 additions & 18 deletions ssv/spectest/tests/runner/full_happy_flow.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
package runner

import (
"encoding/hex"

"github.com/attestantio/go-eth2-client/spec"
ssz "github.com/ferranbt/fastssz"

"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 getSSZRootNoError(obj ssz.HashRoot) string {
r, _ := obj.HashTreeRoot()
return hex.EncodeToString(r[:])
}

// FullHappyFlow tests a full runner happy flow
func FullHappyFlow() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
Expand Down Expand Up @@ -44,9 +35,9 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusSyncCommitteeContributionMsg(ks.Shares[1], 1, ks),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
},
},
{
Expand All @@ -67,7 +58,7 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusSyncCommitteeMsg(ks.Shares[1], 1),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
},
},
{
Expand Down Expand Up @@ -96,7 +87,7 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusAggregatorMsg(ks.Shares[1], 1),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
},
},
{
Expand All @@ -118,7 +109,7 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
},
{
Expand All @@ -140,7 +131,7 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
},
{
Expand All @@ -161,7 +152,7 @@ func FullHappyFlow() tests.SpecTest {
testingutils.PostConsensusAttestationMsg(ks.Shares[1], 1, qbft.FirstHeight),
},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
},
},
{
Expand All @@ -173,11 +164,14 @@ func FullHappyFlow() tests.SpecTest {
testingutils.SSVMsgValidatorRegistration(nil, testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[2], 2)),
testingutils.SSVMsgValidatorRegistration(nil, testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[3], 3)),
},
PostDutyRunnerStateRoot: fullHappyFlowValidatorRegistrationSC().Root(), // "f36c8b537afaba0894dbc8c87cb94466d8ac2623e9283f1c584e3d544b5f2b88",
PostDutyRunnerStateRoot: fullHappyFlowValidatorRegistrationSC().Root(), // "ec573732e70b70808972c43acb5ead6443cff06ba30d8abb51e37ac82ffe0727",
Comment thread
GalRogozinski marked this conversation as resolved.
PostDutyRunnerState: fullHappyFlowValidatorRegistrationSC().ExpectedState,
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
BeaconBroadcastedRoots: []string{
testingutils.GetSSZRootNoError(testingutils.TestingValidatorRegistration),
},
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ func InvalidMessageSlot() tests.SpecTest {
testingutils.SSVMsgValidatorRegistration(nil, testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[3], 3)),
testingutils.SSVMsgValidatorRegistration(nil, invalidateSlot(testingutils.PostConsensusAttestationMsg(ks.Shares[1], 1, qbft.FirstHeight))),
},
PostDutyRunnerStateRoot: "f36c8b537afaba0894dbc8c87cb94466d8ac2623e9283f1c584e3d544b5f2b88",
Comment thread
alonmuroch marked this conversation as resolved.
PostDutyRunnerStateRoot: "ec573732e70b70808972c43acb5ead6443cff06ba30d8abb51e37ac82ffe0727",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
BeaconBroadcastedRoots: []string{
testingutils.GetSSZRootNoError(testingutils.TestingValidatorRegistration),
},
ExpectedError: "no post consensus phase for validator registration",
},
},
Expand Down
16 changes: 8 additions & 8 deletions ssv/spectest/tests/runner/postconsensus/post_quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "57e3a5291c44bb8b8a7e4ed9bdd46657210929388e77c8e596e5b1ae3c33ad7f",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand All @@ -57,7 +57,7 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "22c0704c55bf02dac41189f60c4d9fd3f3dbb0abd4b5313edc228fab1ee0cde9",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand All @@ -79,7 +79,7 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "80607faeceb5e22636685e6cebb0dd2329330267a65181f82146056b489b0afb",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand All @@ -101,7 +101,7 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "7a210fe96e109eaa071b95b3099719e53d0cf17a6581cc16536bb808b5cb0f36",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand All @@ -123,7 +123,7 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "8c299b0c678bd34bab19c6b14a48ab8e82e058c09e954ed16606c2c132ab8e01",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand All @@ -145,7 +145,7 @@ func PostQuorum() tests.SpecTest {
PostDutyRunnerStateRoot: "7afcd06e998ab7d60845e12e08769e005dc63fa9ec0b6bb2f139a70a1e881822",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
},
DontStartDuty: true,
ExpectedError: expectedErr,
Expand Down
16 changes: 8 additions & 8 deletions ssv/spectest/tests/runner/postconsensus/quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "57e3a5291c44bb8b8a7e4ed9bdd46657210929388e77c8e596e5b1ae3c33ad7f",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[0], testingutils.TestingContributionProofsSigned[0], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[1], testingutils.TestingContributionProofsSigned[1], ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeContributions(testingutils.TestingSyncCommitteeContributions[2], testingutils.TestingContributionProofsSigned[2], ks)),
},
DontStartDuty: true,
},
Expand All @@ -53,7 +53,7 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "22c0704c55bf02dac41189f60c4d9fd3f3dbb0abd4b5313edc228fab1ee0cde9",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedSyncCommitteeBlockRoot(ks)),
},
DontStartDuty: true,
},
Expand All @@ -73,7 +73,7 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "80607faeceb5e22636685e6cebb0dd2329330267a65181f82146056b489b0afb",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
DontStartDuty: true,
},
Expand All @@ -93,7 +93,7 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "7a210fe96e109eaa071b95b3099719e53d0cf17a6581cc16536bb808b5cb0f36",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedBeaconBlockV(ks, spec.DataVersionBellatrix)),
},
DontStartDuty: true,
},
Expand All @@ -113,7 +113,7 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "8c299b0c678bd34bab19c6b14a48ab8e82e058c09e954ed16606c2c132ab8e01",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAggregateAndProof(ks)),
},
DontStartDuty: true,
},
Expand All @@ -133,7 +133,7 @@ func Quorum() tests.SpecTest {
PostDutyRunnerStateRoot: "7afcd06e998ab7d60845e12e08769e005dc63fa9ec0b6bb2f139a70a1e881822",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{
getSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
testingutils.GetSSZRootNoError(testingutils.TestingSignedAttestation(ks)),
},
DontStartDuty: true,
},
Expand Down
Loading