From 80d55bc22fdc5840297e5a97e3df1eb4ee03ed3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gianguido=20Sor=C3=A0?= Date: Fri, 21 Jun 2024 14:25:57 +0200 Subject: [PATCH] core/validatorapi: convert blinded to full proposal (#3144) Shortcut `/eth/v2/beacon/blinded_blocks/submit_blinded_block_v2` to use newer proposals rather than blinded block proposals. category: bug ticket: none --- core/bcast/bcast.go | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/core/bcast/bcast.go b/core/bcast/bcast.go index ccf65de2b..379031243 100644 --- a/core/bcast/bcast.go +++ b/core/bcast/bcast.go @@ -73,18 +73,39 @@ func (b Broadcaster) Broadcast(ctx context.Context, duty core.Duty, set core.Sig return err } - block, ok := aggData.(core.VersionedSignedProposal) + var ( + block core.VersionedSignedProposal + blindedBlock core.VersionedSignedBlindedProposal + + blinded bool + ok bool + ) + + block, ok = aggData.(core.VersionedSignedProposal) if !ok { - return errors.New("invalid proposal") + // check if it's a blinded proposal + blindedBlock, blinded = aggData.(core.VersionedSignedBlindedProposal) + if !blinded { + return errors.New("invalid proposal") + } + } + + switch blinded { + case true: + err = b.eth2Cl.SubmitBlindedProposal(ctx, ð2api.SubmitBlindedProposalOpts{ + Proposal: &blindedBlock.VersionedSignedBlindedProposal, + }) + default: + err = b.eth2Cl.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ + Proposal: &block.VersionedSignedProposal, + }) } - err = b.eth2Cl.SubmitProposal(ctx, ð2api.SubmitProposalOpts{ - Proposal: &block.VersionedSignedProposal, - }) if err == nil { 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), ) }