testingutils

package
v0.0.0-...-e35ed4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2025 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestingDutySlot            = 12
	TestingDutySlot2           = 50
	TestingDutyEpoch           = 0
	TestingValidatorIndex      = 1
	TestingWrongValidatorIndex = 100

	UnknownDutyType = 100
)
View Source
const (

	// Electra Fork Epoch: TODO - update to the correct value
	ForkEpochPraterElectra = 232000

	//Deneb Fork Epoch
	ForkEpochPraterDeneb = 231680

	// ForkEpochPraterCapella Goerli taken from https://github.com/ethereum/execution-specs/blob/37a8f892341eb000e56e962a051a87e05a2e4443/network-upgrades/mainnet-upgrades/shanghai.md?plain=1#L18
	ForkEpochPraterCapella = 162304

	ForkEpochBellatrix = 144896

	ForkEpochAltair = 74240

	ForkEpochPhase0 = 0

	TestingDutyEpochPhase0         = TestingDutyEpoch
	TestingDutySlotPhase0          = TestingDutySlot
	TestingDutySlotPhase0NextEpoch = TestingDutySlot2
	TestingDutySlotPhase0Invalid   = TestingDutySlotPhase0 + 50

	TestingDutyEpochAltair         = ForkEpochAltair
	TestingDutySlotAltair          = ForkEpochAltair * 32
	TestingDutySlotAltairNextEpoch = TestingDutySlotAltair + 32
	TestingDutySlotAltairInvalid   = TestingDutySlotAltair + 50

	TestingDutyEpochBellatrix         = ForkEpochBellatrix
	TestingDutySlotBellatrix          = ForkEpochBellatrix * 32
	TestingDutySlotBellatrixNextEpoch = TestingDutySlotBellatrix + 32
	TestingDutySlotBellatrixInvalid   = TestingDutySlotBellatrix + 50

	TestingDutyEpochCapella         = ForkEpochPraterCapella
	TestingDutySlotCapella          = ForkEpochPraterCapella * 32
	TestingDutySlotCapellaNextEpoch = TestingDutySlotCapella + 32
	TestingDutySlotCapellaInvalid   = TestingDutySlotCapella + 50

	TestingDutyEpochDeneb         = ForkEpochPraterDeneb
	TestingDutySlotDeneb          = ForkEpochPraterDeneb * 32
	TestingDutySlotDenebNextEpoch = TestingDutySlotDeneb + 32
	TestingDutySlotDenebInvalid   = TestingDutySlotDeneb + 50

	TestingDutyEpochElectra         = ForkEpochPraterElectra
	TestingDutySlotElectra          = ForkEpochPraterElectra*32 + 12
	TestingDutySlotElectraNextEpoch = TestingDutySlotElectra + 32
	TestingDutySlotElectraInvalid   = TestingDutySlotElectra + 50
)

Variables

View Source
var AggregatorMsgID = func() []byte {
	ret := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleAggregator)
	return ret[:]
}()
View Source
var AggregatorRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleAggregator, keySet)
}
View Source
var AttesterRunner7Operators = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleCommittee, keySet)
}
View Source
var BaseCommittee = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet) *ssv.Committee {

	var keySetSample *TestKeySet
	for _, ks := range keySetMap {
		keySetSample = ks
		break
	}

	shareMap := make(map[phase0.ValidatorIndex]*types.Share)
	for valIdx, ks := range keySetMap {
		shareMap[valIdx] = TestingShare(ks, valIdx)
	}

	createRunnerF := func(shareMap map[phase0.ValidatorIndex]*types.Share) *ssv.CommitteeRunner {
		return CommitteeRunnerWithShareMap(shareMap).(*ssv.CommitteeRunner)
	}
	return ssv.NewCommittee(
		*TestingCommitteeMember(keySetSample),
		shareMap,
		createRunnerF,
	)
}
View Source
var BaseCommitteeWithCreatorFieldsFromRunner = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, runnerSample *ssv.CommitteeRunner) *ssv.Committee {

	var keySetSample *TestKeySet
	for _, ks := range keySetMap {
		keySetSample = ks
		break
	}

	shareMap := make(map[phase0.ValidatorIndex]*types.Share)
	for valIdx, ks := range keySetMap {
		shareMap[valIdx] = TestingShare(ks, valIdx)
	}

	createRunnerF := func(shareMap map[phase0.ValidatorIndex]*types.Share) *ssv.CommitteeRunner {
		runner, err := ssv.NewCommitteeRunner(
			runnerSample.BaseRunner.BeaconNetwork,
			shareMap,
			qbft.NewController(
				runnerSample.BaseRunner.QBFTController.Identifier,
				runnerSample.BaseRunner.QBFTController.CommitteeMember,
				runnerSample.BaseRunner.QBFTController.GetConfig(),
				TestingOperatorSigner(keySetSample),
			),
			NewTestingBeaconNode(),
			NewTestingNetwork(1, keySetSample.OperatorKeys[1]),
			runnerSample.GetSigner(),
			runnerSample.GetOperatorSigner(),
			runnerSample.GetValCheckF(),
		)
		if err != nil {
			panic(err)
		}
		return runner.(*ssv.CommitteeRunner)
	}

	return ssv.NewCommittee(
		*TestingCommitteeMember(keySetSample),
		shareMap,
		createRunnerF,
	)
}
View Source
var BaseCommitteeWithRunner = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, runner *ssv.CommitteeRunner) *ssv.Committee {

	var keySetSample *TestKeySet
	for _, ks := range keySetMap {
		keySetSample = ks
		break
	}

	shareMap := make(map[phase0.ValidatorIndex]*types.Share)
	for valIdx, ks := range keySetMap {
		shareMap[valIdx] = TestingShare(ks, valIdx)
	}

	createRunnerF := func(shareMap map[phase0.ValidatorIndex]*types.Share) *ssv.CommitteeRunner {
		return runner
	}

	return ssv.NewCommittee(
		*TestingCommitteeMember(keySetSample),
		shareMap,
		createRunnerF,
	)
}
View Source
var BaseInstance = func() *qbft.Instance {
	return baseInstance(TestingCommitteeMember(Testing4SharesSet()), Testing4SharesSet(), []byte{1, 2, 3, 4})
}
View Source
var CommitteeMsgID = func(keySet *TestKeySet) []byte {

	committee := make([]uint64, 0)
	for _, op := range keySet.Committee() {
		committee = append(committee, op.Signer)
	}
	committeeID := types.GetCommitteeID(committee)

	ret := types.NewMsgID(TestingSSVDomainType, committeeID[:], types.RoleCommittee)
	return ret[:]
}
View Source
var CommitteeRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleCommittee, keySet)
}
View Source
var CommitteeRunnerWithShareMap = func(shareMap map[phase0.ValidatorIndex]*types.Share) ssv.Runner {
	return baseRunnerWithShareMap(types.RoleCommittee, shareMap)
}
View Source
var ConstructBaseRunner = func(role types.RunnerRole, keySet *TestKeySet) (ssv.Runner, error) {
	share := TestingShare(keySet, TestingValidatorIndex)
	km := NewTestingKeyManager()

	// Identifier
	var ownerID []byte
	if role == types.RoleCommittee {
		committee := make([]uint64, 0)
		for _, op := range keySet.Committee() {
			committee = append(committee, op.Signer)
		}
		clusterID := types.GetCommitteeID(committee)
		ownerID = clusterID[:]
	} else {
		ownerID = TestingValidatorPubKey[:]
	}
	identifier := types.NewMsgID(TestingSSVDomainType, ownerID[:], role)

	net := NewTestingNetwork(1, keySet.OperatorKeys[1])

	committeeMember := TestingCommitteeMember(keySet)

	opSigner := NewOperatorSigner(keySet, committeeMember.OperatorID)

	// Create ValueCheck
	var valCheck qbft.ProposedValueCheckF
	switch role {
	case types.RoleCommittee:
		valCheck = ssv.BeaconVoteValueCheckF(km, TestingDutySlot,
			[]types.ShareValidatorPK{share.SharePubKey}, TestingDutyEpoch)
	case types.RoleProposer:
		valCheck = ssv.ProposerValueCheckF(km, types.BeaconTestNetwork,
			(types.ValidatorPK)(TestingValidatorPubKey), TestingValidatorIndex, share.SharePubKey)
	case types.RoleAggregator:
		valCheck = ssv.AggregatorValueCheckF(km, types.BeaconTestNetwork,
			(types.ValidatorPK)(TestingValidatorPubKey), TestingValidatorIndex)
	case types.RoleSyncCommitteeContribution:
		valCheck = ssv.SyncCommitteeContributionValueCheckF(km, types.BeaconTestNetwork,
			(types.ValidatorPK)(TestingValidatorPubKey), TestingValidatorIndex)
	default:
		valCheck = nil
	}

	config := TestingConfig(keySet)
	config.ValueCheckF = valCheck
	config.ProposerF = func(state *qbft.State, round qbft.Round) types.OperatorID {
		return 1
	}
	config.Network = net

	contr := qbft.NewController(identifier[:], committeeMember, config, opSigner)

	shareMap := make(map[phase0.ValidatorIndex]*types.Share)
	shareMap[share.ValidatorIndex] = share

	var runner ssv.Runner
	var err error
	switch role {
	case types.RoleCommittee:
		runner, err = ssv.NewCommitteeRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
		)
	case types.RoleAggregator:
		runner, err = ssv.NewAggregatorRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleProposer:
		runner, err = ssv.NewProposerRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleSyncCommitteeContribution:
		runner, err = ssv.NewSyncCommitteeAggregatorRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleValidatorRegistration:
		runner, err = ssv.NewValidatorRegistrationRunner(
			types.BeaconTestNetwork,
			shareMap,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			types.DefaultGasLimit,
		)
	case types.RoleVoluntaryExit:
		runner, err = ssv.NewVoluntaryExitRunner(
			types.BeaconTestNetwork,
			shareMap,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
		)
	case UnknownDutyType:
		runner, err = ssv.NewCommitteeRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
		)
		if runner != nil {
			runner.(*ssv.CommitteeRunner).BaseRunner.RunnerRoleType = UnknownDutyType
		}
	default:
		return nil, errors.New("unknown role type")
	}
	return runner, err
}
View Source
var ConstructBaseRunnerWithShareMap = func(role types.RunnerRole, shareMap map[phase0.ValidatorIndex]*types.Share) (ssv.Runner, error) {

	var identifier types.MessageID
	var net *TestingNetwork
	var opSigner *types.OperatorSigner
	var valCheck qbft.ProposedValueCheckF
	var contr *qbft.Controller

	km := NewTestingKeyManager()

	if len(shareMap) > 0 {
		// Get sample instance for share and key set
		var keySetInstance *TestKeySet
		var shareInstance *types.Share
		for _, share := range shareMap {
			keySetInstance = KeySetForShare(share)
			shareInstance = TestingShare(keySetInstance, share.ValidatorIndex)
			break
		}

		sharePubKeys := make([]types.ShareValidatorPK, 0)
		for _, share := range shareMap {
			sharePubKeys = append(sharePubKeys, share.SharePubKey)
		}

		// Identifier
		var ownerID []byte
		if role == types.RoleCommittee {
			committee := make([]uint64, 0)
			for _, op := range keySetInstance.Committee() {
				committee = append(committee, op.Signer)
			}
			committeeID := types.GetCommitteeID(committee)
			ownerID = bytes.Clone(committeeID[:])
		} else {
			ownerID = TestingValidatorPubKey[:]
		}
		identifier = types.NewMsgID(TestingSSVDomainType, ownerID, role)

		net = NewTestingNetwork(1, keySetInstance.OperatorKeys[1])

		committeeMember := TestingCommitteeMember(keySetInstance)

		opSigner = NewOperatorSigner(keySetInstance, committeeMember.OperatorID)

		switch role {
		case types.RoleCommittee:
			valCheck = ssv.BeaconVoteValueCheckF(km, TestingDutySlot,
				sharePubKeys, TestingDutyEpoch)
		case types.RoleProposer:
			valCheck = ssv.ProposerValueCheckF(km, types.BeaconTestNetwork,
				(types.ValidatorPK)(shareInstance.ValidatorPubKey), shareInstance.ValidatorIndex, shareInstance.SharePubKey)
		case types.RoleAggregator:
			valCheck = ssv.AggregatorValueCheckF(km, types.BeaconTestNetwork,
				(types.ValidatorPK)(shareInstance.ValidatorPubKey), shareInstance.ValidatorIndex)
		case types.RoleSyncCommitteeContribution:
			valCheck = ssv.SyncCommitteeContributionValueCheckF(km, types.BeaconTestNetwork,
				(types.ValidatorPK)(shareInstance.ValidatorPubKey), shareInstance.ValidatorIndex)
		default:
			valCheck = nil
		}

		config := TestingConfig(keySetInstance)
		config.ValueCheckF = valCheck
		config.ProposerF = func(state *qbft.State, round qbft.Round) types.OperatorID {
			return 1
		}
		config.Network = net

		contr = qbft.NewController(identifier[:], committeeMember, config, opSigner)
	}

	var runner ssv.Runner
	var err error
	switch role {
	case types.RoleCommittee:
		runner, err = ssv.NewCommitteeRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
		)
	case types.RoleAggregator:
		runner, err = ssv.NewAggregatorRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleProposer:
		runner, err = ssv.NewProposerRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleSyncCommitteeContribution:
		runner, err = ssv.NewSyncCommitteeAggregatorRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
			TestingHighestDecidedSlot,
		)
	case types.RoleValidatorRegistration:
		runner, err = ssv.NewValidatorRegistrationRunner(
			types.BeaconTestNetwork,
			shareMap,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			types.DefaultGasLimit,
		)
	case types.RoleVoluntaryExit:
		runner, err = ssv.NewVoluntaryExitRunner(
			types.BeaconTestNetwork,
			shareMap,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
		)
	case UnknownDutyType:
		runner, err = ssv.NewCommitteeRunner(
			types.BeaconTestNetwork,
			shareMap,
			contr,
			NewTestingBeaconNode(),
			net,
			km,
			opSigner,
			valCheck,
		)
		if runner != nil {
			runner.(*ssv.CommitteeRunner).BaseRunner.RunnerRoleType = UnknownDutyType
		}
	default:
		return nil, errors.New("unknown role type")
	}
	return runner, err
}
View Source
var DecidingMsgsForHeight = func(consensusData *types.ValidatorConsensusData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	byts, _ := consensusData.Encode()
	r, _ := qbft.HashDataRoot(byts)
	fullData, _ := consensusData.MarshalSSZ()

	return DecidingMsgsForHeightWithRoot(r, fullData, msgIdentifier, height, keySet)
}

//////////////////// For QBFT TESTS /////////////////////////////////////////////////////////////////////////

View Source
var DecidingMsgsForHeightWithRoot = func(root [32]byte, fullData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	msgs := make([]*types.SignedSSVMessage, 0)

	for h := qbft.FirstHeight; h <= height; h++ {

		s := SignQBFTMsg(keySet.OperatorKeys[1], 1, &qbft.Message{
			MsgType:    qbft.ProposalMsgType,
			Height:     h,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		})
		s.FullData = fullData
		msgs = append(msgs, s)

		for i := uint64(1); i <= keySet.Threshold; i++ {
			msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
				MsgType:    qbft.PrepareMsgType,
				Height:     h,
				Round:      qbft.FirstRound,
				Identifier: msgIdentifier,
				Root:       root,
			}))
		}

		for i := uint64(1); i <= keySet.Threshold; i++ {
			msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
				MsgType:    qbft.CommitMsgType,
				Height:     h,
				Round:      qbft.FirstRound,
				Identifier: msgIdentifier,
				Root:       root,
			}))
		}
	}
	return msgs
}
View Source
var DifferentFullData = append(TestingQBFTFullData, []byte("different")...)
View Source
var DifferentRoot = func() [32]byte {
	return sha256.Sum256(DifferentFullData)
}()
View Source
var EncodeConsensusDataTest = func(cd *types.ValidatorConsensusData) []byte {
	encodedCD, _ := cd.Encode()
	return encodedCD
}
View Source
var ExpectedDecidingMsgsForHeight = func(consensusData *types.ValidatorConsensusData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	byts, _ := consensusData.Encode()
	r, _ := qbft.HashDataRoot(byts)
	fullData, _ := consensusData.MarshalSSZ()

	return ExpectedDecidingMsgsForHeightWithRoot(r, fullData, msgIdentifier, height, keySet)
}
View Source
var ExpectedDecidingMsgsForHeightWithRoot = func(root [32]byte, fullData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	msgs := make([]*types.SignedSSVMessage, 0)

	for h := qbft.FirstHeight; h <= height; h++ {

		s := SignQBFTMsg(keySet.OperatorKeys[1], 1, &qbft.Message{
			MsgType:    qbft.ProposalMsgType,
			Height:     h,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		})
		s.FullData = fullData
		msgs = append(msgs, s)

		for i := uint64(1); i <= keySet.Threshold; i++ {
			msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
				MsgType:    qbft.PrepareMsgType,
				Height:     h,
				Round:      qbft.FirstRound,
				Identifier: msgIdentifier,
				Root:       root,
			}))
		}

		for i := uint64(1); i <= keySet.Threshold; i++ {
			msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
				MsgType:    qbft.CommitMsgType,
				Height:     h,
				Round:      qbft.FirstRound,
				Identifier: msgIdentifier,
				Root:       root,
			}))
		}
	}
	return msgs
}
View Source
var ExpectedSSVDecidingMsgsV = func(consensusData *types.ValidatorConsensusData, ks *TestKeySet, role types.RunnerRole) []*types.SignedSSVMessage {
	id := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], role)

	ssvMsgF := func(partialSigMsg *types.PartialSignatureMessages) *types.SignedSSVMessage {
		byts, _ := partialSigMsg.Encode()

		ssvMsg := &types.SSVMessage{
			MsgType: types.SSVPartialSignatureMsgType,
			MsgID:   id,
			Data:    byts,
		}
		signer := partialSigMsg.Messages[0].Signer
		sig, err := NewOperatorSigner(ks, signer).SignSSVMessage(ssvMsg)
		if err != nil {
			panic(err)
		}
		return &types.SignedSSVMessage{
			OperatorIDs: []types.OperatorID{signer},
			Signatures:  [][]byte{sig},
			SSVMessage:  ssvMsg,
		}
	}

	base := make([]*types.SignedSSVMessage, 0)
	if role == types.RoleProposer {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, ssvMsgF(PreConsensusRandaoMsgV(ks.Shares[types.OperatorID(i)], types.OperatorID(i), consensusData.Version)))
		}
	}
	if role == types.RoleAggregator {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, ssvMsgF(PreConsensusSelectionProofMsg(ks.Shares[types.OperatorID(i)], ks.Shares[types.OperatorID(i)], types.OperatorID(i), types.OperatorID(i), consensusData.Version)))
		}
	}
	if role == types.RoleSyncCommitteeContribution {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, ssvMsgF(PreConsensusContributionProofMsg(ks.Shares[types.OperatorID(i)], ks.Shares[types.OperatorID(i)], types.OperatorID(i), types.OperatorID(i))))
		}
	}

	qbftMsgs := SSVExpectedDecidingMsgsForHeight(consensusData, id[:], qbft.Height(consensusData.Duty.Slot), ks)
	base = append(base, qbftMsgs...)
	return base
}
View Source
var MarshalJustifications = func(msgs []*types.SignedSSVMessage) [][]byte {
	bytes, err := qbft.MarshalJustifications(msgs)
	if err != nil {
		panic(err)
	}

	return bytes
}
View Source
var MultiSignQBFTMsg = func(sks []*rsa.PrivateKey, ids []types.OperatorID, msg *qbft.Message) *types.SignedSSVMessage {
	if len(sks) == 0 || len(ids) != len(sks) {
		panic("sks != ids")
	}
	var signed *types.SignedSSVMessage
	for i, sk := range sks {
		if signed == nil {
			signed = SignQBFTMsg(sk, ids[i], msg)
		} else {
			if err := signed.Aggregate(SignQBFTMsg(sk, ids[i], msg)); err != nil {
				panic(err.Error())
			}
		}
	}

	return signed
}
View Source
var PostConsensusAggregatorMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAggregatorMsg(sk, id, false, false, version)
}
View Source
var PostConsensusAggregatorTooFewRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: []*types.PartialSignatureMessage{},
	}
	return msg
}
View Source
var PostConsensusAggregatorTooManyRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	ret := postConsensusAggregatorMsg(sk, id, false, false, version)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false)
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusAttestationAndSyncCommitteeMsgForKeySetWithSlot(keySetMap, id, TestingDutySlotV(version))
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsgForKeySetWithSlot = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, slot phase0.Slot) *types.PartialSignatureMessages {

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		pSigMsgs := postConsensusAttestationMsg(ks.Shares[id], id, slot, false, false, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}
	}

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		pSigMsgs := postConsensusSyncCommitteeMsg(ks.Shares[id], id, slot, false, false, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}
	}
	return ret
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsgForValidatorsIndex = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion, validatorIndexes []phase0.ValidatorIndex) *types.PartialSignatureMessages {
	var msg *types.PartialSignatureMessages
	for _, valIdx := range validatorIndexes {
		valIdxMsg := postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false)
		for _, m := range valIdxMsg.Messages {
			m.ValidatorIndex = valIdx
		}

		if msg == nil {
			msg = valIdxMsg
		} else {
			msg.Messages = append(msg.Messages, valIdxMsg.Messages...)
		}
	}
	return msg
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsgTooFewRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: []*types.PartialSignatureMessage{},
	}
	return msg
}
View Source
var PostConsensusAttestationAndSyncCommitteeMsgTooManyRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	ret := postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusAttestationMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), false, false, TestingValidatorIndex)
}
View Source
var PostConsensusAttestationMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusAttestationMsgForKeySetWithSlot(keySetMap, id, TestingDutySlotV(version))
}
View Source
var PostConsensusAttestationMsgForKeySetWithSlot = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, slot phase0.Slot) *types.PartialSignatureMessages {

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		pSigMsgs := postConsensusAttestationMsg(ks.Shares[id], id, slot, false, false, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}
	}
	return ret
}
View Source
var PostConsensusAttestationMsgForValidatorsIndex = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion, validatorIndexes []phase0.ValidatorIndex) *types.PartialSignatureMessages {
	var msg *types.PartialSignatureMessages
	for _, valIdx := range validatorIndexes {
		valIdxMsg := postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), false, false, valIdx)
		if msg == nil {
			msg = valIdxMsg
		} else {
			msg.Messages = append(msg.Messages, valIdxMsg.Messages...)
		}
	}
	return msg
}
View Source
var PostConsensusAttestationTooFewRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: []*types.PartialSignatureMessage{},
	}
	return msg
}
View Source
var PostConsensusAttestationTooManyRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	ret := postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), false, false, TestingValidatorIndex)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusCommitteeMsgForDuty = func(duty *types.CommitteeDuty, keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID) *types.PartialSignatureMessages {

	var ret *types.PartialSignatureMessages

	for _, validatorDuty := range duty.ValidatorDuties {

		ks := keySetMap[validatorDuty.ValidatorIndex]

		if validatorDuty.Type == types.BNRoleAttester {
			attData := TestingAttestationDataForValidatorDuty(validatorDuty)
			pSigMsgs := postConsensusAttestationMsgForAttestationData(ks.Shares[id], id, duty.Slot, attData, validatorDuty.ValidatorIndex)
			if ret == nil {
				ret = pSigMsgs
			} else {
				ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
			}
		} else if validatorDuty.Type == types.BNRoleSyncCommittee {
			pSigMsgs := postConsensusSyncCommitteeMsg(ks.Shares[id], id, duty.Slot, false, false, validatorDuty.ValidatorIndex)
			if ret == nil {
				ret = pSigMsgs
			} else {
				ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
			}
		} else {
			panic(fmt.Sprintf("type %v not expected", validatorDuty.Type))
		}
	}

	return ret
}
View Source
var PostConsensusPartiallyWrongAttestationAndSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion, wrongRoot bool, wrongBeaconSig bool) *types.PartialSignatureMessages {

	numValid := len(keySetMap) / 2
	msgIndex := 0

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key

		invalidMsgFlag := (msgIndex < numValid)

		wrongRootV := wrongRoot && invalidMsgFlag
		wrongBeaconSigV := wrongBeaconSig && invalidMsgFlag

		attPSigMsgs := postConsensusAttestationMsg(ks.Shares[id], id, TestingDutySlotV(version), wrongRootV, wrongBeaconSigV, valIdx)
		if ret == nil {
			ret = attPSigMsgs
		} else {
			ret.Messages = append(ret.Messages, attPSigMsgs.Messages...)
		}

		scPSigMsgs := postConsensusSyncCommitteeMsg(ks.Shares[id], id, TestingDutySlotV(version), wrongRootV, wrongBeaconSigV, valIdx)
		ret.Messages = append(ret.Messages, scPSigMsgs.Messages...)

		msgIndex++
	}
	return ret
}
View Source
var PostConsensusPartiallyWrongAttestationMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion, wrongRoot bool, wrongBeaconSig bool) *types.PartialSignatureMessages {

	numValid := len(keySetMap) / 2
	msgIndex := 0

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key

		invalidMsgFlag := (msgIndex < numValid)

		wrongRootV := wrongRoot && invalidMsgFlag
		wrongBeaconSigV := wrongBeaconSig && invalidMsgFlag

		pSigMsgs := postConsensusAttestationMsg(ks.Shares[id], id, TestingDutySlotV(version), wrongRootV, wrongBeaconSigV, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}

		msgIndex++
	}
	return ret
}
View Source
var PostConsensusPartiallyWrongBeaconSigAttestationAndSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongAttestationAndSyncCommitteeMsgForKeySet(keySetMap, id, version, false, true)
}
View Source
var PostConsensusPartiallyWrongBeaconSigAttestationMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongAttestationMsgForKeySet(keySetMap, id, version, false, true)
}
View Source
var PostConsensusPartiallyWrongBeaconSigSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongSyncCommitteeMsgForKeySet(keySetMap, id, false, true, version)
}
View Source
var PostConsensusPartiallyWrongRootAttestationAndSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongAttestationAndSyncCommitteeMsgForKeySet(keySetMap, id, version, true, false)
}
View Source
var PostConsensusPartiallyWrongRootAttestationMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongAttestationMsgForKeySet(keySetMap, id, version, true, false)
}
View Source
var PostConsensusPartiallyWrongRootSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusPartiallyWrongSyncCommitteeMsgForKeySet(keySetMap, id, true, false, version)
}
View Source
var PostConsensusPartiallyWrongSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, wrongRoot bool, wrongBeaconSig bool, version spec.DataVersion) *types.PartialSignatureMessages {

	numValid := len(keySetMap) / 2
	msgIndex := 0

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key

		invalidMsgFlag := (msgIndex < numValid)

		wrongRootV := wrongRoot && invalidMsgFlag
		wrongBeaconSigV := wrongBeaconSig && invalidMsgFlag

		pSigMsgs := postConsensusSyncCommitteeMsg(ks.Shares[id], id, TestingDutySlotV(version), wrongRootV, wrongBeaconSigV, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}

		msgIndex++
	}
	return ret
}
View Source
var PostConsensusProposerMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusBeaconBlockMsgV(sk, id, false, false, version)
}
View Source
var PostConsensusProposerTooFewRootsMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingProposerDutyV(version).Slot,
		Messages: []*types.PartialSignatureMessage{},
	}
	return msg
}
View Source
var PostConsensusProposerTooManyRootsMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	ret := postConsensusBeaconBlockMsgV(sk, id, false, false, version)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingProposerDutyV(version).Slot,
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusSyncCommitteeContributionMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, false, false, false)
}
View Source
var PostConsensusSyncCommitteeContributionTooFewRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	ret := postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, false, false, false)
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlot,
		Messages: ret.Messages[0:2],
	}

	return msg
}
View Source
var PostConsensusSyncCommitteeContributionTooManyRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	ret := postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, false, false, false)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlot,
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusSyncCommitteeContributionWrongOrderMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, false, false, true)
}
View Source
var PostConsensusSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false, TestingValidatorIndex)
}
View Source
var PostConsensusSyncCommitteeMsgForKeySet = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PostConsensusSyncCommitteeMsgForKeySetWithSlot(keySetMap, id, TestingDutySlotV(version))
}
View Source
var PostConsensusSyncCommitteeMsgForKeySetWithSlot = func(keySetMap map[phase0.ValidatorIndex]*TestKeySet, id types.OperatorID, slot phase0.Slot) *types.PartialSignatureMessages {

	var ret *types.PartialSignatureMessages

	for _, valKs := range SortedMapKeys(keySetMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		pSigMsgs := postConsensusSyncCommitteeMsg(ks.Shares[id], id, slot, false, false, valIdx)
		if ret == nil {
			ret = pSigMsgs
		} else {
			ret.Messages = append(ret.Messages, pSigMsgs.Messages...)
		}
	}
	return ret
}
View Source
var PostConsensusSyncCommitteeMsgForValidatorsIndex = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion, validatorIndexes []phase0.ValidatorIndex) *types.PartialSignatureMessages {
	var msg *types.PartialSignatureMessages
	for _, valIdx := range validatorIndexes {
		valIdxMsg := postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false, valIdx)
		if msg == nil {
			msg = valIdxMsg
		} else {
			msg.Messages = append(msg.Messages, valIdxMsg.Messages...)
		}
	}
	return msg
}
View Source
var PostConsensusSyncCommitteeTooFewRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: []*types.PartialSignatureMessage{},
	}
	return msg
}
View Source
var PostConsensusSyncCommitteeTooManyRootsMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	ret := postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, false, TestingValidatorIndex)
	ret.Messages = append(ret.Messages, ret.Messages[0])

	msg := &types.PartialSignatureMessages{
		Type:     types.PostConsensusPartialSig,
		Slot:     TestingDutySlotV(version),
		Messages: ret.Messages,
	}
	return msg
}
View Source
var PostConsensusWrongAggregatorMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAggregatorMsg(sk, id, true, false, version)
}
View Source
var PostConsensusWrongAttestationAndSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), true, false)
}
View Source
var PostConsensusWrongAttestationMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), true, false, TestingValidatorIndex)
}
View Source
var PostConsensusWrongProposerMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusBeaconBlockMsgV(sk, id, true, false, version)
}
View Source
var PostConsensusWrongSigAggregatorMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAggregatorMsg(sk, id, false, true, version)
}
View Source
var PostConsensusWrongSigAttestationAndSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, true)
}
View Source
var PostConsensusWrongSigAttestationMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), false, true, TestingValidatorIndex)
}
View Source
var PostConsensusWrongSigProposerMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusBeaconBlockMsgV(sk, id, false, true, version)
}
View Source
var PostConsensusWrongSigSyncCommitteeContributionMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, false, true, false)
}
View Source
var PostConsensusWrongSigSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), false, true, TestingValidatorIndex)
}
View Source
var PostConsensusWrongSyncCommitteeContributionMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, true, false, false)
}
View Source
var PostConsensusWrongSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), true, false, TestingValidatorIndex)
}
View Source
var PostConsensusWrongValidatorIndexAggregatorMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := postConsensusAggregatorMsg(sk, id, true, false, version)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PostConsensusWrongValidatorIndexAttestationAndSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := postConsensusAttestationAndSyncCommitteeMsg(sk, id, TestingDutySlotV(version), true, false)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PostConsensusWrongValidatorIndexAttestationMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := postConsensusAttestationMsg(sk, id, TestingDutySlotV(version), true, false, TestingValidatorIndex)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PostConsensusWrongValidatorIndexProposerMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := postConsensusBeaconBlockMsgV(sk, id, true, false, version)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PostConsensusWrongValidatorIndexSyncCommitteeContributionMsg = func(sk *bls.SecretKey, id types.OperatorID, keySet *TestKeySet) *types.PartialSignatureMessages {
	msg := postConsensusSyncCommitteeContributionMsg(sk, id, TestingValidatorIndex, keySet, true, false, false)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PostConsensusWrongValidatorIndexSyncCommitteeMsg = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	msg := postConsensusSyncCommitteeMsg(sk, id, TestingDutySlotV(version), true, false, TestingValidatorIndex)
	for _, m := range msg.Messages {
		m.ValidatorIndex = TestingWrongValidatorIndex
	}
	return msg
}
View Source
var PreConsensusContributionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	return PreConsensusCustomSlotContributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot)
}
View Source
var PreConsensusContributionProofNextEpochMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	return contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot2, TestingDutySlot2, false, false)
}
View Source
var PreConsensusContributionProofTooFewRootsMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	ret := contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot, TestingDutySlot, false, false)
	msg := &types.PartialSignatureMessages{
		Type:     types.ContributionProofs,
		Slot:     TestingDutySlot,
		Messages: ret.Messages[0:2],
	}
	return msg
}
View Source
var PreConsensusContributionProofTooManyRootsMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	ret := contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot, TestingDutySlot, false, false)
	msg := &types.PartialSignatureMessages{
		Type:     types.ContributionProofs,
		Slot:     TestingDutySlot,
		Messages: append(ret.Messages, ret.Messages[0]),
	}
	return msg
}
View Source
var PreConsensusContributionProofWrongBeaconSigMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	return contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot, TestingDutySlot+1, false, true)
}
View Source
var PreConsensusCustomSlotContributionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, slot phase0.Slot) *types.PartialSignatureMessages {
	return contributionProofMsg(msgSK, beaconSK, msgID, beaconID, slot, TestingDutySlot, false, false)
}
View Source
var PreConsensusCustomSlotSelectionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, slot phase0.Slot) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, slot, slot, 1, false, false)
}
View Source
var PreConsensusFailedMsg = func(msgSigner *bls.SecretKey, msgSignerID types.OperatorID) *types.PartialSignatureMessages {
	signer := NewTestingKeyManager()
	beacon := NewTestingBeaconNode()
	d, _ := beacon.DomainData(TestingDutyEpoch, types.DomainRandao)
	signed, root, _ := signer.SignBeaconObject(types.SSZUint64(TestingDutyEpoch), d, msgSigner.GetPublicKey().Serialize(), types.DomainRandao)

	msg := types.PartialSignatureMessages{
		Type: types.RandaoPartialSig,
		Slot: TestingDutySlot,
		Messages: []*types.PartialSignatureMessage{
			{
				PartialSignature: signed[:],
				SigningRoot:      root,
				Signer:           msgSignerID,
				ValidatorIndex:   TestingValidatorIndex,
			},
		},
	}
	return &msg
}
View Source
var PreConsensusRandaoDifferentEpochMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version)+1, 1, false, version)
}
View Source
var PreConsensusRandaoDifferentSignerMsgV = func(
	msgSigner, randaoSigner *bls.SecretKey,
	msgSignerID,
	randaoSignerID types.OperatorID,
	version spec.DataVersion,
) *types.PartialSignatureMessages {
	signer := NewTestingKeyManager()
	beacon := NewTestingBeaconNode()
	epoch := TestingDutyEpochV(version)
	d, _ := beacon.DomainData(epoch, types.DomainRandao)
	signed, root, _ := signer.SignBeaconObject(types.SSZUint64(epoch), d, randaoSigner.GetPublicKey().Serialize(), types.DomainRandao)

	msg := types.PartialSignatureMessages{
		Type: types.RandaoPartialSig,
		Slot: TestingProposerDutyV(version).Slot,
		Messages: []*types.PartialSignatureMessage{
			{
				PartialSignature: signed[:],
				SigningRoot:      root,
				Signer:           randaoSignerID,
				ValidatorIndex:   TestingValidatorIndex,
			},
		},
	}
	return &msg
}
View Source
var PreConsensusRandaoMsg = func(sk *bls.SecretKey, id types.OperatorID) *types.PartialSignatureMessages {
	return randaoMsg(sk, id, false, TestingDutyEpoch, 1, false)
}
View Source
var PreConsensusRandaoMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version), 1, false, version)
}
View Source
var PreConsensusRandaoNextEpochMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version)+1, 1, false, version)
}
View Source
var PreConsensusRandaoNoMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version), 0, false, version)
}
View Source
var PreConsensusRandaoTooFewRootsMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version), 0, false, version)
}
View Source
var PreConsensusRandaoTooManyRootsMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version), 2, false, version)
}
View Source
var PreConsensusRandaoWrongBeaconSigMsgV = func(sk *bls.SecretKey, id types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return randaoMsgV(sk, id, false, TestingDutyEpochV(version), 1, true, version)
}
View Source
var PreConsensusSelectionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return PreConsensusCustomSlotSelectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version))
}
View Source
var PreConsensusSelectionProofNextEpochMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotNextEpochV(version), TestingDutySlotNextEpochV(version), 1, false, false)
}
View Source
var PreConsensusSelectionProofTooFewRootsMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version), TestingDutySlotV(version), 0, false, false)
}
View Source
var PreConsensusSelectionProofTooManyRootsMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version), TestingDutySlotV(version), 3, false, false)
}
View Source
var PreConsensusSelectionProofWrongBeaconSigMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version), TestingDutySlotV(version), 1, true, false)
}
View Source
var PreConsensusSelectionProofWrongRootSigMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version), TestingDutySlotV(version), 1, false, true)
}
View Source
var PreConsensusValidatorRegistrationMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot, false)
}
View Source
var PreConsensusValidatorRegistrationNextEpochMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot2, false)
}
View Source
var PreConsensusValidatorRegistrationTooFewRootsMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 0, false, TestingDutySlot, false)
}
View Source
var PreConsensusValidatorRegistrationTooManyRootsMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 2, false, TestingDutySlot, false)
}
View Source
var PreConsensusValidatorRegistrationWrongBeaconSigMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot, true)
}
View Source
var PreConsensusValidatorRegistrationWrongRootMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return validatorRegistrationMsg(msgSK, msgSK, msgID, msgID, 1, true, TestingDutySlot, false)
}
View Source
var PreConsensusVoluntaryExitMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot, false)
}
View Source
var PreConsensusVoluntaryExitNextEpochMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot2, false)
}
View Source
var PreConsensusVoluntaryExitTooFewRootsMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 0, false, TestingDutySlot, false)
}
View Source
var PreConsensusVoluntaryExitTooManyRootsMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 2, false, TestingDutySlot, false)
}
View Source
var PreConsensusVoluntaryExitWrongBeaconSigMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 1, false, TestingDutySlot, true)
}
View Source
var PreConsensusVoluntaryExitWrongRootMsg = func(msgSK *bls.SecretKey, msgID types.OperatorID) *types.PartialSignatureMessages {
	return VoluntaryExitMsg(msgSK, msgSK, msgID, msgID, 1, true, TestingDutySlot, false)
}
View Source
var PreConsensusWrongMsgSlotContributionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	return contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot, TestingDutySlot+1, false, false)
}
View Source
var PreConsensusWrongMsgSlotSelectionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID, version spec.DataVersion) *types.PartialSignatureMessages {
	return selectionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlotV(version), TestingDutySlotV(version)+1, 1, false, false)
}
View Source
var PreConsensusWrongOrderContributionProofMsg = func(msgSK, beaconSK *bls.SecretKey, msgID, beaconID types.OperatorID) *types.PartialSignatureMessages {
	return contributionProofMsg(msgSK, beaconSK, msgID, beaconID, TestingDutySlot, TestingDutySlot, true, false)
}
View Source
var ProposerBlindedBlockRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleProposer, keySet)
}
View Source
var ProposerMsgID = func() []byte {
	ret := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleProposer)
	return ret[:]
}()
View Source
var ProposerRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleProposer, keySet)
}
View Source
var SSVDecidingMsgsForCommitteeRunner = func(beaconVote *types.BeaconVote, ks *TestKeySet, height qbft.Height) []*types.SignedSSVMessage {
	id := CommitteeMsgID(ks)

	qbftMsgs := SSVDecidingMsgsForHeightAndBeaconVote(beaconVote, id[:], height, ks)
	return qbftMsgs
}
View Source
var SSVDecidingMsgsForHeight = func(consensusData *types.ValidatorConsensusData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	byts, _ := consensusData.Encode()
	r, _ := qbft.HashDataRoot(byts)
	fullData, _ := consensusData.MarshalSSZ()

	return SSVDecidingMsgsForHeightWithRoot(r, fullData, msgIdentifier, height, keySet)
}

//////////////////////////////// For SSV Tests ////////////////////////////////////////////////////////////////

View Source
var SSVDecidingMsgsForHeightAndBeaconVote = func(beaconVote *types.BeaconVote, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	fullData, err := beaconVote.Encode()
	if err != nil {
		panic(err)
	}
	r, err := qbft.HashDataRoot(fullData)
	if err != nil {
		panic(err)
	}

	return SSVDecidingMsgsForHeightWithRoot(r, fullData, msgIdentifier, height, keySet)
}
View Source
var SSVDecidingMsgsForHeightWithRoot = func(root [32]byte, fullData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	msgs := make([]*types.SignedSSVMessage, 0)

	s := SignQBFTMsg(keySet.OperatorKeys[1], 1, &qbft.Message{
		MsgType:    qbft.ProposalMsgType,
		Height:     height,
		Round:      qbft.FirstRound,
		Identifier: msgIdentifier,
		Root:       root,
	})
	s.FullData = fullData
	msgs = append(msgs, s)

	for i := uint64(1); i <= keySet.Threshold; i++ {
		msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
			MsgType:    qbft.PrepareMsgType,
			Height:     height,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		}))
	}

	for i := uint64(1); i <= keySet.Threshold; i++ {
		msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
			MsgType:    qbft.CommitMsgType,
			Height:     height,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		}))
	}
	return msgs
}
View Source
var SSVDecidingMsgsV = func(consensusData *types.ValidatorConsensusData, ks *TestKeySet, role types.RunnerRole) []*types.SignedSSVMessage {
	id := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], role)

	signedF := func(partialSigMsg *types.PartialSignatureMessages) *types.SignedSSVMessage {
		byts, _ := partialSigMsg.Encode()
		ssvMsg := &types.SSVMessage{
			MsgType: types.SSVPartialSignatureMsgType,
			MsgID:   id,
			Data:    byts,
		}
		signer := partialSigMsg.Messages[0].Signer
		sig, err := NewOperatorSigner(ks, signer).SignSSVMessage(ssvMsg)
		if err != nil {
			panic(err)
		}
		return &types.SignedSSVMessage{
			OperatorIDs: []types.OperatorID{signer},
			Signatures:  [][]byte{sig},
			SSVMessage:  ssvMsg,
		}
	}

	base := make([]*types.SignedSSVMessage, 0)
	if role == types.RoleProposer {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, signedF(PreConsensusRandaoMsgV(ks.Shares[types.OperatorID(i)], types.OperatorID(i), consensusData.Version)))
		}
	}
	if role == types.RoleAggregator {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, signedF(PreConsensusSelectionProofMsg(ks.Shares[types.OperatorID(i)], ks.Shares[types.OperatorID(i)], types.OperatorID(i), types.OperatorID(i), consensusData.Version)))
		}
	}
	if role == types.RoleSyncCommitteeContribution {
		for i := uint64(1); i <= ks.Threshold; i++ {
			base = append(base, signedF(PreConsensusContributionProofMsg(ks.Shares[types.OperatorID(i)], ks.Shares[types.OperatorID(i)], types.OperatorID(i), types.OperatorID(i))))
		}
	}

	qbftMsgs := SSVDecidingMsgsForHeight(consensusData, id[:], qbft.Height(consensusData.Duty.Slot), ks)
	base = append(base, qbftMsgs...)
	return base
}
View Source
var SSVExpectedDecidingMsgsForHeight = func(consensusData *types.ValidatorConsensusData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	byts, _ := consensusData.Encode()
	r, _ := qbft.HashDataRoot(byts)
	fullData, _ := consensusData.MarshalSSZ()

	return SSVExpectedDecidingMsgsForHeightWithRoot(r, fullData, msgIdentifier, height, keySet)
}
View Source
var SSVExpectedDecidingMsgsForHeightWithRoot = func(root [32]byte, fullData, msgIdentifier []byte, height qbft.Height, keySet *TestKeySet) []*types.SignedSSVMessage {
	msgs := make([]*types.SignedSSVMessage, 0)

	s := SignQBFTMsg(keySet.OperatorKeys[1], 1, &qbft.Message{
		MsgType:    qbft.ProposalMsgType,
		Height:     height,
		Round:      qbft.FirstRound,
		Identifier: msgIdentifier,
		Root:       root,
	})
	s.FullData = fullData
	msgs = append(msgs, s)

	for i := uint64(1); i <= keySet.Threshold; i++ {
		msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
			MsgType:    qbft.PrepareMsgType,
			Height:     height,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		}))
	}

	for i := uint64(1); i <= keySet.Threshold; i++ {
		msgs = append(msgs, SignQBFTMsg(keySet.OperatorKeys[types.OperatorID(i)], types.OperatorID(i), &qbft.Message{
			MsgType:    qbft.CommitMsgType,
			Height:     height,
			Round:      qbft.FirstRound,
			Identifier: msgIdentifier,
			Root:       root,
		}))
	}
	return msgs
}
View Source
var SSVMsgAggregator = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleAggregator))
}
View Source
var SSVMsgAttester = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleCommittee))
}
View Source
var SSVMsgCommittee = func(ks *TestKeySet, qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	msgIDBytes := CommitteeMsgID(ks)
	var msgID types.MessageID
	copy(msgID[:], msgIDBytes)
	return ssvMsg(qbftMsg, partialSigMsg, msgID)
}
View Source
var SSVMsgProposer = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleProposer))
}
View Source
var SSVMsgSyncCommittee = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleCommittee))
}
View Source
var SSVMsgSyncCommitteeContribution = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleSyncCommitteeContribution))
}
View Source
var SSVMsgValidatorRegistration = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleValidatorRegistration))
}
View Source
var SSVMsgVoluntaryExit = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleVoluntaryExit))
}
View Source
var SSVMsgWrongID = func(qbftMsg *types.SignedSSVMessage, partialSigMsg *types.PartialSignatureMessages) *types.SSVMessage {
	return ssvMsg(qbftMsg, partialSigMsg, types.NewMsgID(TestingSSVDomainType, TestingWrongValidatorPubKey[:], types.RoleCommittee))
}
View Source
var SevenOperatorsInstance = func() *qbft.Instance {
	return baseInstance(TestingCommitteeMember(Testing7SharesSet()), Testing7SharesSet(), []byte{1, 2, 3, 4})
}
View Source
var SignPartialSigSSVMessage = func(ks *TestKeySet, msg *types.SSVMessage) *types.SignedSSVMessage {

	if msg.MsgType != types.SSVPartialSignatureMsgType {
		panic("type different than SSVPartialSignatureMsgType to sign partial signature ssv message")
	}

	psigMsgs := &types.PartialSignatureMessages{}
	if err := psigMsgs.Decode(msg.Data); err != nil {
		panic(err)
	}
	var signer types.OperatorID
	if len(psigMsgs.Messages) == 0 {
		signer = 1
	} else {
		signer = psigMsgs.Messages[0].Signer
	}

	return SignedSSVMessageWithSigner(signer, ks.OperatorKeys[signer], msg)
}
View Source
var SignQBFTMsg = func(sk *rsa.PrivateKey, id types.OperatorID, msg *qbft.Message) *types.SignedSSVMessage {
	encodedMsg, err := msg.Encode()
	if err != nil {
		panic(err)
	}

	msgID := [56]byte{}
	copy(msgID[:], msg.Identifier)

	ssvMsg := &types.SSVMessage{
		MsgType: types.SSVConsensusMsgType,
		MsgID:   msgID,
		Data:    encodedMsg,
	}

	signature, err := types.SignSSVMessage(sk, ssvMsg)
	if err != nil {
		panic(err)
	}

	return &types.SignedSSVMessage{
		OperatorIDs: []types.OperatorID{id},
		Signatures:  [][]byte{signature},
		SSVMessage:  ssvMsg,
	}
}
View Source
var SignedSSVMessageListF = func(ks *TestKeySet, signers []types.OperatorID, ssvMessages []*types.SSVMessage) []*types.SignedSSVMessage {
	ret := make([]*types.SignedSSVMessage, 0)
	for i, msg := range ssvMessages {
		ret = append(ret, SignedSSVMessageWithSigner(signers[i], ks.OperatorKeys[signers[i]], msg))
	}
	return ret
}
View Source
var SignedSSVMessageWithSigner = func(operatorID types.OperatorID, rsaSK *rsa.PrivateKey, ssvMessage *types.SSVMessage) *types.SignedSSVMessage {

	data, err := ssvMessage.Encode()
	if err != nil {
		panic(err)
	}

	hash := sha256.Sum256(data)

	signature, err := rsa.SignPKCS1v15(rand.Reader, rsaSK, crypto.SHA256, hash[:])
	if err != nil {
		panic(err)
	}

	return &types.SignedSSVMessage{
		OperatorIDs: []types.OperatorID{operatorID},
		Signatures:  [][]byte{signature},
		SSVMessage:  ssvMessage,
	}
}
View Source
var SupportedAggregatorVersions = []spec.DataVersion{spec.DataVersionPhase0, spec.DataVersionElectra}
View Source
var SupportedAttestationVersions = []spec.DataVersion{spec.DataVersionPhase0, spec.DataVersionElectra}

SupportedBlockVersions is a list of supported regular/blinded beacon block versions by spec.

View Source
var SyncCommitteeContributionMsgID = func() []byte {
	ret := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleSyncCommitteeContribution)
	return ret[:]
}()
View Source
var SyncCommitteeContributionRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleSyncCommitteeContribution, keySet)
}
View Source
var SyncCommitteeRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleCommittee, keySet)
}
View Source
var TenOperatorsInstance = func() *qbft.Instance {
	return baseInstance(TestingCommitteeMember(Testing10SharesSet()), Testing10SharesSet(), []byte{1, 2, 3, 4})
}
View Source
var TestAggregatorConsensusData = func(version spec.DataVersion) *types.ValidatorConsensusData {
	return &types.ValidatorConsensusData{
		Duty:    *TestingAggregatorDuty(version),
		DataSSZ: TestingAggregateAndProofBytesV(version),
		Version: version,
	}
}
View Source
var TestAggregatorConsensusDataByts = func(version spec.DataVersion) []byte {
	byts, _ := TestAggregatorConsensusData(version).Encode()
	return byts
}

Used only as invalid test case

View Source
var TestAttesterConsensusDataByts, _ = TestAttesterConsensusData.Encode()
View Source
var TestBeaconVote = types.BeaconVote{
	BlockRoot: TestingBlockRoot,
	Source: &phase0.Checkpoint{
		Epoch: 0,
		Root:  TestingBlockRoot,
	},
	Target: &phase0.Checkpoint{
		Epoch: 1,
		Root:  TestingBlockRoot,
	},
}
View Source
var TestBeaconVoteByts, _ = TestBeaconVote.Encode()
View Source
var TestBeaconVoteNextEpoch = types.BeaconVote{
	BlockRoot: TestingBlockRoot,
	Source: &phase0.Checkpoint{
		Epoch: 0,
		Root:  TestingBlockRoot,
	},
	Target: &phase0.Checkpoint{
		Epoch: 1,
		Root:  TestingBlockRoot,
	},
}
View Source
var TestBeaconVoteNextEpochByts, _ = TestBeaconVoteNextEpoch.Encode()
View Source
var TestConsensusUnkownDutyTypeDataByts, _ = TestConsensusUnkownDutyTypeData.Encode()
View Source
var TestConsensusWrongDutyPKDataByts, _ = TestConsensusWrongDutyPKData.Encode()
View Source
var TestProposerBlindedBlockConsensusDataBytsV = func(version spec.DataVersion) []byte {
	cd := TestProposerBlindedBlockConsensusDataV(version)
	byts, _ := cd.Encode()
	return byts
}
View Source
var TestProposerBlindedBlockConsensusDataV = func(version spec.DataVersion) *types.ValidatorConsensusData {
	return &types.ValidatorConsensusData{
		Duty:    *TestingProposerDutyV(version),
		Version: version,
		DataSSZ: TestingBlindedBeaconBlockBytesV(version),
	}
}
View Source
var TestProposerConsensusDataBytsV = func(version spec.DataVersion) []byte {
	cd := TestProposerConsensusDataV(version)
	byts, _ := cd.Encode()
	return byts
}
View Source
var TestProposerConsensusDataV = func(version spec.DataVersion) *types.ValidatorConsensusData {
	duty := TestingProposerDutyV(version)
	return &types.ValidatorConsensusData{
		Duty:    *duty,
		Version: version,
		DataSSZ: TestingBeaconBlockBytesV(version),
	}
}
View Source
var TestSyncCommitteeConsensusData = &types.ValidatorConsensusData{
	Duty:    *TestingSyncCommitteeDuty(spec.DataVersionPhase0).ValidatorDuties[0],
	DataSSZ: TestingSyncCommitteeBlockRoot[:],
	Version: spec.DataVersionPhase0,
}

Used only as invalid test case

View Source
var TestSyncCommitteeConsensusDataByts, _ = TestSyncCommitteeConsensusData.Encode()
View Source
var TestSyncCommitteeContributionConsensusData = &types.ValidatorConsensusData{
	Duty:    TestingSyncCommitteeContributionDuty,
	DataSSZ: TestingContributionsDataBytes,
	Version: spec.DataVersionPhase0,
}
View Source
var TestSyncCommitteeContributionConsensusDataByts, _ = TestSyncCommitteeContributionConsensusData.Encode()
View Source
var TestSyncCommitteeContributionConsensusDataRoot = func() [32]byte {
	return sha256.Sum256(TestSyncCommitteeContributionConsensusDataByts)
}()
View Source
var TestWrongBeaconVote = types.BeaconVote{
	BlockRoot: phase0.Root{1, 2, 3, 4},
	Source: &phase0.Checkpoint{
		Epoch: 2,
		Root:  phase0.Root{1, 2, 3, 4},
	},
	Target: &phase0.Checkpoint{
		Epoch: 1,
		Root:  phase0.Root{1, 2, 3, 5},
	},
}
View Source
var TestWrongBeaconVoteByts, _ = TestWrongBeaconVote.Encode()
View Source
var TestingAggregateAndProofBytesV = func(version spec.DataVersion) []byte {
	if version == spec.DataVersionElectra {
		return TestingElectraAggregateAndProofBytes
	} else {
		return TestingPhase0AggregateAndProofBytes
	}
}
View Source
var TestingAggregateAndProofV = func(version spec.DataVersion) ssz.Marshaler {
	if version == spec.DataVersionElectra {
		return TestingElectraAggregateAndProof
	} else {
		return TestingPhase0AggregateAndProof
	}
}
View Source
var TestingAggregatorDuty = func(version spec.DataVersion) *types.ValidatorDuty {
	return &types.ValidatorDuty{
		Type:                    types.BNRoleAggregator,
		PubKey:                  TestingValidatorPubKey,
		Slot:                    TestingDutySlotV(version),
		ValidatorIndex:          TestingValidatorIndex,
		CommitteeIndex:          22,
		CommitteesAtSlot:        36,
		CommitteeLength:         128,
		ValidatorCommitteeIndex: 11,
	}
}
View Source
var TestingAggregatorDutyFirstSlot = func() *types.ValidatorDuty {
	return &types.ValidatorDuty{
		Type:                    types.BNRoleAggregator,
		PubKey:                  TestingValidatorPubKey,
		Slot:                    0,
		ValidatorIndex:          TestingValidatorIndex,
		CommitteeIndex:          22,
		CommitteesAtSlot:        36,
		CommitteeLength:         128,
		ValidatorCommitteeIndex: 11,
	}
}
View Source
var TestingAggregatorDutyNextEpoch = func(version spec.DataVersion) *types.ValidatorDuty {
	return &types.ValidatorDuty{
		Type:                    types.BNRoleAggregator,
		PubKey:                  TestingValidatorPubKey,
		Slot:                    TestingDutySlotNextEpochV(version),
		ValidatorIndex:          TestingValidatorIndex,
		CommitteeIndex:          22,
		CommitteesAtSlot:        36,
		CommitteeLength:         128,
		ValidatorCommitteeIndex: 11,
	}
}
View Source
var TestingAttestationData = func(version spec.DataVersion) *phase0.AttestationData {
	attData := &phase0.AttestationData{
		Slot:            TestingDutySlotV(version),
		Index:           TestingCommitteeIndex,
		BeaconBlockRoot: TestingBlockRoot,
		Source: &phase0.Checkpoint{
			Epoch: 0,
			Root:  TestingBlockRoot,
		},
		Target: &phase0.Checkpoint{
			Epoch: 1,
			Root:  TestingBlockRoot,
		},
	}

	if version >= spec.DataVersionElectra {
		attData.Index = 0
	}

	return attData
}
View Source
var TestingAttestationDataBytes = func(version spec.DataVersion) []byte {
	ret, _ := TestingAttestationData(version).MarshalSSZ()
	return ret
}
View Source
var TestingAttestationDataForValidatorDuty = func(duty *types.ValidatorDuty) *phase0.AttestationData {
	attData := &phase0.AttestationData{
		Slot:            duty.Slot,
		Index:           duty.CommitteeIndex,
		BeaconBlockRoot: TestBeaconVote.BlockRoot,
		Source:          TestBeaconVote.Source,
		Target:          TestBeaconVote.Target,
	}

	version := VersionBySlot(duty.Slot)
	if version >= spec.DataVersionElectra {
		attData.Index = 0
	}

	return attData
}
View Source
var TestingAttestationDataRoot = func(version spec.DataVersion) [32]byte {
	ret, _ := TestingAttestationData(version).HashTreeRoot()
	return ret
}
View Source
var TestingAttestationNextEpochData = func(version spec.DataVersion) *phase0.AttestationData {
	attData := &phase0.AttestationData{
		Slot:            TestingDutySlotNextEpochV(version),
		Index:           TestingCommitteeIndex,
		BeaconBlockRoot: TestingBlockRoot,
		Source: &phase0.Checkpoint{
			Epoch: 0,
			Root:  TestingBlockRoot,
		},
		Target: &phase0.Checkpoint{
			Epoch: 1,
			Root:  TestingBlockRoot,
		},
	}
	if version >= spec.DataVersionElectra {
		attData.Index = 0
	}
	return attData
}
View Source
var TestingAttestationNextEpochDataBytes = func(version spec.DataVersion) []byte {
	ret, _ := TestingAttestationNextEpochData(version).MarshalSSZ()
	return ret
}
View Source
var TestingAttestationResponseBeaconObject = func(ks *TestKeySet, version spec.DataVersion) ssz.HashRoot {

	switch version {
	case spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix, spec.DataVersionCapella, spec.DataVersionDeneb:
		return TestingSignedAttestation(ks)
	case spec.DataVersionElectra:
		return TestingElectraSingleAttestation(ks)
	default:
		panic("unknown data version")
	}
}
View Source
var TestingAttestationResponseBeaconObjectForDuty = func(ks *TestKeySet, version spec.DataVersion, duty *types.ValidatorDuty) ssz.HashRoot {

	switch version {
	case spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix, spec.DataVersionCapella, spec.DataVersionDeneb:
		return TestingSignedAttestationForDuty(ks, duty)
	case spec.DataVersionElectra:
		return TestingElectraSingleAttestationForDuty(ks, duty)
	default:
		panic("unknown data version")
	}
}
View Source
var TestingAttestationResponseBeaconObjectForValidatorIndex = func(ks *TestKeySet, version spec.DataVersion, validatorIndex phase0.ValidatorIndex) ssz.HashRoot {

	switch version {
	case spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix, spec.DataVersionCapella, spec.DataVersionDeneb:
		return TestingSignedAttestationForValidatorIndex(ks, validatorIndex)
	case spec.DataVersionElectra:
		return TestingElectraSingleAttestationForValidatorIndex(ks, validatorIndex)
	default:
		panic("unknown data version")
	}
}
View Source
var TestingAttesterAndSyncCommitteeDuties = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDuty([]int{TestingValidatorIndex}, []int{TestingValidatorIndex}, version)
}
View Source
var TestingAttesterAndSyncCommitteeDutiesFirstSlot = func() *types.CommitteeDuty {
	return TestingCommitteeDutyFirstSlot([]int{TestingValidatorIndex}, []int{TestingValidatorIndex})
}
View Source
var TestingAttesterAndSyncCommitteeDutiesNextEpoch = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDutyNextEpoch([]int{TestingValidatorIndex}, []int{TestingValidatorIndex}, version)
}
View Source
var TestingAttesterDuty = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDuty([]int{TestingValidatorIndex}, nil, version)
}
View Source
var TestingAttesterDutyFirstSlot = func() *types.CommitteeDuty {
	return TestingCommitteeDutyFirstSlot([]int{TestingValidatorIndex}, nil)
}
View Source
var TestingAttesterDutyForValidator = func(version spec.DataVersion, validatorIndex phase0.ValidatorIndex) *types.CommitteeDuty {
	return TestingCommitteeDuty([]int{int(validatorIndex)}, nil, version)
}
View Source
var TestingAttesterDutyForValidators = func(version spec.DataVersion, validatorIndexLst []int) *types.CommitteeDuty {
	return TestingCommitteeDuty(validatorIndexLst, nil, version)
}
View Source
var TestingAttesterDutyNextEpoch = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDutyNextEpoch([]int{TestingValidatorIndex}, nil, version)
}
View Source
var TestingBeaconBlockBytesV = func(version spec.DataVersion) []byte {
	var ret []byte
	vBlk := TestingBeaconBlockV(version)

	switch version {
	case spec.DataVersionCapella:
		if vBlk.Capella == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Capella.MarshalSSZ()
	case spec.DataVersionDeneb:
		if vBlk.Deneb == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Deneb.MarshalSSZ()

	case spec.DataVersionElectra:
		if vBlk.Electra == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Electra.MarshalSSZ()

	default:
		panic("unsupported version")
	}

	return ret
}
View Source
var TestingBeaconBlockCapella = func() *capella.BeaconBlock {
	var res capella.BeaconBlock
	err := json.Unmarshal(capellaBlock, &res)
	if err != nil {
		panic(err)
	}

	res.Slot = TestingDutySlotCapella
	return &res
}()
View Source
var TestingBeaconBlockV = func(version spec.DataVersion) *api.VersionedProposal {
	switch version {
	case spec.DataVersionCapella:
		return &api.VersionedProposal{
			Version: version,
			Capella: TestingBeaconBlockCapella,
		}
	case spec.DataVersionDeneb:
		return &api.VersionedProposal{
			Version: version,
			Deneb:   TestingBlockContentsDeneb,
		}
	case spec.DataVersionElectra:
		return &api.VersionedProposal{
			Version: version,
			Electra: TestingBlockContentsElectra,
		}
	default:
		panic("unsupported version")
	}
}
View Source
var TestingBlindedBeaconBlockBytesV = func(version spec.DataVersion) []byte {
	var ret []byte
	vBlk := TestingBlindedBeaconBlockV(version)

	switch version {
	case spec.DataVersionCapella:
		if vBlk.Capella == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Capella.MarshalSSZ()
	case spec.DataVersionDeneb:
		if vBlk.Deneb == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Deneb.MarshalSSZ()
	case spec.DataVersionElectra:
		if vBlk.Electra == nil {
			panic("empty block")
		}
		ret, _ = vBlk.Electra.MarshalSSZ()

	default:
		panic("unsupported version")
	}

	return ret
}
View Source
var TestingBlindedBeaconBlockCapella = func() *apiv1capella.BlindedBeaconBlock {
	fullBlk := TestingBeaconBlockCapella
	txRoot, _ := types.SSZTransactions(fullBlk.Body.ExecutionPayload.Transactions).HashTreeRoot()
	withdrawalsRoot, _ := types.SSZWithdrawals(fullBlk.Body.ExecutionPayload.Withdrawals).HashTreeRoot()
	ret := &apiv1capella.BlindedBeaconBlock{
		Slot:          fullBlk.Slot,
		ProposerIndex: fullBlk.ProposerIndex,
		ParentRoot:    fullBlk.ParentRoot,
		StateRoot:     fullBlk.StateRoot,
		Body: &apiv1capella.BlindedBeaconBlockBody{
			RANDAOReveal:      fullBlk.Body.RANDAOReveal,
			ETH1Data:          fullBlk.Body.ETH1Data,
			Graffiti:          fullBlk.Body.Graffiti,
			ProposerSlashings: fullBlk.Body.ProposerSlashings,
			AttesterSlashings: fullBlk.Body.AttesterSlashings,
			Attestations:      fullBlk.Body.Attestations,
			Deposits:          fullBlk.Body.Deposits,
			VoluntaryExits:    fullBlk.Body.VoluntaryExits,
			SyncAggregate:     fullBlk.Body.SyncAggregate,
			ExecutionPayloadHeader: &capella.ExecutionPayloadHeader{
				ParentHash:       fullBlk.Body.ExecutionPayload.ParentHash,
				FeeRecipient:     fullBlk.Body.ExecutionPayload.FeeRecipient,
				StateRoot:        fullBlk.Body.ExecutionPayload.StateRoot,
				ReceiptsRoot:     fullBlk.Body.ExecutionPayload.ReceiptsRoot,
				LogsBloom:        fullBlk.Body.ExecutionPayload.LogsBloom,
				PrevRandao:       fullBlk.Body.ExecutionPayload.PrevRandao,
				BlockNumber:      fullBlk.Body.ExecutionPayload.BlockNumber,
				GasLimit:         fullBlk.Body.ExecutionPayload.GasLimit,
				GasUsed:          fullBlk.Body.ExecutionPayload.GasUsed,
				Timestamp:        fullBlk.Body.ExecutionPayload.Timestamp,
				ExtraData:        fullBlk.Body.ExecutionPayload.ExtraData,
				BaseFeePerGas:    fullBlk.Body.ExecutionPayload.BaseFeePerGas,
				BlockHash:        fullBlk.Body.ExecutionPayload.BlockHash,
				TransactionsRoot: txRoot,
				WithdrawalsRoot:  withdrawalsRoot,
			},
			BLSToExecutionChanges: fullBlk.Body.BLSToExecutionChanges,
		},
	}

	return ret
}()
View Source
var TestingBlindedBeaconBlockDeneb = func() *apiv1deneb.BlindedBeaconBlock {
	blockContents := TestingBlockContentsDeneb
	txRoot, _ := types.SSZTransactions(blockContents.Block.Body.ExecutionPayload.Transactions).HashTreeRoot()
	withdrawalsRoot, _ := types.SSZWithdrawals(blockContents.Block.Body.ExecutionPayload.Withdrawals).HashTreeRoot()
	ret := &apiv1deneb.BlindedBeaconBlock{
		Slot:          blockContents.Block.Slot,
		ProposerIndex: blockContents.Block.ProposerIndex,
		ParentRoot:    blockContents.Block.ParentRoot,
		StateRoot:     blockContents.Block.StateRoot,
		Body: &apiv1deneb.BlindedBeaconBlockBody{
			RANDAOReveal:      blockContents.Block.Body.RANDAOReveal,
			ETH1Data:          blockContents.Block.Body.ETH1Data,
			Graffiti:          blockContents.Block.Body.Graffiti,
			ProposerSlashings: blockContents.Block.Body.ProposerSlashings,
			AttesterSlashings: blockContents.Block.Body.AttesterSlashings,
			Attestations:      blockContents.Block.Body.Attestations,
			Deposits:          blockContents.Block.Body.Deposits,
			VoluntaryExits:    blockContents.Block.Body.VoluntaryExits,
			SyncAggregate:     blockContents.Block.Body.SyncAggregate,
			ExecutionPayloadHeader: &deneb.ExecutionPayloadHeader{
				ParentHash:       blockContents.Block.Body.ExecutionPayload.ParentHash,
				FeeRecipient:     blockContents.Block.Body.ExecutionPayload.FeeRecipient,
				StateRoot:        blockContents.Block.Body.ExecutionPayload.StateRoot,
				ReceiptsRoot:     blockContents.Block.Body.ExecutionPayload.ReceiptsRoot,
				LogsBloom:        blockContents.Block.Body.ExecutionPayload.LogsBloom,
				PrevRandao:       blockContents.Block.Body.ExecutionPayload.PrevRandao,
				BlockNumber:      blockContents.Block.Body.ExecutionPayload.BlockNumber,
				GasLimit:         blockContents.Block.Body.ExecutionPayload.GasLimit,
				GasUsed:          blockContents.Block.Body.ExecutionPayload.GasUsed,
				Timestamp:        blockContents.Block.Body.ExecutionPayload.Timestamp,
				ExtraData:        blockContents.Block.Body.ExecutionPayload.ExtraData,
				BaseFeePerGas:    blockContents.Block.Body.ExecutionPayload.BaseFeePerGas,
				BlockHash:        blockContents.Block.Body.ExecutionPayload.BlockHash,
				TransactionsRoot: txRoot,
				WithdrawalsRoot:  withdrawalsRoot,
				BlobGasUsed:      blockContents.Block.Body.ExecutionPayload.BlobGasUsed,
				ExcessBlobGas:    blockContents.Block.Body.ExecutionPayload.ExcessBlobGas,
			},
			BLSToExecutionChanges: blockContents.Block.Body.BLSToExecutionChanges,
			BlobKZGCommitments:    blockContents.Block.Body.BlobKZGCommitments,
		},
	}

	return ret
}()
View Source
var TestingBlindedBeaconBlockElectra = func() *apiv1electra.BlindedBeaconBlock {
	blockContents := TestingBlockContentsElectra
	txRoot, _ := types.SSZTransactions(blockContents.Block.Body.ExecutionPayload.Transactions).HashTreeRoot()
	withdrawalsRoot, _ := types.SSZWithdrawals(blockContents.Block.Body.ExecutionPayload.Withdrawals).HashTreeRoot()
	ret := &apiv1electra.BlindedBeaconBlock{
		Slot:          blockContents.Block.Slot,
		ProposerIndex: blockContents.Block.ProposerIndex,
		ParentRoot:    blockContents.Block.ParentRoot,
		StateRoot:     blockContents.Block.StateRoot,
		Body: &apiv1electra.BlindedBeaconBlockBody{
			RANDAOReveal:      blockContents.Block.Body.RANDAOReveal,
			ETH1Data:          blockContents.Block.Body.ETH1Data,
			Graffiti:          blockContents.Block.Body.Graffiti,
			ProposerSlashings: blockContents.Block.Body.ProposerSlashings,
			AttesterSlashings: blockContents.Block.Body.AttesterSlashings,
			Attestations:      blockContents.Block.Body.Attestations,
			Deposits:          blockContents.Block.Body.Deposits,
			VoluntaryExits:    blockContents.Block.Body.VoluntaryExits,
			SyncAggregate:     blockContents.Block.Body.SyncAggregate,
			ExecutionPayloadHeader: &deneb.ExecutionPayloadHeader{
				ParentHash:       blockContents.Block.Body.ExecutionPayload.ParentHash,
				FeeRecipient:     blockContents.Block.Body.ExecutionPayload.FeeRecipient,
				StateRoot:        blockContents.Block.Body.ExecutionPayload.StateRoot,
				ReceiptsRoot:     blockContents.Block.Body.ExecutionPayload.ReceiptsRoot,
				LogsBloom:        blockContents.Block.Body.ExecutionPayload.LogsBloom,
				PrevRandao:       blockContents.Block.Body.ExecutionPayload.PrevRandao,
				BlockNumber:      blockContents.Block.Body.ExecutionPayload.BlockNumber,
				GasLimit:         blockContents.Block.Body.ExecutionPayload.GasLimit,
				GasUsed:          blockContents.Block.Body.ExecutionPayload.GasUsed,
				Timestamp:        blockContents.Block.Body.ExecutionPayload.Timestamp,
				ExtraData:        blockContents.Block.Body.ExecutionPayload.ExtraData,
				BaseFeePerGas:    blockContents.Block.Body.ExecutionPayload.BaseFeePerGas,
				BlockHash:        blockContents.Block.Body.ExecutionPayload.BlockHash,
				TransactionsRoot: txRoot,
				WithdrawalsRoot:  withdrawalsRoot,
				BlobGasUsed:      blockContents.Block.Body.ExecutionPayload.BlobGasUsed,
				ExcessBlobGas:    blockContents.Block.Body.ExecutionPayload.ExcessBlobGas,
			},
			BLSToExecutionChanges: blockContents.Block.Body.BLSToExecutionChanges,
			BlobKZGCommitments:    blockContents.Block.Body.BlobKZGCommitments,
			ExecutionRequests:     blockContents.Block.Body.ExecutionRequests,
		},
	}

	return ret
}()
View Source
var TestingBlindedBeaconBlockV = func(version spec.DataVersion) *api.VersionedBlindedProposal {
	switch version {
	case spec.DataVersionCapella:
		return &api.VersionedBlindedProposal{
			Version: version,
			Capella: TestingBlindedBeaconBlockCapella,
		}
	case spec.DataVersionDeneb:
		return &api.VersionedBlindedProposal{
			Version: version,
			Deneb:   TestingBlindedBeaconBlockDeneb,
		}
	case spec.DataVersionElectra:
		return &api.VersionedBlindedProposal{
			Version: version,
			Electra: TestingBlindedBeaconBlockElectra,
		}
	default:
		panic("unsupported version")
	}
}
View Source
var TestingBlockContentsDeneb = func() *apiv1deneb.BlockContents {
	var res apiv1deneb.BlockContents
	if err := json.Unmarshal(denebBlockContents, &res); err != nil {
		panic(err)
	}

	res.Block.Slot = ForkEpochPraterDeneb
	return &res
}()
View Source
var TestingBlockContentsElectra = func() *apiv1electra.BlockContents {

	var beaconBlock *electra.BeaconBlock
	if err := json.Unmarshal(electraBeaconBlock, &beaconBlock); err != nil {
		panic(err)
	}

	beaconBlock.Slot = ForkEpochPraterElectra

	denebBlockContents := TestingBlockContentsDeneb

	return &apiv1electra.BlockContents{
		Block:     beaconBlock,
		KZGProofs: denebBlockContents.KZGProofs,
		Blobs:     denebBlockContents.Blobs,
	}
}()
View Source
var TestingBlockRoot = phase0.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}
View Source
var TestingCommitMessage = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	return TestingCommitMessageWithRound(sk, id, qbft.FirstRound)
}

* Commit messages

View Source
var TestingCommitMessageWithHeight = func(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingCommitMessageWithParams(sk, id, qbft.FirstRound, height, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingCommitMessageWithIdentifierAndRoot = func(sk *rsa.PrivateKey, id types.OperatorID, identifier []byte, root [32]byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.CommitMsgType,
		Height:     qbft.FirstHeight,
		Round:      qbft.FirstRound,
		Identifier: identifier,
		Root:       root,
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = []byte{}
	return ret
}
View Source
var TestingCommitMessageWithParams = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	identifier []byte,
	root [32]byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.CommitMsgType,
		Height:     height,
		Round:      round,
		Identifier: identifier,
		Root:       root,
	}
	ret := SignQBFTMsg(sk, id, msg)
	return ret
}
View Source
var TestingCommitMessageWithRound = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingCommitMessageWithParams(sk, id, round, qbft.FirstHeight, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingCommitMessageWrongHeight = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	return TestingCommitMessageWithParams(sk, id, qbft.FirstRound, 10, TestingIdentifier, DifferentRoot)
}
View Source
var TestingCommitMultiSignerMessage = func(sks []*rsa.PrivateKey, ids []types.OperatorID) *types.SignedSSVMessage {
	return TestingCommitMultiSignerMessageWithRound(sks, ids, qbft.FirstRound)
}
View Source
var TestingCommitMultiSignerMessageWithHeight = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingCommitMultiSignerMessageWithParams(sks, ids, qbft.FirstRound, height, TestingIdentifier, TestingQBFTRootData, TestingQBFTFullData)
}
View Source
var TestingCommitMultiSignerMessageWithHeightAndIdentifier = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height, identifier []byte) *types.SignedSSVMessage {
	return TestingCommitMultiSignerMessageWithParams(sks, ids, qbft.FirstRound, height, identifier, TestingQBFTRootData, TestingQBFTFullData)
}
View Source
var TestingCommitMultiSignerMessageWithParams = func(
	sks []*rsa.PrivateKey,
	ids []types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	identifier []byte,
	root [32]byte,
	fullData []byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.CommitMsgType,
		Height:     height,
		Round:      round,
		Identifier: identifier,
		Root:       root,
	}
	ret := MultiSignQBFTMsg(sks, ids, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingCommitMultiSignerMessageWithRound = func(sks []*rsa.PrivateKey, ids []types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingCommitMultiSignerMessageWithParams(sks, ids, round, qbft.FirstHeight, TestingIdentifier, TestingQBFTRootData, TestingQBFTFullData)
}
View Source
var TestingCommitteeIndex = phase0.CommitteeIndex(3)
View Source
var TestingCommitteeLenght = uint64(128)
View Source
var TestingCommitteeMember = func(keysSet *TestKeySet) *types.CommitteeMember {
	operators := []*types.Operator{}

	for _, key := range keysSet.Committee() {

		pkBytes, err := types.GetPublicKeyPem(keysSet.OperatorKeys[key.Signer])
		if err != nil {
			panic(err)
		}

		operators = append(
			operators, &types.Operator{
				OperatorID:        key.Signer,
				SSVOperatorPubKey: pkBytes,
			},
		)
	}

	opIds := []types.OperatorID{}
	for _, key := range keysSet.Committee() {
		opIds = append(opIds, key.Signer)
	}

	operatorPubKeyBytes, err := types.GetPublicKeyPem(keysSet.OperatorKeys[1])
	if err != nil {
		panic(err)
	}

	return &types.CommitteeMember{
		OperatorID:        1,
		CommitteeID:       types.GetCommitteeID(opIds),
		SSVOperatorPubKey: operatorPubKeyBytes,
		FaultyNodes:       (keysSet.Threshold - 1) / 2,
		Committee:         operators,
		DomainType:        TestingSSVDomainType,
	}
}
View Source
var TestingCommitteesAtSlot = uint64(36)
View Source
var TestingConfig = func(keySet *TestKeySet) *qbft.Config {
	return &qbft.Config{
		Domain: TestingSSVDomainType,
		ValueCheckF: func(data []byte) error {
			if bytes.Equal(data, TestingInvalidValueCheck) {
				return errors.New("invalid value")
			}

			if len(data) == 0 {
				return errors.New("invalid value")
			}
			return nil
		},
		ProposerF: func(state *qbft.State, round qbft.Round) types.OperatorID {
			return 1
		},
		Network:     NewTestingNetwork(1, keySet.OperatorKeys[1]),
		Timer:       NewTestingTimer(),
		CutOffRound: TestingCutOffRound,
	}
}
View Source
var TestingContributionProofIndexes = []uint64{0, 1, 2}
View Source
var TestingContributionProofsSigned = func() []phase0.BLSSignature {

	byts1, _ := hex.DecodeString("b18833bb7549ec33e8ac414ba002fd45bb094ca300bd24596f04a434a89beea462401da7c6b92fb3991bd17163eb603604a40e8dd6781266c990023446776ff42a9313df26a0a34184a590e57fa4003d610c2fa214db4e7dec468592010298bc")
	byts2, _ := hex.DecodeString("9094342c95146554df849dc20f7425fca692dacee7cb45258ddd264a8e5929861469fda3d1567b9521cba83188ffd61a0dbe6d7180c7a96f5810d18db305e9143772b766d368aa96d3751f98d0ce2db9f9e6f26325702088d87f0de500c67c68")
	byts3, _ := hex.DecodeString("a7f88ce43eff3aa8cdd2e3957c5bead4e21353fbecac6079a5398d03019bc45ff7c951785172deee70e9bc5abbc8ca6a0f0441e9d4cc9da74c31121357f7d7c7de9533f6f457da493e3314e22d554ab76613e469b050e246aff539a33807197c")

	ret := make([]phase0.BLSSignature, 0)
	for _, byts := range [][]byte{byts1, byts2, byts3} {
		b := phase0.BLSSignature{}
		copy(b[:], byts)
		ret = append(ret, b)
	}
	return ret
}()
View Source
var TestingContributionsData = func() types.Contributions {
	d := types.Contributions{}
	d = append(d, &types.Contribution{
		SelectionProofSig: TestingContributionProofsSigned[0],
		Contribution:      *TestingSyncCommitteeContributions[0],
	})
	d = append(d, &types.Contribution{
		SelectionProofSig: TestingContributionProofsSigned[1],
		Contribution:      *TestingSyncCommitteeContributions[1],
	})
	d = append(d, &types.Contribution{
		SelectionProofSig: TestingContributionProofsSigned[2],
		Contribution:      *TestingSyncCommitteeContributions[2],
	})
	return d
}()
View Source
var TestingContributionsDataBytes = func() []byte {
	ret, _ := TestingContributionsData.MarshalSSZ()
	return ret
}()
View Source
var TestingCutOffRound = qbft.Round(15)
View Source
var TestingDKGOperators4Map = map[types.OperatorID]struct {
	SK            *ecdsa.PrivateKey
	ETHAddress    common.Address
	EncryptionKey *rsa.PrivateKey
}{
	1: {
		SK:            ecdsaSKFromHex("96e85c616d446272f387f52f8ce936ee7ac3c65ebe284d1de3c481fa0d147501"),
		ETHAddress:    ethAddressFromHex("535953b5a6040074948cf185eaa7d2abbd66808f"),
		EncryptionKey: rsaSKFromHex("308204a50201000282010100cd2476cbe0327a3d7042206e11b549e9519cf713c2fad9d7f9b6e7625c12d69eb5f8ad354ab1af7b4a5b96684802d28e0123f0a25240954821884b516b1bb368b1b8f721ec49e7471cfcc4d7430f3109eb23941a51e6fe172615c0bed0395b41a7d09830fbe67fd38276405caa064fd6e9f3d3a4989be64fcef96d81e28aba5f078376bc4301610ee4c7532c96f7eaf5c403aaa1ed3ac7d779075f64d37ff261e60717825becb181d042ef2e4642cc8ee330d6812c0d98447e8221dacfd839693a0c368379581f5677f64ce45ceeee98b678e8cdd4caf03428d6063ddd298da55ddd5430735b1da21ca38b1922c04622129e7ac925c03546cc39b3b690951c350203010001028201002df4422c6f9fbf246e3651ff76360f459603bc918fb713ffbeafcb6b8c46a80f4ba25662bec5c912ac5891fbf04db98f18104e027ebc7af47a968690c9969dfd10fae759910e0922340b27a9351b7d17c4b5e6a272c0752108660d14719eb7a3a08d28daa8433d554b3f64319de0e617b5b6ea2d5006747462601bb8e1dfc3d9c92309cc0fd8a576723ae6aa8d8dfbba4872067ecf644c4730c00b00a2b8edd1789e0a0ed5e3b76b5f2d31db12105120e49aaad8eb4a5dabc62adfd0e5368773548538ea66c87ea576d7b7a20a8738c25cb1347e5d0bd1cfe28633faaed97d9c070622ddc3764c00e9ce00fc8325b7d5109e543f606d47cf2d953436099f976102818100ec784008ff79151521baa6b98f32c923efae24ce210a51ecf50874332624fe3c9edaa71698a0c7c99273f7d1759785799aa9649e0e62de74586bc768402a6c30ea7c0a949357ba17e2f52c1d92ad3a069a7bc7c5818ed2a7e0ebc5de7ac2e0f7e5b39dcd5bfa0916f3b42fd3316e1556f5617bd50c09a49f0d819e874d4df60902818100de15da091d66d42da949cb3c6dff2d3818ed86ca0d5105ae063ff705b45f6cfb04f4592dceef66d0975b8bfec6abace5a6124f2d22bc7a568f542b67b6f0d6579c9332b912f98482b82347a1a9adc72a97a9c1d05761bb07fe806a1a3f66a62a158d0e4a918723611627ff4808677fe4cab31eb1e55ab33e46b0a870ac7c1fcd02818100bbdc387b2d82a3161baaae43a298e524d08817a34eaa65358be1007796293375337a5fdddab9789f11e361909d0c1834e883047570d66906232cd4c964988f453933fc2fd6f28ddbe62982b7a7cc48d9f026c0298f68c8c0283707065d9eae9d227654ba4e04d0edd404652e3209d39836ef1032cc12691f16dacff78b99910902818100c67752b54890275772ecde71ef7ed62346aba60414e86e21f9b5da04400ff32d545d2500f9e819c2993097a82455311abd51a96e1597c7e0690ff80624878f9515f8b9a0892370d6fcc59273175694212d0de8854e41a949d8975bba7f2435a47043f11c9476e718111bc757d122e5394a27ce6b7e229302395c0ffb393967950281810094163aa0f45111ebb0539c52d35287b08e2aae25d62ce815e2ca6804689c33949420d7968dba1674aad76b8c501940a5ac32e4574dfe6511adf8ed8e6d6b25ceb2037d3b6bcf5ec11b0b3d0eae638e21796d042473fc8c0ee2a8d480b3053c2069618f1dd551e1a1d8c76327efdc704272e8cedba1e1e51f82308b834ed692f4"),
	},
	2: {
		SK:            ecdsaSKFromHex("6222880ea97bba45d6120626691bc74829741db4ad9300a85a20a925e2c74996"),
		ETHAddress:    ethAddressFromHex("01139beb7ceb4c6a9fd3da779ed69612e489f4e6"),
		EncryptionKey: rsaSKFromHex("308204a50201000282010100c0a177fe5c06b91d0374b66a69a6dda067439085de6248825aebcea570873abecb89f8bbb52aacaebf80d46ee576593f10d804a6ffda4274d6fc19cd2444db74c690adafc2432f13149251e5624d8dd32f6fe034d9a174605105ee5d3f6285a220657cbc1d8f52abf6789eef8be2ab831a9f66c9556a43a10d3064de8f9924ccd818966502ad75079006a267116f5d328871f9040c425b4fb4f3d33985fcfd161ac4fe8e8e7b13205208ff13b353f4a56d394e0b08d1b770ae6f3ad8242c2401433eecf3f0a0fc0e2fe076e21041525c7bd27bd659bc386067d5bd2fa88fd6ca8f89092d598c99f146b996a6ce4667cc4be7fa9c9013ffac90e4b82cb075d95102030100010282010100b85b50be0d5119e51ca39cd9a717de505fc4181326cca55cacabb5f03c0c103afe0da411f1c74fd146d2837d46fac75b464197e244479d06b9a239074e48e04798aa6ab02599aaf9f5dc3ba8ef360e2029ec46860e2b2977ecd36257b80c109d23a83d82c43fa0fd973bc5d0b8ee4cfb828540183c392154878ce35ce5cdc99ae14757e866c4c5cab0625fc1f463a7c6adbc18de8f1410c2ae844b59f443296bb12ccf149d5cc7b85cea10f95569b0526882c1aa19fa197579efcb4dbab0d7580c1b05468c24dc0e1ded552a2ba84db32c610029a5426a9700628ce167f9aaa9ef151ac05cfdd6a66ddbc77d27dde1599098cd677bc7c92fd4f8a3e3e9cbc88102818100e8b2aa080efc1684d7b4de3c02a7e9bf1703c0b361039c4b47470ec1fa5e1be63aae59dc1a6f0661b5485f99ea2d36491c17c250779cea0fb61533c3a5936fce4dd2f32c5d4ea70c9bcaa5304cd76571ad257b80bb8cc2b073ae9964152f9bdd78a7c58b38c893d4a1971b9ac64aa99b8db043d6224db86e8f76183fbc46de2902818100d3eba93f76e2457e4324ae71f1d5adad220ef8b8fe0a37c71a4b40b2e02d3820b091ce43f50239ab49b344cb9c31894286ce6379373553b5ff9a78325f02f1fd47efeee66aece1a48102b268599e89e4d917506718e64b99eaf47bb3ea72406172257139d279383508b6ded3e7ad9a07d275dbe20a174486866c0038e97136e9028181009aafda540d120b2e37eea6252266d8fe0ca094032aa4a9cb69109580e19c99d34c83067d489d3192d65dcc1f970a8321caa908a5513e60621d5aaed48a471e75f84a19190ed5f03a737e1c9da51732fa846d7c52315afb392d4d8dee781ef3f01ffaf758fb606ad558ae08cdb4af815c44ae3e0a2537a138ede9456969117b3102818100a99397f91ace714159c50e7a4b43eb17f17afd783a803ea5e9da71c9312dbe0e1a7c720b5b110ec88bcf11abc42eb7612eb2145338e4493a0770b9e1c4b97c9e6a640a4d031ece686e7b93fb804b2698a346cea5d0fce75e20eec5d5f032c065b98b50912e64a59f7a7baacef242ae50b80e6b86f3002f6b5e4129e46098a19102818029055908c97eb39712df34b9078c6c94b6fa3908c2809c7da36f9ff282e79196180a1da03fa67fda6a000cb6e6cf75707921c2243d8a92cccc150e874b5691c5069bbd9d096b4fc05fa2f5f7ae0af2699057b42c0f2b83236de4542781ea77befbb6985cdc5a878518eef254942330898439723840294369519d7103757465ca"),
	},
	3: {
		SK:            ecdsaSKFromHex("182fc09c07dc35580f1e2c67cb623a71aa2745f79824119a1095c0d373bc1c42"),
		ETHAddress:    ethAddressFromHex("ac8dea7a377f42f31a72cbbf0029048bda105c37"),
		EncryptionKey: rsaSKFromHex("308204a40201000282010100d9d5a9e7aa4d9fc75ed0a5a77540b6026b9ea6913a635edf1f5481f81fd0eabbcc3fea37ed11edd38086983260135d25ed4d2cdbae6892fde3787074e892727602639577c0729e6446bb289ec87f6bc8071a6ad9120cfdc892910f005a56fc466b9f9ebb9adf80e14f13de129b82eeec95d0c9ebba4f3952786d8287ff3146a4e00af5c44aaf1f7611a5791dcf05dfe076733d89bca404722ab9810695bdbc95839f47938367ae5f829b053988cb7d94f72825ede566bcc5aac15b227a1d6899efc428c7829ccb38839196b39aa091e714f8fbad4ed75694ada2f90b70a15b147114d360ccd93767c45db0d6fc3dbc58d024fd1fd2d0fd1301823e7e6432cd4d02030100010282010100a62e9f80f1e668278408eee772c71c537a60bd37fbf0453738c292a885352f6e77a2a6ff65679125125f1c0b0a4a9b7c4caddcb3f7392632746fb4732bde555dfbf296db95c09b5f6aaa6b91bee99e832a10184563c4ef732d85668961620cf178377cb428b1abb3b74d33d4c438be27551fc47b8655dc2833616ffc6a4de0528d7987bf8621f3586016bb47f8e81cf04657f471ce6f0d9d71dd7da3e7ef850af1d20551c0cdbbf77fe6e39dd58434083dd20e7f4eddb4883e67db7f172d26b35bb559aa3c7a9c3a0a46e665857463904973d31443097ce1ec37ba8f15efa9c36201acbda208350dedf94b9c52699a8188267a87bcf48c73dc2149dd2c9f53ad02818100f2d7cf3ae35d2e09b5aad153b8b3819c7b8196491ff936abebc7bd86a967e08af4e21e11865833c50ca6a286eca8e9554dc93b6a2acfdb5f38258f41075a7f8fb0c1240e37d4371bab40d8a6eed71974e7c5f40455018f7b50700c028d7c9d2a26b3e6f234c588081d6821a8bb8518693be4c9eb222dbfb80d3cce0369c03e0f02818100e5a2fe04fb9a0cc637ed2e97df12bd2c6f859dadbb41b2f251ab705419c4049779686b9b6275e57fb2950af2816ac8697ec9ec7a98f5899cdf2b377aa3aa0807d7b609afff7ecbe3d539193593f3d209a539509fbe501251c4d35367ed89fe0aac2bca9b0e0a12e427c506aa3dae1fa98a495f43d4086a33b43c659e2aeddae30281802a5b580af6735f3f544f8a196742f01d8231552c46066af1cbbb58246fd1ed896f332d79730c59634a549a4e9c62cde8121c425fbf3de80e90b5846a1c453db0ab6cd4c4221ac2cdf1adeadc1b16ab9b077e3094bcdafbd2cf71ebb65a455d08681dc2ef8622da1a483ecc7828d50b2ff7c16d32b51073bb3f9bd67723efe3230281805bb0d12cbc29aea01704a56e0eac34cce15ac0b2f5ea2dc183caa8776c3250830aff1eb854802ebae65b8c9b780163347c63b400dfc26ac83073d91b26ee65767c333b7b02d16627faa369e572c6103fb9b140f807cd8103154c2c297b3776305cbebf8f59f3bbc74df9e5c764097aaaff847c7d60d45b5379cc03e73bcced7102818100e82890aff55c0ac12bb1be372cf491be5b20d54438f1ff96b32d00b59c539106478ce6d7b6a1200037a4998c12dc7f6f2479a8ca7c0ab0e8bc019d82047cdb315ed2f20cec4ca1f118ea778ea2bbc3c78f20258fd025115c9451e90120c46f0c95f5aeaefb6cf37428d62811051466d5f1d3301144dc7c9e735c0bcd114625a1"),
	},
	4: {
		SK:            ecdsaSKFromHex("4d3eb49ca01aa6b715a482633fac171f26e957874dd64fe14d8645ddd11346fb"),
		ETHAddress:    ethAddressFromHex("aaaa953af60e4423ad0dadacacab635b095ba255"),
		EncryptionKey: rsaSKFromHex("308204a40201000282010100ad489826fd514cc2845646d59bd0846fdc9b77c58fd3b79dbf07f1a4d0d98f5210f5af483c3a02769927961c9de52acdcc78d7a87e720b574d40f93b5a49095e26e95fd5ccfc3976051c8cb18ff26ac8bd1a95a759b9cc6fa3b75aa77687ce103874680aa922b5f0b65831f9903404da1ce87e15276ab956cf6f72622274edf8a34b743575e870e67368d6e0da4167da9e7027dee219c65c7fd66f8484d249fbaf59534ee553d756dd07f9a50c26334fcfd94391f2b5583b67a8a4c2239b5de55f1b21a8d748312010ac99baebe617183fcb0fcb28b93810344089f3cf2e57969d3c6f72b340ff3c2941fd7b921f314440aec96bba353d848685b305ea2732670203010001028201004dc6627c4580830a5f6975fb9426dffa7132da6c32e4dcea117ed8479871bdb120e994d5c02a6d469bf1379ffa828c56b86a98a908afd94542e861b4f10e0d055443b4fefa354ef918cc3a9dcbb50b96b3c1c5dfca16e99a460a1ac7451d29310095c6c8da2739302437ab9e8ec9ba4fc75fd68f5a14bdc127f3a68c4358e621d0c62b855809c0a97cfd617ce639864be5b5d367eb4ebe37e647856ffe2d7dbc43eb20c8ce2fca5651dcbf682a85848297375d611dcee007d4d1edeaa7eb47431b1ee2b24d929f4587b55368c37adc21adeb72d4bcd4046c00954007177a28a4df766be75bb64a60d43ec02f9306e405485767fd5e010e0670f04c215a662f4102818100d995225d2236d885ae9818e03e947f88ac408f4580bd7166bc17e2e02d58c7b81bcd74e5ded04ae6f1d65b87232b1d7c3a7e3a7b8c8c5202731549d1f9ea39c769364003970d703634f2e0d50a46dccf8f7972756b1bc01fb183bc3915dc9875ccb488a79e09af675fa456a1dfe4489bcc49ac13c3517146e03ff6132d2f1e8702818100cbe11e635ede1aee24e1771d187da30161c521795f7e11a99997828f3257df51ab6a56ab62eae6bf691bddcc39547dc88ce34faeb1254f3c1fe48a1cbb89c21bd56a154533a77da103962fcc5485d82291a828e9a6e04e42ad135bd8dbaf7a30ec4845392517ed89ba23037070943a4cbd257bda17a4f8654f40c26400ef65210281807d5ea3184ad8935623cddbb78a17828cbbc3cf49daee4d6346c9f49dfb4306811cf3fb81602b609d45879fe173f029e324c90ae5998c58ccb486f5ac19764ea88a050a498745e4fc36f2237e5d978b2fc599d2cbb9559a1428f2a107bb830a0e064f97d60d07c39baace4464ad5f1a3f3b2cd00beb25084230806a478e67720d0281810096849ceac01f39c29777dd789d9c23bbe172a843f33c1fce1696c4ccf35dec815f0c22f0651707444955496a7ce8e3f42c0fa5c45304387b2b108ee6a78e0cc07fced1e5453d62827d23642676405a512b37fafc8537149025372597f498989d85d3d5475b1b4f435f287a6188bbe64ec155eb1a185ab308187ab7091da7a00102818100c157cce973ed91393e04048d321042feaed05d9cf4ec21e1cb0ed584ebad80c06810357fc45e9324173c4bbd234288403f15ad58e83184c2dade6e47d897ce100fc6c3bd4e6d1ef4b5af1f6621dd111b27a6f14f8850e89b61c3970234696d1a487322e972cd835d8ff35a0571585c827b3c630f4474e814dfd88dc4bc113477"),
	},
}
View Source
var TestingDifferentCommitteeIndex = phase0.CommitteeIndex(4)
View Source
var TestingElectraAggregateAndProof = &electra.AggregateAndProof{
	AggregatorIndex: 1,
	SelectionProof:  phase0.BLSSignature{},
	Aggregate: &electra.Attestation{
		AggregationBits: bitfield.NewBitlist(128),
		Signature:       phase0.BLSSignature{},
		Data:            TestingAttestationData(spec.DataVersionElectra),
		CommitteeBits:   bitfield.NewBitvector64(),
	},
}
View Source
var TestingElectraAggregateAndProofBytes = func() []byte {
	ret, _ := TestingElectraAggregateAndProof.MarshalSSZ()
	return ret
}()
View Source
var TestingElectraAttestation = func(ks *TestKeySet) *electra.Attestation {
	duty := TestingAttesterDuty(spec.DataVersionPhase0).ValidatorDuties[0]

	attData := TestingAttestationData(spec.DataVersionElectra)

	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)

	committeeBits := bitfield.NewBitvector64()
	committeeBits.SetBitAt(uint64(duty.CommitteeIndex), true)

	return &electra.Attestation{
		Data:            attData,
		AggregationBits: aggregationBitfield,
		CommitteeBits:   committeeBits,
		Signature:       signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraAttestationForDuty = func(ks *TestKeySet, duty *types.ValidatorDuty) *electra.Attestation {
	attData := TestingAttestationDataForValidatorDuty(duty)

	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)

	committeeBits := bitfield.NewBitvector64()
	committeeBits.SetBitAt(uint64(duty.CommitteeIndex), true)

	return &electra.Attestation{
		Data:            attData,
		AggregationBits: aggregationBitfield,
		CommitteeBits:   committeeBits,
		Signature:       signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraAttestationForValidatorIndex = func(ks *TestKeySet, validatorIndex phase0.ValidatorIndex) *electra.Attestation {
	committeeDuty := TestingAttesterDutyForValidator(spec.DataVersionPhase0, validatorIndex)
	duty := committeeDuty.ValidatorDuties[0]

	attData := TestingAttestationData(spec.DataVersionElectra)

	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)

	committeeBits := bitfield.NewBitvector64()
	committeeBits.SetBitAt(uint64(duty.CommitteeIndex), true)

	return &electra.Attestation{
		Data:            attData,
		AggregationBits: aggregationBitfield,
		CommitteeBits:   committeeBits,
		Signature:       signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraAttestationSSZRootForKeyMap = func(ksMap map[phase0.ValidatorIndex]*TestKeySet) []string {
	ret := make([]string, 0)
	for _, valKs := range SortedMapKeys(ksMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		committeeDuty := TestingAttesterDutyForValidator(spec.DataVersionElectra, valIdx)
		duty := committeeDuty.ValidatorDuties[0]

		attData := TestingAttestationDataForValidatorDuty(duty)

		aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
		aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)

		committeeBits := bitfield.NewBitvector64()
		committeeBits.SetBitAt(uint64(duty.CommitteeIndex), true)

		att := &electra.Attestation{
			Data:            attData,
			AggregationBits: aggregationBitfield,
			CommitteeBits:   committeeBits,
			Signature:       signBeaconObject(attData, types.DomainAttester, ks),
		}

		ret = append(ret, GetSSZRootNoError(att))
	}
	return ret
}
View Source
var TestingElectraSignedAggregateAndProof = func(ks *TestKeySet) *electra.SignedAggregateAndProof {
	return &electra.SignedAggregateAndProof{
		Message:   TestingElectraAggregateAndProof,
		Signature: signBeaconObject(TestingElectraAggregateAndProof, types.DomainAggregateAndProof, ks),
	}
}
View Source
var TestingElectraSingleAttestation = func(ks *TestKeySet) *electra.SingleAttestation {
	duty := TestingAttesterDuty(spec.DataVersionPhase0).ValidatorDuties[0]

	attData := TestingAttestationData(spec.DataVersionElectra)

	return &electra.SingleAttestation{
		CommitteeIndex: duty.CommitteeIndex,
		AttesterIndex:  TestingValidatorIndex,
		Data:           attData,
		Signature:      signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraSingleAttestationForDuty = func(ks *TestKeySet, duty *types.ValidatorDuty) *electra.SingleAttestation {

	attData := TestingAttestationDataForValidatorDuty(duty)

	return &electra.SingleAttestation{
		CommitteeIndex: duty.CommitteeIndex,
		AttesterIndex:  duty.ValidatorIndex,
		Data:           attData,
		Signature:      signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraSingleAttestationForValidatorIndex = func(ks *TestKeySet, validatorIndex phase0.ValidatorIndex) *electra.SingleAttestation {

	committeeDuty := TestingAttesterDutyForValidator(spec.DataVersionPhase0, validatorIndex)
	duty := committeeDuty.ValidatorDuties[0]

	attData := TestingAttestationData(spec.DataVersionElectra)

	return &electra.SingleAttestation{
		CommitteeIndex: duty.CommitteeIndex,
		AttesterIndex:  validatorIndex,
		Data:           attData,
		Signature:      signBeaconObject(attData, types.DomainAttester, ks),
	}
}
View Source
var TestingElectraSingleAttestationSSZRootForKeyMap = func(ksMap map[phase0.ValidatorIndex]*TestKeySet) []string {
	ret := make([]string, 0)

	for _, valKs := range SortedMapKeys(ksMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		committeeDuty := TestingAttesterDutyForValidator(spec.DataVersionElectra, valIdx)
		duty := committeeDuty.ValidatorDuties[0]

		attData := TestingAttestationDataForValidatorDuty(duty)

		singleAtt := &electra.SingleAttestation{
			CommitteeIndex: duty.CommitteeIndex,
			AttesterIndex:  valIdx,
			Data:           attData,
			Signature:      signBeaconObject(attData, types.DomainAttester, ks),
		}

		ret = append(ret, GetSSZRootNoError(singleAtt))
	}
	return ret
}
View Source
var TestingFeeRecipient = bellatrix.ExecutionAddress(ethAddressFromHex("535953b5a6040074948cf185eaa7d2abbd66808f"))
View Source
var TestingForkData = types.ForkData{Epoch: TestingDutyEpoch, Domain: TestingSSVDomainType}
View Source
var TestingGraffiti = [32]byte{1}
View Source
var TestingHighestDecidedSlot = phase0.Slot(0)
View Source
var TestingIdentifier = []byte{1, 2, 3, 4}
View Source
var TestingInvalidMessage = func(sk *rsa.PrivateKey, id types.OperatorID, msgType qbft.MessageType) *types.SignedSSVMessage {
	return TestingMultiSignerInvalidMessage([]*rsa.PrivateKey{sk}, []types.OperatorID{id}, msgType)
}
View Source
var TestingInvalidValueCheck = []byte{1, 1, 1, 1}
View Source
var TestingKeySetMap = map[phase0.ValidatorIndex]*TestKeySet{}/* 500 elements not displayed */
View Source
var TestingMultiSignerInvalidMessage = func(sks []*rsa.PrivateKey, ids []types.OperatorID, msgType qbft.MessageType) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    msgType,
		Height:     qbft.FirstHeight,
		Round:      qbft.FirstRound,
		Identifier: []byte{},
		Root:       TestingQBFTRootData,
	}
	ret := MultiSignQBFTMsg(sks, ids, msg)
	ret.FullData = TestingQBFTFullData
	return ret
}
View Source
var TestingMultiSignerProposalMessageWithHeight = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingMultiSignerProposalMessageWithParams(sks, ids, qbft.FirstRound, height, TestingIdentifier, TestingQBFTFullData, TestingQBFTRootData)
}
View Source
var TestingMultiSignerProposalMessageWithParams = func(
	sk []*rsa.PrivateKey,
	id []types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	identifier,
	fullData []byte,
	root [32]byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.ProposalMsgType,
		Height:     height,
		Round:      round,
		Identifier: identifier,
		Root:       root,
	}
	ret := MultiSignQBFTMsg(sk, id, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingMultiSignerRoundChangeMessageWithHeight = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingMultiSignerRoundChangeMessageWithParams(sks, ids, qbft.FirstRound, height, TestingQBFTRootData)
}
View Source
var TestingMultiSignerRoundChangeMessageWithParams = func(sk []*rsa.PrivateKey, id []types.OperatorID, round qbft.Round, height qbft.Height, root [32]byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.RoundChangeMsgType,
		Height:     height,
		Round:      round,
		Identifier: TestingIdentifier,
		Root:       root,
	}
	ret := MultiSignQBFTMsg(sk, id, msg)
	ret.FullData = TestingQBFTFullData
	return ret
}
View Source
var TestingMultiSignerRoundChangeMessageWithRound = func(sks []*rsa.PrivateKey, ids []types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingMultiSignerRoundChangeMessageWithParams(sks, ids, round, qbft.FirstHeight, TestingQBFTRootData)
}
View Source
var TestingOperatorKeys4Map = map[types.OperatorID]*rsa.PrivateKey{
	1: rsaSKFromHex("308204a40201000282010100c8ccf66fe299248cc1cd1670b696f22effe0ed8e0f14bf054dbe1c178a97b045f1261bb49462614f4618602c5809abcc65fe743500cee1009d7b796ca046016b0d1e7ed917362d8b5ffc708a3ddc37ce7a7761a8d2161fd81115d89137a337524abe5c862fda4efd7797c68c61c8d6d3c972033940533dd782f4627552a6c7186300f1137f73e6a6ec216a8dd89ffc0bf1147a3808c2111e0aed173fe6f9ca8ef061e7b95241fed814e7567e094770c7177f0539f9ebda12645a8a8a1acd2072d352a8d910c1a45fee13beec75fd42eb94d026fa0acb61742506efd0e4134a35b408fc34852daf3b304d53ebc01045f8c2a063cf75fe3c3bbd2dbc00e785a6510203010001028201000a16219ae52b0426fde52b676604970dbd54b31a1bafd318951b23961b241b7aa7ee5e1de80639151e544320771ba541932e00f058a60baf5839c793a9495af0e1abd27b5d2b1f868cbfc5776c3c0fa1938d439e934f01327d4937a3b3c3c317a32184cc48c3128cb0e132dc025d704d1b255afc193b15342a23d47e48349073965e376ad6adda5b2b0ca0079211e57a4333975e40cb7be59c1496514f179efb29055f4940aa7b0ebd05d2534f3cd84333b2a7d14782f85bc65dfbb9e39c3829b94aef63072ebc8f54a03cb696dde520cdd5f47213fedcbd72220d63df197a882d4cfa488d7067bbc5ec3b6c5c07effbf85b310bc3572c07048e653814cf54b102818100e49816bb4cc65881dfedd4f766074c4ba5d25dea4a241de0d043c0ebef275db2ddf4182611f2ae4e66e409555f190f82e6a6fff8e9da984afe5e23beaa85511b534d559f2ded88ba16f2d177f75fb2496d528a4ff80bf1714e0a91b7f73eb403f54cda1c524c8fd7b7238a350c392f141c9ea88ba37a7628dce811c07c6cfdc302818100e0dfd9544d600582e0ab69b6a262990818696a3c500e7fc07f3bf83dc5fb0331ec70468186518374d5299cb395f35166195ebef5d6d04190c05de9233553a5d1f1816250b45804286461d5984c7f6490812bf0066c4255dbbbf67e9bd792d3a7a612540e44395f24332ccb3913ef0a25a20738b3c5d81e8e0260e6677429a65b02818100c03df36802f20f7ef19e66eac44040f6a176a00aa7dd65cf29f6c0e8ea10362975a591257b14976851f956ac1834d029aae62900e152379f61fa339f667285ba303d2a539ae1578a0040a6ce78185fac86a6d2b0dc0ed7370d85aff4819696f77934ef7cbfeda94ea5b2dac930056b4543a85e6048d475487a3724aeb73545d702818100cef777b10d5dd8f4b20f51c694022752ba151b7fd336e501a898eb4aff929d482f92ce719bcc1e2f43997eee128ed55620f780ce071db99a9e5250a6e507cdd0427490a632b5e76dbda605ce9c698b872c3be238271f8ea2248723d40f3ec5aac140913868365d8895c91e69b41d07bbc73ada472b4a5424e3af879fa3dc498d02818053120a3e1ed0900b6c63e844b5068d92e5f84e0268d5aa83a8e31d39cab5c2a75dbbfeee601f928c4f7250f8daaf7b1c64f05d5e41b5b731c7837978a5f230f281adcbffc685876a41fee167e7fddd6c18a147aa68bd4d6cb47563f71f93dfb2125549c6080cab6b991fb799f6f2877293b682228b30100eb1619a467bf37e14"),
	2: rsaSKFromHex("308204a4020100028201010099864fd861b8ab755145a89d9a099a382c33cfcf064cbdbfb6ce2cc767cc689070b7699c46919224bb8c021f9024422110f7166926eb6146bb35e1fa4ef470b8c210bd6b0ec6c1027ceea0bdf6cb84cc43ae17e4160e86ccc80960199442ea842296c859ff905b684211b077b86bfcaa2d3b888d123b4cfc29c7f1054056ea4aba0c8b73de527a81534ded2e1302755d2a3ebad2719b9c709ef513f7e1f92b4ca9d0d06a020fcc6f135ed25a563c1ab6ac0e5225e75a9b44396f12b20ab7f0ea02761d7cdfbf3caccb2362de3dc70742e5898cff50bd832192bfd4560af473c464ee792f6b391b92429b931793d89c3cfd5ee1ff26b887c6283f3d812b0350710203010001028201003e105c2affa6663a3136d5e990a21d24644a35d25d9b9c81ea67031741d112dc8194c42f172036527f37248c99faee78eba0d8007e695d93f88ed9e215152094b06f9003bd9f7fdb7fa2007d8b4dcf4bbc789ed3e84ecb13f23248154f28962200d1b001221dbbb6342f6e85979aa03433c1037cf447e0e1780a8a5733216fe9516c582a2d8aa33782aba179a7813cd2b1e8396d053490019ffe1f64b4b56acf10882085973283f59c9067a7f0090caf4832752f9ee9bc659487fdd036c9d5bc0d76b6ddd9555fb5e9b8af6189624d5ae9e9fedd2ab99356e5eecdddad1815da4d5c9ccc50a65b9df76a40c5feb628019a7c9262e3a4067d790ede5d630d1c2102818100c8888e3a44e0711f4cbcb0ed1077885b80aa68ee38becd5e596d9e3e83af835b6becba0186fedb0ded6987855e423650e4e60c8d8cf55fe0958a5ce14cc9e3119b57a92ed16ec90cad7db1e45308c49dafae51d80f2efcc00c42c5f28e232d46eebb006d825e97e15a1b635eec55d987a73506f3d2f665f478bbddeeeeef53fd02818100c3fd247330ed61b28412b168e827befe777ad131843c0cfcbe504ae43ff231f530c1f7ef64659366703485a28d6867d809f7804dda90dff30611b711cdc6aa17100852e7d7e6f70b110a9da6229829d1f48262cc1a7961f2d196bdc27125bc8141cd4271e3b9d54260b861cf450c3b8cfb1f017cb51c08065ec9ef5904c3c68502818100c22d98ab4bae995b598f0d3340d2be32fc70069346575bbd9492d4bc6bff340efe7e87ce9acd858802f040ce1febb574b7711b8ea583a4876fc63f11daad5336e55908f5d0ce99d7b0d719bea1b8c7ca79272f112c02afb3b72ba149b1e0d622ed601e95ebbb750e3d966faea6e2aa74f4b0203f51744e5d5fdb6a97c6bdf0710281800a22840904e5b1a0a69dc4d8d4f0813aed78c76a9518f9def40478eaf6b79287c85eaf708cb387fccb1e9c2e7cbb826b3490bcecc9b9a62b0e0c4a783c38e2c0d08e6da3199213025a7e3f0ac14d3714695d78b86f4209a3a1dcf6b12062c02dbaf65f523e6174babaffade726fdebf26d65fc10b3d8e03d5c177b2e1246017502818100a7cf5af2ea38792850e778b9bff3fb03119e2b8805cecc264419ec8e1213f7a763c98c7d5ac085f26e7829ed42cc40244b0b2c1a9eb23da6046be2da4f16b894f043897ba60f50a3b0483aa0e4d77c7f9ec984ca66620e58e9ad1f39d17bbd34a32ced9047b4befebd5d0377235f318728c58f2b96e95abc03e1c9bed8d5a4b1"),
	3: rsaSKFromHex("308204a40201000282010100b688854d4a89a4bf38c6f84c15200e600a9b1188b30c13e5fe5336735f0ab06f480120d2cdb35fc469dcda90b7ee38ebee1ddb952c4435848a3985475b6376abc6f32c1bb4ea42b4833b150c324c35cf23a55a8df8422b3e52233582f69a9e593676b3c9a580695564358c8c69a8c80334f2ad9fbac2ea104688aecd2825bb447a7ae59065ef02722113d590eb0b4462867f9b201a377bbbf4cc501ec374305372251688f3b49e6b8fe25f97241a522ff34c2cbda933e7596140ced199e857bfd37ba154dd2cf16670b76cb55756e21d800f633eb67e2b42578e18ae4cc43a62128119f75288cece4f2f345626702478d4bdb0fe8d7b4740f72e0f27c42e8c25020301000102820101008074b922f8a6bf3b1750e7225be79056448076a9761fb4cd31db0bc1cb8bf1388f3ac407b65d5ab3163127db9aa55a87a6ae7a7e938579084a624a8a3a255839712c66c924db8b900f9e7fa472ad315d11dfe7476c03dcfce1bf07849fd996408054af17e491e70f0213b1528b750d353c88e0693d7cb84e35e530e70e2ee7870be016c12bbc5e40a90883ba6d94514a9608142e79d57c25b9ba815b7cd107831383e470666a15c2f6b2e4766ba7c082e83f27103e338fe53f021eb208b58e53e6aa009e9dbff86a88d4d5fec44d85ce26ad84cd0f05b8cfa37f57129aa56be6a128bc0c164ec8be430970c7e3f03fd6412ad4af7f72f732de3fa0df32c1078102818100cd04a971ccb3472473203c5fd025075d949432eab85926297f6a16761aecdc131ef9cc0cc7934dedb7f183c1f2b35bfef654e5b7b13ac263a176549baa2d24d9b17f3d56ebeee78439516db1bcb39fb79aa76b7f994b145b5713e6028246456b5f57ce64f860769eb5f74e30576f061e5df7d0993f1bd5fc9f83fccded11b3c502818100e3ec7b4fd5daab0763f48f5b3fcbb506312d1ea0603b351107a9d2790f9141e0cddd9c3e778c99efe3b57e7564ec0c433378ffca40ee7e0107506bc4629ec4b334b56b38924bb84f19fa649203bb43e32d2928ed66d190e890bfc425c1998bc4a2091f680b1caa6b064e68641da7e4c626c57d23450b9317e56b35d4d97e1ce102818017189a5a269c5fbc5c77da35550686e0e4f7191156393cd259f74296858bff72ebff6a1c5a735ec913fad2440c2a6687bf8a6ae299c5abd67b7f10230535d6bbeb82110ff4be52389418774a199f06b4316900f43bf9b84e5dedf0f0816a9731746938e8290efcedfe43e0fc132d7fbbf60c0fe4e3b62812308a36f59fea699d02818100bc04221cd37ed4c2fdf38a266dd3eefab2aa53af5c72baedd772818b180a6d5bb2b6f2e29cdfc144a084e15299f4169180ee79a330390c7c70ba288c120682a08a0475f46eca43ba0ce5fefc6c539846d8c4315cd50a5f0d5a0ab715a644b1857d5d252940b15eeb76824b9efacfbaeab2a50afb83436f0db154e54d3634d0410281803c24edfc42dcfc9e94245260120129e89f3c1a7c671373a36dfc060753a2d6f732a016cef726c34740f8bc0b0881919deb97204e4ca78adbb4e92ac38f008d80db808989fa5c55b8ffd69e1574d0eb86f390183e9db8f6baa3f207eea3de1f3ae6d52f12cea8c9f9b20e1ff97731214d3aaccc24f597616c8b7d83be30281f8e"),
	4: rsaSKFromHex("308204a40201000282010100a905f3abfe97b5511f25367fbf53f09334a43515dba42ff8d5af4b490bec924202746d9d1b0f906a090d558a6f290b11df003105f0e842a74ca04bfc1a1f7105a65a7fa90b5a49da55860d25e5a7e9b1220e65e35580ccab976197da1df5484ae04613f2b21fe5a95fc846bdf96b3da1e00b4b6d5c54fa513e86d01f1b17f31a3db900ab2f13aa738116f36f392a3e6f9d095fa461b6d561417db1c64785daf9a98e7d328f9512e579550ccf05feee978627fe47de3a4b165fa815aaf60bf6031ff109cf4f8daba1899bbd6227b31cd7e7343fa14e6b2e99a99f990e3f5da4977f99ba98cf2deb2ba6cfa3c36f3446074897ce443e0a8cd308b384b5ca9c592302030100010282010060dd2e562523601fcb4f923a07b5dd2b1f81f382414b88ca7bfb6793c7279e7201e2236763b8b9b46ad79f6c24644b19c4c8e14f5c4e5ed46dcf777c54a42c2b66b87a6cb03ae01425eb1ae1db092d9dfbbc709ba5c69884c5ce822dd7f957a2c180a7b1f06ee338fbd154e94e652cfef5dcc32f3b38dff36b77eb11c87f232bb9be79e7039dc61af7ac15e608369c479f23cd99887bc01dadbe5aeefee4b579a7b9858705a4cb2a3f66c13ae304cd52d6a60f0cc445025d872883b419ea6f2fc90d794b82f107afa191239642d97b85e2f7069b560bcc855c9ea5119d9f98d2b4e207102ebc23153a956207b62295172f725655c46756ef7c57ce6c117659e102818100c2b75c4ce021fef5ca4ec0a5581e7383c7ec0a0342bae6082ea3b2d9c3a9ce157b190a1eb2bb7a7e5407332f8e28ac16926156b4b47f25e1392bf5fcd35e0de463f928ecb1d3c6311c6f69b4244d666eb4f29dc10622ad124ed33c95abaec5d1443036725a92831ab1aa956f18f4f5a713f48e3a12b1a210f0d3b6ec7c0907c902818100de3875b1ee8f03e42274bb26b34739d4e4b33e48280a72ff9b2c7e5954308a5faaf7bceef3c45d495082f1825217646fd490cf2bc0df90fe807c13b4f7c2e8106438f856f04089a6130f0974cbb619709be2ee988f0362f8900f37444e5e53ed85b07574063cfa275b8f4636d5e94cbcd1c7a655dd3a1cd66209daa7f319a78b0281807665198960eb2ae4f6db45c603bb984f73bb712724671241bd6229f8c141399ed4179890abead50385424f7c45fb331012777f4a2749fc9562b6f93e7ea2fcdd777063d2f019adb3e4ef559d84494fd456d002de00460b684b67a3b9fa072e1f1d50177b16d969404cf14525a54e25242f3d0f51fe55e60e58f0d2941ea33b0902818100bc66abca3612445f47a32604b29c6178908932f5a414efd8ababb6576fdc5384b683a148099de2e544802fd7a857b2cc693078a484ba46c8af1002f93bd1a0443d645b9001d305a0aaa9e5ff82b299b0f2491cb675118ef863d2b2ad93afbf823205201f4526af836cc9f4e28acb6846f1a84deaa04c23a4d2abbe19042f2cef02818100bb9e385d27f693f7981cad37aa856e24b651e26e8f8040e9e29b9da15b9a54f51cf49cd718dfc70948436ee8d4a4625b6cab3da065ba1f286fd423f55e10a778634a4286e1838df70e2525fc5cc48a3f4e1e28859526e1f8a2563f6bd635484ce101d1a7158d2702f25399d0013d4fff927547b828286a3f882d3c39869f3836"),
}
View Source
var TestingOperatorSigner = func(keySet *TestKeySet) *types.OperatorSigner {
	return NewOperatorSigner(keySet, 1)
}
View Source
var TestingPhase0AggregateAndProof = &phase0.AggregateAndProof{
	AggregatorIndex: 1,
	SelectionProof:  phase0.BLSSignature{},
	Aggregate: &phase0.Attestation{
		AggregationBits: bitfield.NewBitlist(128),
		Signature:       phase0.BLSSignature{},
		Data:            TestingAttestationData(spec.DataVersionPhase0),
	},
}
View Source
var TestingPhase0AggregateAndProofBytes = func() []byte {
	ret, _ := TestingPhase0AggregateAndProof.MarshalSSZ()
	return ret
}()
View Source
var TestingPhase0SignedAggregateAndProof = func(ks *TestKeySet) *phase0.SignedAggregateAndProof {
	return &phase0.SignedAggregateAndProof{
		Message:   TestingPhase0AggregateAndProof,
		Signature: signBeaconObject(TestingPhase0AggregateAndProof, types.DomainAggregateAndProof, ks),
	}
}
View Source
var TestingPrepareMessage = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	return TestingPrepareMessageWithRound(sk, id, qbft.FirstRound)
}

* Prepare messages

View Source
var TestingPrepareMessageWithFullData = func(sk *rsa.PrivateKey, id types.OperatorID, fullData []byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.PrepareMsgType,
		Height:     qbft.FirstHeight,
		Round:      qbft.FirstRound,
		Identifier: TestingIdentifier,
		Root:       sha256.Sum256(fullData),
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingPrepareMessageWithHeight = func(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingPrepareMessageWithParams(sk, id, qbft.FirstRound, height, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingPrepareMessageWithIdentifierAndRoot = func(sk *rsa.PrivateKey, id types.OperatorID, identifier []byte, root [32]byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.PrepareMsgType,
		Height:     qbft.FirstHeight,
		Round:      qbft.FirstRound,
		Identifier: identifier,
		Root:       root,

		RoundChangeJustification: [][]byte{},
		PrepareJustification:     [][]byte{},
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = []byte{}
	return ret
}
View Source
var TestingPrepareMessageWithParams = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	identifier []byte,
	root [32]byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.PrepareMsgType,
		Height:     height,
		Round:      round,
		Identifier: identifier,
		Root:       root,
	}
	ret := SignQBFTMsg(sk, id, msg)
	return ret
}
View Source
var TestingPrepareMessageWithRound = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingPrepareMessageWithParams(sk, id, round, qbft.FirstHeight, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingPrepareMessageWithRoundAndFullData = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	fullData []byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.PrepareMsgType,
		Height:     qbft.FirstHeight,
		Round:      round,
		Identifier: TestingIdentifier,
		Root:       sha256.Sum256(fullData),
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingPrepareMultiSignerMessage = func(sks []*rsa.PrivateKey, ids []types.OperatorID) *types.SignedSSVMessage {
	return TestingPrepareMultiSignerMessageWithRound(sks, ids, qbft.FirstRound)
}
View Source
var TestingPrepareMultiSignerMessageWithHeight = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingPrepareMultiSignerMessageWithParams(sks, ids, qbft.FirstRound, height, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingPrepareMultiSignerMessageWithHeightAndIdentifier = func(sks []*rsa.PrivateKey, ids []types.OperatorID, height qbft.Height, identifier []byte) *types.SignedSSVMessage {
	return TestingPrepareMultiSignerMessageWithParams(sks, ids, qbft.FirstRound, height, identifier, TestingQBFTRootData)
}
View Source
var TestingPrepareMultiSignerMessageWithParams = func(sks []*rsa.PrivateKey, ids []types.OperatorID, round qbft.Round, height qbft.Height, identifier []byte, root [32]byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.PrepareMsgType,
		Height:     height,
		Round:      round,
		Identifier: identifier,
		Root:       root,
	}
	ret := MultiSignQBFTMsg(sks, ids, msg)
	ret.FullData = TestingQBFTFullData
	return ret
}
View Source
var TestingPrepareMultiSignerMessageWithRound = func(sks []*rsa.PrivateKey, ids []types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingPrepareMultiSignerMessageWithParams(sks, ids, round, qbft.FirstHeight, TestingIdentifier, TestingQBFTRootData)
}
View Source
var TestingProposalMessage = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	return TestingProposalMessageWithRound(sk, id, qbft.FirstRound)
}

* Proposal messages

View Source
var TestingProposalMessageDifferentRoot = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.ProposalMsgType,
		Height:     qbft.FirstHeight,
		Round:      qbft.FirstRound,
		Identifier: TestingIdentifier,
		Root:       DifferentRoot,
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = DifferentFullData
	return ret
}
View Source
var TestingProposalMessageWithHeight = func(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingProposalMessageWithParams(sk, id, qbft.FirstRound, height, TestingQBFTRootData, nil, nil)
}
View Source
var TestingProposalMessageWithID = func(sk *rsa.PrivateKey, id types.OperatorID, msgID types.MessageID) *types.SignedSSVMessage {
	ret := TestingProposalMessageWithRound(sk, id, qbft.FirstRound)

	qbftMsg, err := qbft.DecodeMessage(ret.SSVMessage.Data)
	if err != nil {
		panic(err)
	}
	qbftMsg.Identifier = msgID[:]

	return SignQBFTMsg(sk, id, qbftMsg)
}
View Source
var TestingProposalMessageWithParams = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	root [32]byte,
	roundChangeJustification [][]byte,
	prepareJustification [][]byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:                  qbft.ProposalMsgType,
		Height:                   height,
		Round:                    round,
		Identifier:               TestingIdentifier,
		Root:                     root,
		RoundChangeJustification: roundChangeJustification,
		PrepareJustification:     prepareJustification,
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = TestingQBFTFullData
	return ret
}
View Source
var TestingProposalMessageWithRound = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingProposalMessageWithParams(sk, id, round, qbft.FirstHeight, TestingQBFTRootData, nil, nil)
}
View Source
var TestingProposalMessageWithRoundAndRC = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round, roundChangeJustification [][]byte) *types.SignedSSVMessage {
	return TestingProposalMessageWithParams(sk, id, round, qbft.FirstHeight, TestingQBFTRootData, roundChangeJustification, nil)
}
View Source
var TestingProposerDutyFirstSlot = types.ValidatorDuty{
	Type:           types.BNRoleProposer,
	PubKey:         TestingValidatorPubKey,
	Slot:           0,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingProposerDutyNextEpochV = func(version spec.DataVersion) *types.ValidatorDuty {
	duty := &types.ValidatorDuty{
		Type:           types.BNRoleProposer,
		PubKey:         TestingValidatorPubKey,
		ValidatorIndex: TestingValidatorIndex,

		CommitteeIndex:          3,
		CommitteesAtSlot:        36,
		CommitteeLength:         128,
		ValidatorCommitteeIndex: 11,
	}

	switch version {
	case spec.DataVersionCapella:
		duty.Slot = TestingDutySlotCapellaNextEpoch
	case spec.DataVersionDeneb:
		duty.Slot = TestingDutySlotDenebNextEpoch
	case spec.DataVersionElectra:
		duty.Slot = TestingDutySlotElectraNextEpoch

	default:
		panic("unsupported version")
	}

	return duty
}
View Source
var TestingProposerDutyV = func(version spec.DataVersion) *types.ValidatorDuty {
	duty := &types.ValidatorDuty{
		Type:           types.BNRoleProposer,
		PubKey:         TestingValidatorPubKey,
		Slot:           TestingDutySlotV(version),
		ValidatorIndex: TestingValidatorIndex,

		CommitteeIndex:          3,
		CommitteesAtSlot:        36,
		CommitteeLength:         128,
		ValidatorCommitteeIndex: 11,
	}

	return duty
}
View Source
var TestingQBFTFullData = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9}
View Source
var TestingQBFTRootData = func() [32]byte {
	return sha256.Sum256(TestingQBFTFullData)
}()
View Source
var TestingRoundChangeMessage = func(sk *rsa.PrivateKey, id types.OperatorID) *types.SignedSSVMessage {
	return TestingRoundChangeMessageWithRound(sk, id, qbft.FirstRound)
}

* Round Change messages

View Source
var TestingRoundChangeMessageWithHeight = func(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height) *types.SignedSSVMessage {
	return TestingRoundChangeMessageWithParams(sk, id, qbft.FirstRound, height, TestingQBFTRootData, qbft.NoRound, nil)
}
View Source
var TestingRoundChangeMessageWithHeightAndIdentifier = func(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height, identifier []byte) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.RoundChangeMsgType,
		Height:     height,
		Round:      qbft.FirstRound,
		Identifier: TestingIdentifier,
		Root:       TestingQBFTRootData,
	}
	ret := SignQBFTMsg(sk, id, msg)
	return ret
}
View Source
var TestingRoundChangeMessageWithParams = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	root [32]byte,
	dataRound qbft.Round,
	roundChangeJustification [][]byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:                  qbft.RoundChangeMsgType,
		Height:                   height,
		Round:                    round,
		Identifier:               TestingIdentifier,
		Root:                     root,
		DataRound:                dataRound,
		RoundChangeJustification: roundChangeJustification,
	}
	ret := SignQBFTMsg(sk, id, msg)
	return ret
}
View Source
var TestingRoundChangeMessageWithParamsAndFullData = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	height qbft.Height,
	root [32]byte,
	dataRound qbft.Round,
	roundChangeJustification [][]byte,
	fullData []byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:                  qbft.RoundChangeMsgType,
		Height:                   height,
		Round:                    round,
		Identifier:               TestingIdentifier,
		Root:                     root,
		DataRound:                dataRound,
		RoundChangeJustification: roundChangeJustification,
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingRoundChangeMessageWithRound = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round) *types.SignedSSVMessage {
	return TestingRoundChangeMessageWithParams(sk, id, round, qbft.FirstHeight, TestingQBFTRootData, qbft.NoRound, nil)
}
View Source
var TestingRoundChangeMessageWithRoundAndFullData = func(
	sk *rsa.PrivateKey,
	id types.OperatorID,
	round qbft.Round,
	fullData []byte,
) *types.SignedSSVMessage {
	msg := &qbft.Message{
		MsgType:    qbft.RoundChangeMsgType,
		Height:     qbft.FirstHeight,
		Round:      round,
		Identifier: TestingIdentifier,
		Root:       sha256.Sum256(fullData),
	}
	ret := SignQBFTMsg(sk, id, msg)
	ret.FullData = fullData
	return ret
}
View Source
var TestingRoundChangeMessageWithRoundAndHeight = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round, height qbft.Height) *types.SignedSSVMessage {
	return TestingRoundChangeMessageWithParams(sk, id, round, height, TestingQBFTRootData, qbft.NoRound, nil)
}
View Source
var TestingRoundChangeMessageWithRoundAndRC = func(sk *rsa.PrivateKey, id types.OperatorID, round qbft.Round, roundChangeJustification [][]byte) *types.SignedSSVMessage {
	ret := TestingRoundChangeMessageWithParams(sk, id, round, qbft.FirstHeight, TestingQBFTRootData, qbft.FirstRound, roundChangeJustification)
	ret.FullData = TestingQBFTFullData
	return ret
}
View Source
var TestingSSVDomainType = types.JatoTestnet
View Source
var TestingShare = func(keysSet *TestKeySet, valIdx phase0.ValidatorIndex) *types.Share {

	pkBytesSlice := keysSet.ValidatorPK.Serialize()
	pkBytesArray := [48]byte{}
	copy(pkBytesArray[:], pkBytesSlice)

	return &types.Share{
		ValidatorIndex:      valIdx,
		ValidatorPubKey:     pkBytesArray,
		SharePubKey:         keysSet.Shares[1].GetPublicKey().Serialize(),
		Committee:           keysSet.Committee(),
		DomainType:          TestingSSVDomainType,
		FeeRecipientAddress: TestingFeeRecipient,
		Graffiti:            TestingGraffiti[:],
	}
}
View Source
var TestingSignedAggregateAndProof = func(ks *TestKeySet, version spec.DataVersion) ssz.HashRoot {
	switch version {
	case spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix, spec.DataVersionCapella, spec.DataVersionDeneb:
		return TestingPhase0SignedAggregateAndProof(ks)
	case spec.DataVersionElectra:
		return TestingElectraSignedAggregateAndProof(ks)
	default:
		panic("unknown data version")
	}
}
View Source
var TestingSignedAttestation = func(ks *TestKeySet) *phase0.Attestation {
	duty := TestingAttesterDuty(spec.DataVersionPhase0).ValidatorDuties[0]
	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)
	return &phase0.Attestation{
		Data:            TestingAttestationData(spec.DataVersionPhase0),
		Signature:       signBeaconObject(TestingAttestationData(spec.DataVersionPhase0), types.DomainAttester, ks),
		AggregationBits: aggregationBitfield,
	}
}
View Source
var TestingSignedAttestationForDuty = func(ks *TestKeySet, duty *types.ValidatorDuty) *phase0.Attestation {
	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)
	attData := TestingAttestationDataForValidatorDuty(duty)
	return &phase0.Attestation{
		Data:            attData,
		Signature:       signBeaconObject(attData, types.DomainAttester, ks),
		AggregationBits: aggregationBitfield,
	}
}
View Source
var TestingSignedAttestationForValidatorIndex = func(ks *TestKeySet, validatorIndex phase0.ValidatorIndex) *phase0.Attestation {
	committeeDuty := TestingAttesterDutyForValidator(spec.DataVersionPhase0, validatorIndex)
	duty := committeeDuty.ValidatorDuties[0]
	aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
	aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)
	return &phase0.Attestation{
		Data:            TestingAttestationData(spec.DataVersionPhase0),
		Signature:       signBeaconObject(TestingAttestationData(spec.DataVersionPhase0), types.DomainAttester, ks),
		AggregationBits: aggregationBitfield,
	}
}
View Source
var TestingSignedAttestationResponseForDuty = func(ks *TestKeySet, version spec.DataVersion, duty *types.ValidatorDuty) *spec.VersionedAttestation {

	switch version {
	case spec.DataVersionPhase0:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Phase0:         TestingSignedAttestationForDuty(ks, duty),
		}

	case spec.DataVersionAltair:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Altair:         TestingSignedAttestationForDuty(ks, duty),
		}

	case spec.DataVersionBellatrix:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Bellatrix:      TestingSignedAttestationForDuty(ks, duty),
		}

	case spec.DataVersionCapella:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Capella:        TestingSignedAttestationForDuty(ks, duty),
		}
	case spec.DataVersionDeneb:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Deneb:          TestingSignedAttestationForDuty(ks, duty),
		}
	case spec.DataVersionElectra:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &duty.ValidatorIndex,
			Electra:        TestingElectraAttestationForDuty(ks, duty),
		}
	default:
		panic("unknown data version")
	}
}
View Source
var TestingSignedAttestationResponseForValidatorIndex = func(ks *TestKeySet, version spec.DataVersion, validatorIndex phase0.ValidatorIndex) *spec.VersionedAttestation {

	switch version {
	case spec.DataVersionPhase0:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Phase0:         TestingSignedAttestationForValidatorIndex(ks, validatorIndex),
		}

	case spec.DataVersionAltair:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Altair:         TestingSignedAttestationForValidatorIndex(ks, validatorIndex),
		}

	case spec.DataVersionBellatrix:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Bellatrix:      TestingSignedAttestationForValidatorIndex(ks, validatorIndex),
		}

	case spec.DataVersionCapella:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Capella:        TestingSignedAttestationForValidatorIndex(ks, validatorIndex),
		}
	case spec.DataVersionDeneb:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Deneb:          TestingSignedAttestationForValidatorIndex(ks, validatorIndex),
		}
	case spec.DataVersionElectra:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &validatorIndex,
			Electra:        TestingElectraAttestationForValidatorIndex(ks, validatorIndex),
		}
	default:
		panic("unknown data version")
	}
}
View Source
var TestingSignedAttestationResponseSSZRootForKeyMap = func(ksMap map[phase0.ValidatorIndex]*TestKeySet, version spec.DataVersion) []string {
	switch version {
	case spec.DataVersionPhase0, spec.DataVersionAltair, spec.DataVersionBellatrix, spec.DataVersionCapella, spec.DataVersionDeneb:
		return TestingSignedAttestationSSZRootForKeyMap(ksMap)
	case spec.DataVersionElectra:
		return TestingElectraSingleAttestationSSZRootForKeyMap(ksMap)
	default:
		panic("unknown data version")
	}
}
View Source
var TestingSignedAttestationSSZRootForKeyMap = func(ksMap map[phase0.ValidatorIndex]*TestKeySet) []string {
	ret := make([]string, 0)
	for _, valKs := range SortedMapKeys(ksMap) {
		ks := valKs.Value
		duty := TestingAttesterDuty(spec.DataVersionPhase0).ValidatorDuties[0]
		aggregationBitfield := bitfield.NewBitlist(duty.CommitteeLength)
		aggregationBitfield.SetBitAt(duty.ValidatorCommitteeIndex, true)
		ret = append(ret, GetSSZRootNoError(&phase0.Attestation{
			Data:            TestingAttestationData(spec.DataVersionPhase0),
			Signature:       signBeaconObject(TestingAttestationData(spec.DataVersionPhase0), types.DomainAttester, ks),
			AggregationBits: aggregationBitfield,
		}))
	}
	return ret
}
View Source
var TestingSignedBeaconBlockV = func(ks *TestKeySet, version spec.DataVersion) ssz.HashRoot {
	vBlk := TestingBeaconBlockV(version)

	switch version {
	case spec.DataVersionCapella:
		if vBlk.Capella == nil {
			panic("empty block")
		}
		return &capella.SignedBeaconBlock{
			Message:   vBlk.Capella,
			Signature: signBeaconObject(vBlk.Capella, types.DomainProposer, ks),
		}
	case spec.DataVersionDeneb:
		if vBlk.Deneb == nil {
			panic("empty block contents")
		}
		if vBlk.Deneb.Block == nil {
			panic("empty block")
		}
		return &apiv1deneb.SignedBlockContents{
			SignedBlock: &deneb.SignedBeaconBlock{
				Message:   vBlk.Deneb.Block,
				Signature: signBeaconObject(vBlk.Deneb.Block, types.DomainProposer, ks),
			},
			KZGProofs: vBlk.Deneb.KZGProofs,
			Blobs:     vBlk.Deneb.Blobs,
		}
	case spec.DataVersionElectra:
		if vBlk.Electra == nil {
			panic("empty block contents")
		}
		if vBlk.Electra.Block == nil {
			panic("empty block")
		}
		return &apiv1electra.SignedBlockContents{
			SignedBlock: &electra.SignedBeaconBlock{
				Message:   vBlk.Electra.Block,
				Signature: signBeaconObject(vBlk.Electra.Block, types.DomainProposer, ks),
			},
			KZGProofs: vBlk.Electra.KZGProofs,
			Blobs:     vBlk.Electra.Blobs,
		}
	default:
		panic("unsupported version")
	}
}
View Source
var TestingSignedBlindedBeaconBlockV = func(ks *TestKeySet, version spec.DataVersion) ssz.HashRoot {
	vBlk := TestingBlindedBeaconBlockV(version)

	switch version {
	case spec.DataVersionCapella:
		if vBlk.Capella == nil {
			panic("empty block")
		}
		return &apiv1capella.SignedBlindedBeaconBlock{
			Message:   vBlk.Capella,
			Signature: signBeaconObject(vBlk.Capella, types.DomainProposer, ks),
		}
	case spec.DataVersionDeneb:
		if vBlk.Deneb == nil {
			panic("empty block")
		}
		return &apiv1deneb.SignedBlindedBeaconBlock{
			Message:   vBlk.Deneb,
			Signature: signBeaconObject(vBlk.Deneb, types.DomainProposer, ks),
		}
	case spec.DataVersionElectra:
		if vBlk.Electra == nil {
			panic("empty block")
		}
		return &apiv1electra.SignedBlindedBeaconBlock{
			Message:   vBlk.Electra,
			Signature: signBeaconObject(vBlk.Electra, types.DomainProposer, ks),
		}
	default:
		panic("unsupported version")
	}
}
View Source
var TestingSignedCommitteeBeaconObjectSSZRoot = func(duty *types.CommitteeDuty, ksMap map[phase0.ValidatorIndex]*TestKeySet, version spec.DataVersion) []string {
	ret := make([]string, 0)
	for _, validatorDuty := range duty.ValidatorDuties {

		ks := ksMap[validatorDuty.ValidatorIndex]

		if validatorDuty.Type == types.BNRoleAttester {

			attResponse := TestingAttestationResponseBeaconObjectForDuty(ks, version, validatorDuty)
			ret = append(ret, GetSSZRootNoError(attResponse))
		} else if validatorDuty.Type == types.BNRoleSyncCommittee {
			ret = append(ret, GetSSZRootNoError(&altair.SyncCommitteeMessage{
				Slot:            validatorDuty.Slot,
				BeaconBlockRoot: TestingBlockRoot,
				ValidatorIndex:  validatorDuty.ValidatorIndex,
				Signature:       signBeaconObject(types.SSZBytes(TestingBlockRoot[:]), types.DomainSyncCommittee, ks),
			}))
		} else {
			panic(fmt.Sprintf("type %v not expected", validatorDuty.Type))
		}
	}
	return ret
}
View Source
var TestingSignedSSVMessage = func(sk *bls.SecretKey, operatorID types.OperatorID, rsaSK *rsa.PrivateKey) *types.SignedSSVMessage {

	signedPartialSig := PreConsensusSelectionProofMsg(sk, sk, operatorID, operatorID, spec.DataVersionPhase0)
	signedPartialSigByts, err := signedPartialSig.Encode()
	if err != nil {
		panic(err.Error())
	}

	ssvMsg := types.SSVMessage{
		MsgType: types.SSVPartialSignatureMsgType,
		MsgID:   TestingMessageID,
		Data:    signedPartialSigByts[:],
	}
	ssvMsgByts, err := ssvMsg.Encode()
	if err != nil {
		panic(err.Error())
	}

	hash := sha256.Sum256(ssvMsgByts)
	signature, err := rsa.SignPKCS1v15(nil, rsaSK, crypto.SHA256, hash[:])
	if err != nil {
		panic(err.Error())
	}

	return &types.SignedSSVMessage{
		OperatorIDs: []types.OperatorID{operatorID},
		Signatures:  [][]byte{signature},
		SSVMessage:  &ssvMsg,
	}
}
View Source
var TestingSignedSSVMessageSignature = []byte{1, 2, 3, 4}
View Source
var TestingSignedSyncCommitteeBlockRoot = func(ks *TestKeySet, version spec.DataVersion) *altair.SyncCommitteeMessage {
	return &altair.SyncCommitteeMessage{
		Slot:            TestingDutySlotV(version),
		BeaconBlockRoot: TestingSyncCommitteeBlockRoot,
		ValidatorIndex:  TestingValidatorIndex,
		Signature:       signBeaconObject(types.SSZBytes(TestingSyncCommitteeBlockRoot[:]), types.DomainSyncCommittee, ks),
	}
}
View Source
var TestingSignedSyncCommitteeBlockRootForValidatorIndex = func(ks *TestKeySet, validatorIndex phase0.ValidatorIndex, version spec.DataVersion) *altair.SyncCommitteeMessage {
	return &altair.SyncCommitteeMessage{
		Slot:            TestingDutySlotV(version),
		BeaconBlockRoot: TestingSyncCommitteeBlockRoot,
		ValidatorIndex:  validatorIndex,
		Signature:       signBeaconObject(types.SSZBytes(TestingSyncCommitteeBlockRoot[:]), types.DomainSyncCommittee, ks),
	}
}
View Source
var TestingSignedSyncCommitteeBlockRootSSZRootForKeyMap = func(ksMap map[phase0.ValidatorIndex]*TestKeySet, version spec.DataVersion) []string {
	ret := make([]string, 0)
	for _, valKs := range SortedMapKeys(ksMap) {
		ks := valKs.Value
		valIdx := valKs.Key
		ret = append(ret, GetSSZRootNoError(&altair.SyncCommitteeMessage{
			Slot:            TestingDutySlotV(version),
			BeaconBlockRoot: TestingBlockRoot,
			ValidatorIndex:  valIdx,
			Signature:       signBeaconObject(types.SSZBytes(TestingBlockRoot[:]), types.DomainSyncCommittee, ks),
		}))
	}
	return ret
}
View Source
var TestingSignedSyncCommitteeContributions = func(
	contrib *altair.SyncCommitteeContribution,
	proof phase0.BLSSignature,
	ks *TestKeySet) *altair.SignedContributionAndProof {
	msg := &altair.ContributionAndProof{
		AggregatorIndex: TestingValidatorIndex,
		Contribution:    contrib,
		SelectionProof:  proof,
	}
	return &altair.SignedContributionAndProof{
		Message:   msg,
		Signature: signBeaconObject(msg, types.DomainContributionAndProof, ks),
	}
}
View Source
var TestingSignedValidatorRegistration = func(ks *TestKeySet) *v1.SignedValidatorRegistration {
	vr := TestingValidatorRegistration
	sig := signBeaconObject(vr, types.DomainApplicationBuilder, ks)
	return &v1.SignedValidatorRegistration{
		Message:   vr,
		Signature: sig,
	}
}
View Source
var TestingSignedValidatorRegistrationBySlot = func(ks *TestKeySet, slot phase0.Slot) *v1.SignedValidatorRegistration {
	vr := TestingValidatorRegistrationBySlot(slot)
	sig := signBeaconObject(vr, types.DomainApplicationBuilder, ks)
	return &v1.SignedValidatorRegistration{
		Message:   vr,
		Signature: sig,
	}
}
View Source
var TestingSignedValidatorRegistrationWrong = func(ks *TestKeySet) *v1.SignedValidatorRegistration {
	vr := TestingValidatorRegistrationWrong
	sig := signBeaconObject(vr, types.DomainApplicationBuilder, ks)
	return &v1.SignedValidatorRegistration{
		Message:   vr,
		Signature: sig,
	}
}
View Source
var TestingSignedVoluntaryExit = func(ks *TestKeySet) *phase0.SignedVoluntaryExit {
	return &phase0.SignedVoluntaryExit{
		Message:   TestingVoluntaryExit,
		Signature: signBeaconObject(TestingVoluntaryExit, types.DomainVoluntaryExit, ks),
	}
}
View Source
var TestingSyncCommitteeBlockRoot = TestingBlockRoot
View Source
var TestingSyncCommitteeContributionDuty = types.ValidatorDuty{
	Type:                          types.BNRoleSyncCommitteeContribution,
	PubKey:                        TestingValidatorPubKey,
	Slot:                          TestingDutySlot,
	ValidatorIndex:                TestingValidatorIndex,
	CommitteeIndex:                3,
	CommitteesAtSlot:              36,
	CommitteeLength:               128,
	ValidatorCommitteeIndex:       11,
	ValidatorSyncCommitteeIndices: TestingContributionProofIndexes,
}
View Source
var TestingSyncCommitteeContributionDutyFirstSlot = types.ValidatorDuty{
	Type:                          types.BNRoleSyncCommitteeContribution,
	PubKey:                        TestingValidatorPubKey,
	Slot:                          0,
	ValidatorIndex:                TestingValidatorIndex,
	CommitteeIndex:                3,
	CommitteesAtSlot:              36,
	CommitteeLength:               128,
	ValidatorCommitteeIndex:       11,
	ValidatorSyncCommitteeIndices: TestingContributionProofIndexes,
}
View Source
var TestingSyncCommitteeContributionNexEpochDuty = types.ValidatorDuty{
	Type:                          types.BNRoleSyncCommitteeContribution,
	PubKey:                        TestingValidatorPubKey,
	Slot:                          TestingDutySlot2,
	ValidatorIndex:                TestingValidatorIndex,
	CommitteeIndex:                3,
	CommitteesAtSlot:              36,
	CommitteeLength:               128,
	ValidatorCommitteeIndex:       11,
	ValidatorSyncCommitteeIndices: TestingContributionProofIndexes,
}
View Source
var TestingSyncCommitteeContributions = []*altair.SyncCommitteeContribution{
	{
		Slot:              TestingDutySlot,
		BeaconBlockRoot:   TestingSyncCommitteeBlockRoot,
		SubcommitteeIndex: 0,
		AggregationBits:   bitfield.NewBitvector128(),
		Signature:         phase0.BLSSignature{},
	},
	{
		Slot:              TestingDutySlot,
		BeaconBlockRoot:   TestingSyncCommitteeBlockRoot,
		SubcommitteeIndex: 1,
		AggregationBits:   bitfield.NewBitvector128(),
		Signature:         phase0.BLSSignature{},
	},
	{
		Slot:              TestingDutySlot,
		BeaconBlockRoot:   TestingSyncCommitteeBlockRoot,
		SubcommitteeIndex: 2,
		AggregationBits:   bitfield.NewBitvector128(),
		Signature:         phase0.BLSSignature{},
	},
}
View Source
var TestingSyncCommitteeDuty = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDuty(nil, []int{TestingValidatorIndex}, version)
}
View Source
var TestingSyncCommitteeDutyFirstSlot = func() *types.CommitteeDuty {
	return TestingCommitteeDutyFirstSlot(nil, []int{TestingValidatorIndex})
}
View Source
var TestingSyncCommitteeDutyForValidator = func(version spec.DataVersion, validatorIndex phase0.ValidatorIndex) *types.CommitteeDuty {
	return TestingCommitteeDuty(nil, []int{int(validatorIndex)}, version)
}
View Source
var TestingSyncCommitteeDutyForValidators = func(version spec.DataVersion, validatorIndexLst []int) *types.CommitteeDuty {
	return TestingCommitteeDuty(nil, validatorIndexLst, version)
}
View Source
var TestingSyncCommitteeDutyNextEpoch = func(version spec.DataVersion) *types.CommitteeDuty {
	return TestingCommitteeDutyNextEpoch(nil, []int{TestingValidatorIndex}, version)
}
View Source
var TestingSyncCommitteeWrongBlockRoot = phase0.Root{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
View Source
var TestingUnknownDutyType = types.ValidatorDuty{
	Type:                    UnknownDutyType,
	PubKey:                  TestingValidatorPubKey,
	Slot:                    12,
	ValidatorIndex:          TestingValidatorIndex,
	CommitteeIndex:          22,
	CommitteesAtSlot:        36,
	CommitteeLength:         128,
	ValidatorCommitteeIndex: 11,
}

Unknown duty type

View Source
var TestingValidatorCommitteeIndex = uint64(11)
View Source
var TestingValidatorPubKey = func() spec.BLSPubKey {

	pk, _ := hex.DecodeString("8e80066551a81b318258709edaf7dd1f63cd686a0e4db8b29bbb7acfe65608677af5a527d9448ee47835485e02b50bc0")
	blsPK := spec.BLSPubKey{}
	copy(blsPK[:], pk)
	return blsPK
}()
View Source
var TestingValidatorPubKeyForValidatorIndex = func(ValidatorIndex phase0.ValidatorIndex) spec.BLSPubKey {
	ks, exists := TestingKeySetMap[ValidatorIndex]
	if !exists {
		panic(fmt.Sprintf("Validator index %v does not exist in TestingKeySetMap", ValidatorIndex))
	}
	pk := ks.ValidatorPK
	pkHexString := pk.SerializeToHexStr()
	pkString, _ := hex.DecodeString(pkHexString)
	blsPK := spec.BLSPubKey{}
	copy(blsPK[:], pkString)
	return blsPK
}
View Source
var TestingValidatorPubKeyList = func() []spec.BLSPubKey {
	ret := make([]spec.BLSPubKey, len(TestingKeySetMap))
	listIndex := 0
	for valIdx := range TestingKeySetMap {
		pk := TestingValidatorPubKeyForValidatorIndex(valIdx)
		ret[listIndex] = pk
		listIndex += 1
	}
	return ret
}()
View Source
var TestingValidatorRegistration = &v1.ValidatorRegistration{
	FeeRecipient: TestingFeeRecipient,
	GasLimit:     types.DefaultGasLimit,
	Timestamp:    types.PraterNetwork.EpochStartTime(TestingDutyEpoch),
	Pubkey:       TestingValidatorPubKey,
}
View Source
var TestingValidatorRegistrationDuty = types.ValidatorDuty{
	Type:           types.BNRoleValidatorRegistration,
	PubKey:         TestingValidatorPubKey,
	Slot:           TestingDutySlot,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingValidatorRegistrationDutyNextEpoch = types.ValidatorDuty{
	Type:           types.BNRoleValidatorRegistration,
	PubKey:         TestingValidatorPubKey,
	Slot:           TestingDutySlot2,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingValidatorRegistrationWrong = &v1.ValidatorRegistration{
	FeeRecipient: TestingFeeRecipient,
	GasLimit:     5,
	Timestamp:    types.PraterNetwork.EpochStartTime(TestingDutyEpoch),
	Pubkey:       TestingValidatorPubKey,
}
View Source
var TestingVersionedAttestation = func(ks *TestKeySet, version spec.DataVersion) *spec.VersionedAttestation {

	vIdx := phase0.ValidatorIndex(TestingValidatorIndex)

	switch version {
	case spec.DataVersionPhase0:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Phase0:         TestingSignedAttestation(ks),
		}

	case spec.DataVersionAltair:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Altair:         TestingSignedAttestation(ks),
		}

	case spec.DataVersionBellatrix:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Bellatrix:      TestingSignedAttestation(ks),
		}

	case spec.DataVersionCapella:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Capella:        TestingSignedAttestation(ks),
		}
	case spec.DataVersionDeneb:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Deneb:          TestingSignedAttestation(ks),
		}
	case spec.DataVersionElectra:
		return &spec.VersionedAttestation{
			Version:        version,
			ValidatorIndex: &vIdx,
			Electra:        TestingElectraAttestation(ks),
		}
	default:
		panic("unknown data version")
	}
}
View Source
var TestingVersionedSignedAggregateAndProof = func(ks *TestKeySet, version spec.DataVersion) *spec.VersionedSignedAggregateAndProof {

	switch version {
	case spec.DataVersionPhase0:
		return &spec.VersionedSignedAggregateAndProof{
			Version: version,
			Phase0:  TestingPhase0SignedAggregateAndProof(ks),
		}

	case spec.DataVersionAltair:
		return &spec.VersionedSignedAggregateAndProof{
			Version: version,
			Altair:  TestingPhase0SignedAggregateAndProof(ks),
		}

	case spec.DataVersionBellatrix:
		return &spec.VersionedSignedAggregateAndProof{
			Version:   version,
			Bellatrix: TestingPhase0SignedAggregateAndProof(ks),
		}

	case spec.DataVersionCapella:
		return &spec.VersionedSignedAggregateAndProof{
			Version: version,
			Capella: TestingPhase0SignedAggregateAndProof(ks),
		}
	case spec.DataVersionDeneb:
		return &spec.VersionedSignedAggregateAndProof{
			Version: version,
			Deneb:   TestingPhase0SignedAggregateAndProof(ks),
		}
	case spec.DataVersionElectra:
		return &spec.VersionedSignedAggregateAndProof{
			Version: version,
			Electra: TestingElectraSignedAggregateAndProof(ks),
		}
	default:
		panic("unknown data version")
	}
}
View Source
var TestingVoluntaryExit = &phase0.VoluntaryExit{
	Epoch:          0,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingVoluntaryExitDuty = types.ValidatorDuty{
	Type:           types.BNRoleVoluntaryExit,
	PubKey:         TestingValidatorPubKey,
	Slot:           TestingDutySlot,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingVoluntaryExitDutyNextEpoch = types.ValidatorDuty{
	Type:           types.BNRoleVoluntaryExit,
	PubKey:         TestingValidatorPubKey,
	Slot:           TestingDutySlot2,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingVoluntaryExitWrong = &phase0.VoluntaryExit{
	Epoch:          1,
	ValidatorIndex: TestingValidatorIndex,
}
View Source
var TestingWrongAggregateAndProofV = func(version spec.DataVersion) ssz.Marshaler {
	if version == spec.DataVersionElectra {
		return TestingWrongElectraAggregateAndProof
	} else {
		return TestingWrongPhase0AggregateAndProof
	}
}
View Source
var TestingWrongAttestationData = func(version spec.DataVersion) *phase0.AttestationData {
	byts, _ := TestingAttestationData(version).MarshalSSZ()
	ret := &phase0.AttestationData{}
	if err := ret.UnmarshalSSZ(byts); err != nil {
		panic(err.Error())
	}
	ret.Slot += 100
	return ret
}
View Source
var TestingWrongBeaconBlockV = func(version spec.DataVersion) *api.VersionedProposal {
	blkByts := TestingBeaconBlockBytesV(version)

	switch version {
	case spec.DataVersionCapella:
		ret := &capella.BeaconBlock{}
		if err := ret.UnmarshalSSZ(blkByts); err != nil {
			panic(err.Error())
		}
		ret.Slot = TestingDutySlotCapella + 100
		return &api.VersionedProposal{
			Version: version,
			Capella: ret,
		}
	case spec.DataVersionDeneb:
		ret := &apiv1deneb.BlockContents{}
		if err := ret.UnmarshalSSZ(blkByts); err != nil {
			panic(err.Error())
		}
		ret.Block.Slot = TestingDutySlotDeneb + 100
		return &api.VersionedProposal{
			Version: version,
			Deneb:   ret,
		}
	case spec.DataVersionElectra:
		ret := &apiv1electra.BlockContents{}
		if err := ret.UnmarshalSSZ(blkByts); err != nil {
			panic(err.Error())
		}
		ret.Block.Slot = TestingDutySlotElectra + 100
		return &api.VersionedProposal{
			Version: version,
			Electra: ret,
		}

	default:
		panic("unsupported version")
	}
}
View Source
var TestingWrongDutyPK = types.ValidatorDuty{
	Type:                    types.BNRoleAttester,
	PubKey:                  TestingWrongValidatorPubKey,
	Slot:                    12,
	ValidatorIndex:          TestingValidatorIndex,
	CommitteeIndex:          3,
	CommitteesAtSlot:        36,
	CommitteeLength:         128,
	ValidatorCommitteeIndex: 11,
}

Wrong validator pub key

View Source
var TestingWrongElectraAggregateAndProof = func() *electra.AggregateAndProof {
	byts, err := TestingElectraAggregateAndProof.MarshalSSZ()
	if err != nil {
		panic(err.Error())
	}
	ret := &electra.AggregateAndProof{}
	if err := ret.UnmarshalSSZ(byts); err != nil {
		panic(err.Error())
	}
	ret.AggregatorIndex = 100
	return ret
}()
View Source
var TestingWrongPhase0AggregateAndProof = func() *phase0.AggregateAndProof {
	byts, err := TestingPhase0AggregateAndProof.MarshalSSZ()
	if err != nil {
		panic(err.Error())
	}
	ret := &phase0.AggregateAndProof{}
	if err := ret.UnmarshalSSZ(byts); err != nil {
		panic(err.Error())
	}
	ret.AggregatorIndex = 100
	return ret
}()
View Source
var TestingWrongValidatorPubKey = func() spec.BLSPubKey {

	pk, _ := hex.DecodeString("948fb44582ce25336fdb17122eac64fe5a1afc39174ce92d6013becac116766dc5a778c880dd47de7dfff6a0f86ba42b")
	blsPK := spec.BLSPubKey{}
	copy(blsPK[:], pk)
	return blsPK
}()
View Source
var ThirteenOperatorsInstance = func() *qbft.Instance {
	return baseInstance(TestingCommitteeMember(Testing13SharesSet()), Testing13SharesSet(), []byte{1, 2, 3, 4})
}
View Source
var ToProcessingMessage = func(msg *types.SignedSSVMessage) *qbft.ProcessingMessage {
	pm, _ := qbft.NewProcessingMessage(msg)
	return pm
}
View Source
var ToProcessingMessages = func(msgs []*types.SignedSSVMessage) []*qbft.ProcessingMessage {
	ret := make([]*qbft.ProcessingMessage, 0)
	for _, msg := range msgs {
		ret = append(ret, ToProcessingMessage(msg))
	}
	return ret
}
View Source
var UnknownDutyTypeRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(UnknownDutyType, keySet)
}
View Source
var ValidatorRegistrationMsgID = func() []byte {
	ret := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleValidatorRegistration)
	return ret[:]
}()
View Source
var ValidatorRegistrationRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleValidatorRegistration, keySet)
}
View Source
var VersionByEpoch = func(epoch phase0.Epoch) spec.DataVersion {
	if epoch < ForkEpochAltair {
		return spec.DataVersionPhase0
	} else if epoch < ForkEpochBellatrix {
		return spec.DataVersionAltair
	} else if epoch < ForkEpochPraterCapella {
		return spec.DataVersionBellatrix
	} else if epoch < ForkEpochPraterDeneb {
		return spec.DataVersionCapella
	} else if epoch < ForkEpochPraterElectra {
		return spec.DataVersionDeneb
	}
	return spec.DataVersionElectra
}
View Source
var VersionBySlot = func(slot phase0.Slot) spec.DataVersion {
	if slot < ForkEpochAltair*32 {
		return spec.DataVersionPhase0
	} else if slot < ForkEpochBellatrix*32 {
		return spec.DataVersionAltair
	} else if slot < ForkEpochPraterCapella*32 {
		return spec.DataVersionBellatrix
	} else if slot < ForkEpochPraterDeneb*32 {
		return spec.DataVersionCapella
	} else if slot < ForkEpochPraterElectra*32 {
		return spec.DataVersionDeneb
	}
	return spec.DataVersionElectra
}
View Source
var VoluntaryExitMsg = func(
	sk, beaconSK *bls.SecretKey,
	id, beaconID types.OperatorID,
	msgCnt int,
	wrongRoot bool,
	slot phase0.Slot,
	wrongBeaconSig bool,
) *types.PartialSignatureMessages {
	signer := NewTestingKeyManager()
	beacon := NewTestingBeaconNode()
	d, _ := beacon.DomainData(TestingDutyEpoch, types.DomainVoluntaryExit)

	signed, root, _ := signer.SignBeaconObject(TestingVoluntaryExitBySlot(slot), d,
		beaconSK.GetPublicKey().Serialize(),
		types.DomainVoluntaryExit)
	if wrongRoot {
		signed, root, _ = signer.SignBeaconObject(TestingVoluntaryExitWrong, d, beaconSK.GetPublicKey().Serialize(), types.DomainVoluntaryExit)
	}
	if wrongBeaconSig {
		signed, root, _ = signer.SignBeaconObject(TestingVoluntaryExit, d, Testing7SharesSet().ValidatorPK.Serialize(), types.DomainVoluntaryExit)
	}

	msgs := types.PartialSignatureMessages{
		Type:     types.VoluntaryExitPartialSig,
		Slot:     slot,
		Messages: []*types.PartialSignatureMessage{},
	}

	for i := 0; i < msgCnt; i++ {
		msg := &types.PartialSignatureMessage{
			PartialSignature: signed[:],
			SigningRoot:      root,
			Signer:           beaconID,
			ValidatorIndex:   TestingValidatorIndex,
		}
		msgs.Messages = append(msgs.Messages, msg)
	}

	msg := &types.PartialSignatureMessage{
		PartialSignature: signed[:],
		SigningRoot:      root,
		Signer:           id,
		ValidatorIndex:   TestingValidatorIndex,
	}
	if wrongRoot {
		msg.SigningRoot = [32]byte{}
	}

	return &msgs
}
View Source
var VoluntaryExitMsgID = func() []byte {
	ret := types.NewMsgID(TestingSSVDomainType, TestingValidatorPubKey[:], types.RoleVoluntaryExit)
	return ret[:]
}()
View Source
var VoluntaryExitRunner = func(keySet *TestKeySet) ssv.Runner {
	return baseRunner(types.RoleVoluntaryExit, keySet)
}

Functions

func CommitteeBeaconBroadcastedRootsForDuties

func CommitteeBeaconBroadcastedRootsForDuties(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, version spec.DataVersion) []string

func CommitteeBeaconBroadcastedRootsForDutiesWithDifferentValidators

func CommitteeBeaconBroadcastedRootsForDutiesWithDifferentValidators(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, version spec.DataVersion) []string

func CommitteeBeaconBroadcastedRootsForDutiesWithParams

func CommitteeBeaconBroadcastedRootsForDutiesWithParams(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, startingSlot phase0.Slot, diffValidatorsForDuties bool, version spec.DataVersion) []string

Returns a list of beacon roots for committees duties

func CommitteeBeaconBroadcastedRootsForDutiesWithStartingSlot

func CommitteeBeaconBroadcastedRootsForDutiesWithStartingSlot(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, slot phase0.Slot, version spec.DataVersion) []string

func CommitteeBeaconBroadcastedRootsForDuty

func CommitteeBeaconBroadcastedRootsForDuty(slot phase0.Slot, numAttestingValidators int, numSyncCommitteeValidators int, version spec.DataVersion) []string

Returns a list of beacon roots for committees duties

func CommitteeInputForDuties

func CommitteeInputForDuties(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, addPostConsensus bool, version spec.DataVersion) []interface{}

func CommitteeInputForDutiesWithFailuresThanSuccess

func CommitteeInputForDutiesWithFailuresThanSuccess(numAttestingValidators int, numSyncCommitteeValidators int, numFails int, numSuccess int, version spec.DataVersion) []interface{}

func CommitteeInputForDutiesWithParams

func CommitteeInputForDutiesWithParams(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, startingSlot phase0.Slot, addPostConsensus bool, shuffle bool, diffValidatorsForDuties bool) []interface{}

Returns a list of [Duty, qbft messages...] for each duty

func CommitteeInputForDutiesWithShuffle

func CommitteeInputForDutiesWithShuffle(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, addPostConsensus bool, version spec.DataVersion) []interface{}

func CommitteeInputForDutiesWithShuffleAndDifferentValidators

func CommitteeInputForDutiesWithShuffleAndDifferentValidators(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, addPostConsensus bool, version spec.DataVersion) []interface{}

func CommitteeInputForDuty

func CommitteeInputForDuty(duty *types.CommitteeDuty, slot phase0.Slot, ksMap map[phase0.ValidatorIndex]*TestKeySet, addPostConsensus bool) []*types.SignedSSVMessage

func CommitteeInputForSlotInSequencedDuties

func CommitteeInputForSlotInSequencedDuties(numAttestingValidators int, numSyncCommitteeValidators int, numSequencedDuties int, slotIncrement int, currentSlot phase0.Slot, ksMap map[phase0.ValidatorIndex]*TestKeySet, addPostConsensus bool, diffValidatorsForDuties bool) (*types.CommitteeDuty, []*types.SignedSSVMessage)

Return the input for the committee for a given slot of a sequence of duties

func CommitteeOutputMessagesForDuties

func CommitteeOutputMessagesForDuties(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, version spec.DataVersion) []*types.PartialSignatureMessages

func CommitteeOutputMessagesForDutiesWithDifferentValidators

func CommitteeOutputMessagesForDutiesWithDifferentValidators(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, version spec.DataVersion) []*types.PartialSignatureMessages

func CommitteeOutputMessagesForDutiesWithParams

func CommitteeOutputMessagesForDutiesWithParams(numSequencedDuties int, numAttestingValidators int, numSyncCommitteeValidators int, startingSlot phase0.Slot, diffValidatorsForDuties bool) []*types.PartialSignatureMessages

Returns a list of partial sig output messages for each duty slot

func CompareBroadcastedBeaconMsgs

func CompareBroadcastedBeaconMsgs(t *testing.T, expectedRoots []string, broadcastedRoots []phase0.Root)

func ComparePartialSignatureMessages

func ComparePartialSignatureMessages(msg1 *types.PartialSignatureMessages, msg2 *types.PartialSignatureMessages) error

func ComparePartialSignatureOutputMessages

func ComparePartialSignatureOutputMessages(t *testing.T, expectedMessages []*types.PartialSignatureMessages, broadcastedSignedMsgs []*types.SignedSSVMessage, committee []*types.Operator)

func ComparePartialSignatureOutputMessagesInAsynchronousOrder

func ComparePartialSignatureOutputMessagesInAsynchronousOrder(t *testing.T, expectedMessages []*types.PartialSignatureMessages, broadcastedSignedMsgs []*types.SignedSSVMessage, committee []*types.Operator)

Compare partial sig output messages without assuming any order between messages (asynchonous)

func CompareSignedSSVMessageOutputMessages

func CompareSignedSSVMessageOutputMessages(t *testing.T, expectedMessages []*types.SignedSSVMessage, broadcastedSignedMsgs []*types.SignedSSVMessage, committee []*types.Operator)

func ConvertBroadcastedMessagesToSSVMessages

func ConvertBroadcastedMessagesToSSVMessages(signedMessages []*types.SignedSSVMessage) []*types.SSVMessage

func GenerateETHDepositData

func GenerateETHDepositData(
	validatorPK, withdrawalCredentials []byte,
	fork phase0.Version,
	domain phase0.DomainType) ([]byte, *phase0.DepositData, error)

GenerateETHDepositData returns un-signed deposit data and deposit data root for signature

func GetSSZRootNoError

func GetSSZRootNoError(obj ssz.HashRoot) string

Util inline function for getting the SSZ root of an object

func KeySetMapForValidatorIndexList

func KeySetMapForValidatorIndexList(valIndexes []int) map[phase0.ValidatorIndex]*TestKeySet

func KeySetMapForValidators

func KeySetMapForValidators(limit int) map[phase0.ValidatorIndex]*TestKeySet

func MergeListsWithRandomPick

func MergeListsWithRandomPick(lists [][]interface{}) []interface{}

Function to merge the given lists with a random pick order. The result is a shuffled list that preserves the orders of each sublist

func NewOperatorSigner

func NewOperatorSigner(keySet *TestKeySet, operatorID types.OperatorID) *types.OperatorSigner

func NewTestingQBFTController

func NewTestingQBFTController(identifier []byte, share *types.CommitteeMember, config qbft.IConfig,
	signer *types.OperatorSigner) *qbft.Controller

func NewTestingStorage

func NewTestingStorage() *testingStorage

func NewTestingTimer

func NewTestingTimer() qbft.Timer

func RootCountMapForPartialSignatureMessages

func RootCountMapForPartialSignatureMessages(msg *types.PartialSignatureMessages) map[string]int

func ShareMapFromKeySetMap

func ShareMapFromKeySetMap(keySetMap map[phase0.ValidatorIndex]*TestKeySet) map[phase0.ValidatorIndex]*types.Share

func SortedMapKeys

func SortedMapKeys[K constraints.Ordered, V any](m map[K]V) []struct {
	Key   K
	Value V
}

SortMapByKey sorts a map by its keys and returns a sorted slice of key-value pairs.

func TestingCommitMessageWithHeightIdentifierAndFullData

func TestingCommitMessageWithHeightIdentifierAndFullData(sk *rsa.PrivateKey, id types.OperatorID, height qbft.Height, identifier, fullData []byte) *types.SignedSSVMessage

func TestingCommitMultiSignerMessageWithHeightIdentifierAndFullData

func TestingCommitMultiSignerMessageWithHeightIdentifierAndFullData(
	sks []*rsa.PrivateKey,
	ids []types.OperatorID,
	height qbft.Height,
	identifier, fullData []byte,
) *types.SignedSSVMessage

func TestingCommitteeDuty

func TestingCommitteeDuty(attestationValidatorIds []int, syncCommitteeValidatorIds []int, version spec.DataVersion) *types.CommitteeDuty

func TestingCommitteeDutyFirstSlot

func TestingCommitteeDutyFirstSlot(attestationValidatorIds []int, syncCommitteeValidatorIds []int) *types.CommitteeDuty

func TestingCommitteeDutyForSlot

func TestingCommitteeDutyForSlot(slot phase0.Slot, attestationValidatorIds []int, syncCommitteeValidatorIds []int) *types.CommitteeDuty

func TestingCommitteeDutyInvalid

func TestingCommitteeDutyInvalid(attestationValidatorIds []int, syncCommitteeValidatorIds []int, version spec.DataVersion) *types.CommitteeDuty

func TestingCommitteeDutyNextEpoch

func TestingCommitteeDutyNextEpoch(attestationValidatorIds []int, syncCommitteeValidatorIds []int, version spec.DataVersion) *types.CommitteeDuty

func TestingCommitteeDutyWithMixedCommitteeIndexes

func TestingCommitteeDutyWithMixedCommitteeIndexes(attestationValidatorIds []int, syncCommitteeValidatorIds []int, version spec.DataVersion) *types.CommitteeDuty

Create a CommitteeDuty with attestations and sync committee with mixed CommitteeIndexes

func TestingCommitteeDutyWithParams

func TestingCommitteeDutyWithParams(
	slot phase0.Slot,
	attestationValidatorIds []int,
	syncCommitteeValidatorIds []int,
	committeeIndex phase0.CommitteeIndex,
	committeesAtSlot uint64,
	committeeLenght uint64,
	validatorCommitteeIndex uint64) *types.CommitteeDuty

func TestingProposalMessageWithIdentifierAndFullData

func TestingProposalMessageWithIdentifierAndFullData(sk *rsa.PrivateKey, id types.OperatorID, identifier, fullData []byte, height qbft.Height) *types.SignedSSVMessage

func TestingValidatorRegistrationBySlot

func TestingValidatorRegistrationBySlot(slot phase0.Slot) *v1.ValidatorRegistration

func TestingVoluntaryExitBySlot

func TestingVoluntaryExitBySlot(slot phase0.Slot) *phase0.VoluntaryExit

func ValidatorIndexList

func ValidatorIndexList(limit int) []int

func VerifyListOfSignedSSVMessages

func VerifyListOfSignedSSVMessages(msgs []*types.SignedSSVMessage, operators []*types.Operator) error

Verifies a list of SignedSSVMessage using the operators list

Types

type SignOutput

type SignOutput struct {
	Signature []byte
	Root      [32]byte
}

type TestKeySet

type TestKeySet struct {
	ValidatorSK                             *bls.SecretKey
	ValidatorPK                             *bls.PublicKey
	ShareCount, Threshold, PartialThreshold uint64
	Shares                                  map[types.OperatorID]*bls.SecretKey
	OperatorKeys                            map[types.OperatorID]*rsa.PrivateKey
	DKGOperators                            map[types.OperatorID]struct {
		SK            *ecdsa.PrivateKey
		ETHAddress    common.Address
		EncryptionKey *rsa.PrivateKey
	}
}

func KeySetForCommitteeMember

func KeySetForCommitteeMember(committeeMember *types.CommitteeMember) *TestKeySet

func KeySetForShare

func KeySetForShare(share *types.Share) *TestKeySet

func Testing10SharesSet

func Testing10SharesSet() *TestKeySet

func Testing13SharesSet

func Testing13SharesSet() *TestKeySet

func Testing4SharesSet

func Testing4SharesSet() *TestKeySet

func Testing7SharesSet

func Testing7SharesSet() *TestKeySet

func (*TestKeySet) Committee

func (ks *TestKeySet) Committee() []*types.ShareMember

type TestQBFTTimer

type TestQBFTTimer struct {
	State TimerState
}

func (*TestQBFTTimer) TimeoutForRound

func (t *TestQBFTTimer) TimeoutForRound(round qbft.Round)

type TestingBeaconNode

type TestingBeaconNode struct {
	BroadcastedRoots []phase0.Root
	// contains filtered or unexported fields
}

func NewTestingBeaconNode

func NewTestingBeaconNode() *TestingBeaconNode

func (*TestingBeaconNode) DataVersion

func (bn *TestingBeaconNode) DataVersion(epoch phase0.Epoch) spec.DataVersion

func (*TestingBeaconNode) DomainData

func (bn *TestingBeaconNode) DomainData(epoch phase0.Epoch, domain phase0.DomainType) (phase0.Domain, error)

func (*TestingBeaconNode) GetAttestationData

func (bn *TestingBeaconNode) GetAttestationData(slot phase0.Slot) (*phase0.
	AttestationData, spec.DataVersion, error)

GetAttestationData returns attestation data by the given slot and committee index

func (*TestingBeaconNode) GetBeaconBlock

func (bn *TestingBeaconNode) GetBeaconBlock(slot phase0.Slot, graffiti, randao []byte) (ssz.Marshaler, spec.DataVersion, error)

GetBeaconBlock returns beacon block by the given slot, graffiti, and randao.

func (*TestingBeaconNode) GetBeaconNetwork

func (bn *TestingBeaconNode) GetBeaconNetwork() types.BeaconNetwork

GetBeaconNetwork returns the beacon network the node is on

func (*TestingBeaconNode) GetSyncCommitteeContribution

func (bn *TestingBeaconNode) GetSyncCommitteeContribution(slot phase0.Slot, selectionProofs []phase0.BLSSignature, subnetIDs []uint64) (ssz.Marshaler, spec.DataVersion, error)

GetSyncCommitteeContribution returns

func (*TestingBeaconNode) GetSyncMessageBlockRoot

func (bn *TestingBeaconNode) GetSyncMessageBlockRoot(slot phase0.Slot) (phase0.Root, spec.DataVersion, error)

GetSyncMessageBlockRoot returns beacon block root for sync committee

func (*TestingBeaconNode) IsSyncCommitteeAggregator

func (bn *TestingBeaconNode) IsSyncCommitteeAggregator(proof []byte) (bool, error)

IsSyncCommitteeAggregator returns tru if aggregator

func (*TestingBeaconNode) SetSyncCommitteeAggregatorRootHexes

func (bn *TestingBeaconNode) SetSyncCommitteeAggregatorRootHexes(roots map[string]bool)

SetSyncCommitteeAggregatorRootHexes FOR TESTING ONLY!! sets which sync committee aggregator roots will return true for aggregator

func (*TestingBeaconNode) SubmitAggregateSelectionProof

func (bn *TestingBeaconNode) SubmitAggregateSelectionProof(slot phase0.Slot, committeeIndex phase0.CommitteeIndex, committeeLength uint64, index phase0.ValidatorIndex, slotSig []byte) (ssz.Marshaler, spec.DataVersion, error)

SubmitAggregateSelectionProof returns an AggregateAndProof object

func (*TestingBeaconNode) SubmitAttestations

func (bn *TestingBeaconNode) SubmitAttestations(attestations []*spec.VersionedAttestation) error

SubmitAttestations submit attestations to the node Note: The test is concerned with what should be sent on the wire. Thus, electra Attestations are converted into a SingleAttestation object as in the Ethereum spec.

func (*TestingBeaconNode) SubmitBeaconBlock

func (bn *TestingBeaconNode) SubmitBeaconBlock(block *api.VersionedProposal, sig phase0.BLSSignature) error

SubmitBeaconBlock submit the block to the node

func (*TestingBeaconNode) SubmitBlindedBeaconBlock

func (bn *TestingBeaconNode) SubmitBlindedBeaconBlock(block *api.VersionedBlindedProposal, sig phase0.BLSSignature) error

SubmitBlindedBeaconBlock submit the blinded block to the node

func (*TestingBeaconNode) SubmitSignedAggregateSelectionProof

func (bn *TestingBeaconNode) SubmitSignedAggregateSelectionProof(msg *spec.VersionedSignedAggregateAndProof) error

SubmitSignedAggregateSelectionProof broadcasts a signed aggregator msg

func (*TestingBeaconNode) SubmitSignedContributionAndProof

func (bn *TestingBeaconNode) SubmitSignedContributionAndProof(contribution *altair.SignedContributionAndProof) error

SubmitSignedContributionAndProof broadcasts to the network

func (*TestingBeaconNode) SubmitSyncMessages

func (bn *TestingBeaconNode) SubmitSyncMessages(msgs []*altair.SyncCommitteeMessage) error

SubmitSyncMessage submits a signed sync committee msg

func (*TestingBeaconNode) SubmitValidatorRegistration

func (bn *TestingBeaconNode) SubmitValidatorRegistration(registration *api.VersionedSignedValidatorRegistration) error

func (*TestingBeaconNode) SubmitVoluntaryExit

func (bn *TestingBeaconNode) SubmitVoluntaryExit(voluntaryExit *phase0.SignedVoluntaryExit) error

SubmitVoluntaryExit submit the VoluntaryExit object to the node

func (*TestingBeaconNode) SyncCommitteeSubnetID

func (bn *TestingBeaconNode) SyncCommitteeSubnetID(index phase0.CommitteeIndex) (uint64, error)

SyncCommitteeSubnetID returns sync committee subnet ID from subcommittee index

type TestingKeyManager

type TestingKeyManager struct {
	// contains filtered or unexported fields
}

func NewTestingKeyManager

func NewTestingKeyManager() *TestingKeyManager

func NewTestingKeyManagerWithSlashableSlots

func NewTestingKeyManagerWithSlashableSlots(slashableSlots map[string][]phase0.Slot) *TestingKeyManager

func (*TestingKeyManager) AddShare

func (km *TestingKeyManager) AddShare(shareKey *bls.SecretKey) error

func (*TestingKeyManager) AddSlashableSlot

func (km *TestingKeyManager) AddSlashableSlot(pk types.ShareValidatorPK, slot phase0.Slot)

AddSlashableDataRoot adds a slashable slot for the validator to the key manager

func (*TestingKeyManager) IsAttestationSlashable

func (km *TestingKeyManager) IsAttestationSlashable(pk types.ShareValidatorPK, data *spec.AttestationData) error

IsAttestationSlashable returns error if attestation is slashable

func (*TestingKeyManager) IsBeaconBlockSlashable

func (km *TestingKeyManager) IsBeaconBlockSlashable(pk []byte, slot spec.Slot) error

IsBeaconBlockSlashable returns error if the given block is slashable

func (*TestingKeyManager) RemoveShare

func (km *TestingKeyManager) RemoveShare(pubKey string) error

func (*TestingKeyManager) SignBeaconObject

func (km *TestingKeyManager) SignBeaconObject(obj ssz.HashRoot, domain spec.Domain, pk []byte, domainType spec.DomainType) (types.Signature, [32]byte, error)

func (*TestingKeyManager) SignDKGOutput

func (km *TestingKeyManager) SignDKGOutput(output types.Root, address common.Address) (types.Signature, error)

SignDKGOutput signs output according to the SIP https://docs.google.com/document/d/1TRVUHjFyxINWW2H9FYLNL2pQoLy6gmvaI62KL_4cREQ/edit

func (*TestingKeyManager) SignETHDepositRoot

func (km *TestingKeyManager) SignETHDepositRoot(root []byte, address common.Address) (types.Signature, error)

func (*TestingKeyManager) SignRoot

func (km *TestingKeyManager) SignRoot(data types.Root, sigType types.SignatureType, pk []byte) (types.Signature, error)

type TestingKeyStorage

type TestingKeyStorage struct {
	// contains filtered or unexported fields
}

TestingKeyStorage holds all TestingXSharesSet keys for X = 4, 7, 10, 13. This data is never changed and, thus, we implement the singleton creational pattern

func NewTestingKeyStorage

func NewTestingKeyStorage() *TestingKeyStorage

func (*TestingKeyStorage) AddShare

func (ks *TestingKeyStorage) AddShare(shareKey *bls.SecretKey) error

type TestingNetwork

type TestingNetwork struct {
	BroadcastedMsgs []*types.SignedSSVMessage
	OperatorID      types.OperatorID
	OperatorSK      *rsa.PrivateKey
}

func NewTestingNetwork

func NewTestingNetwork(operatorID types.OperatorID, sk *rsa.PrivateKey) *TestingNetwork

func (*TestingNetwork) Broadcast

func (net *TestingNetwork) Broadcast(msgID types.MessageID, message *types.SignedSSVMessage) error

type TimerState

type TimerState struct {
	Timeouts int
	Round    qbft.Round
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL