From befb14d0a95ef11244d3ccc3caddac7eaff50547 Mon Sep 17 00:00:00 2001 From: Kasey Kirkham Date: Wed, 15 May 2024 21:12:23 -0500 Subject: [PATCH] Sammy's feedback to just call it ExecutionPayloadBody --- beacon-chain/execution/engine_client.go | 10 ++-- beacon-chain/execution/engine_client_test.go | 54 +++++++++---------- beacon-chain/execution/payload_body.go | 6 +-- beacon-chain/execution/payload_body_test.go | 6 +-- proto/engine/v1/json_marshal_unmarshal.go | 4 +- .../engine/v1/json_marshal_unmarshal_test.go | 4 +- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/beacon-chain/execution/engine_client.go b/beacon-chain/execution/engine_client.go index 1159caa937f5..ea2fe7f2c5cc 100644 --- a/beacon-chain/execution/engine_client.go +++ b/beacon-chain/execution/engine_client.go @@ -522,7 +522,7 @@ func (s *Service) HeaderByNumber(ctx context.Context, number *big.Int) (*types.H } // GetPayloadBodiesByHash returns the relevant payload bodies for the provided block hash. -func (s *Service) GetPayloadBodiesByHash(ctx context.Context, executionBlockHashes []common.Hash) ([]*pb.ExecutionPayloadBodyV1Or2, error) { +func (s *Service) GetPayloadBodiesByHash(ctx context.Context, executionBlockHashes []common.Hash) ([]*pb.ExecutionPayloadBody, error) { ctx, span := trace.StartSpan(ctx, "powchain.engine-api-client.GetPayloadBodiesByHashV1") defer span.End() @@ -530,7 +530,7 @@ func (s *Service) GetPayloadBodiesByHash(ctx context.Context, executionBlockHash if len(executionBlockHashes) == 0 { return nil, nil } - result := make([]*pb.ExecutionPayloadBodyV1Or2, 0) + result := make([]*pb.ExecutionPayloadBody, 0) err := s.rpcClient.CallContext(ctx, &result, GetPayloadBodiesByHashV1, executionBlockHashes) if err != nil { return nil, handleRPCError(err) @@ -542,11 +542,11 @@ func (s *Service) GetPayloadBodiesByHash(ctx context.Context, executionBlockHash } // GetPayloadBodiesByRange returns the relevant payload bodies for the provided range. -func (s *Service) GetPayloadBodiesByRange(ctx context.Context, start, count uint64) ([]*pb.ExecutionPayloadBodyV1Or2, error) { +func (s *Service) GetPayloadBodiesByRange(ctx context.Context, start, count uint64) ([]*pb.ExecutionPayloadBody, error) { ctx, span := trace.StartSpan(ctx, "powchain.engine-api-client.GetPayloadBodiesByRangeV1") defer span.End() - result := make([]*pb.ExecutionPayloadBodyV1Or2, 0) + result := make([]*pb.ExecutionPayloadBody, 0) err := s.rpcClient.CallContext(ctx, &result, GetPayloadBodiesByRangeV1, start, count) return result, handleRPCError(err) @@ -576,7 +576,7 @@ func (s *Service) ReconstructFullBellatrixBlockBatch( } func fullPayloadFromPayloadBody( - header interfaces.ExecutionData, body *pb.ExecutionPayloadBodyV1Or2, bVersion int, + header interfaces.ExecutionData, body *pb.ExecutionPayloadBody, bVersion int, ) (interfaces.ExecutionData, error) { if header.IsNil() || body == nil { return nil, errors.New("execution block and header cannot be nil") diff --git a/beacon-chain/execution/engine_client_test.go b/beacon-chain/execution/engine_client_test.go index 38d405874441..f22c924121ec 100644 --- a/beacon-chain/execution/engine_client_test.go +++ b/beacon-chain/execution/engine_client_test.go @@ -1445,7 +1445,7 @@ func fixturesStruct() *payloadFixtures { BlockHash: foo[:], Transactions: [][]byte{foo[:]}, } - executionPayloadBodyFixture := &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodyFixture := &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{foo[:]}, Withdrawals: []*pb.Withdrawal{}, } @@ -1752,7 +1752,7 @@ func fixturesStruct() *payloadFixtures { type payloadFixtures struct { ExecutionBlock *pb.ExecutionBlock - ExecutionPayloadBody *pb.ExecutionPayloadBodyV1Or2 + ExecutionPayloadBody *pb.ExecutionPayloadBody ExecutionPayload *pb.ExecutionPayload ExecutionPayloadCapella *pb.ExecutionPayloadCapella EmptyExecutionPayloadDeneb *pb.ExecutionPayloadDeneb @@ -2176,7 +2176,7 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 1) + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 1) executionPayloadBodies[0] = nil resp := map[string]interface{}{ @@ -2205,13 +2205,13 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 3) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 3) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } executionPayloadBodies[1] = nil - executionPayloadBodies[2] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[2] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2252,8 +2252,8 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 1) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 1) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2295,8 +2295,8 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 2) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 2) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2305,7 +2305,7 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { Amount: 1, }}, } - executionPayloadBodies[1] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[1] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 2, @@ -2349,13 +2349,13 @@ func TestCapella_PayloadBodiesByHash(t *testing.T) { }() // [A, B, C] but no B in the server means // we get [Abody, null, Cbody]. - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 3) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 3) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } executionPayloadBodies[1] = nil - executionPayloadBodies[2] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[2] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } @@ -2394,7 +2394,7 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 0) + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 0) resp := map[string]interface{}{ "jsonrpc": "2.0", "id": 1, @@ -2425,7 +2425,7 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 1) + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 1) executionPayloadBodies[0] = nil resp := map[string]interface{}{ @@ -2456,13 +2456,13 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 3) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 3) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } executionPayloadBodies[1] = nil - executionPayloadBodies[2] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[2] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2501,8 +2501,8 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 1) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 1) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2542,8 +2542,8 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 2) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 2) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 1, @@ -2552,7 +2552,7 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { Amount: 1, }}, } - executionPayloadBodies[1] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[1] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{hexutil.MustDecode("0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86")}, Withdrawals: []*pb.Withdrawal{{ Index: 2, @@ -2594,13 +2594,13 @@ func TestCapella_PayloadBodiesByRange(t *testing.T) { }() // [A, B, C] but no B in the server means // we get [Abody, null, Cbody]. - executionPayloadBodies := make([]*pb.ExecutionPayloadBodyV1Or2, 3) - executionPayloadBodies[0] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := make([]*pb.ExecutionPayloadBody, 3) + executionPayloadBodies[0] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } executionPayloadBodies[1] = nil - executionPayloadBodies[2] = &pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies[2] = &pb.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{}, Withdrawals: []*pb.Withdrawal{}, } diff --git a/beacon-chain/execution/payload_body.go b/beacon-chain/execution/payload_body.go index c0fa762d925e..fec0654d73f5 100644 --- a/beacon-chain/execution/payload_body.go +++ b/beacon-chain/execution/payload_body.go @@ -25,7 +25,7 @@ type reconstructionBatch map[[32]byte]struct{} type blindedBlockReconstructor struct { orderedBlocks []*blockWithHeader - bodies map[[32]byte]*pb.ExecutionPayloadBodyV1Or2 + bodies map[[32]byte]*pb.ExecutionPayloadBody batches map[string]reconstructionBatch } @@ -43,7 +43,7 @@ func reconstructBlindedBlockBatch(ctx context.Context, client RPCClient, sbb []i func newBlindedBlockReconstructor(sbb []interfaces.ReadOnlySignedBeaconBlock) (*blindedBlockReconstructor, error) { r := &blindedBlockReconstructor{ orderedBlocks: make([]*blockWithHeader, 0, len(sbb)), - bodies: make(map[[32]byte]*pb.ExecutionPayloadBodyV1Or2), + bodies: make(map[[32]byte]*pb.ExecutionPayloadBody), } for i := range sbb { if err := r.addToBatch(sbb[i]); err != nil { @@ -124,7 +124,7 @@ func (r *blindedBlockReconstructor) requestBodiesByHash(ctx context.Context, cli } hashes = append(hashes, h) } - result := make([]*pb.ExecutionPayloadBodyV1Or2, 0) + result := make([]*pb.ExecutionPayloadBody, 0) if err := client.CallContext(ctx, &result, method, hashes); err != nil { return nil, err } diff --git a/beacon-chain/execution/payload_body_test.go b/beacon-chain/execution/payload_body_test.go index 6065e1503595..5f1fabc2346f 100644 --- a/beacon-chain/execution/payload_body_test.go +++ b/beacon-chain/execution/payload_body_test.go @@ -55,8 +55,8 @@ func TestPayloadBodyMethodForBlock(t *testing.T) { }) } -func payloadToBody(t *testing.T, ed interfaces.ExecutionData) *pb.ExecutionPayloadBodyV1Or2 { - body := &pb.ExecutionPayloadBodyV1Or2{} +func payloadToBody(t *testing.T, ed interfaces.ExecutionData) *pb.ExecutionPayloadBody { + body := &pb.ExecutionPayloadBody{} txs, err := ed.Transactions() require.NoError(t, err) wd, err := ed.Withdrawals() @@ -128,7 +128,7 @@ func TestPayloadBodiesViaUnblinder(t *testing.T) { defer func() { require.NoError(t, r.Body.Close()) }() - executionPayloadBodies := []*pb.ExecutionPayloadBodyV1Or2{ + executionPayloadBodies := []*pb.ExecutionPayloadBody{ payloadToBody(t, fx.denebBlock.blinded.header), payloadToBody(t, fx.emptyDenebBlock.blinded.header), } diff --git a/proto/engine/v1/json_marshal_unmarshal.go b/proto/engine/v1/json_marshal_unmarshal.go index c36fb68f91c5..cbaac71f2be6 100644 --- a/proto/engine/v1/json_marshal_unmarshal.go +++ b/proto/engine/v1/json_marshal_unmarshal.go @@ -327,8 +327,8 @@ type ExecutionPayloadElectraJSON struct { DepositRequests []DepositRequestV1 `json:"depositRequests"` } -// ExecutionPayloadBodyV1Or2 represents the engine API ExecutionPayloadV1 or ExecutionPayloadV2 type. -type ExecutionPayloadBodyV1Or2 struct { +// ExecutionPayloadBody represents the engine API ExecutionPayloadV1 or ExecutionPayloadV2 type. +type ExecutionPayloadBody struct { Transactions []hexutil.Bytes `json:"transactions"` Withdrawals []*Withdrawal `json:"withdrawals"` WithdrawalRequests []WithdrawalRequestV1 `json:"withdrawalRequests"` diff --git a/proto/engine/v1/json_marshal_unmarshal_test.go b/proto/engine/v1/json_marshal_unmarshal_test.go index 0b3af3a1ce7e..7aed00f1b7a9 100644 --- a/proto/engine/v1/json_marshal_unmarshal_test.go +++ b/proto/engine/v1/json_marshal_unmarshal_test.go @@ -763,7 +763,7 @@ func TestPayloadIDBytes_MarshalUnmarshalJSON(t *testing.T) { } func TestExecutionPayloadBody_MarshalUnmarshalJSON(t *testing.T) { - pBody := &enginev1.ExecutionPayloadBodyV1Or2{ + pBody := &enginev1.ExecutionPayloadBody{ Transactions: []hexutil.Bytes{[]byte("random1"), []byte("random2"), []byte("random3")}, Withdrawals: []*enginev1.Withdrawal{ { @@ -782,7 +782,7 @@ func TestExecutionPayloadBody_MarshalUnmarshalJSON(t *testing.T) { } enc, err := json.Marshal(pBody) require.NoError(t, err) - res := &enginev1.ExecutionPayloadBodyV1Or2{} + res := &enginev1.ExecutionPayloadBody{} err = json.Unmarshal(enc, res) require.NoError(t, err) require.DeepEqual(t, pBody, res)