From 45f830b17eef082ddc3be71adc3c8e567d3fef54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gianguido=20Sor=C3=A0?= Date: Tue, 25 Jun 2024 18:14:52 +0200 Subject: [PATCH] *: cherrypick for v1.0-rc7, round two (#3156) - #3146 - #3155 category: misc ticket: none --- cmd/exit_sign.go | 1 + core/bcast/bcast.go | 26 +- core/eth2signeddata.go | 16 - core/eth2signeddata_test.go | 12 - core/parsigex/parsigex_test.go | 10 +- core/serialise_test.go | 8 +- core/sigagg/sigagg_test.go | 4 +- core/signeddata.go | 228 +++--------- core/signeddata_test.go | 153 -------- core/ssz.go | 84 ----- core/ssz_test.go | 1 - ...ion_VersionedSignedProposal.json#01.golden | 350 ++++++++++++++++++ ...tion_VersionedSignedProposal.ssz#01.golden | Bin 0 -> 5835 bytes core/tracker/inclusion.go | 30 +- core/tracker/inclusion_internal_test.go | 4 +- core/tracker/tracker_internal_test.go | 14 +- core/validatorapi/validatorapi_test.go | 13 +- testutil/fuzz.go | 29 +- testutil/random.go | 27 +- 19 files changed, 487 insertions(+), 523 deletions(-) create mode 100644 core/testdata/TestJSONSerialisation_VersionedSignedProposal.json#01.golden create mode 100644 core/testdata/TestSSZSerialisation_VersionedSignedProposal.ssz#01.golden diff --git a/cmd/exit_sign.go b/cmd/exit_sign.go index 5fc0d92c6..99e9cb8e8 100644 --- a/cmd/exit_sign.go +++ b/cmd/exit_sign.go @@ -148,6 +148,7 @@ func runSignPartialExit(ctx context.Context, config exitConfig) error { valAPICallOpts.Indices = []eth2p0.ValidatorIndex{ eth2p0.ValidatorIndex(config.ValidatorIndex), } + valIndex = eth2p0.ValidatorIndex(config.ValidatorIndex) } else { valAPICallOpts.PubKeys = []eth2p0.BLSPubKey{ valEth2, diff --git a/core/bcast/bcast.go b/core/bcast/bcast.go index 379031243..4819cab06 100644 --- a/core/bcast/bcast.go +++ b/core/bcast/bcast.go @@ -74,26 +74,26 @@ func (b Broadcaster) Broadcast(ctx context.Context, duty core.Duty, set core.Sig } var ( - block core.VersionedSignedProposal - blindedBlock core.VersionedSignedBlindedProposal - - blinded bool - ok bool + block core.VersionedSignedProposal + ok bool ) block, ok = aggData.(core.VersionedSignedProposal) if !ok { - // check if it's a blinded proposal - blindedBlock, blinded = aggData.(core.VersionedSignedBlindedProposal) - if !blinded { - return errors.New("invalid proposal") - } + return errors.New("invalid proposal") } - switch blinded { + switch block.Blinded { case true: + var blinded eth2api.VersionedSignedBlindedProposal + + blinded, err = block.ToBlinded() + if err != nil { + return errors.Wrap(err, "cannot broadcast, expected blinded proposal") + } + err = b.eth2Cl.SubmitBlindedProposal(ctx, ð2api.SubmitBlindedProposalOpts{ - Proposal: &blindedBlock.VersionedSignedBlindedProposal, + Proposal: &blinded, }) default: err = b.eth2Cl.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ @@ -105,7 +105,7 @@ func (b Broadcaster) Broadcast(ctx context.Context, duty core.Duty, set core.Sig log.Info(ctx, "Successfully submitted block proposal to beacon node", z.Any("delay", b.delayFunc(duty.Slot)), z.Any("pubkey", pubkey), - z.Bool("blinded", blinded), + z.Bool("blinded", block.Blinded), ) } diff --git a/core/eth2signeddata.go b/core/eth2signeddata.go index 80bba0b1c..373dba3db 100644 --- a/core/eth2signeddata.go +++ b/core/eth2signeddata.go @@ -17,7 +17,6 @@ var ( _ Eth2SignedData = VersionedSignedProposal{} _ Eth2SignedData = Attestation{} _ Eth2SignedData = SignedVoluntaryExit{} - _ Eth2SignedData = VersionedSignedBlindedProposal{} _ Eth2SignedData = VersionedSignedValidatorRegistration{} _ Eth2SignedData = SignedRandao{} _ Eth2SignedData = BeaconCommitteeSelection{} @@ -57,21 +56,6 @@ func (p VersionedSignedProposal) Epoch(ctx context.Context, eth2Cl eth2wrap.Clie return eth2util.EpochFromSlot(ctx, eth2Cl, slot) } -// Implement Eth2SignedData for VersionedSignedBlindedProposal. - -func (VersionedSignedBlindedProposal) DomainName() signing.DomainName { - return signing.DomainBeaconProposer -} - -func (p VersionedSignedBlindedProposal) Epoch(ctx context.Context, eth2Cl eth2wrap.Client) (eth2p0.Epoch, error) { - slot, err := p.VersionedSignedBlindedProposal.Slot() - if err != nil { - return 0, err - } - - return eth2util.EpochFromSlot(ctx, eth2Cl, slot) -} - // Implement Eth2SignedData for Attestation. func (Attestation) DomainName() signing.DomainName { diff --git a/core/eth2signeddata_test.go b/core/eth2signeddata_test.go index 27fb6c13a..1b2250464 100644 --- a/core/eth2signeddata_test.go +++ b/core/eth2signeddata_test.go @@ -30,18 +30,6 @@ func TestVerifyEth2SignedData(t *testing.T) { name: "verify beacon block", data: testutil.RandomBellatrixCoreVersionedSignedProposal(), }, - { - name: "verify blinded beacon block bellatrix", - data: testutil.RandomBellatrixVersionedSignedBlindedProposal(), - }, - { - name: "verify blinded beacon block capella", - data: testutil.RandomCapellaVersionedSignedBlindedProposal(), - }, - { - name: "verify blinded beacon block deneb", - data: testutil.RandomDenebVersionedSignedBlindedProposal(), - }, { name: "verify randao", data: testutil.RandomCoreSignedRandao(), diff --git a/core/parsigex/parsigex_test.go b/core/parsigex/parsigex_test.go index f1cae407a..648148850 100644 --- a/core/parsigex/parsigex_test.go +++ b/core/parsigex/parsigex_test.go @@ -174,15 +174,17 @@ func TestParSigExVerifier(t *testing.T) { t.Run("Verify blinded proposal", func(t *testing.T) { blindedBlock := testutil.RandomDenebVersionedSignedBlindedProposal() - blindedBlock.Deneb.Message.Slot = slot - sigRoot, err := blindedBlock.Root() + blindedBlock.DenebBlinded.Message.Slot = slot + sigRoot, err := blindedBlock.DenebBlinded.Message.HashTreeRoot() require.NoError(t, err) sigData, err := signing.GetDataRoot(ctx, bmock, signing.DomainBeaconProposer, epoch, sigRoot) require.NoError(t, err) - blindedBlock.Deneb.Signature = sign(sigData[:]) - data, err := core.NewPartialVersionedSignedBlindedProposal(&blindedBlock.VersionedSignedBlindedProposal, shareIdx) + blindedBlock.DenebBlinded.Signature = sign(sigData[:]) + eth2apiBlinded, err := blindedBlock.ToBlinded() + require.NoError(t, err) + data, err := core.NewPartialVersionedSignedBlindedProposal(ð2apiBlinded, shareIdx) require.NoError(t, err) require.NoError(t, verifyFunc(ctx, core.NewProposerDuty(slot), pubkey, data)) diff --git a/core/serialise_test.go b/core/serialise_test.go index 1a2db4d5b..de34cb025 100644 --- a/core/serialise_test.go +++ b/core/serialise_test.go @@ -16,11 +16,15 @@ import ( var coreTypeFuncs = []func() any{ func() any { return new(core.VersionedSignedProposal) }, + func() any { + ret := new(core.VersionedSignedProposal) + ret.Blinded = true + + return ret + }, func() any { return new(core.Attestation) }, func() any { return new(core.Signature) }, func() any { return new(core.SignedVoluntaryExit) }, - func() any { return new(core.VersionedSignedBlindedProposal) }, - func() any { return new(core.SignedRandao) }, func() any { return new(core.BeaconCommitteeSelection) }, func() any { return new(core.SignedAggregateAndProof) }, diff --git a/core/sigagg/sigagg_test.go b/core/sigagg/sigagg_test.go index a968552f2..a27798676 100644 --- a/core/sigagg/sigagg_test.go +++ b/core/sigagg/sigagg_test.go @@ -490,7 +490,7 @@ func TestSigAgg_DutyBuilderProposer(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - block, err := core.NewVersionedSignedBlindedProposal(test.block) + block, err := core.NewVersionedSignedProposalFromBlindedProposal(test.block) require.NoError(t, err) msgRoot, err := block.MessageRoot() @@ -514,7 +514,7 @@ func TestSigAgg_DutyBuilderProposer(t *testing.T) { sig, err := tbls.Sign(secret, msg[:]) require.NoError(t, err) - block, err := core.NewVersionedSignedBlindedProposal(test.block) + block, err := core.NewVersionedSignedProposalFromBlindedProposal(test.block) require.NoError(t, err) sigCore := tblsconv.SigToCore(sig) diff --git a/core/signeddata.go b/core/signeddata.go index 9cd127b3c..2de6f6483 100644 --- a/core/signeddata.go +++ b/core/signeddata.go @@ -30,7 +30,6 @@ var ( _ SignedData = Attestation{} _ SignedData = Signature{} _ SignedData = SignedVoluntaryExit{} - _ SignedData = VersionedSignedBlindedProposal{} _ SignedData = VersionedSignedValidatorRegistration{} _ SignedData = SignedRandao{} _ SignedData = BeaconCommitteeSelection{} @@ -43,14 +42,12 @@ var ( // Some types support SSZ marshalling and unmarshalling. _ ssz.Marshaler = VersionedSignedProposal{} _ ssz.Marshaler = Attestation{} - _ ssz.Marshaler = VersionedSignedBlindedProposal{} _ ssz.Marshaler = SignedAggregateAndProof{} _ ssz.Marshaler = SignedSyncMessage{} _ ssz.Marshaler = SyncContributionAndProof{} _ ssz.Marshaler = SignedSyncContributionAndProof{} _ ssz.Unmarshaler = new(VersionedSignedProposal) _ ssz.Unmarshaler = new(Attestation) - _ ssz.Unmarshaler = new(VersionedSignedBlindedProposal) _ ssz.Unmarshaler = new(SignedAggregateAndProof) _ ssz.Unmarshaler = new(SignedSyncMessage) _ ssz.Unmarshaler = new(SyncContributionAndProof) @@ -181,11 +178,57 @@ func NewPartialVersionedSignedProposal(proposal *eth2api.VersionedSignedProposal }, nil } +func NewVersionedSignedProposalFromBlindedProposal(bp *eth2api.VersionedSignedBlindedProposal) (VersionedSignedProposal, error) { + wrap, err := NewVersionedSignedProposal(ð2api.VersionedSignedProposal{ + Version: bp.Version, + Blinded: true, + BellatrixBlinded: bp.Bellatrix, + CapellaBlinded: bp.Capella, + DenebBlinded: bp.Deneb, + }) + if err != nil { + return VersionedSignedProposal{}, err + } + + return wrap, nil +} + +func NewPartialVersionedSignedBlindedProposal(bp *eth2api.VersionedSignedBlindedProposal, shareIdx int) (ParSignedData, error) { + wrap, err := NewVersionedSignedProposal(ð2api.VersionedSignedProposal{ + Version: bp.Version, + Blinded: true, + BellatrixBlinded: bp.Bellatrix, + CapellaBlinded: bp.Capella, + DenebBlinded: bp.Deneb, + }) + if err != nil { + return ParSignedData{}, err + } + + return ParSignedData{ + SignedData: wrap, + ShareIdx: shareIdx, + }, nil +} + // VersionedSignedProposal is a signed versioned proposal and implements SignedData. type VersionedSignedProposal struct { eth2api.VersionedSignedProposal } +func (p VersionedSignedProposal) ToBlinded() (eth2api.VersionedSignedBlindedProposal, error) { + if !p.Blinded { + return eth2api.VersionedSignedBlindedProposal{}, errors.New("proposal is not blinded") + } + + return eth2api.VersionedSignedBlindedProposal{ + Version: p.Version, + Bellatrix: p.BellatrixBlinded, + Capella: p.CapellaBlinded, + Deneb: p.DenebBlinded, + }, nil +} + func (p VersionedSignedProposal) Signature() Signature { switch p.Version { // No block nil checks since `NewVersionedSignedBeaconBlock` assumed. @@ -424,185 +467,6 @@ func (p *VersionedSignedProposal) UnmarshalJSON(input []byte) error { return nil } -// NewVersionedSignedBlindedProposal validates and returns a new wrapped VersionedSignedBlindedProposal. -func NewVersionedSignedBlindedProposal(block *eth2api.VersionedSignedBlindedProposal) (VersionedSignedBlindedProposal, error) { - switch block.Version { - case eth2spec.DataVersionBellatrix: - if block.Bellatrix == nil { - return VersionedSignedBlindedProposal{}, errors.New("no bellatrix block") - } - case eth2spec.DataVersionCapella: - if block.Capella == nil { - return VersionedSignedBlindedProposal{}, errors.New("no capella block") - } - case eth2spec.DataVersionDeneb: - if block.Deneb == nil { - return VersionedSignedBlindedProposal{}, errors.New("no deneb block") - } - default: - return VersionedSignedBlindedProposal{}, errors.New("unknown version") - } - - return VersionedSignedBlindedProposal{VersionedSignedBlindedProposal: *block}, nil -} - -// NewPartialVersionedSignedBlindedProposal is a convenience function that returns a new partial signed proposal. -func NewPartialVersionedSignedBlindedProposal(proposal *eth2api.VersionedSignedBlindedProposal, shareIdx int) (ParSignedData, error) { - wrap, err := NewVersionedSignedBlindedProposal(proposal) - if err != nil { - return ParSignedData{}, err - } - - return ParSignedData{ - SignedData: wrap, - ShareIdx: shareIdx, - }, nil -} - -// VersionedSignedBlindedProposal is a signed versioned blinded proposal and implements SignedData. -type VersionedSignedBlindedProposal struct { - eth2api.VersionedSignedBlindedProposal -} - -func (p VersionedSignedBlindedProposal) Signature() Signature { - switch p.Version { - // No block nil checks since `NewVersionedSignedBlindedBeaconBlock` assumed. - case eth2spec.DataVersionBellatrix: - return SigFromETH2(p.Bellatrix.Signature) - case eth2spec.DataVersionCapella: - return SigFromETH2(p.Capella.Signature) - case eth2spec.DataVersionDeneb: - return SigFromETH2(p.Deneb.Signature) - default: - panic("unknown version") // Note this is avoided by using `NewVersionedSignedBlindedProposal`. - } -} - -func (p VersionedSignedBlindedProposal) SetSignature(sig Signature) (SignedData, error) { - resp, err := p.clone() - if err != nil { - return nil, err - } - - switch resp.Version { - // No block nil checks since `NewVersionedSignedBlindedBeaconBlock` assumed. - case eth2spec.DataVersionBellatrix: - resp.Bellatrix.Signature = sig.ToETH2() - case eth2spec.DataVersionCapella: - resp.Capella.Signature = sig.ToETH2() - case eth2spec.DataVersionDeneb: - resp.Deneb.Signature = sig.ToETH2() - default: - return nil, errors.New("unknown type") - } - - return resp, nil -} - -func (p VersionedSignedBlindedProposal) MessageRoot() ([32]byte, error) { - switch p.Version { - // No block nil checks since `NewVersionedSignedBlindedBeaconBlock` assumed. - case eth2spec.DataVersionBellatrix: - return p.Bellatrix.Message.HashTreeRoot() - case eth2spec.DataVersionCapella: - return p.Capella.Message.HashTreeRoot() - case eth2spec.DataVersionDeneb: - return p.Deneb.Message.HashTreeRoot() - default: - panic("unknown version") // Note this is avoided by using `NewVersionedSignedBlindedProposal`. - } -} - -func (p VersionedSignedBlindedProposal) Clone() (SignedData, error) { - return p.clone() -} - -// clone returns a copy of the VersionedSignedBlindedProposal. -// It is similar to Clone that returns the SignedData interface. -func (p VersionedSignedBlindedProposal) clone() (VersionedSignedBlindedProposal, error) { - var resp VersionedSignedBlindedProposal - err := cloneJSONMarshaler(p, &resp) - if err != nil { - return VersionedSignedBlindedProposal{}, errors.Wrap(err, "clone blinded proposal") - } - - return resp, nil -} - -func (p VersionedSignedBlindedProposal) MarshalJSON() ([]byte, error) { - var marshaller json.Marshaler - switch p.Version { - // No block nil checks since `NewVersionedSignedBlindedProposal` assumed. - case eth2spec.DataVersionBellatrix: - marshaller = p.VersionedSignedBlindedProposal.Bellatrix - case eth2spec.DataVersionCapella: - marshaller = p.VersionedSignedBlindedProposal.Capella - case eth2spec.DataVersionDeneb: - marshaller = p.VersionedSignedBlindedProposal.Deneb - default: - return nil, errors.New("unknown version") - } - - block, err := marshaller.MarshalJSON() - if err != nil { - return nil, errors.Wrap(err, "marshal block") - } - - version, err := eth2util.DataVersionFromETH2(p.Version) - if err != nil { - return nil, errors.Wrap(err, "convert version") - } - - resp, err := json.Marshal(versionedRawBlockJSON{ - Version: version, - Block: block, - Blinded: true, - }) - if err != nil { - return nil, errors.Wrap(err, "marshal wrapper") - } - - return resp, nil -} - -func (p *VersionedSignedBlindedProposal) UnmarshalJSON(input []byte) error { - var raw versionedRawBlockJSON - if err := json.Unmarshal(input, &raw); err != nil { - return errors.Wrap(err, "unmarshal block") - } - if !raw.Blinded { - return errors.New("unmarshalled block is not blinded") - } - - resp := eth2api.VersionedSignedBlindedProposal{Version: raw.Version.ToETH2()} - switch resp.Version { - case eth2spec.DataVersionBellatrix: - block := new(eth2bellatrix.SignedBlindedBeaconBlock) - if err := json.Unmarshal(raw.Block, &block); err != nil { - return errors.Wrap(err, "unmarshal bellatrix") - } - resp.Bellatrix = block - case eth2spec.DataVersionCapella: - block := new(eth2capella.SignedBlindedBeaconBlock) - if err := json.Unmarshal(raw.Block, &block); err != nil { - return errors.Wrap(err, "unmarshal capella") - } - resp.Capella = block - case eth2spec.DataVersionDeneb: - block := new(eth2deneb.SignedBlindedBeaconBlock) - if err := json.Unmarshal(raw.Block, &block); err != nil { - return errors.Wrap(err, "unmarshal deneb") - } - resp.Deneb = block - default: - return errors.New("unknown version") - } - - p.VersionedSignedBlindedProposal = resp - - return nil -} - // versionedRawBlockJSON is a custom VersionedSignedBeaconBlock or VersionedSignedBlindedBeaconBlock serialiser. type versionedRawBlockJSON struct { Version eth2util.DataVersion `json:"version"` diff --git a/core/signeddata_test.go b/core/signeddata_test.go index 62c09a6bd..2624a3fd2 100644 --- a/core/signeddata_test.go +++ b/core/signeddata_test.go @@ -42,42 +42,6 @@ func TestSignedDataSetSignature(t *testing.T) { }, }, }, - { - name: "versioned signed blinded proposal bellatrix", - data: core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionBellatrix, - Bellatrix: ð2bellatrix.SignedBlindedBeaconBlock{ - Message: testutil.RandomBellatrixBlindedBeaconBlock(), - Signature: testutil.RandomEth2Signature(), - }, - }, - }, - }, - { - name: "versioned signed blinded proposal capella", - data: core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionCapella, - Capella: ð2capella.SignedBlindedBeaconBlock{ - Message: testutil.RandomCapellaBlindedBeaconBlock(), - Signature: testutil.RandomEth2Signature(), - }, - }, - }, - }, - { - name: "versioned signed blinded proposal deneb", - data: core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionDeneb, - Deneb: ð2deneb.SignedBlindedBeaconBlock{ - Message: testutil.RandomDenebBlindedBeaconBlock(), - Signature: testutil.RandomEth2Signature(), - }, - }, - }, - }, { name: "signed beacon committee selection", data: testutil.RandomCoreBeaconCommitteeSelection(), @@ -383,120 +347,3 @@ func TestVersionedSignedProposal(t *testing.T) { }) } } - -func TestNewVersionedSignedBlindedProposal(t *testing.T) { - type testCase struct { - error string - proposal *eth2api.VersionedSignedBlindedProposal - } - - tests := []testCase{ - { - error: "unknown version", - proposal: ð2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersion(999), - }, - }, - { - error: "no bellatrix block", - proposal: ð2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionBellatrix, - }, - }, - { - error: "no capella block", - proposal: ð2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionCapella, - }, - }, - { - error: "no deneb block", - proposal: ð2api.VersionedSignedBlindedProposal{ - Version: eth2spec.DataVersionDeneb, - }, - }, - } - - for _, test := range tests { - t.Run(test.error, func(t *testing.T) { - _, err := core.NewVersionedSignedBlindedProposal(test.proposal) - require.ErrorContains(t, err, test.error) - }) - } - - t.Run("happy path", func(t *testing.T) { - proposal := testutil.RandomBellatrixVersionedSignedBlindedProposal() - - p, err := core.NewVersionedSignedBlindedProposal(&proposal.VersionedSignedBlindedProposal) - require.NoError(t, err) - require.Equal(t, proposal, p) - }) -} - -func TestNewPartialVersionedSignedBlindedProposal(t *testing.T) { - proposal := testutil.RandomBellatrixVersionedSignedBlindedProposal() - - psd, err := core.NewPartialVersionedSignedBlindedProposal(&proposal.VersionedSignedBlindedProposal, 3) - - require.NoError(t, err) - require.NotNil(t, psd.SignedData) - require.Equal(t, 3, psd.ShareIdx) -} - -func TestVersionedSignedBlindedProposal(t *testing.T) { - type testCase struct { - name string - proposal eth2api.VersionedSignedBlindedProposal - } - - tests := []testCase{ - { - name: "bellatrix", - proposal: testutil.RandomBellatrixVersionedSignedBlindedProposal().VersionedSignedBlindedProposal, - }, - { - name: "capella", - proposal: testutil.RandomCapellaVersionedSignedBlindedProposal().VersionedSignedBlindedProposal, - }, - { - name: "deneb", - proposal: testutil.RandomDenebVersionedSignedBlindedProposal().VersionedSignedBlindedProposal, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - p, err := core.NewVersionedSignedBlindedProposal(&test.proposal) - require.NoError(t, err) - - msgRoot, err := p.MessageRoot() - require.NoError(t, err) - require.NotEmpty(t, msgRoot) - - _, err = p.SetSignature(testutil.RandomCoreSignature()) - require.NoError(t, err) - - clone, err := p.Clone() - require.NoError(t, err) - require.Equal(t, p, clone) - - js, err := p.MarshalJSON() - require.NoError(t, err) - - p2 := &core.VersionedSignedBlindedProposal{} - err = p2.UnmarshalJSON(js) - require.NoError(t, err) - require.Equal(t, p, *p2) - - // Malformed data - err = p2.UnmarshalJSON([]byte("malformed")) - require.ErrorContains(t, err, "unmarshal block") - - if test.proposal.Version != eth2spec.DataVersionUnknown { - js := fmt.Sprintf(`{"version":%d,"blinded":true,"block":123}`, test.proposal.Version-1) - err = p2.UnmarshalJSON([]byte(js)) - require.ErrorContains(t, err, unmarshalPrefix+test.proposal.Version.String()) - } - }) - } -} diff --git a/core/ssz.go b/core/ssz.go index 05c6cac8d..8369cf8aa 100644 --- a/core/ssz.go +++ b/core/ssz.go @@ -249,90 +249,6 @@ func (p *VersionedProposal) sszValFromVersion(version eth2util.DataVersion, blin } } -// ================== VersionedSignedBlindedProposal =================== - -// MarshalSSZ ssz marshals the VersionedSignedBlindedProposal object. -func (p VersionedSignedBlindedProposal) MarshalSSZ() ([]byte, error) { - resp, err := ssz.MarshalSSZ(p) - if err != nil { - return nil, errors.Wrap(err, "marshal VersionedSignedBlindedProposal") - } - - return resp, nil -} - -// MarshalSSZTo ssz marshals the VersionedSignedBlindedProposal object to a target array. -func (p VersionedSignedBlindedProposal) MarshalSSZTo(buf []byte) ([]byte, error) { - version, err := eth2util.DataVersionFromETH2(p.Version) - if err != nil { - return nil, errors.Wrap(err, "invalid version") - } - - return marshalSSZVersionedTo(buf, version, true, p.sszValFromVersion) -} - -// UnmarshalSSZ ssz unmarshalls the VersionedSignedBlindedProposal object. -func (p *VersionedSignedBlindedProposal) UnmarshalSSZ(buf []byte) error { - version, blinded, err := unmarshalSSZVersioned(buf, p.sszValFromVersion) - if err != nil { - return errors.Wrap(err, "unmarshal VersionedSignedBlindedProposal") - } - if !blinded { - return errors.New("expected blinded data") - } - - p.Version = version.ToETH2() - - return nil -} - -// SizeSSZ returns the ssz encoded size in bytes for the VersionedSignedBlindedProposal object. -func (p VersionedSignedBlindedProposal) SizeSSZ() int { - version, err := eth2util.DataVersionFromETH2(p.Version) - if err != nil { - // SSZMarshaller interface doesn't return an error, so we can't either. - return 0 - } - - val, err := p.sszValFromVersion(version, true) - if err != nil { - // SSZMarshaller interface doesn't return an error, so we can't either. - return 0 - } - - return sizeSSZVersioned(val) -} - -// sszValFromVersion returns the internal value of the VersionedSignedBlindedBeaconBlock object for a given version. -func (p *VersionedSignedBlindedProposal) sszValFromVersion(version eth2util.DataVersion, blinded bool) (sszType, error) { - if !blinded { - return nil, errors.New("blinded param must be true") - } - - switch version { - case eth2util.DataVersionBellatrix: - if p.Bellatrix == nil { - p.Bellatrix = new(eth2bellatrix.SignedBlindedBeaconBlock) - } - - return p.Bellatrix, nil - case eth2util.DataVersionCapella: - if p.Capella == nil { - p.Capella = new(eth2capella.SignedBlindedBeaconBlock) - } - - return p.Capella, nil - case eth2util.DataVersionDeneb: - if p.Deneb == nil { - p.Deneb = new(eth2deneb.SignedBlindedBeaconBlock) - } - - return p.Deneb, nil - default: - return nil, errors.New("invalid version") - } -} - // versionedOffset is the offset of a versioned ssz encoded object. const versionedOffset = 8 + 1 + 4 // version (uint64) + blinded (uint8) + offset (uint32) diff --git a/core/ssz_test.go b/core/ssz_test.go index 7a2d73f5d..46b960ed4 100644 --- a/core/ssz_test.go +++ b/core/ssz_test.go @@ -63,7 +63,6 @@ func TestSSZ(t *testing.T) { }{ {zero: func() any { return new(core.VersionedSignedProposal) }}, {zero: func() any { return new(core.Attestation) }}, - {zero: func() any { return new(core.VersionedSignedBlindedProposal) }}, {zero: func() any { return new(core.SignedAggregateAndProof) }}, {zero: func() any { return new(core.SignedSyncMessage) }}, {zero: func() any { return new(core.SyncContributionAndProof) }}, diff --git a/core/testdata/TestJSONSerialisation_VersionedSignedProposal.json#01.golden b/core/testdata/TestJSONSerialisation_VersionedSignedProposal.json#01.golden new file mode 100644 index 000000000..62d89ccd5 --- /dev/null +++ b/core/testdata/TestJSONSerialisation_VersionedSignedProposal.json#01.golden @@ -0,0 +1,350 @@ +{ + "version": 2, + "block": { + "message": { + "slot": "8074401586156473090", + "proposer_index": "12669649448940181106", + "parent_root": "0x485fe3352bc5b52456f0eff11f99ef25258727c8b2922e22f5563d39490544d0", + "state_root": "0xce92f83e0212d3077d0549b01b83b78e64fc147e5086ae7c1ac5bbb6496af670", + "body": { + "randao_reveal": "0xb0d88158d69078e3e244ee141c7cfe1c0ef0c2f60c29616c2f6b3a805e91ebdedc8fef611e1d079aa67a620d157145bb08f5197bb91ffb894a8e40f9a837cbbccd54915ca94d509daa426fe2a33e1b669111cc4ff4fcc5071606dc666e998b59", + "eth1_data": { + "deposit_root": "0x84152c509ad47e009399b5de04763e89ef5dd57558ad80535cb99835d61d2c5a", + "deposit_count": "8303874249530489053", + "block_hash": "0xc35dd93515cefe0b002cee5e71c47935e281ebfc4b8b652b69ccb092e55a20f1" + }, + "graffiti": "0xc6f733b6c8161d12ff1a9536e5ecfdb4c49a3f8cff429c026a404df8b9f7305d", + "proposer_slashings": [ + { + "signed_header_1": { + "message": { + "slot": "4002884295865133464", + "proposer_index": "10401092129559668577", + "parent_root": "0xa5a1350874452a54bc1d4d3021afb9a99adb32f0e7586d114eb003386bd43746", + "state_root": "0xddf2339b0c6346397fb2b009b6e25cac5585194df25566526b33a35cf21ddee3", + "body_root": "0xa216b739392c2fece974118d4545f4e49351149d26057e1c0d47dd244fee3a22" + }, + "signature": "0x8bc71e1e9867ae25640f4e158921c54009b7b78713ebabe0e6f188aab1968170cf910311c84e1469a0aa9696c7c6a5507bcb0400cf695e3ebc1b8668a081e3435809b8c533f091d705d311b8c04616fd3311b1432a23c580babee4bf1d30b37b" + }, + "signed_header_2": { + "message": { + "slot": "2963419752847912041", + "proposer_index": "4283313901335272943", + "parent_root": "0x42ba882638a71ed14533c08aaccd646143da1e8000d198fd846c054325f5d007", + "state_root": "0xceeecebcca54f905dc0272ef398c9b6d6c0a7630fbac34a583e6df09b94b6231", + "body_root": "0x5ac158e4b24d9b0d4797c7655fb2f3e8e5298a7652a5de720c5d66f2849ea78c" + }, + "signature": "0x2fd3592e40f342c6c2309e7407bd527b730b4ce65e8bd76a154117c86ea9dc2c24825700c8b87f790008c8a2a80ea7323c2d5ee36c6cf90cc0f2ae3ecaa28eca5ec131c34a130cb37ead9808dc6993178bd5cbc43530be0a8e2cedb849a173c2" + } + }, + { + "signed_header_1": { + "message": { + "slot": "12514005461132338934", + "proposer_index": "11339736146871302061", + "parent_root": "0x61a451b895e36d5ba7db3a85cb282b7ca372df9fffa1eeeeb02e34fe0e0d24ef", + "state_root": "0x2ad74844b04429c044040b15d79a3e1e9e541a42185bc8b2628ca6d4747fd4e4", + "body_root": "0xbe64cbfaf4668785b2158fae65bb08414e047bcc8b29189e6a0ca3ce2367ba7e" + }, + "signature": "0x61acfb123df52d39f64b9b1dc35cad8362ca399b0d4efdda8589460ae2908f7ffd620e0ddc2b33d99e1fa7639f38afa1e116883d1864093ee04ba975d1ea9ae4d3b7e5ed17dd3a184918b27ec848b6ad81bb1d3297d37b0d3728bcbb7f909f55" + }, + "signed_header_2": { + "message": { + "slot": "14478679172016965523", + "proposer_index": "4949088424957339860", + "parent_root": "0xda7258829c9e0882885c981f02db4705ea8b6691c12124ddd52340e5003189c9", + "state_root": "0x3a3029278514e80b9b6cbee11e26d13dc172d172629a42f964e3a6794d6adc86", + "body_root": "0x1e4cb3a8aeb8ac7c41082843b5cc7afa207e98c4b4220491850dfb5821c02e10" + }, + "signature": "0x55933f2d29f2422b7c49397e5a37e9768383e919971dd4ca7c414471dbfe0d91c0cb8675fdc13ffe620e9ad48f2d8526a0e8d1c5b4208ff61fab6fbe3ae850840d75e1765c58410116e331c184c4ba0e95905ecc721b6a55d5963c3b3a142154" + } + }, + { + "signed_header_1": { + "message": { + "slot": "14978695424185213637", + "proposer_index": "15657162861418879273", + "parent_root": "0x617f5144d8ca5b8f7241f0e83732c7ef860072ca49e2522cbaee0a91bf1b4eb6", + "state_root": "0xf415a441e4123d9037001e57b022d79e029b89af3324cb30205bed2e858024bd", + "body_root": "0x0be98ee0c8c664893564e83d9d65d83f5db43a5364ec8f529cc878e0204090bb" + }, + "signature": "0xa3d015accb260a31d335f4244286d47e9209a45d0953a8c5fa6d85e595ddbc29ebfa64884aedb91a8f8c7401f2e1a35b4c8b55f514e515573e343c1b54b4c7fde86f7566949c2118dbe9851331553f33951cde55c3ec1f28c8b7e8e168b30efd" + }, + "signed_header_2": { + "message": { + "slot": "3356883683953708419", + "proposer_index": "11054301287111598102", + "parent_root": "0x81d9457db4844c8c06c2e5ea47921a75b4a4027e1faa672aa0bf3d9be2052e73", + "state_root": "0x64b16cba3d3cc587a190b25ebc066375328e6838c9a0cecc6707ef392444c8a2", + "body_root": "0xe9987f301e9b266200d604471e9b8a202ce3654b1dd7cb3473b7a6bb5bc525a6" + }, + "signature": "0x4669a66f6932907d1c4c2774359b58f34a5e89d46698929f54126cef5ff40f1d1639412f7e3357cf8f82d2e930275cbf8596b36f928299b018e7541e19f786d44febfcc787cb95b0345867072446077f2d51ddc0c3ca9bc2516389deddd45f56" + } + }, + { + "signed_header_1": { + "message": { + "slot": "4787081931091397057", + "proposer_index": "10811382614581199756", + "parent_root": "0xea90f6d57954afda2357417db672814e200222da05eea9c54abc6176aed03b09", + "state_root": "0xd63d962e02929169cdbbda6ad567b600aa9c4bd4eeb9d660bb8ea6856a6aaa23", + "body_root": "0x3725c1058f13fcc9e17be4e67054a9336a604131cca9faf647ed0e3beeb0a87b" + }, + "signature": "0xd8ee885de87b4b9e31608072fa33a208b90f73bbce5550285172a784dad0099baaad5c3d17a54adfb25b87e50eec16e9dee30d69d03e54847854696d2673651989c97e9d0a604dcc5f89ff80450befab4ca92dd15dc6a5308420437188ec5367" + }, + "signed_header_2": { + "message": { + "slot": "8108327346961970619", + "proposer_index": "8895882612123814663", + "parent_root": "0x112605e9c2b6f350b8cb360540c6aa7a6d1582d8123484b27b93e9935c55b5c5", + "state_root": "0x5aa0076f17dafcd2cb9a370655cb0c51bf8fe48fa1e680775b4c32b0f2665900", + "body_root": "0xeda1e48ca6c79384e3040c5955e4f6d73d09ce0a17decafede513785156ae418" + }, + "signature": "0x87ea564acc2b6620571d63a1a6f91c319cd35c359b92b35bfdf69f56977da7fdca3ef3e839c80d4d2f09a561a9ddbe83ca8ca44ab8c4848e24f9acb772f6636f9ba28effb18798501e9bda3750ca1537cded9dc22141b7f95bd7e9328186c32a" + } + }, + { + "signed_header_1": { + "message": { + "slot": "12241430169457960610", + "proposer_index": "15489455263612697224", + "parent_root": "0x095c196a951cec498c601cef9cd70a55d1b3e27df171123112bf72db7e7f8f3b", + "state_root": "0xa443635e908601f729697dc5a2fc15fc2edf2a1eb3bc3b18a9fb8499527a17ab", + "body_root": "0x462299fe6f2fe924e5480d8a5b56664e6d8dc277f226d628a4af482466be2887" + }, + "signature": "0x67ec5bee090fbbb94330b6f3f313ae58384bba33e90fbb22744fc13ba6ac860d1519a7a86f58b96cab740a9d8c04248832e88ad3dd6020de04a20cd501b4179337cd28b03081a1af822dcc42826e9e7d604a70436bf346f41af56d074f83a678" + }, + "signed_header_2": { + "message": { + "slot": "14339611822790892076", + "proposer_index": "15504947264660018950", + "parent_root": "0x89ff2c15e503d9fba4956835bec5ae59d907c0069a6dc4aaade6b763595166f6", + "state_root": "0x0515bf0489cb195e088b19625d2c0e1353c8de4cbb15a0b8e2b51fb136b826e8", + "body_root": "0x11bbaf875f4584c48cd8cc3b6379ce410b80d0623ddcc4fe7ea2589bf00f6e6f" + }, + "signature": "0x4237376ad640ec0c588613e966e51d615c341fd9ddfea1baac3d940634599994f865b7e6d6e16b193b8297c4e67306529a75b2e8c9d87fb7eb7e75da27963ce551bf5fbb52edffb17e8d40f5f1ddb8616742c55dbd129bf5ef31c1f0fc89998c" + } + }, + { + "signed_header_1": { + "message": { + "slot": "13955344097399898630", + "proposer_index": "16177985131740430920", + "parent_root": "0x56c2f18439439156ad659a686b721c1b43847ba740efcef513080268e58f0bc5", + "state_root": "0x08f00b6ac8454d837de85c6411f3be5e7083a96681bc52c168d17e1acd1b98a9", + "body_root": "0x6c96557d90fc508058ea683b27bae3820f26836f309ca62af8b7fb40d560dd1c" + }, + "signature": "0x9d8c69f73839e8593b3a8cc4310ea512c67fdb1d9211c522ba59eefd794baf5cd4e8e9e93f1cb49cdcf69af8471a22c6c3a3f384d57a485197ce701f3b8a0bb4c0e51e0541417e18e78e803a43d1ccc0306a512561cef204452a9ce2d3296636" + }, + "signed_header_2": { + "message": { + "slot": "17133548747787937708", + "proposer_index": "15930321481495902910", + "parent_root": "0x26b689b8ae9e662c22d2682500e4536b8173ad8b3da35be0fa3f40196118cd16", + "state_root": "0x696711769e29c64223768621fb3acfcb6d69daa33f3fe563247757fcb41dde97", + "body_root": "0xa0008d6fdb735e04f5f9593471125ab837715e0f792830559dee22de822723a7" + }, + "signature": "0xddaea62491af02619aed92853956690a235a2f9c1554affb49655cba6cf6d52014a3a62e38e24d317c7bb657ba2fc5e36db7256e36ea41eee5ea2d2b4c0d73657d0cbffc146454b1fb6c1aee38d0da4a2c408da0df342469fbc2c3eabab57c9a" + } + } + ], + "attester_slashings": [ + { + "attestation_1": { + "attesting_indices": [ + "893066331788262369" + ], + "data": { + "slot": "15247804440919432904", + "index": "1403889905033743889", + "beacon_block_root": "0x997e1d9204a950ca94a639ea55065b305d2ba296fcc516a2e42b1257447440de", + "source": { + "epoch": "7940837671565932034", + "root": "0xccfd178744d66b23d98ff44163f35cbfab30b1229da6cab1789f1afcad3457fe" + }, + "target": { + "epoch": "847787583585081175", + "root": "0xd81f4bdb586f39cf74fbe3d9c7c2b4a7558997b1e31ddaf8af8cd5b37e30d518" + } + }, + "signature": "0xa8d3d1a5e82d3bec42d185a2b05300d2979ff55f0d442af0739b59cc10762d875302ec21019093302e7093ed0a2c5be690d6279ec70546d63cab7ac75c830e0b6152d70fc73ee68806af8e43861046939009b0694c1c64bfa542090784f0a4b0" + }, + "attestation_2": { + "attesting_indices": [ + "8735207622981199872", + "15807877765652200381", + "17626514909741646584", + "9610286011333021172", + "9726791872520084943" + ], + "data": { + "slot": "6542787319576380665", + "index": "4967071366844573801", + "beacon_block_root": "0x20f218cd879e978af8cd5d849496c14d937dd41c00af4ed0275a93c32e16f976", + "source": { + "epoch": "18437843598040230806", + "root": "0x7f5168facb00317fb89bf8a974f272ab5910fe15c762fcb96d486228a0df7885" + }, + "target": { + "epoch": "15813630485965658133", + "root": "0xe33869a047cfff34b10d7c658225262292a09e3dcad1fe061526aa2a63e2cf93" + } + }, + "signature": "0xac7fffd1a232deb19212e6ea5f6414393b2d317fdc134d770cdaeaf0df87f7c1cc7e9f11f65e3ca61792d9eeec2a1d2fc448e4eb394886959fc94b7e5bb2911303ef18c2ec90ee8a376fc6e30b467b4fa0fefd8a238e77ebf7c55337b0379e1e" + } + }, + { + "attestation_1": { + "attesting_indices": [ + "12834633968877827254", + "16028384842644167465", + "9891597630206425107", + "2407052889813376980", + "15101739462282017968", + "17779805899293890522", + "8219995904465343204", + "1904743925013243260" + ], + "data": { + "slot": "3712471358971666084", + "index": "5998616854737989056", + "beacon_block_root": "0xdc798437a567a7af975d095c9dc31fe46877cb08571809d1fce20e40380aff3c", + "source": { + "epoch": "6846126122713505852", + "root": "0xc1510d0adfd1c5b52bbb9b228eba51c678ddcfb5c9636ef1dd32c887bc05c933" + }, + "target": { + "epoch": "7975243728505521389", + "root": "0x1b60b0a7e6a0d36f42edace5ec8674d0a1edf955b3738292fb287bd23d0d4e3b" + } + }, + "signature": "0x1d1831ef319833e469dbd1d0bcfa22aae1d5e184cb729ac2f6aec0dfa1b8593d7ad7a41e58abfa2a723d2bcbef7d1d52e6f574647dfc4ff89bea3cf01260a35b0b467bf3fbf987ed0b762976573d39d70d2d26908e17da4a6fbda3456c118ab1" + }, + "attestation_2": { + "attesting_indices": [ + "7002908683142314270", + "2265431971051241649", + "15768239433913981732", + "11484797692738486381" + ], + "data": { + "slot": "16278253854771540604", + "index": "3921887449114240950", + "beacon_block_root": "0xdc79cd4558c4795161a5fbbad0c7c36bdd748035abf67c033d4fa2e6c531915d", + "source": { + "epoch": "8830875663257838774", + "root": "0x2ff861d60968dc929cf37c344ee7da6d9c047e9e7e1d518ee51f6855777cb411" + }, + "target": { + "epoch": "16654076203214392199", + "root": "0x0f53c6f7c82251a51f8ca49c1917117377c3e490b38e15f7561a25b8af06995b" + } + }, + "signature": "0xf4f4bf5db0efd0825809bd73c78a351a41ef03da6f72a7a0f18a7dffe25a21752ef3e988bc4b93fa847f1573f0604c8049a49220a7d8ef268828458afa556b19afd5adbd5060159835454b5689788879f105f0d4d4c2507700307a46cc60232d" + } + } + ], + "attestations": [ + { + "aggregation_bits": "0x506ba6062d6e01", + "data": { + "slot": "45099439454616", + "index": "3750086134417328117", + "beacon_block_root": "0x59a77bfaeeb6892e09c5a80444411a558142e037c029be8a2e749f44c5aaedc1", + "source": { + "epoch": "9505132055064219328", + "root": "0xcf2cb5456c09bfeb150d2f3ae3d6ad9ca03333815c146b3b4e8da358d0624ae7" + }, + "target": { + "epoch": "220852002765357462", + "root": "0x7a84bcbe0889985ca83218baa491fc7cabe299d21acabcd999e40cf9f03ad3ac" + } + }, + "signature": "0xc8e6fe7a38fe32dbf8d956c3829fbe4e97d203e808c5803a6c2f4ae34f34cf22a257dd9d1dec6e73cfc7366f6bbbd14ad57ebe6fe25984aa092612a4e294a8a0e22d7b68bc9d443c285e5fa721d82af67a7be12f5e364b0789ac03bbfbbffb44" + } + ], + "deposits": [], + "voluntary_exits": [ + { + "message": { + "epoch": "16998290760025894103", + "validator_index": "4446171403600537826" + }, + "signature": "0x77cdd8846cdc4af9b5a537a67f6b1f979184b98a05ccce2ef7e70a05b098fdb7cfb4907e4064ccc53165a38257fdf769894367a695ee086c88010051d03ab44177a202c0aaf79c7a7d2b1c5e8c4e287709b0361590ac2150be31210b8c747a55" + }, + { + "message": { + "epoch": "13112383983593789351", + "validator_index": "7383249158549931332" + }, + "signature": "0xb2c22ea683798dae46e598f614e550cf092a097083168d5204019ea9b4690ccca23424934d46f98ecad8e509e5cab366e06342cd3432b8ed0b62e13a694575ae5d81fa489f892a0a03fd22d44fc9c14bb56fb79cfa85c012882fc0233645db9a" + }, + { + "message": { + "epoch": "1427965508409778396", + "validator_index": "5452087992404512307" + }, + "signature": "0x724534337d06a5ae96d1e42b9a1c413595b888e9bd3bcac38e1cc75d065a92fed959921fb809a0ccc36fe8017d0d1c0761d0b69aa488e97953dd9b385c2a13438b4812adafcfb08c50eb8a36b629378d2abef5a9e15c44712c6a7ebf76b7659d" + }, + { + "message": { + "epoch": "10328258751789621544", + "validator_index": "2131363725498082369" + }, + "signature": "0x262ca596a6158cb1a0db2572e7045957917b0b9f166e42a3e6ef6fc1ae7e43f6dfdca821eb41fac4b1be6a7174c83687adf219389e1efbf090522ad32f171dc8afd795463f50fb94e063003c47419b045f095b447f6b80ecb035340bc9120ebc" + }, + { + "message": { + "epoch": "4190083748766997992", + "validator_index": "4472110232095440286" + }, + "signature": "0x22890ee9a7d3a6a8f26b19edc92bfe09ebd624463077a00bbc3b28e262b4770da55706118ec861c92af45b86406bb40b7ccccf0cbd72df4d6d4aa0fb91f25151fb18c4b9a43c5da36a8acb24cfb4bb8d46c392f7d36361d1d599a4bb031882eb" + }, + { + "message": { + "epoch": "10829947487376358245", + "validator_index": "7850593689424825949" + }, + "signature": "0xa04fe838e4a9633a7733e02a594e9dafb35e02d15fec1d08d7115e0d60f252239e2b532134fbe2a0095fdd4774b5da01ef46391a114da6dbe1d50089850f18c31abfdf8b5131a019be3d9811557adfe6bdf694eb98a78ac5b59fcf23bf99b41e" + }, + { + "message": { + "epoch": "12857063653108192263", + "validator_index": "11049615835183679401" + }, + "signature": "0x0a886909cdd43cd1cce0041649646dff7840cdf18626ce96873c25d93a63f5c7e52b5ba14e802b905acfeb5eff29f14a9ccd17d33760501c0afd0b19f9676489e18f0a70eb4d02e868734cdd35e9c3de84bbf676064f50955f90b827c8920b34" + }, + { + "message": { + "epoch": "17738091289425346382", + "validator_index": "4495441538889603873" + }, + "signature": "0x4c2bbde7352897ae68aaaadd9f92b839856ec1e8ddddd15e1875a7c9e71ed6e4cc6af987a2b0e0701a5b9d9d9bf6d4609c89d0210af50c9cfe4499ade3f487c6d4cb554719e143205af2bd8934c45ab682cedeadd7e291a9cb0ac4b1eddf97b0" + } + ], + "sync_aggregate": { + "sync_committee_bits": "0xffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "sync_committee_signature": "0x496a45e1562dd9d9c9b1a3512973c4bba153c453f7a95a319cc0a8fe9597eb56100869247a4e710988241448933b74b4fa03ef2b7839fa4ba7536c2eeea8e729d912f3e18089d99835aef171b4475a80640da39c9762b4e368d1a28d3be58fd3" + }, + "execution_payload_header": { + "parent_hash": "0xfe07128427cda54e3fb49a14dcbaf8872f5c5962551169e2808d4dab13f4cb24", + "fee_recipient": "0xFE23Fd31Ab40B4dAC415Ccb42d02cB144D7168fD", + "state_root": "0x2cddc8052ad28df44aec48086af6f09a756baeb8b7dec99c276a6650d824f367", + "receipts_root": "0xc30590627fe49f018c56dbe7bb4f162945d1572addff11f9b9fec086283d0d40", + "logs_bloom": "0x2dd93d7787163f6f43ebfcb722ebbc7c374e2a6d5088e9ecfd0ce5d4d76df3e23d8c94a7f346651bbdd566d298daecf0e4e1a5df671e8c9efd3e0e886f8336fbe079ec2f0211c9b5e9bdab3d5a0fe59f427d997a2d7070d16c0fabc50b587dd99a70e1259cf42fbe1b5c828eb92a4a81e0e181ada5ca5233c129d617b33a927a9905961f589401f15fb033adcf07b6cc7b9e437c3da8a6d780a733d12c1bee7790ffb7c4d24e421fb3e3c7a094d4115e2cb7af7fdf42c94a74469343202d02322e5cfec6e1a10fa1fb1a5e7b15381440ad4cfdeb2d279dac893d60240ab7fa9cb38edd1365e82478cd486565934b115219ad2fa2896d1521de41315b553b6704", + "prev_randao": "0x6fe18df67dd6bae400556f434bfc5341ddcb0912980bcc4d4918901c8a890a70", + "block_number": "8634275115911202187", + "gas_limit": "9036531375346604998", + "gas_used": "15270993355054234489", + "timestamp": "14197348212488441818", + "extra_data": "0xc74fb56ac7cee5", + "base_fee_per_gas": "91577184446315187551084787769775496173001154650143137101442557991818561254809", + "block_hash": "0x94f2de88ae056e5c9e2ffd83b3cf8407138d906be33f8b2843989af29c6582e8", + "transactions_root": "0xb79f70b9f5dc52c72fe265033bc571bf3d831e8beaf82ae5c0c75388df262a74" + } + } + }, + "signature": "0x3c12a70ecc4992ee947f6d3acd65b1e9d3a6f247d3ca007bf1a9a13ea3ae88768616888a6057179ae7120e986aafd101fff4096c44ab1de89257282d1224e413a07d1a369d49181f32675b5f34b90b8c88127993f1f11f8579fc6fd07d1a9d4e" + }, + "blinded": true +} \ No newline at end of file diff --git a/core/testdata/TestSSZSerialisation_VersionedSignedProposal.ssz#01.golden b/core/testdata/TestSSZSerialisation_VersionedSignedProposal.ssz#01.golden new file mode 100644 index 0000000000000000000000000000000000000000..0bc33948b8a6671c982c256d08eb6fd0298b37cd GIT binary patch literal 5835 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 literal 0 HcmV?d00001 diff --git a/core/tracker/inclusion.go b/core/tracker/inclusion.go index 7cdbc873a..872da562e 100644 --- a/core/tracker/inclusion.go +++ b/core/tracker/inclusion.go @@ -104,38 +104,32 @@ func (i *inclusionCore) Submitted(duty core.Duty, pubkey core.PubKey, data core. } } else if duty.Type == core.DutyProposer { var ( - block core.VersionedSignedProposal - blindedBlock core.VersionedSignedBlindedProposal - - blinded bool - ok bool + block core.VersionedSignedProposal + ok bool ) block, ok = data.(core.VersionedSignedProposal) if !ok { - blindedBlock, blinded = data.(core.VersionedSignedBlindedProposal) - if !blinded { - return errors.New("invalid block") - } + return errors.New("invalid block") } defer func() { if r := recover(); r != nil { - proposal := fmt.Sprintf("%+v", block) - if blinded { - proposal = fmt.Sprintf("%+v", blindedBlock) - } - err = errors.New("could not determine if proposal was synthetic or not", - z.Str("proposal", proposal), - z.Bool("blinded", blinded), + z.Str("proposal", fmt.Sprintf("%+v", block)), + z.Bool("blinded", block.Blinded), ) } }() - switch blinded { + switch block.Blinded { case true: - if eth2wrap.IsSyntheticBlindedBlock(&blindedBlock.VersionedSignedBlindedProposal) { + blinded, err := block.ToBlinded() + if err != nil { + return errors.Wrap(err, "expected blinded proposal") + } + + if eth2wrap.IsSyntheticBlindedBlock(&blinded) { // Report inclusion for synthetic blocks as it is already included on-chain. i.trackerInclFunc(duty, pubkey, data, nil) diff --git a/core/tracker/inclusion_internal_test.go b/core/tracker/inclusion_internal_test.go index 5dde5a6dd..e09e8bc3c 100644 --- a/core/tracker/inclusion_internal_test.go +++ b/core/tracker/inclusion_internal_test.go @@ -101,9 +101,9 @@ func TestInclusion(t *testing.T) { block4Duty := core.NewProposerDuty(uint64(block4.Deneb.SignedBlock.Message.Slot)) block5 := testutil.RandomDenebVersionedSignedBlindedProposal() - block5.Deneb.Message.Body.Graffiti = eth2wrap.GetSyntheticGraffiti() // Ignored, not included or missed. + block5.DenebBlinded.Message.Body.Graffiti = eth2wrap.GetSyntheticGraffiti() // Ignored, not included or missed. block5Duty := core.Duty{ - Slot: uint64(block5.Deneb.Message.Slot), + Slot: uint64(block5.DenebBlinded.Message.Slot), Type: core.DutyBuilderProposer, } diff --git a/core/tracker/tracker_internal_test.go b/core/tracker/tracker_internal_test.go index 3cbd68e11..065ca7fdb 100644 --- a/core/tracker/tracker_internal_test.go +++ b/core/tracker/tracker_internal_test.go @@ -1336,8 +1336,18 @@ func TestSubmittedProposals(t *testing.T) { require.NoError(t, err) require.NotPanics(t, func() { - err = ic.Submitted(core.NewProposerDuty(42), testutil.RandomCorePubKey(t), core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ + // Not blinded + err = ic.Submitted(core.NewProposerDuty(42), testutil.RandomCorePubKey(t), core.VersionedSignedProposal{ + VersionedSignedProposal: eth2api.VersionedSignedProposal{ + Version: eth2spec.DataVersionDeneb, + }, + }, 1*time.Millisecond) + require.ErrorContains(t, err, "could not determine if proposal was synthetic or not") + + // Blinded + err = ic.Submitted(core.NewProposerDuty(42), testutil.RandomCorePubKey(t), core.VersionedSignedProposal{ + VersionedSignedProposal: eth2api.VersionedSignedProposal{ + Blinded: true, Version: eth2spec.DataVersionDeneb, }, }, 1*time.Millisecond) diff --git a/core/validatorapi/validatorapi_test.go b/core/validatorapi/validatorapi_test.go index aac0128d4..5078682bf 100644 --- a/core/validatorapi/validatorapi_test.go +++ b/core/validatorapi/validatorapi_test.go @@ -702,9 +702,12 @@ func TestComponent_SubmitBlindedProposal(t *testing.T) { // Register subscriber vapi.Subscribe(func(ctx context.Context, duty core.Duty, set core.ParSignedDataSet) error { - block, ok := set[corePubKey].SignedData.(core.VersionedSignedBlindedProposal) + block, ok := set[corePubKey].SignedData.(core.VersionedSignedProposal) require.True(t, ok) - require.Equal(t, *signedBlindedBlock, block.VersionedSignedBlindedProposal) + + blindedBlock, err := block.ToBlinded() + require.NoError(t, err) + require.Equal(t, *signedBlindedBlock, blindedBlock) return nil }) @@ -773,10 +776,14 @@ func TestComponent_SubmitBlindedProposalInvalidSignature(t *testing.T) { // Register subscriber vapi.Subscribe(func(ctx context.Context, duty core.Duty, set core.ParSignedDataSet) error { - block, ok := set[corePubKey].SignedData.(core.VersionedSignedBlindedProposal) + block, ok := set[corePubKey].SignedData.(core.VersionedSignedProposal) require.True(t, ok) require.Equal(t, signedBlindedBlock, block) + blindedBlock, err := block.ToBlinded() + require.NoError(t, err) + require.Equal(t, signedBlindedBlock, blindedBlock) + return nil }) diff --git a/testutil/fuzz.go b/testutil/fuzz.go index 9025758e2..4550bdd33 100644 --- a/testutil/fuzz.go +++ b/testutil/fuzz.go @@ -104,28 +104,17 @@ func NewEth2Fuzzer(t *testing.T, seed int64) *fuzz.Fuzzer { *e = (*e)[:4] } }, - // Populate one of the versions of these Versioned*Proposal types. - func(e *core.VersionedSignedBlindedProposal, c fuzz.Continue) { - e.Version = blindedVersions[(c.Intn(len(blindedVersions)))] - version, err := eth2util.DataVersionFromETH2(e.Version) - require.NoError(t, err) - - val := core.VersionedSSZValueForT(t, e, version, true) - c.Fuzz(val) - - // Limit length of blob KZG commitments to 6 - // See https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md#execution - maxBlobCommitments := 4096 - if e.Version == eth2spec.DataVersionDeneb && len(e.Deneb.Message.Body.BlobKZGCommitments) > maxBlobCommitments { - e.Deneb.Message.Body.BlobKZGCommitments = e.Deneb.Message.Body.BlobKZGCommitments[:maxBlobCommitments] - } - }, + // Populate one of the versions of these VersionedSignedProposal types. func(e *core.VersionedSignedProposal, c fuzz.Continue) { e.Version = allVersions[(c.Intn(len(allVersions)))] + if e.Blinded { + e.Version = blindedVersions[(c.Intn(len(blindedVersions)))] + } + version, err := eth2util.DataVersionFromETH2(e.Version) require.NoError(t, err) - val := core.VersionedSSZValueForT(t, e, version, false) + val := core.VersionedSSZValueForT(t, e, version, e.Blinded) c.Fuzz(val) // Limit length of KZGProofs and Blobs to 6 @@ -134,10 +123,16 @@ func NewEth2Fuzzer(t *testing.T, seed int64) *fuzz.Fuzzer { if e.Version == eth2spec.DataVersionDeneb && len(e.Deneb.KZGProofs) > maxKZGProofs { e.Deneb.KZGProofs = e.Deneb.KZGProofs[:maxKZGProofs] } + maxBlobs := 6 if e.Version == eth2spec.DataVersionDeneb && len(e.Deneb.Blobs) > maxBlobs { e.Deneb.Blobs = e.Deneb.Blobs[:maxBlobs] } + + maxBlobCommitments := 4096 + if e.Version == eth2spec.DataVersionDeneb && len(e.DenebBlinded.Message.Body.BlobKZGCommitments) > maxBlobCommitments { + e.DenebBlinded.Message.Body.BlobKZGCommitments = e.DenebBlinded.Message.Body.BlobKZGCommitments[:maxBlobCommitments] + } }, func(e *core.VersionedProposal, c fuzz.Continue) { e.Version = allVersions[(c.Intn(len(allVersions)))] diff --git a/testutil/random.go b/testutil/random.go index 7636abacb..7009589fe 100644 --- a/testutil/random.go +++ b/testutil/random.go @@ -484,11 +484,12 @@ func RandomCapellaVersionedBlindedProposal() core.VersionedProposal { } } -func RandomBellatrixVersionedSignedBlindedProposal() core.VersionedSignedBlindedProposal { - return core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ +func RandomBellatrixVersionedSignedBlindedProposal() core.VersionedSignedProposal { + return core.VersionedSignedProposal{ + VersionedSignedProposal: eth2api.VersionedSignedProposal{ + Blinded: true, Version: eth2spec.DataVersionBellatrix, - Bellatrix: ð2bellatrix.SignedBlindedBeaconBlock{ + BellatrixBlinded: ð2bellatrix.SignedBlindedBeaconBlock{ Message: RandomBellatrixBlindedBeaconBlock(), Signature: RandomEth2Signature(), }, @@ -496,11 +497,12 @@ func RandomBellatrixVersionedSignedBlindedProposal() core.VersionedSignedBlinded } } -func RandomCapellaVersionedSignedBlindedProposal() core.VersionedSignedBlindedProposal { - return core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ +func RandomCapellaVersionedSignedBlindedProposal() core.VersionedSignedProposal { + return core.VersionedSignedProposal{ + VersionedSignedProposal: eth2api.VersionedSignedProposal{ + Blinded: true, Version: eth2spec.DataVersionCapella, - Capella: ð2capella.SignedBlindedBeaconBlock{ + CapellaBlinded: ð2capella.SignedBlindedBeaconBlock{ Message: RandomCapellaBlindedBeaconBlock(), Signature: RandomEth2Signature(), }, @@ -508,11 +510,12 @@ func RandomCapellaVersionedSignedBlindedProposal() core.VersionedSignedBlindedPr } } -func RandomDenebVersionedSignedBlindedProposal() core.VersionedSignedBlindedProposal { - return core.VersionedSignedBlindedProposal{ - VersionedSignedBlindedProposal: eth2api.VersionedSignedBlindedProposal{ +func RandomDenebVersionedSignedBlindedProposal() core.VersionedSignedProposal { + return core.VersionedSignedProposal{ + VersionedSignedProposal: eth2api.VersionedSignedProposal{ + Blinded: true, Version: eth2spec.DataVersionDeneb, - Deneb: ð2deneb.SignedBlindedBeaconBlock{ + DenebBlinded: ð2deneb.SignedBlindedBeaconBlock{ Message: RandomDenebBlindedBeaconBlock(), Signature: RandomEth2Signature(), },