Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: deprecate VersionedSignedBlindedProposal #3155

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions core/bcast/bcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,26 @@
}

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")

Check warning on line 83 in core/bcast/bcast.go

View check run for this annotation

Codecov / codecov/patch

core/bcast/bcast.go#L83

Added line #L83 was not covered by tests
}

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")
}

Check warning on line 93 in core/bcast/bcast.go

View check run for this annotation

Codecov / codecov/patch

core/bcast/bcast.go#L88-L93

Added lines #L88 - L93 were not covered by tests

err = b.eth2Cl.SubmitBlindedProposal(ctx, &eth2api.SubmitBlindedProposalOpts{
Proposal: &blindedBlock.VersionedSignedBlindedProposal,
Proposal: &blinded,

Check warning on line 96 in core/bcast/bcast.go

View check run for this annotation

Codecov / codecov/patch

core/bcast/bcast.go#L96

Added line #L96 was not covered by tests
})
default:
err = b.eth2Cl.SubmitProposal(ctx, &eth2api.SubmitProposalOpts{
Expand All @@ -105,7 +105,7 @@
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),
)
}

Expand Down
16 changes: 0 additions & 16 deletions core/eth2signeddata.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var (
_ Eth2SignedData = VersionedSignedProposal{}
_ Eth2SignedData = Attestation{}
_ Eth2SignedData = SignedVoluntaryExit{}
_ Eth2SignedData = VersionedSignedBlindedProposal{}
_ Eth2SignedData = VersionedSignedValidatorRegistration{}
_ Eth2SignedData = SignedRandao{}
_ Eth2SignedData = BeaconCommitteeSelection{}
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 0 additions & 12 deletions core/eth2signeddata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
10 changes: 6 additions & 4 deletions core/parsigex/parsigex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&eth2apiBlinded, shareIdx)
require.NoError(t, err)

require.NoError(t, verifyFunc(ctx, core.NewProposerDuty(slot), pubkey, data))
Expand Down
8 changes: 6 additions & 2 deletions core/serialise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down
4 changes: 2 additions & 2 deletions core/sigagg/sigagg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
Loading
Loading