From 5d939cdc18fa7412ab6e3bf545b8cbfc51dfef04 Mon Sep 17 00:00:00 2001 From: rkapka Date: Fri, 19 Jan 2024 15:31:11 +0100 Subject: [PATCH] simplify how payload is returned --- .../rpc/eth/validator/handlers_block.go | 2 +- .../rpc/prysm/v1alpha1/validator/BUILD.bazel | 1 + consensus-types/blocks/getters.go | 44 +------------------ 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/beacon-chain/rpc/eth/validator/handlers_block.go b/beacon-chain/rpc/eth/validator/handlers_block.go index 6f363afb3226..f94dd4027808 100644 --- a/beacon-chain/rpc/eth/validator/handlers_block.go +++ b/beacon-chain/rpc/eth/validator/handlers_block.go @@ -223,7 +223,7 @@ func (s *Server) produceBlockV3(ctx context.Context, w http.ResponseWriter, r *h } w.Header().Set(api.ExecutionPayloadBlindedHeader, fmt.Sprintf("%v", v1alpha1resp.IsBlinded)) - w.Header().Set(api.ExecutionPayloadValueHeader, fmt.Sprintf("%d", v1alpha1resp.PayloadValue)) + w.Header().Set(api.ExecutionPayloadValueHeader, v1alpha1resp.PayloadValue) w.Header().Set(api.ConsensusBlockValueHeader, consensusBlockValue) phase0Block, ok := v1alpha1resp.Block.(*eth.GenericBeaconBlock_Phase0) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel index e9aefbeed7de..e80f41fe0241 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel @@ -76,6 +76,7 @@ go_library( "//crypto/rand:go_default_library", "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", + "//math:go_default_library", "//monitoring/tracing:go_default_library", "//network/forks:go_default_library", "//proto/engine/v1:go_default_library", diff --git a/consensus-types/blocks/getters.go b/consensus-types/blocks/getters.go index fbb2ae9e342e..dd5def19a78c 100644 --- a/consensus-types/blocks/getters.go +++ b/consensus-types/blocks/getters.go @@ -1059,49 +1059,7 @@ func (b *BeaconBlockBody) Execution() (interfaces.ExecutionData, error) { switch b.version { case version.Phase0, version.Altair: return nil, consensus_types.ErrNotSupported("Execution", b.version) - case version.Bellatrix: - if b.IsBlinded() { - var ph *enginev1.ExecutionPayloadHeader - var ok bool - if b.executionPayloadHeader != nil { - ph, ok = b.executionPayloadHeader.Proto().(*enginev1.ExecutionPayloadHeader) - if !ok { - return nil, errPayloadHeaderWrongType - } - } - return WrappedExecutionPayloadHeader(ph) - } - var p *enginev1.ExecutionPayload - var ok bool - if b.executionPayload != nil { - p, ok = b.executionPayload.Proto().(*enginev1.ExecutionPayload) - if !ok { - return nil, errPayloadWrongType - } - } - return WrappedExecutionPayload(p) - case version.Capella: - if b.IsBlinded() { - var ph *enginev1.ExecutionPayloadHeaderCapella - var ok bool - if b.executionPayloadHeader != nil { - ph, ok = b.executionPayloadHeader.Proto().(*enginev1.ExecutionPayloadHeaderCapella) - if !ok { - return nil, errPayloadHeaderWrongType - } - return WrappedExecutionPayloadHeaderCapella(ph, big.NewInt(0)) - } - } - var p *enginev1.ExecutionPayloadCapella - var ok bool - if b.executionPayload != nil { - p, ok = b.executionPayload.Proto().(*enginev1.ExecutionPayloadCapella) - if !ok { - return nil, errPayloadWrongType - } - } - return WrappedExecutionPayloadCapella(p, big.NewInt(0)) - case version.Deneb: + default: if b.IsBlinded() { return b.executionPayloadHeader, nil }