From aa1b263df9955a4a9be2a446a0b4ab7af825918e Mon Sep 17 00:00:00 2001 From: terence tsao Date: Thu, 13 Feb 2025 11:12:57 -0800 Subject: [PATCH] Add payload by root handler --- beacon-chain/execution/BUILD.bazel | 1 + beacon-chain/execution/engine_client.go | 2 +- beacon-chain/execution/engine_client_epbs.go | 54 +++++++++++ beacon-chain/rpc/eth/beacon/handlers_epbs.go | 2 +- beacon-chain/rpc/lookup/blocker.go | 67 ++++---------- beacon-chain/rpc/service.go | 9 +- beacon-chain/sync/BUILD.bazel | 1 + beacon-chain/sync/rate_limiter.go | 3 + beacon-chain/sync/rpc.go | 14 +++ .../sync/rpc_execution_payload_envelope.go | 77 ++++++++++++++++ proto/engine/v1/epbs.go | 6 +- proto/engine/v1/epbs.pb.go | 92 +++++++++---------- proto/engine/v1/epbs.proto | 2 +- testing/util/random/epbs.go | 2 +- 14 files changed, 222 insertions(+), 110 deletions(-) create mode 100644 beacon-chain/execution/engine_client_epbs.go create mode 100644 beacon-chain/sync/rpc_execution_payload_envelope.go diff --git a/beacon-chain/execution/BUILD.bazel b/beacon-chain/execution/BUILD.bazel index 641db3540d6a..e016df46fb08 100644 --- a/beacon-chain/execution/BUILD.bazel +++ b/beacon-chain/execution/BUILD.bazel @@ -7,6 +7,7 @@ go_library( "block_reader.go", "deposit.go", "engine_client.go", + "engine_client_epbs.go", "errors.go", "log.go", "log_processing.go", diff --git a/beacon-chain/execution/engine_client.go b/beacon-chain/execution/engine_client.go index 07fcfed63bfe..01031bab7b03 100644 --- a/beacon-chain/execution/engine_client.go +++ b/beacon-chain/execution/engine_client.go @@ -106,7 +106,7 @@ type Reconstructor interface { ctx context.Context, blindedBlocks []interfaces.ReadOnlySignedBeaconBlock, ) ([]interfaces.SignedBeaconBlock, error) ReconstructBlobSidecars(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock, blockRoot [32]byte, indices []bool) ([]blocks.VerifiedROBlob, error) - Client() RPCClient + ReconstructPayloadEnvelope(ctx context.Context, e *pb.SignedBlindPayloadEnvelope) (*pb.SignedExecutionPayloadEnvelope, error) } // EngineCaller defines a client that can interact with an Ethereum diff --git a/beacon-chain/execution/engine_client_epbs.go b/beacon-chain/execution/engine_client_epbs.go new file mode 100644 index 000000000000..e71048882f19 --- /dev/null +++ b/beacon-chain/execution/engine_client_epbs.go @@ -0,0 +1,54 @@ +package execution + +import ( + "context" + + "github.com/ethereum/go-ethereum/common" + fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" + pb "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +func (s *Service) ReconstructPayloadEnvelope(ctx context.Context, e *pb.SignedBlindPayloadEnvelope) (*pb.SignedExecutionPayloadEnvelope, error) { + b, err := s.ExecutionBlockByHash(ctx, common.Hash(e.Message.BlockHash), true) + if err != nil { + return nil, err + } + txs := make([][]byte, len(b.Transactions)) + for i, t := range b.Transactions { + txs[i], err = t.MarshalBinary() + if err != nil { + return nil, err + } + } + return &pb.SignedExecutionPayloadEnvelope{ + Message: &pb.ExecutionPayloadEnvelope{ + Payload: &pb.ExecutionPayloadDeneb{ + ParentHash: b.ParentHash.Bytes(), + FeeRecipient: b.Coinbase.Bytes(), + StateRoot: b.Root.Bytes(), + ReceiptsRoot: b.ReceiptHash.Bytes(), + LogsBloom: b.Bloom.Bytes(), + PrevRandao: b.MixDigest.Bytes(), + BlockNumber: b.Number.Uint64(), + GasLimit: b.GasLimit, + GasUsed: b.GasUsed, + Timestamp: b.Time, + ExtraData: b.Extra, + BaseFeePerGas: bytesutil.PadTo(bytesutil.ReverseByteOrder(b.BaseFee.Bytes()), fieldparams.RootLength), + BlockHash: b.Hash.Bytes(), + Transactions: txs, + Withdrawals: b.Withdrawals, + BlobGasUsed: *b.BlobGasUsed, + ExcessBlobGas: *b.ExcessBlobGas, + }, + ExecutionRequests: e.Message.ExecutionRequests, + BuilderIndex: e.Message.BuilderIndex, + BeaconBlockRoot: e.Message.BeaconBlockRoot, + Slot: e.Message.Slot, + BlobKzgCommitments: e.Message.BlobKzgCommitments, + StateRoot: e.Message.StateRoot, + }, + Signature: e.Signature, + }, nil +} diff --git a/beacon-chain/rpc/eth/beacon/handlers_epbs.go b/beacon-chain/rpc/eth/beacon/handlers_epbs.go index 9a1d46dc4f9c..b9d7ef2d0441 100644 --- a/beacon-chain/rpc/eth/beacon/handlers_epbs.go +++ b/beacon-chain/rpc/eth/beacon/handlers_epbs.go @@ -27,7 +27,7 @@ func (s *Server) GetExecutionPayloadV1(w http.ResponseWriter, r *http.Request) { httputil.HandleError(w, "block_id is required in URL params", http.StatusBadRequest) return } - signed, err := s.Blocker.Payload(ctx, s.ExecutionReconstructor.Client(), []byte(blockId)) + signed, err := s.Blocker.Payload(ctx, []byte(blockId)) if !writePayloadFetchError(w, signed, err) { return } diff --git a/beacon-chain/rpc/lookup/blocker.go b/beacon-chain/rpc/lookup/blocker.go index 034030025095..915bb850077b 100644 --- a/beacon-chain/rpc/lookup/blocker.go +++ b/beacon-chain/rpc/lookup/blocker.go @@ -19,7 +19,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" - enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" log "github.com/sirupsen/logrus" @@ -46,39 +45,40 @@ func (e BlockIdParseError) Error() string { type Blocker interface { Block(ctx context.Context, id []byte) (interfaces.ReadOnlySignedBeaconBlock, error) Blobs(ctx context.Context, id string, indices []uint64) ([]*blocks.VerifiedROBlob, *core.RpcError) - Payload(ctx context.Context, client execution.RPCClient, id []byte) (interfaces.ROSignedExecutionPayloadEnvelope, error) + Payload(ctx context.Context, id []byte) (interfaces.ROSignedExecutionPayloadEnvelope, error) } // BeaconDbBlocker is an implementation of Blocker. It retrieves blocks from the beacon chain database. type BeaconDbBlocker struct { - BeaconDB db.ReadOnlyDatabase - ChainInfoFetcher blockchain.ChainInfoFetcher - GenesisTimeFetcher blockchain.TimeFetcher - BlobStorage *filesystem.BlobStorage + BeaconDB db.ReadOnlyDatabase + ChainInfoFetcher blockchain.ChainInfoFetcher + GenesisTimeFetcher blockchain.TimeFetcher + BlobStorage *filesystem.BlobStorage + ExecutionReconstructor execution.Reconstructor } -func (p *BeaconDbBlocker) headPayload(ctx context.Context, client execution.RPCClient) (interfaces.ROSignedExecutionPayloadEnvelope, error) { +func (p *BeaconDbBlocker) headPayload(ctx context.Context) (interfaces.ROSignedExecutionPayloadEnvelope, error) { root, err := p.ChainInfoFetcher.HeadRoot(ctx) if err != nil { return nil, errors.Wrap(err, "could not retrieve head root") } - return p.Payload(ctx, client, root) + return p.Payload(ctx, root) } -func (p *BeaconDbBlocker) finalizedPayload(ctx context.Context, client execution.RPCClient) (interfaces.ROSignedExecutionPayloadEnvelope, error) { +func (p *BeaconDbBlocker) finalizedPayload(ctx context.Context) (interfaces.ROSignedExecutionPayloadEnvelope, error) { finalized := p.ChainInfoFetcher.FinalizedCheckpt() - return p.Payload(ctx, client, finalized.Root) + return p.Payload(ctx, finalized.Root) } // Payload returns a ROSignedExecutionPayloadEnvelope for a given block ID. -func (p *BeaconDbBlocker) Payload(ctx context.Context, client execution.RPCClient, id []byte) (interfaces.ROSignedExecutionPayloadEnvelope, error) { +func (p *BeaconDbBlocker) Payload(ctx context.Context, id []byte) (interfaces.ROSignedExecutionPayloadEnvelope, error) { var err error var blk interfaces.ReadOnlySignedBeaconBlock switch string(id) { case "head": - return p.headPayload(ctx, client) + return p.headPayload(ctx) case "finalized": - return p.finalizedPayload(ctx, client) + return p.finalizedPayload(ctx) case "genesis": default: @@ -144,44 +144,9 @@ func (p *BeaconDbBlocker) Payload(ctx context.Context, client execution.RPCClien if err != nil { return nil, errors.Wrap(err, "could not retrieve signed blind payload envelope") } - result := make([]*enginev1.ExecutionPayloadBody, 0) - if err := client.CallContext(ctx, &result, execution.GetPayloadBodiesByHashV1, [][]byte{hash[:]}); err != nil { - return nil, err - } - if len(result) != 1 { - return nil, errors.New("could not find execution payload body") - } - body := result[0] - parentHash := header.ParentBlockHash() - transactions := make([][]byte, len(body.Transactions)) - for i, tx := range body.Transactions { - transactions[i] = tx - } - - pbFull := &enginev1.SignedExecutionPayloadEnvelope{ - Message: &enginev1.ExecutionPayloadEnvelope{ - Payload: &enginev1.ExecutionPayloadDeneb{ - ParentHash: parentHash[:], - FeeRecipient: make([]byte, 20), - StateRoot: make([]byte, 32), - ReceiptsRoot: make([]byte, 32), - LogsBloom: make([]byte, 256), - PrevRandao: make([]byte, 32), - GasLimit: header.GasLimit(), - ExtraData: make([]byte, 32), - BaseFeePerGas: make([]byte, 32), - BlockHash: hash[:], - Transactions: transactions, - Withdrawals: body.Withdrawals, - }, - ExecutionRequests: pb.Message.ExecutionRequests, - BuilderIndex: pb.Message.BuilderIndex, - BeaconBlockRoot: pb.Message.BeaconBlockRoot, - Slot: pb.Message.Slot, - BlobKzgCommitments: pb.Message.BlobKzgCommitments, - StateRoot: pb.Message.StateRoot, - }, - Signature: pb.Signature, + pbFull, err := p.ExecutionReconstructor.ReconstructPayloadEnvelope(ctx, pb) + if err != nil { + return nil, errors.Wrap(err, "could not reconstruct payload envelope") } return blocks.WrappedROSignedExecutionPayloadEnvelope(pbFull) } diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index 3ba0bc35e44a..fdd0a1aaf322 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -192,10 +192,11 @@ func NewService(ctx context.Context, cfg *Config) *Service { ReplayerBuilder: ch, } blocker := &lookup.BeaconDbBlocker{ - BeaconDB: s.cfg.BeaconDB, - ChainInfoFetcher: s.cfg.ChainInfoFetcher, - GenesisTimeFetcher: s.cfg.GenesisTimeFetcher, - BlobStorage: s.cfg.BlobStorage, + BeaconDB: s.cfg.BeaconDB, + ChainInfoFetcher: s.cfg.ChainInfoFetcher, + GenesisTimeFetcher: s.cfg.GenesisTimeFetcher, + BlobStorage: s.cfg.BlobStorage, + ExecutionReconstructor: s.cfg.ExecutionReconstructor, } rewardFetcher := &rewards.BlockRewardService{Replayer: ch, DB: s.cfg.BeaconDB} coreService := &core.Service{ diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 6bdcddb282df..bf3953fe4721 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -29,6 +29,7 @@ go_library( "rpc_blob_sidecars_by_range.go", "rpc_blob_sidecars_by_root.go", "rpc_chunked_response.go", + "rpc_execution_payload_envelope.go", "rpc_goodbye.go", "rpc_metadata.go", "rpc_ping.go", diff --git a/beacon-chain/sync/rate_limiter.go b/beacon-chain/sync/rate_limiter.go index 5d088f5002a1..5b53e078ac14 100644 --- a/beacon-chain/sync/rate_limiter.go +++ b/beacon-chain/sync/rate_limiter.go @@ -83,6 +83,9 @@ func newRateLimiter(p2pProvider p2p.P2P) *limiter { // General topic for all rpc requests. topicMap[rpcLimiterTopic] = leakybucket.NewCollector(5, defaultBurstLimit*2, leakyBucketPeriod, false /* deleteEmptyBuckets */) + // PayloadByRoots requests + topicMap[addEncoding(p2p.RPCExecutionPayloadsByRootTopicV1)] = blockCollector // Use the same rate limiter as block since payload and block comes at similar rate. + return &limiter{limiterMap: topicMap, p2p: p2pProvider} } diff --git a/beacon-chain/sync/rpc.go b/beacon-chain/sync/rpc.go index f931db7f2ee5..d6a878587106 100644 --- a/beacon-chain/sync/rpc.go +++ b/beacon-chain/sync/rpc.go @@ -38,6 +38,20 @@ type rpcHandler func(context.Context, interface{}, libp2pcore.Stream) error // rpcHandlerByTopicFromFork returns the RPC handlers for a given fork index. func (s *Service) rpcHandlerByTopicFromFork(forkIndex int) (map[string]rpcHandler, error) { + if forkIndex >= version.EPBS { + return map[string]rpcHandler{ + p2p.RPCStatusTopicV1: s.statusRPCHandler, + p2p.RPCGoodByeTopicV1: s.goodbyeRPCHandler, + p2p.RPCBlocksByRangeTopicV2: s.beaconBlocksByRangeRPCHandler, + p2p.RPCBlocksByRootTopicV2: s.beaconBlocksRootRPCHandler, + p2p.RPCPingTopicV1: s.pingHandler, + p2p.RPCMetaDataTopicV2: s.metaDataHandler, + p2p.RPCBlobSidecarsByRootTopicV1: s.blobSidecarByRootRPCHandler, + p2p.RPCBlobSidecarsByRangeTopicV1: s.blobSidecarsByRangeRPCHandler, + p2p.RPCExecutionPayloadsByRootTopicV1: s.executionPayloadByRootRPCHandler, + }, nil + } + // Electra: https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/p2p-interface.md#messages if forkIndex >= version.Electra { return map[string]rpcHandler{ diff --git a/beacon-chain/sync/rpc_execution_payload_envelope.go b/beacon-chain/sync/rpc_execution_payload_envelope.go new file mode 100644 index 000000000000..f25db4a71776 --- /dev/null +++ b/beacon-chain/sync/rpc_execution_payload_envelope.go @@ -0,0 +1,77 @@ +package sync + +import ( + "context" + + libp2pcore "github.com/libp2p/go-libp2p/core" + "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/encoder" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types" + "github.com/prysmaticlabs/prysm/v5/network/forks" + enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" + "github.com/prysmaticlabs/prysm/v5/time/slots" +) + +func (s *Service) executionPayloadByRootRPCHandler(ctx context.Context, msg interface{}, stream libp2pcore.Stream) error { + SetRPCStreamDeadlines(stream) + + r, ok := msg.(*types.BeaconBlockByRootsReq) + if !ok { + return errors.New("message is not type BlobSidecarsByRootReq") + } + blockRoots := *r + if err := s.rateLimiter.validateRequest(stream, uint64(len(blockRoots))); err != nil { + return err + } + if len(blockRoots) == 0 { + s.rateLimiter.add(stream, 1) + s.writeErrorResponseToStream(responseCodeInvalidRequest, "no block roots provided in request", stream) + return errors.New("no block roots provided") + } + for _, root := range blockRoots { + blindPayload, err := s.cfg.beaconDB.SignedBlindPayloadEnvelope(ctx, root[:]) + if err != nil { + log.WithError(err).WithField("root", root).Error("Failed to get payload envelope") + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return err + } + if blindPayload == nil { + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return errors.New("payload is nil") + } + SetStreamWriteDeadline(stream, defaultWriteDuration) + + constructedPayload, err := s.cfg.executionReconstructor.ReconstructPayloadEnvelope(ctx, blindPayload) + if err != nil { + log.WithError(err).WithField("root", root).Error("Failed to reconstruct payload envelope") + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return err + } + + if chunkErr := writePayloadChunk(stream, s.cfg.chain, s.cfg.p2p.Encoding(), constructedPayload); chunkErr != nil { + log.WithError(chunkErr).Debug("Could not send a chunked response") + s.writeErrorResponseToStream(responseCodeServerError, types.ErrGeneric.Error(), stream) + return chunkErr + } + } + closeStream(stream, log) + return nil +} + +func writePayloadChunk(stream libp2pcore.Stream, tor blockchain.TemporalOracle, encoding encoder.NetworkEncoding, payload *enginev1.SignedExecutionPayloadEnvelope) error { + if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { + return err + } + valRoot := tor.GenesisValidatorsRoot() + ctxBytes, err := forks.ForkDigestFromEpoch(slots.ToEpoch(payload.Message.Slot), valRoot[:]) + if err != nil { + return err + } + + if err := writeContextToStream(ctxBytes[:], stream); err != nil { + return err + } + _, err = encoding.EncodeWithMaxLength(stream, payload) + return err +} diff --git a/proto/engine/v1/epbs.go b/proto/engine/v1/epbs.go index 02d79e662071..229fb5c1e1ff 100644 --- a/proto/engine/v1/epbs.go +++ b/proto/engine/v1/epbs.go @@ -7,13 +7,9 @@ func (s *SignedExecutionPayloadEnvelope) Blind() *SignedBlindPayloadEnvelope { if s.Message.Payload == nil { return nil } - payloadRoot, err := s.Message.Payload.HashTreeRoot() - if err != nil { - return nil - } return &SignedBlindPayloadEnvelope{ Message: &BlindPayloadEnvelope{ - PayloadRoot: payloadRoot[:], + BlockHash: s.Message.Payload.BlockHash, ExecutionRequests: s.Message.ExecutionRequests, BuilderIndex: s.Message.BuilderIndex, BeaconBlockRoot: s.Message.BeaconBlockRoot, diff --git a/proto/engine/v1/epbs.pb.go b/proto/engine/v1/epbs.pb.go index 27915c8a6866..7b1c6e1765d3 100755 --- a/proto/engine/v1/epbs.pb.go +++ b/proto/engine/v1/epbs.pb.go @@ -391,7 +391,7 @@ type BlindPayloadEnvelope struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PayloadRoot []byte `protobuf:"bytes,1,opt,name=payload_root,json=payloadRoot,proto3" json:"payload_root,omitempty" ssz-size:"32"` + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty" ssz-size:"32"` ExecutionRequests *ExecutionRequests `protobuf:"bytes,2,opt,name=execution_requests,json=executionRequests,proto3" json:"execution_requests,omitempty"` BuilderIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,3,opt,name=builder_index,json=builderIndex,proto3" json:"builder_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"` BeaconBlockRoot []byte `protobuf:"bytes,4,opt,name=beacon_block_root,json=beaconBlockRoot,proto3" json:"beacon_block_root,omitempty" ssz-size:"32"` @@ -432,9 +432,9 @@ func (*BlindPayloadEnvelope) Descriptor() ([]byte, []int) { return file_proto_engine_v1_epbs_proto_rawDescGZIP(), []int{5} } -func (x *BlindPayloadEnvelope) GetPayloadRoot() []byte { +func (x *BlindPayloadEnvelope) GetBlockHash() []byte { if x != nil { - return x.PayloadRoot + return x.BlockHash } return nil } @@ -585,50 +585,50 @@ var file_proto_engine_v1_epbs_proto_rawDesc = []byte{ 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, - 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x87, 0x04, 0x0a, + 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x83, 0x04, 0x0a, 0x14, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x45, 0x6e, 0x76, - 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, - 0x02, 0x33, 0x32, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x6f, 0x6f, 0x74, - 0x12, 0x54, 0x0a, 0x12, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x73, 0x52, 0x11, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x74, 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, - 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, - 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, - 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, - 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, - 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0c, - 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x32, 0x0a, 0x11, - 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, - 0x0f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, - 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, - 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, - 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, - 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x42, 0x0a, 0x14, 0x62, - 0x6c, 0x6f, 0x62, 0x5f, 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x10, 0x8a, 0xb5, 0x18, 0x04, 0x3f, - 0x2c, 0x34, 0x38, 0x92, 0xb5, 0x18, 0x04, 0x34, 0x30, 0x39, 0x36, 0x52, 0x12, 0x62, 0x6c, 0x6f, - 0x62, 0x4b, 0x7a, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, - 0x25, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x42, 0x96, 0x01, 0x0a, 0x16, 0x6f, 0x72, 0x67, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, - 0x31, 0x42, 0x14, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x67, 0x69, - 0x6e, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, - 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x6e, 0x67, - 0x69, 0x6e, 0x65, 0x76, 0x31, 0xaa, 0x02, 0x12, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5c, 0x76, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, + 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x54, 0x0a, 0x12, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, + 0x11, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x73, 0x12, 0x74, 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, + 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, + 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0c, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x32, 0x0a, 0x11, 0x62, 0x65, 0x61, 0x63, + 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x62, 0x65, 0x61, + 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x59, 0x0a, 0x04, + 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, + 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x42, 0x0a, 0x14, 0x62, 0x6c, 0x6f, 0x62, 0x5f, + 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x10, 0x8a, 0xb5, 0x18, 0x04, 0x3f, 0x2c, 0x34, 0x38, 0x92, + 0xb5, 0x18, 0x04, 0x34, 0x30, 0x39, 0x36, 0x52, 0x12, 0x62, 0x6c, 0x6f, 0x62, 0x4b, 0x7a, 0x67, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, + 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x6f, + 0x6f, 0x74, 0x42, 0x96, 0x01, 0x0a, 0x16, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x14, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, + 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, + 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x76, + 0x31, 0xaa, 0x02, 0x12, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x5c, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/proto/engine/v1/epbs.proto b/proto/engine/v1/epbs.proto index d55d3c0d91d1..08ea59ba52d8 100644 --- a/proto/engine/v1/epbs.proto +++ b/proto/engine/v1/epbs.proto @@ -76,7 +76,7 @@ message SignedBlindPayloadEnvelope { } message BlindPayloadEnvelope { - bytes payload_root = 1 [ (ethereum.eth.ext.ssz_size) = "32" ]; + bytes block_hash = 1 [ (ethereum.eth.ext.ssz_size) = "32" ]; ExecutionRequests execution_requests = 2; uint64 builder_index = 3 [ (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/" diff --git a/testing/util/random/epbs.go b/testing/util/random/epbs.go index 690208951355..a20d26b54a69 100644 --- a/testing/util/random/epbs.go +++ b/testing/util/random/epbs.go @@ -465,7 +465,7 @@ func SignedBlindPayloadEnvelope(t *testing.T) *enginev1.SignedBlindPayloadEnvelo // BlindPayloadEnvelope creates a random BlindPayloadEnvelope for testing purposes. func BlindPayloadEnvelope(t *testing.T) *enginev1.BlindPayloadEnvelope { return &enginev1.BlindPayloadEnvelope{ - PayloadRoot: randomBytes(32, t), + BlockHash: randomBytes(32, t), BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), BeaconBlockRoot: randomBytes(32, t), Slot: primitives.Slot(randomUint64(t)),