From 4d5827c5279033225e7332b817aafe76af228f0f Mon Sep 17 00:00:00 2001 From: shana Date: Tue, 21 Mar 2023 06:36:18 -0700 Subject: [PATCH] Fix payload attributes json (#12169) Co-authored-by: terencechain --- beacon-chain/rpc/apimiddleware/structs.go | 2 +- beacon-chain/rpc/eth/events/events.go | 2 +- beacon-chain/rpc/eth/events/events_test.go | 2 +- proto/eth/v1/events.pb.go | 50 +++++++++++----------- proto/eth/v1/events.proto | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/beacon-chain/rpc/apimiddleware/structs.go b/beacon-chain/rpc/apimiddleware/structs.go index f305b6d85ddb..1d682c76ce52 100644 --- a/beacon-chain/rpc/apimiddleware/structs.go +++ b/beacon-chain/rpc/apimiddleware/structs.go @@ -1185,7 +1185,7 @@ type EventPayloadAttributeV2Json struct { ParentBlockNumber string `json:"parent_block_number"` ParentBlockRoot string `json:"parent_block_root" hex:"true"` ParentBlockHash string `json:"parent_block_hash" hex:"true"` - PayloadAttributes *PayloadAttributesV2Json `json:"payload_attributes_v2"` + PayloadAttributes *PayloadAttributesV2Json `json:"payload_attributes"` } type PayloadAttributesV1Json struct { diff --git a/beacon-chain/rpc/eth/events/events.go b/beacon-chain/rpc/eth/events/events.go index 194bfbf3ecdf..2a33f12638b1 100644 --- a/beacon-chain/rpc/eth/events/events.go +++ b/beacon-chain/rpc/eth/events/events.go @@ -331,7 +331,7 @@ func (s *Server) streamPayloadAttributes(stream ethpbservice.Events_StreamEvents ParentBlockNumber: headPayload.BlockNumber(), ParentBlockRoot: headRoot, ParentBlockHash: headPayload.BlockHash(), - PayloadAttributesV2: &enginev1.PayloadAttributesV2{ + PayloadAttributes: &enginev1.PayloadAttributesV2{ Timestamp: uint64(t.Unix()), PrevRandao: prevRando, SuggestedFeeRecipient: headPayload.FeeRecipient(), diff --git a/beacon-chain/rpc/eth/events/events_test.go b/beacon-chain/rpc/eth/events/events_test.go index 3f8f0661932c..a7bceb50d0f1 100644 --- a/beacon-chain/rpc/eth/events/events_test.go +++ b/beacon-chain/rpc/eth/events/events_test.go @@ -494,7 +494,7 @@ func TestStreamEvents_StateEvents(t *testing.T) { ParentBlockNumber: 1, ParentBlockRoot: make([]byte, 32), ParentBlockHash: make([]byte, 32), - PayloadAttributesV2: &enginev1.PayloadAttributesV2{ + PayloadAttributes: &enginev1.PayloadAttributesV2{ Timestamp: 24, PrevRandao: prevRando, SuggestedFeeRecipient: make([]byte, 20), diff --git a/proto/eth/v1/events.pb.go b/proto/eth/v1/events.pb.go index 5be46dd99b95..f48dbbd6156f 100755 --- a/proto/eth/v1/events.pb.go +++ b/proto/eth/v1/events.pb.go @@ -606,12 +606,12 @@ type EventPayloadAttributeV2_BasePayloadAttribute struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProposalSlot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,3,opt,name=proposal_slot,json=proposalSlot,proto3" json:"proposal_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` - ParentBlockNumber uint64 `protobuf:"varint,4,opt,name=parent_block_number,json=parentBlockNumber,proto3" json:"parent_block_number,omitempty"` - ParentBlockRoot []byte `protobuf:"bytes,5,opt,name=parent_block_root,json=parentBlockRoot,proto3" json:"parent_block_root,omitempty" ssz-size:"32"` - ParentBlockHash []byte `protobuf:"bytes,6,opt,name=parent_block_hash,json=parentBlockHash,proto3" json:"parent_block_hash,omitempty" ssz-size:"32"` - ProposerIndex github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex `protobuf:"varint,7,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"` - PayloadAttributesV2 *v1.PayloadAttributesV2 `protobuf:"bytes,8,opt,name=payload_attributes_v2,json=payloadAttributesV2,proto3" json:"payload_attributes_v2,omitempty"` + ProposalSlot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,3,opt,name=proposal_slot,json=proposalSlot,proto3" json:"proposal_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` + ParentBlockNumber uint64 `protobuf:"varint,4,opt,name=parent_block_number,json=parentBlockNumber,proto3" json:"parent_block_number,omitempty"` + ParentBlockRoot []byte `protobuf:"bytes,5,opt,name=parent_block_root,json=parentBlockRoot,proto3" json:"parent_block_root,omitempty" ssz-size:"32"` + ParentBlockHash []byte `protobuf:"bytes,6,opt,name=parent_block_hash,json=parentBlockHash,proto3" json:"parent_block_hash,omitempty" ssz-size:"32"` + ProposerIndex github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex `protobuf:"varint,7,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"` + PayloadAttributes *v1.PayloadAttributesV2 `protobuf:"bytes,8,opt,name=payload_attributes,json=payloadAttributes,proto3" json:"payload_attributes,omitempty"` } func (x *EventPayloadAttributeV2_BasePayloadAttribute) Reset() { @@ -681,9 +681,9 @@ func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetProposerIndex() github return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex(0) } -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetPayloadAttributesV2() *v1.PayloadAttributesV2 { +func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetPayloadAttributes() *v1.PayloadAttributesV2 { if x != nil { - return x.PayloadAttributesV2 + return x.PayloadAttributes } return nil } @@ -822,7 +822,7 @@ var file_proto_eth_v1_events_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xf8, 0x04, 0x0a, + 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xf3, 0x04, 0x0a, 0x17, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, @@ -831,7 +831,7 @@ var file_proto_eth_v1_events_proto_rawDesc = []byte{ 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x32, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xef, 0x03, 0x0a, 0x14, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xea, 0x03, 0x0a, 0x14, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, @@ -856,21 +856,21 @@ var file_proto_eth_v1_events_proto_rawDesc = []byte{ 0x34, 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, 0x0d, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x5b, 0x0a, 0x15, 0x70, 0x61, + 0x70, 0x6f, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x56, 0x0a, 0x12, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x5f, 0x76, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x74, 0x68, 0x65, - 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x56, 0x32, 0x52, 0x13, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x56, 0x32, 0x42, 0x7e, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x11, - 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2e, 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, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, - 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, - 0x74, 0x68, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x56, 0x32, 0x52, + 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x42, 0x7e, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x11, 0x42, 0x65, 0x61, 0x63, 0x6f, + 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, + 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, + 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0xaa, 0x02, + 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -903,7 +903,7 @@ var file_proto_eth_v1_events_proto_depIdxs = []int32{ 7, // 0: ethereum.eth.v1.EventPayloadAttributeV1.data:type_name -> ethereum.eth.v1.EventPayloadAttributeV1.BasePayloadAttribute 8, // 1: ethereum.eth.v1.EventPayloadAttributeV2.data:type_name -> ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute 9, // 2: ethereum.eth.v1.EventPayloadAttributeV1.BasePayloadAttribute.payload_attributes:type_name -> ethereum.engine.v1.PayloadAttributes - 10, // 3: ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute.payload_attributes_v2:type_name -> ethereum.engine.v1.PayloadAttributesV2 + 10, // 3: ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute.payload_attributes:type_name -> ethereum.engine.v1.PayloadAttributesV2 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/proto/eth/v1/events.proto b/proto/eth/v1/events.proto index ddf5fd98e55e..06fab9431b79 100644 --- a/proto/eth/v1/events.proto +++ b/proto/eth/v1/events.proto @@ -159,6 +159,6 @@ message EventPayloadAttributeV2 { // The version N must match the payload attributes for the hard fork matching version. // The beacon API encoded object must have equivalent fields to its counterpart in execution-apis with two differences: // 1) snake_case identifiers must be used rather than camelCase; 2) integers must be encoded as quoted decimals rather than big-endian hex. - engine.v1.PayloadAttributesV2 payload_attributes_v2 = 8; + engine.v1.PayloadAttributesV2 payload_attributes = 8; } } \ No newline at end of file