From ebc1d3423d99238bc40dcbe0019074f17fcc3229 Mon Sep 17 00:00:00 2001 From: djadih Date: Mon, 26 Aug 2024 14:27:33 -0500 Subject: [PATCH] Encode missing TxHash, GasUsed, and Logs fields for storage --- common/proto_common.pb.go | 2 +- core/rawdb/db.pb.go | 2 +- core/types/proto_block.pb.go | 60 ++++++++++----------- core/types/proto_block.proto | 10 ++-- core/types/receipt.go | 3 ++ p2p/node/peerManager/peerdb/peer_info.pb.go | 2 +- p2p/pb/quai_messages.pb.go | 2 +- 7 files changed, 42 insertions(+), 39 deletions(-) diff --git a/common/proto_common.pb.go b/common/proto_common.pb.go index f29af48c61..cafde597bc 100644 --- a/common/proto_common.pb.go +++ b/common/proto_common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.2 +// protoc v5.27.3 // source: common/proto_common.proto package common diff --git a/core/rawdb/db.pb.go b/core/rawdb/db.pb.go index 0405985557..ebce6c3d78 100644 --- a/core/rawdb/db.pb.go +++ b/core/rawdb/db.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.2 +// protoc v5.27.3 // source: core/rawdb/db.proto package rawdb diff --git a/core/types/proto_block.pb.go b/core/types/proto_block.pb.go index 5debbbe94f..fb4d047fa7 100644 --- a/core/types/proto_block.pb.go +++ b/core/types/proto_block.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.2 +// protoc v5.27.3 // source: core/types/proto_block.proto package types @@ -1324,11 +1324,11 @@ type ProtoReceiptForStorage struct { PostStateOrStatus []byte `protobuf:"bytes,1,opt,name=post_state_or_status,json=postStateOrStatus,proto3" json:"post_state_or_status,omitempty"` CumulativeGasUsed uint64 `protobuf:"varint,2,opt,name=cumulative_gas_used,json=cumulativeGasUsed,proto3" json:"cumulative_gas_used,omitempty"` - TxHash *common.ProtoHash `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - ContractAddress *common.ProtoAddress `protobuf:"bytes,4,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - Logs *ProtoLogsForStorage `protobuf:"bytes,5,opt,name=logs,proto3" json:"logs,omitempty"` - Etxs *ProtoTransactions `protobuf:"bytes,6,opt,name=etxs,proto3" json:"etxs,omitempty"` - GasUsed uint64 `protobuf:"varint,7,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + Logs *ProtoLogsForStorage `protobuf:"bytes,3,opt,name=logs,proto3" json:"logs,omitempty"` + TxHash *common.ProtoHash `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + ContractAddress *common.ProtoAddress `protobuf:"bytes,5,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + Etxs *ProtoTransactions `protobuf:"bytes,7,opt,name=etxs,proto3" json:"etxs,omitempty"` } func (x *ProtoReceiptForStorage) Reset() { @@ -1377,6 +1377,13 @@ func (x *ProtoReceiptForStorage) GetCumulativeGasUsed() uint64 { return 0 } +func (x *ProtoReceiptForStorage) GetLogs() *ProtoLogsForStorage { + if x != nil { + return x.Logs + } + return nil +} + func (x *ProtoReceiptForStorage) GetTxHash() *common.ProtoHash { if x != nil { return x.TxHash @@ -1391,11 +1398,11 @@ func (x *ProtoReceiptForStorage) GetContractAddress() *common.ProtoAddress { return nil } -func (x *ProtoReceiptForStorage) GetLogs() *ProtoLogsForStorage { +func (x *ProtoReceiptForStorage) GetGasUsed() uint64 { if x != nil { - return x.Logs + return x.GasUsed } - return nil + return 0 } func (x *ProtoReceiptForStorage) GetEtxs() *ProtoTransactions { @@ -1405,13 +1412,6 @@ func (x *ProtoReceiptForStorage) GetEtxs() *ProtoTransactions { return nil } -func (x *ProtoReceiptForStorage) GetGasUsed() uint64 { - if x != nil { - return x.GasUsed - } - return 0 -} - type ProtoReceiptsForStorage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2603,21 +2603,21 @@ var file_core_types_proto_block_proto_rawDesc = []byte{ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x47, - 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x4c, 0x6f, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x48, 0x61, 0x73, 0x68, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3f, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4c, - 0x6f, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x04, 0x6c, - 0x6f, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x04, 0x65, 0x74, 0x78, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x65, 0x74, 0x78, - 0x73, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x22, 0x54, 0x0a, 0x17, + 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x2c, + 0x0a, 0x04, 0x65, 0x74, 0x78, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x65, 0x74, 0x78, 0x73, 0x22, 0x54, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x46, 0x6f, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c, 0x6f, 0x63, @@ -2852,9 +2852,9 @@ var file_core_types_proto_block_proto_depIdxs = []int32{ 9, // 44: block.ProtoWorkObjectHeaderView.work_object:type_name -> block.ProtoWorkObject 9, // 45: block.ProtoWorkObjectShareView.work_object:type_name -> block.ProtoWorkObject 35, // 46: block.ProtoAccessTuple.storage_key:type_name -> common.ProtoHash - 35, // 47: block.ProtoReceiptForStorage.tx_hash:type_name -> common.ProtoHash - 37, // 48: block.ProtoReceiptForStorage.contract_address:type_name -> common.ProtoAddress - 19, // 49: block.ProtoReceiptForStorage.logs:type_name -> block.ProtoLogsForStorage + 19, // 47: block.ProtoReceiptForStorage.logs:type_name -> block.ProtoLogsForStorage + 35, // 48: block.ProtoReceiptForStorage.tx_hash:type_name -> common.ProtoHash + 37, // 49: block.ProtoReceiptForStorage.contract_address:type_name -> common.ProtoAddress 2, // 50: block.ProtoReceiptForStorage.etxs:type_name -> block.ProtoTransactions 16, // 51: block.ProtoReceiptsForStorage.receipts:type_name -> block.ProtoReceiptForStorage 37, // 52: block.ProtoLogForStorage.address:type_name -> common.ProtoAddress diff --git a/core/types/proto_block.proto b/core/types/proto_block.proto index 7a4cbb2871..51bf64537f 100644 --- a/core/types/proto_block.proto +++ b/core/types/proto_block.proto @@ -130,11 +130,11 @@ message ProtoAccessTuple { message ProtoReceiptForStorage { bytes post_state_or_status = 1; uint64 cumulative_gas_used = 2; - common.ProtoHash tx_hash = 3; - common.ProtoAddress contract_address = 4; - ProtoLogsForStorage logs = 5; - ProtoTransactions etxs = 6; - uint64 gas_used = 7; + ProtoLogsForStorage logs = 3; + common.ProtoHash tx_hash = 4; + common.ProtoAddress contract_address = 5; + uint64 gas_used = 6; + ProtoTransactions etxs = 7; } message ProtoReceiptsForStorage { diff --git a/core/types/receipt.go b/core/types/receipt.go index 23ab2e4d01..e539e08bc2 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -241,7 +241,9 @@ func (r *ReceiptForStorage) ProtoEncode() (*ProtoReceiptForStorage, error) { ProtoReceiptForStorage := &ProtoReceiptForStorage{ PostStateOrStatus: (*Receipt)(r).statusEncoding(), CumulativeGasUsed: r.CumulativeGasUsed, + TxHash: r.TxHash.ProtoEncode(), ContractAddress: r.ContractAddress.ProtoEncode(), + GasUsed: r.GasUsed, } protoEtxs, err := r.Etxs.ProtoEncode() if err != nil { @@ -255,6 +257,7 @@ func (r *ReceiptForStorage) ProtoEncode() (*ProtoReceiptForStorage, error) { protoLog := (*LogForStorage)(log).ProtoEncode() protoLogs.Logs[i] = protoLog } + ProtoReceiptForStorage.Logs = protoLogs return ProtoReceiptForStorage, nil } diff --git a/p2p/node/peerManager/peerdb/peer_info.pb.go b/p2p/node/peerManager/peerdb/peer_info.pb.go index 2e4b2a71a7..b04c1bcba3 100644 --- a/p2p/node/peerManager/peerdb/peer_info.pb.go +++ b/p2p/node/peerManager/peerdb/peer_info.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.2 +// protoc v5.27.3 // source: p2p/node/peerManager/peerdb/peer_info.proto package peerdb diff --git a/p2p/pb/quai_messages.pb.go b/p2p/pb/quai_messages.pb.go index 2c5ea6093e..909e959776 100644 --- a/p2p/pb/quai_messages.pb.go +++ b/p2p/pb/quai_messages.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.2 +// protoc v5.27.3 // source: p2p/pb/quai_messages.proto package pb