diff --git a/cmd/rpcdaemon/rpcservices/eth_backend.go b/cmd/rpcdaemon/rpcservices/eth_backend.go index 1a1ccee5e59..22ab2f2f712 100644 --- a/cmd/rpcdaemon/rpcservices/eth_backend.go +++ b/cmd/rpcdaemon/rpcservices/eth_backend.go @@ -298,6 +298,12 @@ func (back *RemoteBackend) HeaderByHash(ctx context.Context, tx kv.Getter, hash func (back *RemoteBackend) CanonicalHash(ctx context.Context, tx kv.Getter, blockNum uint64) (common.Hash, error) { return back.blockReader.CanonicalHash(ctx, tx, blockNum) } +func (back *RemoteBackend) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) { + return back.blockReader.HeaderNumber(ctx, tx, hash) +} +func (back *RemoteBackend) IsCanonical(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (bool, error) { + return back.blockReader.IsCanonical(ctx, tx, hash, blockNum) +} func (back *RemoteBackend) TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, i int) (types.Transaction, error) { return back.blockReader.TxnByIdxInBlock(ctx, tx, blockNum, i) } diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 39158091e39..b16eb3e1d29 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -483,20 +483,6 @@ func WriteBodyForStorage(db kv.Putter, hash common.Hash, number uint64, body *ty return db.Put(kv.BlockBody, dbutils.BlockBodyKey(number, hash), data) } -// ReadBodyByNumber - returns canonical block body -func ReadBodyByNumber(db kv.Tx, number uint64) (*types.Body, uint64, uint32, error) { - hash, err := ReadCanonicalHash(db, number) - if err != nil { - return nil, 0, 0, fmt.Errorf("failed ReadCanonicalHash: %w", err) - } - if hash == (common.Hash{}) { - return nil, 0, 0, nil - } - body, baseTxnID, txCount := ReadBody(db, hash, number) - // TODO baseTxnID from ReadBody is baseTxnID+1, but we could expect original baseTxnID here - return body, baseTxnID, txCount, nil -} - func ReadBodyWithTransactions(db kv.Getter, hash common.Hash, number uint64) (*types.Body, error) { body, firstTxId, txCount := ReadBody(db, hash, number) if body == nil { diff --git a/erigon-lib/common/dbg/experiments.go b/erigon-lib/common/dbg/experiments.go index ed2f8a83eb3..dfff5b658fc 100644 --- a/erigon-lib/common/dbg/experiments.go +++ b/erigon-lib/common/dbg/experiments.go @@ -45,10 +45,11 @@ var ( mergeTr = EnvInt("MERGE_THRESHOLD", -1) //state v3 - noPrune = EnvBool("NO_PRUNE", false) - noMerge = EnvBool("NO_MERGE", false) - discardHistory = EnvBool("DISCARD_HISTORY", false) - discardCommitment = EnvBool("DISCARD_COMMITMENT", false) + noPrune = EnvBool("NO_PRUNE", false) + noMerge = EnvBool("NO_MERGE", false) + discardHistory = EnvBool("DISCARD_HISTORY", false) + discardCommitment = EnvBool("DISCARD_COMMITMENT", false) + pruneTotalDifficulty = EnvBool("PRUNE_TOTAL_DIFFICULTY", false) // force skipping of any non-Erigon2 .torrent files DownloaderOnlyBlocks = EnvBool("DOWNLOADER_ONLY_BLOCKS", false) @@ -82,10 +83,11 @@ func NoSync() bool { return noSync } func MdbxReadAhead() bool { return mdbxReadahead } func MdbxLockInRam() bool { return mdbxLockInRam } -func DiscardHistory() bool { return discardHistory } -func DiscardCommitment() bool { return discardCommitment } -func NoPrune() bool { return noPrune } -func NoMerge() bool { return noMerge } +func DiscardHistory() bool { return discardHistory } +func DiscardCommitment() bool { return discardCommitment } +func NoPrune() bool { return noPrune } +func NoMerge() bool { return noMerge } +func PruneTotalDifficulty() bool { return pruneTotalDifficulty } var ( dirtySace uint64 diff --git a/erigon-lib/direct/eth_backend_client.go b/erigon-lib/direct/eth_backend_client.go index 88a481dd45c..ea9d090dd64 100644 --- a/erigon-lib/direct/eth_backend_client.go +++ b/erigon-lib/direct/eth_backend_client.go @@ -191,6 +191,14 @@ func (c *SubscribeLogsStreamC) Recv() (*remote.SubscribeLogsReply, error) { // -- end SubscribeLogs +func (s *EthBackendClientDirect) CanonicalHash(ctx context.Context, in *remote.CanonicalHashRequest, opts ...grpc.CallOption) (*remote.CanonicalHashReply, error) { + return s.server.CanonicalHash(ctx, in) +} + +func (s *EthBackendClientDirect) HeaderNumber(ctx context.Context, in *remote.HeaderNumberRequest, opts ...grpc.CallOption) (*remote.HeaderNumberReply, error) { + return s.server.HeaderNumber(ctx, in) +} + func (s *EthBackendClientDirect) Block(ctx context.Context, in *remote.BlockRequest, opts ...grpc.CallOption) (*remote.BlockReply, error) { return s.server.Block(ctx, in) } diff --git a/erigon-lib/go.mod b/erigon-lib/go.mod index 5e4b958e22f..7b85f9d74a7 100644 --- a/erigon-lib/go.mod +++ b/erigon-lib/go.mod @@ -4,7 +4,7 @@ go 1.21.5 require ( github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978 - github.com/erigontech/interfaces v0.0.0-20240723225543-c6b574058f8c + github.com/erigontech/interfaces v0.0.0-20240816222220-760b11456e56 github.com/erigontech/mdbx-go v0.38.4 github.com/erigontech/secp256k1 v1.1.0 github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 diff --git a/erigon-lib/go.sum b/erigon-lib/go.sum index 96b053fbf90..38096649b4a 100644 --- a/erigon-lib/go.sum +++ b/erigon-lib/go.sum @@ -148,8 +148,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978 h1:7ECOf7Us3+/706WGZXIX84qQc6zmxQby8fGbFLiqFlU= github.com/erigontech/erigon-snapshot v1.3.1-0.20240814160410-2ce37904b978/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M= -github.com/erigontech/interfaces v0.0.0-20240723225543-c6b574058f8c h1:KbcMdRKYRL+A4bJGK+fNOITk95wJzh9rUXFJ17wCyUY= -github.com/erigontech/interfaces v0.0.0-20240723225543-c6b574058f8c/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE= +github.com/erigontech/interfaces v0.0.0-20240816222220-760b11456e56 h1:RFLd10LsbUdcXS7zntLuVj+mZZJFDD6E7y183kYC+SM= +github.com/erigontech/interfaces v0.0.0-20240816222220-760b11456e56/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE= github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo= github.com/erigontech/mdbx-go v0.38.4/go.mod h1:IcOLQDPw3VM/asP6T5JVPPN4FHHgJtY16XfYjzWKVNI= github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M0X9qY= diff --git a/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go b/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go index a584bff2057..216e8fb1cd7 100644 --- a/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/ethbackend.pb.go @@ -502,6 +502,194 @@ func (x *ClientVersionReply) GetNodeName() string { return "" } +type CanonicalHashRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` +} + +func (x *CanonicalHashRequest) Reset() { + *x = CanonicalHashRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_remote_ethbackend_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CanonicalHashRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CanonicalHashRequest) ProtoMessage() {} + +func (x *CanonicalHashRequest) ProtoReflect() protoreflect.Message { + mi := &file_remote_ethbackend_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CanonicalHashRequest.ProtoReflect.Descriptor instead. +func (*CanonicalHashRequest) Descriptor() ([]byte, []int) { + return file_remote_ethbackend_proto_rawDescGZIP(), []int{10} +} + +func (x *CanonicalHashRequest) GetBlockNumber() uint64 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +type CanonicalHashReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *CanonicalHashReply) Reset() { + *x = CanonicalHashReply{} + if protoimpl.UnsafeEnabled { + mi := &file_remote_ethbackend_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CanonicalHashReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CanonicalHashReply) ProtoMessage() {} + +func (x *CanonicalHashReply) ProtoReflect() protoreflect.Message { + mi := &file_remote_ethbackend_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CanonicalHashReply.ProtoReflect.Descriptor instead. +func (*CanonicalHashReply) Descriptor() ([]byte, []int) { + return file_remote_ethbackend_proto_rawDescGZIP(), []int{11} +} + +func (x *CanonicalHashReply) GetHash() *typesproto.H256 { + if x != nil { + return x.Hash + } + return nil +} + +type HeaderNumberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash *typesproto.H256 `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *HeaderNumberRequest) Reset() { + *x = HeaderNumberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_remote_ethbackend_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeaderNumberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeaderNumberRequest) ProtoMessage() {} + +func (x *HeaderNumberRequest) ProtoReflect() protoreflect.Message { + mi := &file_remote_ethbackend_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeaderNumberRequest.ProtoReflect.Descriptor instead. +func (*HeaderNumberRequest) Descriptor() ([]byte, []int) { + return file_remote_ethbackend_proto_rawDescGZIP(), []int{12} +} + +func (x *HeaderNumberRequest) GetHash() *typesproto.H256 { + if x != nil { + return x.Hash + } + return nil +} + +type HeaderNumberReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number *uint64 `protobuf:"varint,1,opt,name=number,proto3,oneof" json:"number,omitempty"` +} + +func (x *HeaderNumberReply) Reset() { + *x = HeaderNumberReply{} + if protoimpl.UnsafeEnabled { + mi := &file_remote_ethbackend_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeaderNumberReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeaderNumberReply) ProtoMessage() {} + +func (x *HeaderNumberReply) ProtoReflect() protoreflect.Message { + mi := &file_remote_ethbackend_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeaderNumberReply.ProtoReflect.Descriptor instead. +func (*HeaderNumberReply) Descriptor() ([]byte, []int) { + return file_remote_ethbackend_proto_rawDescGZIP(), []int{13} +} + +func (x *HeaderNumberReply) GetNumber() uint64 { + if x != nil && x.Number != nil { + return *x.Number + } + return 0 +} + type SubscribeRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -513,7 +701,7 @@ type SubscribeRequest struct { func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[10] + mi := &file_remote_ethbackend_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -526,7 +714,7 @@ func (x *SubscribeRequest) String() string { func (*SubscribeRequest) ProtoMessage() {} func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[10] + mi := &file_remote_ethbackend_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -539,7 +727,7 @@ func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{10} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{14} } func (x *SubscribeRequest) GetType() Event { @@ -561,7 +749,7 @@ type SubscribeReply struct { func (x *SubscribeReply) Reset() { *x = SubscribeReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[11] + mi := &file_remote_ethbackend_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -574,7 +762,7 @@ func (x *SubscribeReply) String() string { func (*SubscribeReply) ProtoMessage() {} func (x *SubscribeReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[11] + mi := &file_remote_ethbackend_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -587,7 +775,7 @@ func (x *SubscribeReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeReply.ProtoReflect.Descriptor instead. func (*SubscribeReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{11} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{15} } func (x *SubscribeReply) GetType() Event { @@ -618,7 +806,7 @@ type LogsFilterRequest struct { func (x *LogsFilterRequest) Reset() { *x = LogsFilterRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[12] + mi := &file_remote_ethbackend_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -631,7 +819,7 @@ func (x *LogsFilterRequest) String() string { func (*LogsFilterRequest) ProtoMessage() {} func (x *LogsFilterRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[12] + mi := &file_remote_ethbackend_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -644,7 +832,7 @@ func (x *LogsFilterRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LogsFilterRequest.ProtoReflect.Descriptor instead. func (*LogsFilterRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{12} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{16} } func (x *LogsFilterRequest) GetAllAddresses() bool { @@ -694,7 +882,7 @@ type SubscribeLogsReply struct { func (x *SubscribeLogsReply) Reset() { *x = SubscribeLogsReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[13] + mi := &file_remote_ethbackend_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -707,7 +895,7 @@ func (x *SubscribeLogsReply) String() string { func (*SubscribeLogsReply) ProtoMessage() {} func (x *SubscribeLogsReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[13] + mi := &file_remote_ethbackend_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -720,7 +908,7 @@ func (x *SubscribeLogsReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeLogsReply.ProtoReflect.Descriptor instead. func (*SubscribeLogsReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{13} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{17} } func (x *SubscribeLogsReply) GetAddress() *typesproto.H160 { @@ -798,7 +986,7 @@ type BlockRequest struct { func (x *BlockRequest) Reset() { *x = BlockRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[14] + mi := &file_remote_ethbackend_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -811,7 +999,7 @@ func (x *BlockRequest) String() string { func (*BlockRequest) ProtoMessage() {} func (x *BlockRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[14] + mi := &file_remote_ethbackend_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -824,7 +1012,7 @@ func (x *BlockRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockRequest.ProtoReflect.Descriptor instead. func (*BlockRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{14} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{18} } func (x *BlockRequest) GetBlockHeight() uint64 { @@ -853,7 +1041,7 @@ type BlockReply struct { func (x *BlockReply) Reset() { *x = BlockReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[15] + mi := &file_remote_ethbackend_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -866,7 +1054,7 @@ func (x *BlockReply) String() string { func (*BlockReply) ProtoMessage() {} func (x *BlockReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[15] + mi := &file_remote_ethbackend_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -879,7 +1067,7 @@ func (x *BlockReply) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockReply.ProtoReflect.Descriptor instead. func (*BlockReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{15} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{19} } func (x *BlockReply) GetBlockRlp() []byte { @@ -907,7 +1095,7 @@ type TxnLookupRequest struct { func (x *TxnLookupRequest) Reset() { *x = TxnLookupRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[16] + mi := &file_remote_ethbackend_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -920,7 +1108,7 @@ func (x *TxnLookupRequest) String() string { func (*TxnLookupRequest) ProtoMessage() {} func (x *TxnLookupRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[16] + mi := &file_remote_ethbackend_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -933,7 +1121,7 @@ func (x *TxnLookupRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TxnLookupRequest.ProtoReflect.Descriptor instead. func (*TxnLookupRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{16} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{20} } func (x *TxnLookupRequest) GetTxnHash() *typesproto.H256 { @@ -954,7 +1142,7 @@ type TxnLookupReply struct { func (x *TxnLookupReply) Reset() { *x = TxnLookupReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[17] + mi := &file_remote_ethbackend_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -967,7 +1155,7 @@ func (x *TxnLookupReply) String() string { func (*TxnLookupReply) ProtoMessage() {} func (x *TxnLookupReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[17] + mi := &file_remote_ethbackend_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -980,7 +1168,7 @@ func (x *TxnLookupReply) ProtoReflect() protoreflect.Message { // Deprecated: Use TxnLookupReply.ProtoReflect.Descriptor instead. func (*TxnLookupReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{17} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{21} } func (x *TxnLookupReply) GetBlockNumber() uint64 { @@ -1001,7 +1189,7 @@ type NodesInfoRequest struct { func (x *NodesInfoRequest) Reset() { *x = NodesInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[18] + mi := &file_remote_ethbackend_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1014,7 +1202,7 @@ func (x *NodesInfoRequest) String() string { func (*NodesInfoRequest) ProtoMessage() {} func (x *NodesInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[18] + mi := &file_remote_ethbackend_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1027,7 +1215,7 @@ func (x *NodesInfoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use NodesInfoRequest.ProtoReflect.Descriptor instead. func (*NodesInfoRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{18} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{22} } func (x *NodesInfoRequest) GetLimit() uint32 { @@ -1048,7 +1236,7 @@ type AddPeerRequest struct { func (x *AddPeerRequest) Reset() { *x = AddPeerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[19] + mi := &file_remote_ethbackend_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1061,7 +1249,7 @@ func (x *AddPeerRequest) String() string { func (*AddPeerRequest) ProtoMessage() {} func (x *AddPeerRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[19] + mi := &file_remote_ethbackend_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1074,7 +1262,7 @@ func (x *AddPeerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPeerRequest.ProtoReflect.Descriptor instead. func (*AddPeerRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{19} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{23} } func (x *AddPeerRequest) GetUrl() string { @@ -1095,7 +1283,7 @@ type NodesInfoReply struct { func (x *NodesInfoReply) Reset() { *x = NodesInfoReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[20] + mi := &file_remote_ethbackend_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1108,7 +1296,7 @@ func (x *NodesInfoReply) String() string { func (*NodesInfoReply) ProtoMessage() {} func (x *NodesInfoReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[20] + mi := &file_remote_ethbackend_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1121,7 +1309,7 @@ func (x *NodesInfoReply) ProtoReflect() protoreflect.Message { // Deprecated: Use NodesInfoReply.ProtoReflect.Descriptor instead. func (*NodesInfoReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{20} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{24} } func (x *NodesInfoReply) GetNodesInfo() []*typesproto.NodeInfoReply { @@ -1142,7 +1330,7 @@ type PeersReply struct { func (x *PeersReply) Reset() { *x = PeersReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[21] + mi := &file_remote_ethbackend_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1155,7 +1343,7 @@ func (x *PeersReply) String() string { func (*PeersReply) ProtoMessage() {} func (x *PeersReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[21] + mi := &file_remote_ethbackend_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1168,7 +1356,7 @@ func (x *PeersReply) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersReply.ProtoReflect.Descriptor instead. func (*PeersReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{21} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{25} } func (x *PeersReply) GetPeers() []*typesproto.PeerInfo { @@ -1189,7 +1377,7 @@ type AddPeerReply struct { func (x *AddPeerReply) Reset() { *x = AddPeerReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[22] + mi := &file_remote_ethbackend_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1202,7 +1390,7 @@ func (x *AddPeerReply) String() string { func (*AddPeerReply) ProtoMessage() {} func (x *AddPeerReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[22] + mi := &file_remote_ethbackend_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1215,7 +1403,7 @@ func (x *AddPeerReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AddPeerReply.ProtoReflect.Descriptor instead. func (*AddPeerReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{22} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{26} } func (x *AddPeerReply) GetSuccess() bool { @@ -1236,7 +1424,7 @@ type PendingBlockReply struct { func (x *PendingBlockReply) Reset() { *x = PendingBlockReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[23] + mi := &file_remote_ethbackend_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1249,7 +1437,7 @@ func (x *PendingBlockReply) String() string { func (*PendingBlockReply) ProtoMessage() {} func (x *PendingBlockReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[23] + mi := &file_remote_ethbackend_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1262,7 +1450,7 @@ func (x *PendingBlockReply) ProtoReflect() protoreflect.Message { // Deprecated: Use PendingBlockReply.ProtoReflect.Descriptor instead. func (*PendingBlockReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{23} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{27} } func (x *PendingBlockReply) GetBlockRlp() []byte { @@ -1283,7 +1471,7 @@ type EngineGetPayloadBodiesByHashV1Request struct { func (x *EngineGetPayloadBodiesByHashV1Request) Reset() { *x = EngineGetPayloadBodiesByHashV1Request{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[24] + mi := &file_remote_ethbackend_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1296,7 +1484,7 @@ func (x *EngineGetPayloadBodiesByHashV1Request) String() string { func (*EngineGetPayloadBodiesByHashV1Request) ProtoMessage() {} func (x *EngineGetPayloadBodiesByHashV1Request) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[24] + mi := &file_remote_ethbackend_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1309,7 +1497,7 @@ func (x *EngineGetPayloadBodiesByHashV1Request) ProtoReflect() protoreflect.Mess // Deprecated: Use EngineGetPayloadBodiesByHashV1Request.ProtoReflect.Descriptor instead. func (*EngineGetPayloadBodiesByHashV1Request) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{24} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{28} } func (x *EngineGetPayloadBodiesByHashV1Request) GetHashes() []*typesproto.H256 { @@ -1331,7 +1519,7 @@ type EngineGetPayloadBodiesByRangeV1Request struct { func (x *EngineGetPayloadBodiesByRangeV1Request) Reset() { *x = EngineGetPayloadBodiesByRangeV1Request{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[25] + mi := &file_remote_ethbackend_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1344,7 +1532,7 @@ func (x *EngineGetPayloadBodiesByRangeV1Request) String() string { func (*EngineGetPayloadBodiesByRangeV1Request) ProtoMessage() {} func (x *EngineGetPayloadBodiesByRangeV1Request) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[25] + mi := &file_remote_ethbackend_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1357,7 +1545,7 @@ func (x *EngineGetPayloadBodiesByRangeV1Request) ProtoReflect() protoreflect.Mes // Deprecated: Use EngineGetPayloadBodiesByRangeV1Request.ProtoReflect.Descriptor instead. func (*EngineGetPayloadBodiesByRangeV1Request) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{25} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{29} } func (x *EngineGetPayloadBodiesByRangeV1Request) GetStart() uint64 { @@ -1385,7 +1573,7 @@ type BorEventRequest struct { func (x *BorEventRequest) Reset() { *x = BorEventRequest{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[26] + mi := &file_remote_ethbackend_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1398,7 +1586,7 @@ func (x *BorEventRequest) String() string { func (*BorEventRequest) ProtoMessage() {} func (x *BorEventRequest) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[26] + mi := &file_remote_ethbackend_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1411,7 +1599,7 @@ func (x *BorEventRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BorEventRequest.ProtoReflect.Descriptor instead. func (*BorEventRequest) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{26} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{30} } func (x *BorEventRequest) GetBorTxHash() *typesproto.H256 { @@ -1434,7 +1622,7 @@ type BorEventReply struct { func (x *BorEventReply) Reset() { *x = BorEventReply{} if protoimpl.UnsafeEnabled { - mi := &file_remote_ethbackend_proto_msgTypes[27] + mi := &file_remote_ethbackend_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1447,7 +1635,7 @@ func (x *BorEventReply) String() string { func (*BorEventReply) ProtoMessage() {} func (x *BorEventReply) ProtoReflect() protoreflect.Message { - mi := &file_remote_ethbackend_proto_msgTypes[27] + mi := &file_remote_ethbackend_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1460,7 +1648,7 @@ func (x *BorEventReply) ProtoReflect() protoreflect.Message { // Deprecated: Use BorEventReply.ProtoReflect.Descriptor instead. func (*BorEventReply) Descriptor() ([]byte, []int) { - return file_remote_ethbackend_proto_rawDescGZIP(), []int{27} + return file_remote_ethbackend_proto_rawDescGZIP(), []int{31} } func (x *BorEventReply) GetPresent() bool { @@ -1513,172 +1701,196 @@ var file_remote_ethbackend_proto_rawDesc = []byte{ 0x73, 0x74, 0x22, 0x31, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x47, 0x0a, 0x0e, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x21, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xa7, 0x01, 0x0a, 0x11, 0x4c, 0x6f, 0x67, 0x73, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, - 0x6c, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x12, 0x29, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x31, 0x36, 0x30, - 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, - 0x6c, 0x6c, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x61, 0x6c, 0x6c, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x12, 0x23, 0x0a, 0x06, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x22, - 0xdf, 0x02, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, - 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x48, 0x31, 0x36, 0x30, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2a, 0x0a, - 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x09, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x23, 0x0a, - 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, - 0x63, 0x73, 0x12, 0x36, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x64, 0x22, 0x5d, 0x0a, 0x0c, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x12, 0x2a, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x14, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, + 0x61, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, + 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x35, 0x0a, 0x12, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, + 0x36, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x36, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, + 0x3b, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x88, 0x01, + 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x35, 0x0a, 0x10, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, + 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x22, 0x47, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xa7, 0x01, 0x0a, + 0x11, 0x4c, 0x6f, 0x67, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x48, 0x31, 0x36, 0x30, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x54, 0x6f, 0x70, 0x69, 0x63, + 0x73, 0x12, 0x23, 0x0a, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x06, + 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x22, 0xdf, 0x02, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x31, 0x36, 0x30, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, - 0x22, 0x43, 0x0a, 0x0a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, - 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6c, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6c, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x0a, 0x10, 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x78, 0x6e, - 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x07, 0x74, 0x78, 0x6e, 0x48, 0x61, 0x73, - 0x68, 0x22, 0x33, 0x0a, 0x0e, 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x28, 0x0a, 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x22, 0x22, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x75, 0x72, 0x6c, 0x22, 0x45, 0x0a, 0x0e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x33, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x5f, - 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x33, 0x0a, 0x0a, 0x50, - 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x70, 0x65, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x22, 0x28, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x30, 0x0a, 0x11, 0x50, 0x65, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x1b, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6c, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6c, 0x70, 0x22, 0x4c, 0x0a, 0x25, - 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x56, 0x31, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, - 0x35, 0x36, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x54, 0x0a, 0x26, 0x45, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, - 0x64, 0x69, 0x65, 0x73, 0x42, 0x79, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x56, 0x31, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x3e, 0x0a, 0x0f, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x0b, 0x62, 0x6f, 0x72, 0x5f, 0x74, 0x78, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x09, 0x62, 0x6f, 0x72, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, - 0x22, 0x6b, 0x0a, 0x0d, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, - 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6c, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0c, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x6c, 0x70, 0x73, 0x2a, 0x4a, 0x0a, - 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x4f, - 0x47, 0x53, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, - 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x45, 0x57, 0x5f, 0x53, - 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x10, 0x03, 0x32, 0xd3, 0x07, 0x0a, 0x0a, 0x45, 0x54, - 0x48, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x12, 0x3d, 0x0a, 0x09, 0x45, 0x74, 0x68, 0x65, - 0x72, 0x62, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x61, - 0x73, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x40, 0x0a, 0x0a, 0x4e, 0x65, 0x74, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, - 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x17, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x65, 0x74, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x4e, 0x65, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x2e, 0x4e, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, - 0x4e, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4f, 0x0a, 0x0f, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x49, 0x0a, 0x0d, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x72, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3f, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x62, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x4a, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, - 0x30, 0x01, 0x12, 0x31, 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x2e, 0x72, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x12, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x09, 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x54, 0x78, 0x6e, 0x4c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, + 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x23, 0x0a, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, + 0x36, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x12, 0x36, 0x0a, 0x10, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, + 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, + 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x5d, 0x0a, 0x0c, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2a, 0x0a, 0x0a, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x09, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x43, 0x0a, 0x0a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, + 0x6c, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x6c, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x0a, 0x10, + 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x26, 0x0a, 0x08, 0x74, 0x78, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, + 0x07, 0x74, 0x78, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x22, 0x33, 0x0a, 0x0e, 0x54, 0x78, 0x6e, 0x4c, + 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x28, 0x0a, + 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x22, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x50, 0x65, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x45, 0x0a, 0x0e, 0x4e, + 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x33, 0x0a, + 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, + 0x66, 0x6f, 0x22, 0x33, 0x0a, 0x0a, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x25, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x28, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x50, 0x65, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x22, 0x30, 0x0a, 0x11, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x72, 0x6c, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x6c, 0x70, 0x22, 0x4c, 0x0a, 0x25, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x42, 0x79, 0x48, + 0x61, 0x73, 0x68, 0x56, 0x31, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, + 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, + 0x73, 0x22, 0x54, 0x0a, 0x26, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x42, 0x79, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x56, 0x31, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3e, 0x0a, 0x0f, 0x42, 0x6f, 0x72, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x0b, 0x62, 0x6f, + 0x72, 0x5f, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x32, 0x35, 0x36, 0x52, 0x09, 0x62, 0x6f, + 0x72, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x22, 0x6b, 0x0a, 0x0d, 0x42, 0x6f, 0x72, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x65, 0x73, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x65, 0x73, 0x65, + 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x72, + 0x6c, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x6c, 0x70, 0x73, 0x2a, 0x4a, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0a, 0x0a, + 0x06, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x4e, + 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x4f, 0x47, 0x53, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, + 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, 0x12, 0x10, + 0x0a, 0x0c, 0x4e, 0x45, 0x57, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x10, 0x03, + 0x32, 0xe6, 0x08, 0x0a, 0x0a, 0x45, 0x54, 0x48, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x12, + 0x3d, 0x0a, 0x09, 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x61, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, + 0x45, 0x74, 0x68, 0x65, 0x72, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x40, + 0x0a, 0x0a, 0x4e, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x4e, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x46, 0x0a, 0x0c, 0x4e, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x1b, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x65, 0x74, 0x50, 0x65, 0x65, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x4f, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x49, 0x0a, 0x0d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3f, 0x0a, 0x09, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x30, 0x01, 0x12, 0x4a, 0x0a, + 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x19, + 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x67, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x30, 0x01, 0x12, 0x31, 0x0a, 0x05, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x14, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x49, 0x0a, 0x0d, + 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, + 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x48, 0x61, + 0x73, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x3d, 0x0a, 0x09, 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3c, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, 0x6d, - 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x50, - 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x65, 0x6d, - 0x6f, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x41, 0x0a, 0x0c, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x3a, 0x0a, 0x08, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, - 0x17, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2e, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, - 0x16, 0x5a, 0x14, 0x2e, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3b, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, + 0x54, 0x78, 0x6e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3c, + 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x33, 0x0a, 0x05, + 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x37, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x41, 0x64, + 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x41, 0x0a, 0x0c, 0x50, 0x65, + 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3a, 0x0a, + 0x08, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x42, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x42, 0x6f, 0x72, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x16, 0x5a, 0x14, 0x2e, 0x2f, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3b, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1694,7 +1906,7 @@ func file_remote_ethbackend_proto_rawDescGZIP() []byte { } var file_remote_ethbackend_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_remote_ethbackend_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_remote_ethbackend_proto_msgTypes = make([]protoimpl.MessageInfo, 32) var file_remote_ethbackend_proto_goTypes = []any{ (Event)(0), // 0: remote.Event (*EtherbaseRequest)(nil), // 1: remote.EtherbaseRequest @@ -1707,82 +1919,92 @@ var file_remote_ethbackend_proto_goTypes = []any{ (*ProtocolVersionReply)(nil), // 8: remote.ProtocolVersionReply (*ClientVersionRequest)(nil), // 9: remote.ClientVersionRequest (*ClientVersionReply)(nil), // 10: remote.ClientVersionReply - (*SubscribeRequest)(nil), // 11: remote.SubscribeRequest - (*SubscribeReply)(nil), // 12: remote.SubscribeReply - (*LogsFilterRequest)(nil), // 13: remote.LogsFilterRequest - (*SubscribeLogsReply)(nil), // 14: remote.SubscribeLogsReply - (*BlockRequest)(nil), // 15: remote.BlockRequest - (*BlockReply)(nil), // 16: remote.BlockReply - (*TxnLookupRequest)(nil), // 17: remote.TxnLookupRequest - (*TxnLookupReply)(nil), // 18: remote.TxnLookupReply - (*NodesInfoRequest)(nil), // 19: remote.NodesInfoRequest - (*AddPeerRequest)(nil), // 20: remote.AddPeerRequest - (*NodesInfoReply)(nil), // 21: remote.NodesInfoReply - (*PeersReply)(nil), // 22: remote.PeersReply - (*AddPeerReply)(nil), // 23: remote.AddPeerReply - (*PendingBlockReply)(nil), // 24: remote.PendingBlockReply - (*EngineGetPayloadBodiesByHashV1Request)(nil), // 25: remote.EngineGetPayloadBodiesByHashV1Request - (*EngineGetPayloadBodiesByRangeV1Request)(nil), // 26: remote.EngineGetPayloadBodiesByRangeV1Request - (*BorEventRequest)(nil), // 27: remote.BorEventRequest - (*BorEventReply)(nil), // 28: remote.BorEventReply - (*typesproto.H160)(nil), // 29: types.H160 - (*typesproto.H256)(nil), // 30: types.H256 - (*typesproto.NodeInfoReply)(nil), // 31: types.NodeInfoReply - (*typesproto.PeerInfo)(nil), // 32: types.PeerInfo - (*emptypb.Empty)(nil), // 33: google.protobuf.Empty - (*typesproto.VersionReply)(nil), // 34: types.VersionReply + (*CanonicalHashRequest)(nil), // 11: remote.CanonicalHashRequest + (*CanonicalHashReply)(nil), // 12: remote.CanonicalHashReply + (*HeaderNumberRequest)(nil), // 13: remote.HeaderNumberRequest + (*HeaderNumberReply)(nil), // 14: remote.HeaderNumberReply + (*SubscribeRequest)(nil), // 15: remote.SubscribeRequest + (*SubscribeReply)(nil), // 16: remote.SubscribeReply + (*LogsFilterRequest)(nil), // 17: remote.LogsFilterRequest + (*SubscribeLogsReply)(nil), // 18: remote.SubscribeLogsReply + (*BlockRequest)(nil), // 19: remote.BlockRequest + (*BlockReply)(nil), // 20: remote.BlockReply + (*TxnLookupRequest)(nil), // 21: remote.TxnLookupRequest + (*TxnLookupReply)(nil), // 22: remote.TxnLookupReply + (*NodesInfoRequest)(nil), // 23: remote.NodesInfoRequest + (*AddPeerRequest)(nil), // 24: remote.AddPeerRequest + (*NodesInfoReply)(nil), // 25: remote.NodesInfoReply + (*PeersReply)(nil), // 26: remote.PeersReply + (*AddPeerReply)(nil), // 27: remote.AddPeerReply + (*PendingBlockReply)(nil), // 28: remote.PendingBlockReply + (*EngineGetPayloadBodiesByHashV1Request)(nil), // 29: remote.EngineGetPayloadBodiesByHashV1Request + (*EngineGetPayloadBodiesByRangeV1Request)(nil), // 30: remote.EngineGetPayloadBodiesByRangeV1Request + (*BorEventRequest)(nil), // 31: remote.BorEventRequest + (*BorEventReply)(nil), // 32: remote.BorEventReply + (*typesproto.H160)(nil), // 33: types.H160 + (*typesproto.H256)(nil), // 34: types.H256 + (*typesproto.NodeInfoReply)(nil), // 35: types.NodeInfoReply + (*typesproto.PeerInfo)(nil), // 36: types.PeerInfo + (*emptypb.Empty)(nil), // 37: google.protobuf.Empty + (*typesproto.VersionReply)(nil), // 38: types.VersionReply } var file_remote_ethbackend_proto_depIdxs = []int32{ - 29, // 0: remote.EtherbaseReply.address:type_name -> types.H160 - 0, // 1: remote.SubscribeRequest.type:type_name -> remote.Event - 0, // 2: remote.SubscribeReply.type:type_name -> remote.Event - 29, // 3: remote.LogsFilterRequest.addresses:type_name -> types.H160 - 30, // 4: remote.LogsFilterRequest.topics:type_name -> types.H256 - 29, // 5: remote.SubscribeLogsReply.address:type_name -> types.H160 - 30, // 6: remote.SubscribeLogsReply.block_hash:type_name -> types.H256 - 30, // 7: remote.SubscribeLogsReply.topics:type_name -> types.H256 - 30, // 8: remote.SubscribeLogsReply.transaction_hash:type_name -> types.H256 - 30, // 9: remote.BlockRequest.block_hash:type_name -> types.H256 - 30, // 10: remote.TxnLookupRequest.txn_hash:type_name -> types.H256 - 31, // 11: remote.NodesInfoReply.nodes_info:type_name -> types.NodeInfoReply - 32, // 12: remote.PeersReply.peers:type_name -> types.PeerInfo - 30, // 13: remote.EngineGetPayloadBodiesByHashV1Request.hashes:type_name -> types.H256 - 30, // 14: remote.BorEventRequest.bor_tx_hash:type_name -> types.H256 - 1, // 15: remote.ETHBACKEND.Etherbase:input_type -> remote.EtherbaseRequest - 3, // 16: remote.ETHBACKEND.NetVersion:input_type -> remote.NetVersionRequest - 5, // 17: remote.ETHBACKEND.NetPeerCount:input_type -> remote.NetPeerCountRequest - 33, // 18: remote.ETHBACKEND.Version:input_type -> google.protobuf.Empty - 7, // 19: remote.ETHBACKEND.ProtocolVersion:input_type -> remote.ProtocolVersionRequest - 9, // 20: remote.ETHBACKEND.ClientVersion:input_type -> remote.ClientVersionRequest - 11, // 21: remote.ETHBACKEND.Subscribe:input_type -> remote.SubscribeRequest - 13, // 22: remote.ETHBACKEND.SubscribeLogs:input_type -> remote.LogsFilterRequest - 15, // 23: remote.ETHBACKEND.Block:input_type -> remote.BlockRequest - 17, // 24: remote.ETHBACKEND.TxnLookup:input_type -> remote.TxnLookupRequest - 19, // 25: remote.ETHBACKEND.NodeInfo:input_type -> remote.NodesInfoRequest - 33, // 26: remote.ETHBACKEND.Peers:input_type -> google.protobuf.Empty - 20, // 27: remote.ETHBACKEND.AddPeer:input_type -> remote.AddPeerRequest - 33, // 28: remote.ETHBACKEND.PendingBlock:input_type -> google.protobuf.Empty - 27, // 29: remote.ETHBACKEND.BorEvent:input_type -> remote.BorEventRequest - 2, // 30: remote.ETHBACKEND.Etherbase:output_type -> remote.EtherbaseReply - 4, // 31: remote.ETHBACKEND.NetVersion:output_type -> remote.NetVersionReply - 6, // 32: remote.ETHBACKEND.NetPeerCount:output_type -> remote.NetPeerCountReply - 34, // 33: remote.ETHBACKEND.Version:output_type -> types.VersionReply - 8, // 34: remote.ETHBACKEND.ProtocolVersion:output_type -> remote.ProtocolVersionReply - 10, // 35: remote.ETHBACKEND.ClientVersion:output_type -> remote.ClientVersionReply - 12, // 36: remote.ETHBACKEND.Subscribe:output_type -> remote.SubscribeReply - 14, // 37: remote.ETHBACKEND.SubscribeLogs:output_type -> remote.SubscribeLogsReply - 16, // 38: remote.ETHBACKEND.Block:output_type -> remote.BlockReply - 18, // 39: remote.ETHBACKEND.TxnLookup:output_type -> remote.TxnLookupReply - 21, // 40: remote.ETHBACKEND.NodeInfo:output_type -> remote.NodesInfoReply - 22, // 41: remote.ETHBACKEND.Peers:output_type -> remote.PeersReply - 23, // 42: remote.ETHBACKEND.AddPeer:output_type -> remote.AddPeerReply - 24, // 43: remote.ETHBACKEND.PendingBlock:output_type -> remote.PendingBlockReply - 28, // 44: remote.ETHBACKEND.BorEvent:output_type -> remote.BorEventReply - 30, // [30:45] is the sub-list for method output_type - 15, // [15:30] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 33, // 0: remote.EtherbaseReply.address:type_name -> types.H160 + 34, // 1: remote.CanonicalHashReply.hash:type_name -> types.H256 + 34, // 2: remote.HeaderNumberRequest.hash:type_name -> types.H256 + 0, // 3: remote.SubscribeRequest.type:type_name -> remote.Event + 0, // 4: remote.SubscribeReply.type:type_name -> remote.Event + 33, // 5: remote.LogsFilterRequest.addresses:type_name -> types.H160 + 34, // 6: remote.LogsFilterRequest.topics:type_name -> types.H256 + 33, // 7: remote.SubscribeLogsReply.address:type_name -> types.H160 + 34, // 8: remote.SubscribeLogsReply.block_hash:type_name -> types.H256 + 34, // 9: remote.SubscribeLogsReply.topics:type_name -> types.H256 + 34, // 10: remote.SubscribeLogsReply.transaction_hash:type_name -> types.H256 + 34, // 11: remote.BlockRequest.block_hash:type_name -> types.H256 + 34, // 12: remote.TxnLookupRequest.txn_hash:type_name -> types.H256 + 35, // 13: remote.NodesInfoReply.nodes_info:type_name -> types.NodeInfoReply + 36, // 14: remote.PeersReply.peers:type_name -> types.PeerInfo + 34, // 15: remote.EngineGetPayloadBodiesByHashV1Request.hashes:type_name -> types.H256 + 34, // 16: remote.BorEventRequest.bor_tx_hash:type_name -> types.H256 + 1, // 17: remote.ETHBACKEND.Etherbase:input_type -> remote.EtherbaseRequest + 3, // 18: remote.ETHBACKEND.NetVersion:input_type -> remote.NetVersionRequest + 5, // 19: remote.ETHBACKEND.NetPeerCount:input_type -> remote.NetPeerCountRequest + 37, // 20: remote.ETHBACKEND.Version:input_type -> google.protobuf.Empty + 7, // 21: remote.ETHBACKEND.ProtocolVersion:input_type -> remote.ProtocolVersionRequest + 9, // 22: remote.ETHBACKEND.ClientVersion:input_type -> remote.ClientVersionRequest + 15, // 23: remote.ETHBACKEND.Subscribe:input_type -> remote.SubscribeRequest + 17, // 24: remote.ETHBACKEND.SubscribeLogs:input_type -> remote.LogsFilterRequest + 19, // 25: remote.ETHBACKEND.Block:input_type -> remote.BlockRequest + 11, // 26: remote.ETHBACKEND.CanonicalHash:input_type -> remote.CanonicalHashRequest + 13, // 27: remote.ETHBACKEND.HeaderNumber:input_type -> remote.HeaderNumberRequest + 21, // 28: remote.ETHBACKEND.TxnLookup:input_type -> remote.TxnLookupRequest + 23, // 29: remote.ETHBACKEND.NodeInfo:input_type -> remote.NodesInfoRequest + 37, // 30: remote.ETHBACKEND.Peers:input_type -> google.protobuf.Empty + 24, // 31: remote.ETHBACKEND.AddPeer:input_type -> remote.AddPeerRequest + 37, // 32: remote.ETHBACKEND.PendingBlock:input_type -> google.protobuf.Empty + 31, // 33: remote.ETHBACKEND.BorEvent:input_type -> remote.BorEventRequest + 2, // 34: remote.ETHBACKEND.Etherbase:output_type -> remote.EtherbaseReply + 4, // 35: remote.ETHBACKEND.NetVersion:output_type -> remote.NetVersionReply + 6, // 36: remote.ETHBACKEND.NetPeerCount:output_type -> remote.NetPeerCountReply + 38, // 37: remote.ETHBACKEND.Version:output_type -> types.VersionReply + 8, // 38: remote.ETHBACKEND.ProtocolVersion:output_type -> remote.ProtocolVersionReply + 10, // 39: remote.ETHBACKEND.ClientVersion:output_type -> remote.ClientVersionReply + 16, // 40: remote.ETHBACKEND.Subscribe:output_type -> remote.SubscribeReply + 18, // 41: remote.ETHBACKEND.SubscribeLogs:output_type -> remote.SubscribeLogsReply + 20, // 42: remote.ETHBACKEND.Block:output_type -> remote.BlockReply + 12, // 43: remote.ETHBACKEND.CanonicalHash:output_type -> remote.CanonicalHashReply + 14, // 44: remote.ETHBACKEND.HeaderNumber:output_type -> remote.HeaderNumberReply + 22, // 45: remote.ETHBACKEND.TxnLookup:output_type -> remote.TxnLookupReply + 25, // 46: remote.ETHBACKEND.NodeInfo:output_type -> remote.NodesInfoReply + 26, // 47: remote.ETHBACKEND.Peers:output_type -> remote.PeersReply + 27, // 48: remote.ETHBACKEND.AddPeer:output_type -> remote.AddPeerReply + 28, // 49: remote.ETHBACKEND.PendingBlock:output_type -> remote.PendingBlockReply + 32, // 50: remote.ETHBACKEND.BorEvent:output_type -> remote.BorEventReply + 34, // [34:51] is the sub-list for method output_type + 17, // [17:34] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_remote_ethbackend_proto_init() } @@ -1912,7 +2134,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeRequest); i { + switch v := v.(*CanonicalHashRequest); i { case 0: return &v.state case 1: @@ -1924,7 +2146,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeReply); i { + switch v := v.(*CanonicalHashReply); i { case 0: return &v.state case 1: @@ -1936,7 +2158,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*LogsFilterRequest); i { + switch v := v.(*HeaderNumberRequest); i { case 0: return &v.state case 1: @@ -1948,7 +2170,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeLogsReply); i { + switch v := v.(*HeaderNumberReply); i { case 0: return &v.state case 1: @@ -1960,7 +2182,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*BlockRequest); i { + switch v := v.(*SubscribeRequest); i { case 0: return &v.state case 1: @@ -1972,7 +2194,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*BlockReply); i { + switch v := v.(*SubscribeReply); i { case 0: return &v.state case 1: @@ -1984,7 +2206,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*TxnLookupRequest); i { + switch v := v.(*LogsFilterRequest); i { case 0: return &v.state case 1: @@ -1996,7 +2218,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*TxnLookupReply); i { + switch v := v.(*SubscribeLogsReply); i { case 0: return &v.state case 1: @@ -2008,7 +2230,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*NodesInfoRequest); i { + switch v := v.(*BlockRequest); i { case 0: return &v.state case 1: @@ -2020,7 +2242,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerRequest); i { + switch v := v.(*BlockReply); i { case 0: return &v.state case 1: @@ -2032,7 +2254,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*NodesInfoReply); i { + switch v := v.(*TxnLookupRequest); i { case 0: return &v.state case 1: @@ -2044,7 +2266,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[21].Exporter = func(v any, i int) any { - switch v := v.(*PeersReply); i { + switch v := v.(*TxnLookupReply); i { case 0: return &v.state case 1: @@ -2056,7 +2278,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[22].Exporter = func(v any, i int) any { - switch v := v.(*AddPeerReply); i { + switch v := v.(*NodesInfoRequest); i { case 0: return &v.state case 1: @@ -2068,7 +2290,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[23].Exporter = func(v any, i int) any { - switch v := v.(*PendingBlockReply); i { + switch v := v.(*AddPeerRequest); i { case 0: return &v.state case 1: @@ -2080,7 +2302,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[24].Exporter = func(v any, i int) any { - switch v := v.(*EngineGetPayloadBodiesByHashV1Request); i { + switch v := v.(*NodesInfoReply); i { case 0: return &v.state case 1: @@ -2092,7 +2314,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[25].Exporter = func(v any, i int) any { - switch v := v.(*EngineGetPayloadBodiesByRangeV1Request); i { + switch v := v.(*PeersReply); i { case 0: return &v.state case 1: @@ -2104,7 +2326,7 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[26].Exporter = func(v any, i int) any { - switch v := v.(*BorEventRequest); i { + switch v := v.(*AddPeerReply); i { case 0: return &v.state case 1: @@ -2116,6 +2338,54 @@ func file_remote_ethbackend_proto_init() { } } file_remote_ethbackend_proto_msgTypes[27].Exporter = func(v any, i int) any { + switch v := v.(*PendingBlockReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_remote_ethbackend_proto_msgTypes[28].Exporter = func(v any, i int) any { + switch v := v.(*EngineGetPayloadBodiesByHashV1Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_remote_ethbackend_proto_msgTypes[29].Exporter = func(v any, i int) any { + switch v := v.(*EngineGetPayloadBodiesByRangeV1Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_remote_ethbackend_proto_msgTypes[30].Exporter = func(v any, i int) any { + switch v := v.(*BorEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_remote_ethbackend_proto_msgTypes[31].Exporter = func(v any, i int) any { switch v := v.(*BorEventReply); i { case 0: return &v.state @@ -2128,13 +2398,14 @@ func file_remote_ethbackend_proto_init() { } } } + file_remote_ethbackend_proto_msgTypes[13].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_remote_ethbackend_proto_rawDesc, NumEnums: 1, - NumMessages: 28, + NumMessages: 32, NumExtensions: 0, NumServices: 1, }, diff --git a/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go b/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go index 804d62e8b34..01e0fb2753e 100644 --- a/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go +++ b/erigon-lib/gointerfaces/remoteproto/ethbackend_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc v5.27.1 // source: remote/ethbackend.proto @@ -17,8 +17,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ETHBACKEND_Etherbase_FullMethodName = "/remote.ETHBACKEND/Etherbase" @@ -30,6 +30,8 @@ const ( ETHBACKEND_Subscribe_FullMethodName = "/remote.ETHBACKEND/Subscribe" ETHBACKEND_SubscribeLogs_FullMethodName = "/remote.ETHBACKEND/SubscribeLogs" ETHBACKEND_Block_FullMethodName = "/remote.ETHBACKEND/Block" + ETHBACKEND_CanonicalHash_FullMethodName = "/remote.ETHBACKEND/CanonicalHash" + ETHBACKEND_HeaderNumber_FullMethodName = "/remote.ETHBACKEND/HeaderNumber" ETHBACKEND_TxnLookup_FullMethodName = "/remote.ETHBACKEND/TxnLookup" ETHBACKEND_NodeInfo_FullMethodName = "/remote.ETHBACKEND/NodeInfo" ETHBACKEND_Peers_FullMethodName = "/remote.ETHBACKEND/Peers" @@ -51,13 +53,17 @@ type ETHBACKENDClient interface { ProtocolVersion(ctx context.Context, in *ProtocolVersionRequest, opts ...grpc.CallOption) (*ProtocolVersionReply, error) // ClientVersion returns the Ethereum client version string using node name convention (e.g. TurboGeth/v2021.03.2-alpha/Linux). ClientVersion(ctx context.Context, in *ClientVersionRequest, opts ...grpc.CallOption) (*ClientVersionReply, error) - Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (ETHBACKEND_SubscribeClient, error) + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeReply], error) // Only one subscription is needed to serve all the users, LogsFilterRequest allows to dynamically modifying the subscription - SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (ETHBACKEND_SubscribeLogsClient, error) + SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply], error) // High-level method - can read block from db, snapshots or apply any other logic // it doesn't provide consistency // Request fields are optional - it's ok to request block only by hash or only by number Block(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockReply, error) + // High-level method - can find block hash by block number + CanonicalHash(ctx context.Context, in *CanonicalHashRequest, opts ...grpc.CallOption) (*CanonicalHashReply, error) + // High-level method - can find block number by block hash + HeaderNumber(ctx context.Context, in *HeaderNumberRequest, opts ...grpc.CallOption) (*HeaderNumberReply, error) // High-level method - can find block number by txn hash // it doesn't provide consistency TxnLookup(ctx context.Context, in *TxnLookupRequest, opts ...grpc.CallOption) (*TxnLookupReply, error) @@ -139,13 +145,13 @@ func (c *eTHBACKENDClient) ClientVersion(ctx context.Context, in *ClientVersionR return out, nil } -func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (ETHBACKEND_SubscribeClient, error) { +func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, ÐBACKEND_ServiceDesc.Streams[0], ETHBACKEND_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &eTHBACKENDSubscribeClient{ClientStream: stream} + x := &grpc.GenericClientStream[SubscribeRequest, SubscribeReply]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -155,59 +161,46 @@ func (c *eTHBACKENDClient) Subscribe(ctx context.Context, in *SubscribeRequest, return x, nil } -type ETHBACKEND_SubscribeClient interface { - Recv() (*SubscribeReply, error) - grpc.ClientStream -} - -type eTHBACKENDSubscribeClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeClient = grpc.ServerStreamingClient[SubscribeReply] -func (x *eTHBACKENDSubscribeClient) Recv() (*SubscribeReply, error) { - m := new(SubscribeReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *eTHBACKENDClient) SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (ETHBACKEND_SubscribeLogsClient, error) { +func (c *eTHBACKENDClient) SubscribeLogs(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, ÐBACKEND_ServiceDesc.Streams[1], ETHBACKEND_SubscribeLogs_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &eTHBACKENDSubscribeLogsClient{ClientStream: stream} + x := &grpc.GenericClientStream[LogsFilterRequest, SubscribeLogsReply]{ClientStream: stream} return x, nil } -type ETHBACKEND_SubscribeLogsClient interface { - Send(*LogsFilterRequest) error - Recv() (*SubscribeLogsReply, error) - grpc.ClientStream -} - -type eTHBACKENDSubscribeLogsClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeLogsClient = grpc.BidiStreamingClient[LogsFilterRequest, SubscribeLogsReply] -func (x *eTHBACKENDSubscribeLogsClient) Send(m *LogsFilterRequest) error { - return x.ClientStream.SendMsg(m) +func (c *eTHBACKENDClient) Block(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BlockReply) + err := c.cc.Invoke(ctx, ETHBACKEND_Block_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil } -func (x *eTHBACKENDSubscribeLogsClient) Recv() (*SubscribeLogsReply, error) { - m := new(SubscribeLogsReply) - if err := x.ClientStream.RecvMsg(m); err != nil { +func (c *eTHBACKENDClient) CanonicalHash(ctx context.Context, in *CanonicalHashRequest, opts ...grpc.CallOption) (*CanonicalHashReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CanonicalHashReply) + err := c.cc.Invoke(ctx, ETHBACKEND_CanonicalHash_FullMethodName, in, out, cOpts...) + if err != nil { return nil, err } - return m, nil + return out, nil } -func (c *eTHBACKENDClient) Block(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockReply, error) { +func (c *eTHBACKENDClient) HeaderNumber(ctx context.Context, in *HeaderNumberRequest, opts ...grpc.CallOption) (*HeaderNumberReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(BlockReply) - err := c.cc.Invoke(ctx, ETHBACKEND_Block_FullMethodName, in, out, cOpts...) + out := new(HeaderNumberReply) + err := c.cc.Invoke(ctx, ETHBACKEND_HeaderNumber_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -276,7 +269,7 @@ func (c *eTHBACKENDClient) BorEvent(ctx context.Context, in *BorEventRequest, op // ETHBACKENDServer is the server API for ETHBACKEND service. // All implementations must embed UnimplementedETHBACKENDServer -// for forward compatibility +// for forward compatibility. type ETHBACKENDServer interface { Etherbase(context.Context, *EtherbaseRequest) (*EtherbaseReply, error) NetVersion(context.Context, *NetVersionRequest) (*NetVersionReply, error) @@ -287,13 +280,17 @@ type ETHBACKENDServer interface { ProtocolVersion(context.Context, *ProtocolVersionRequest) (*ProtocolVersionReply, error) // ClientVersion returns the Ethereum client version string using node name convention (e.g. TurboGeth/v2021.03.2-alpha/Linux). ClientVersion(context.Context, *ClientVersionRequest) (*ClientVersionReply, error) - Subscribe(*SubscribeRequest, ETHBACKEND_SubscribeServer) error + Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeReply]) error // Only one subscription is needed to serve all the users, LogsFilterRequest allows to dynamically modifying the subscription - SubscribeLogs(ETHBACKEND_SubscribeLogsServer) error + SubscribeLogs(grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply]) error // High-level method - can read block from db, snapshots or apply any other logic // it doesn't provide consistency // Request fields are optional - it's ok to request block only by hash or only by number Block(context.Context, *BlockRequest) (*BlockReply, error) + // High-level method - can find block hash by block number + CanonicalHash(context.Context, *CanonicalHashRequest) (*CanonicalHashReply, error) + // High-level method - can find block number by block hash + HeaderNumber(context.Context, *HeaderNumberRequest) (*HeaderNumberReply, error) // High-level method - can find block number by txn hash // it doesn't provide consistency TxnLookup(context.Context, *TxnLookupRequest) (*TxnLookupReply, error) @@ -308,9 +305,12 @@ type ETHBACKENDServer interface { mustEmbedUnimplementedETHBACKENDServer() } -// UnimplementedETHBACKENDServer must be embedded to have forward compatible implementations. -type UnimplementedETHBACKENDServer struct { -} +// UnimplementedETHBACKENDServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedETHBACKENDServer struct{} func (UnimplementedETHBACKENDServer) Etherbase(context.Context, *EtherbaseRequest) (*EtherbaseReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Etherbase not implemented") @@ -330,15 +330,21 @@ func (UnimplementedETHBACKENDServer) ProtocolVersion(context.Context, *ProtocolV func (UnimplementedETHBACKENDServer) ClientVersion(context.Context, *ClientVersionRequest) (*ClientVersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ClientVersion not implemented") } -func (UnimplementedETHBACKENDServer) Subscribe(*SubscribeRequest, ETHBACKEND_SubscribeServer) error { +func (UnimplementedETHBACKENDServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeReply]) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } -func (UnimplementedETHBACKENDServer) SubscribeLogs(ETHBACKEND_SubscribeLogsServer) error { +func (UnimplementedETHBACKENDServer) SubscribeLogs(grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply]) error { return status.Errorf(codes.Unimplemented, "method SubscribeLogs not implemented") } func (UnimplementedETHBACKENDServer) Block(context.Context, *BlockRequest) (*BlockReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Block not implemented") } +func (UnimplementedETHBACKENDServer) CanonicalHash(context.Context, *CanonicalHashRequest) (*CanonicalHashReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method CanonicalHash not implemented") +} +func (UnimplementedETHBACKENDServer) HeaderNumber(context.Context, *HeaderNumberRequest) (*HeaderNumberReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method HeaderNumber not implemented") +} func (UnimplementedETHBACKENDServer) TxnLookup(context.Context, *TxnLookupRequest) (*TxnLookupReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TxnLookup not implemented") } @@ -358,6 +364,7 @@ func (UnimplementedETHBACKENDServer) BorEvent(context.Context, *BorEventRequest) return nil, status.Errorf(codes.Unimplemented, "method BorEvent not implemented") } func (UnimplementedETHBACKENDServer) mustEmbedUnimplementedETHBACKENDServer() {} +func (UnimplementedETHBACKENDServer) testEmbeddedByValue() {} // UnsafeETHBACKENDServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ETHBACKENDServer will @@ -367,6 +374,13 @@ type UnsafeETHBACKENDServer interface { } func RegisterETHBACKENDServer(s grpc.ServiceRegistrar, srv ETHBACKENDServer) { + // If the following call pancis, it indicates UnimplementedETHBACKENDServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(ÐBACKEND_ServiceDesc, srv) } @@ -483,62 +497,69 @@ func _ETHBACKEND_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) er if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ETHBACKENDServer).Subscribe(m, &eTHBACKENDSubscribeServer{ServerStream: stream}) + return srv.(ETHBACKENDServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, SubscribeReply]{ServerStream: stream}) } -type ETHBACKEND_SubscribeServer interface { - Send(*SubscribeReply) error - grpc.ServerStream -} - -type eTHBACKENDSubscribeServer struct { - grpc.ServerStream -} - -func (x *eTHBACKENDSubscribeServer) Send(m *SubscribeReply) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeServer = grpc.ServerStreamingServer[SubscribeReply] func _ETHBACKEND_SubscribeLogs_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ETHBACKENDServer).SubscribeLogs(&eTHBACKENDSubscribeLogsServer{ServerStream: stream}) + return srv.(ETHBACKENDServer).SubscribeLogs(&grpc.GenericServerStream[LogsFilterRequest, SubscribeLogsReply]{ServerStream: stream}) } -type ETHBACKEND_SubscribeLogsServer interface { - Send(*SubscribeLogsReply) error - Recv() (*LogsFilterRequest, error) - grpc.ServerStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ETHBACKEND_SubscribeLogsServer = grpc.BidiStreamingServer[LogsFilterRequest, SubscribeLogsReply] -type eTHBACKENDSubscribeLogsServer struct { - grpc.ServerStream -} - -func (x *eTHBACKENDSubscribeLogsServer) Send(m *SubscribeLogsReply) error { - return x.ServerStream.SendMsg(m) +func _ETHBACKEND_Block_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ETHBACKENDServer).Block(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ETHBACKEND_Block_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ETHBACKENDServer).Block(ctx, req.(*BlockRequest)) + } + return interceptor(ctx, in, info, handler) } -func (x *eTHBACKENDSubscribeLogsServer) Recv() (*LogsFilterRequest, error) { - m := new(LogsFilterRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { +func _ETHBACKEND_CanonicalHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CanonicalHashRequest) + if err := dec(in); err != nil { return nil, err } - return m, nil + if interceptor == nil { + return srv.(ETHBACKENDServer).CanonicalHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ETHBACKEND_CanonicalHash_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ETHBACKENDServer).CanonicalHash(ctx, req.(*CanonicalHashRequest)) + } + return interceptor(ctx, in, info, handler) } -func _ETHBACKEND_Block_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BlockRequest) +func _ETHBACKEND_HeaderNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeaderNumberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ETHBACKENDServer).Block(ctx, in) + return srv.(ETHBACKENDServer).HeaderNumber(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ETHBACKEND_Block_FullMethodName, + FullMethod: ETHBACKEND_HeaderNumber_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ETHBACKENDServer).Block(ctx, req.(*BlockRequest)) + return srv.(ETHBACKENDServer).HeaderNumber(ctx, req.(*HeaderNumberRequest)) } return interceptor(ctx, in, info, handler) } @@ -686,6 +707,14 @@ var ETHBACKEND_ServiceDesc = grpc.ServiceDesc{ MethodName: "Block", Handler: _ETHBACKEND_Block_Handler, }, + { + MethodName: "CanonicalHash", + Handler: _ETHBACKEND_CanonicalHash_Handler, + }, + { + MethodName: "HeaderNumber", + Handler: _ETHBACKEND_HeaderNumber_Handler, + }, { MethodName: "TxnLookup", Handler: _ETHBACKEND_TxnLookup_Handler, diff --git a/eth/consensuschain/consensus_chain_reader.go b/eth/consensuschain/consensus_chain_reader.go index 319675be2fe..d06a20f1e83 100644 --- a/eth/consensuschain/consensus_chain_reader.go +++ b/eth/consensuschain/consensus_chain_reader.go @@ -44,20 +44,17 @@ func NewReader(config *chain.Config, tx kv.Tx, blockReader services.FullBlockRea func (cr Reader) Config() *chain.Config { return cr.config } func (cr Reader) CurrentHeader() *types.Header { hash := rawdb.ReadHeadHeaderHash(cr.tx) - number := rawdb.ReadHeaderNumber(cr.tx, hash) - h, _ := cr.blockReader.Header(context.Background(), cr.tx, hash, *number) + h, _ := cr.blockReader.HeaderByHash(context.TODO(), cr.tx, hash) return h } func (cr Reader) CurrentFinalizedHeader() *types.Header { hash := rawdb.ReadForkchoiceFinalized(cr.tx) - number := rawdb.ReadHeaderNumber(cr.tx, hash) - h, _ := cr.blockReader.Header(context.Background(), cr.tx, hash, *number) + h, _ := cr.blockReader.HeaderByHash(context.Background(), cr.tx, hash) return h } func (cr Reader) CurrentSafeHeader() *types.Header { hash := rawdb.ReadForkchoiceSafe(cr.tx) - number := rawdb.ReadHeaderNumber(cr.tx, hash) - h, _ := cr.blockReader.Header(context.Background(), cr.tx, hash, *number) + h, _ := cr.blockReader.HeaderByHash(context.Background(), cr.tx, hash) return h } func (cr Reader) GetHeader(hash common.Hash, number uint64) *types.Header { diff --git a/eth/integrity/no_gaps_in_canonical_headers.go b/eth/integrity/no_gaps_in_canonical_headers.go index 56678a65f84..433941ad659 100644 --- a/eth/integrity/no_gaps_in_canonical_headers.go +++ b/eth/integrity/no_gaps_in_canonical_headers.go @@ -45,7 +45,7 @@ func NoGapsInCanonicalHeaders(tx kv.Tx, ctx context.Context, br services.FullBlo } for i := firstBlockInDB; i < lastBlockNum; i++ { - hash, err := rawdb.ReadCanonicalHash(tx, i) + hash, err := br.CanonicalHash(ctx, tx, i) if err != nil { panic(err) } diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index f089053a70a..b56549fc414 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -146,7 +146,7 @@ func AnswerGetBlockBodiesQuery(db kv.Tx, query GetBlockBodiesPacket, blockReader lookups >= 2*MaxBodiesServe { break } - number := rawdb.ReadHeaderNumber(db, hash) + number, _ := blockReader.HeaderNumber(context.Background(), db, hash) if number == nil { continue } @@ -176,7 +176,7 @@ func AnswerGetReceiptsQuery(ctx context.Context, cfg *chain.Config, receiptsGett lookups >= 2*maxReceiptsServe { break } - number := rawdb.ReadHeaderNumber(db, hash) + number, _ := br.HeaderNumber(context.Background(), db, hash) if number == nil { return nil, nil } diff --git a/eth/stagedsync/chain_reader.go b/eth/stagedsync/chain_reader.go index 5073c548383..e44a5f1ba47 100644 --- a/eth/stagedsync/chain_reader.go +++ b/eth/stagedsync/chain_reader.go @@ -47,8 +47,7 @@ func (cr ChainReader) Config() *chain.Config { // CurrentHeader retrieves the current header from the local chain. func (cr ChainReader) CurrentHeader() *types.Header { hash := rawdb.ReadHeadHeaderHash(cr.Db) - number := rawdb.ReadHeaderNumber(cr.Db, hash) - h, _ := cr.BlockReader.Header(context.Background(), cr.Db, hash, *number) + h, _ := cr.BlockReader.HeaderByHash(context.Background(), cr.Db, hash) return h } @@ -59,12 +58,7 @@ func (cr ChainReader) CurrentFinalizedHeader() *types.Header { return nil } - number := rawdb.ReadHeaderNumber(cr.Db, hash) - if number == nil { - return nil - } - - return rawdb.ReadHeader(cr.Db, hash, *number) + return cr.GetHeaderByHash(hash) } func (cr ChainReader) CurrentSafeHeader() *types.Header { @@ -73,12 +67,7 @@ func (cr ChainReader) CurrentSafeHeader() *types.Header { return nil } - number := rawdb.ReadHeaderNumber(cr.Db, hash) - if number == nil { - return nil - } - - return rawdb.ReadHeader(cr.Db, hash, *number) + return cr.GetHeaderByHash(hash) } // GetHeader retrieves a block header from the database by hash and number. @@ -95,8 +84,7 @@ func (cr ChainReader) GetHeaderByNumber(number uint64) *types.Header { // GetHeaderByHash retrieves a block header from the database by its hash. func (cr ChainReader) GetHeaderByHash(hash libcommon.Hash) *types.Header { - number := rawdb.ReadHeaderNumber(cr.Db, hash) - h, _ := cr.BlockReader.Header(context.Background(), cr.Db, hash, *number) + h, _ := cr.BlockReader.HeaderByHash(context.Background(), cr.Db, hash) return h } diff --git a/eth/stagedsync/default_stages.go b/eth/stagedsync/default_stages.go index e17815c22a6..1c1f2a7dd19 100644 --- a/eth/stagedsync/default_stages.go +++ b/eth/stagedsync/default_stages.go @@ -65,7 +65,7 @@ func DefaultStages(ctx context.Context, return SpawnStageHeaders(s, u, ctx, txc.Tx, headers, test, logger) }, Unwind: func(u *UnwindState, s *StageState, txc wrap.TxContainer, logger log.Logger) error { - return HeadersUnwind(u, s, txc.Tx, headers, test) + return HeadersUnwind(ctx, u, s, txc.Tx, headers, test) }, Prune: func(p *PruneState, tx kv.RwTx, logger log.Logger) error { return nil @@ -303,7 +303,7 @@ func UploaderPipelineStages(ctx context.Context, snapshots SnapshotsCfg, headers return SpawnStageHeaders(s, u, ctx, txc.Tx, headers, test, logger) }, Unwind: func(u *UnwindState, s *StageState, txc wrap.TxContainer, logger log.Logger) error { - return HeadersUnwind(u, s, txc.Tx, headers, test) + return HeadersUnwind(ctx, u, s, txc.Tx, headers, test) }, Prune: func(p *PruneState, tx kv.RwTx, logger log.Logger) error { return nil @@ -400,7 +400,7 @@ func StateStages(ctx context.Context, headers HeadersCfg, bodies BodiesCfg, bloc return nil }, Unwind: func(u *UnwindState, s *StageState, txc wrap.TxContainer, logger log.Logger) error { - return HeadersUnwind(u, s, txc.Tx, headers, false) + return HeadersUnwind(ctx, u, s, txc.Tx, headers, false) }, }, { diff --git a/eth/stagedsync/stage_execute.go b/eth/stagedsync/stage_execute.go index 287f8605164..e1bb7c9cf3f 100644 --- a/eth/stagedsync/stage_execute.go +++ b/eth/stagedsync/stage_execute.go @@ -163,7 +163,7 @@ func ExecBlockV3(s *StageState, u Unwinder, txc wrap.TxContainer, toBlock uint64 var ErrTooDeepUnwind = errors.New("too deep unwind") -func unwindExec3(u *UnwindState, s *StageState, txc wrap.TxContainer, ctx context.Context, accumulator *shards.Accumulator, logger log.Logger) (err error) { +func unwindExec3(u *UnwindState, s *StageState, txc wrap.TxContainer, ctx context.Context, br services.FullBlockReader, accumulator *shards.Accumulator, logger log.Logger) (err error) { var domains *libstate.SharedDomains if txc.Doms == nil { domains, err = libstate.NewSharedDomains(txc.Tx, logger) @@ -180,10 +180,11 @@ func unwindExec3(u *UnwindState, s *StageState, txc wrap.TxContainer, ctx contex if err != nil { return err } + t := time.Now() var changeset *[kv.DomainLen][]libstate.DomainEntryDiff for currentBlock := u.CurrentBlockNumber; currentBlock > u.UnwindPoint; currentBlock-- { - currentHash, err := rawdb.ReadCanonicalHash(txc.Tx, currentBlock) + currentHash, err := br.CanonicalHash(ctx, txc.Tx, currentBlock) if err != nil { return err } @@ -365,7 +366,7 @@ func unwindExecutionStage(u *UnwindState, s *StageState, txc wrap.TxContainer, c accumulator.StartChange(u.UnwindPoint, hash, txs, true) } - return unwindExec3(u, s, txc, ctx, accumulator, logger) + return unwindExec3(u, s, txc, ctx, cfg.blockReader, accumulator, logger) } func PruneExecutionStage(s *PruneState, tx kv.RwTx, cfg ExecuteBlockCfg, ctx context.Context) (err error) { diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index 546d597c2ab..60fbbabcd6c 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -427,7 +427,7 @@ func fixCanonicalChain(logPrefix string, logEvery *time.Ticker, height uint64, h return newNodes, badNodes, nil } -func HeadersUnwind(u *UnwindState, s *StageState, tx kv.RwTx, cfg HeadersCfg, test bool) (err error) { +func HeadersUnwind(ctx context.Context, u *UnwindState, s *StageState, tx kv.RwTx, cfg HeadersCfg, test bool) (err error) { u.UnwindPoint = max(u.UnwindPoint, cfg.blockReader.FrozenBlocks()) // protect from unwind behind files useExternalTx := tx != nil @@ -517,7 +517,7 @@ func HeadersUnwind(u *UnwindState, s *StageState, tx kv.RwTx, cfg HeadersCfg, te */ if maxNum == 0 { maxNum = u.UnwindPoint - if maxHash, err = rawdb.ReadCanonicalHash(tx, maxNum); err != nil { + if maxHash, err = cfg.blockReader.CanonicalHash(ctx, tx, maxNum); err != nil { return err } } @@ -597,13 +597,7 @@ func (cr ChainReaderImpl) CurrentFinalizedHeader() *types.Header { if hash == (libcommon.Hash{}) { return nil } - - number := rawdb.ReadHeaderNumber(cr.tx, hash) - if number == nil { - return nil - } - - return rawdb.ReadHeader(cr.tx, hash, *number) + return cr.GetHeaderByHash(hash) } func (cr ChainReaderImpl) CurrentSafeHeader() *types.Header { hash := rawdb.ReadForkchoiceSafe(cr.tx) @@ -611,12 +605,7 @@ func (cr ChainReaderImpl) CurrentSafeHeader() *types.Header { return nil } - number := rawdb.ReadHeaderNumber(cr.tx, hash) - if number == nil { - return nil - } - - return rawdb.ReadHeader(cr.tx, hash, *number) + return cr.GetHeaderByHash(hash) } func (cr ChainReaderImpl) GetHeader(hash libcommon.Hash, number uint64) *types.Header { if cr.blockReader != nil { @@ -631,15 +620,10 @@ func (cr ChainReaderImpl) GetHeaderByNumber(number uint64) *types.Header { return h } return rawdb.ReadHeaderByNumber(cr.tx, number) - } func (cr ChainReaderImpl) GetHeaderByHash(hash libcommon.Hash) *types.Header { if cr.blockReader != nil { - number := rawdb.ReadHeaderNumber(cr.tx, hash) - if number == nil { - return nil - } - return cr.GetHeader(hash, *number) + return cr.GetHeaderByHash(hash) } h, _ := rawdb.ReadHeaderByHash(cr.tx, hash) return h diff --git a/eth/stagedsync/stage_mining_create_block.go b/eth/stagedsync/stage_mining_create_block.go index 8a7250c01ab..f05433808d6 100644 --- a/eth/stagedsync/stage_mining_create_block.go +++ b/eth/stagedsync/stage_mining_create_block.go @@ -137,7 +137,7 @@ func SpawnMiningCreateBlockStage(s *StageState, tx kv.RwTx, cfg MiningCreateBloc } chain := ChainReader{Cfg: cfg.chainConfig, Db: tx, BlockReader: cfg.blockReader, Logger: logger} var GetBlocksFromHash = func(hash libcommon.Hash, n int) (blocks []*types.Block) { - number := rawdb.ReadHeaderNumber(tx, hash) + number, _ := cfg.blockReader.HeaderNumber(context.Background(), tx, hash) if number == nil { return nil } diff --git a/eth/stagedsync/stage_polygon_sync.go b/eth/stagedsync/stage_polygon_sync.go index 41a24efe200..ffebb20a3e9 100644 --- a/eth/stagedsync/stage_polygon_sync.go +++ b/eth/stagedsync/stage_polygon_sync.go @@ -204,7 +204,7 @@ func UnwindPolygonSyncStage(ctx context.Context, tx kv.RwTx, u *UnwindState, cfg return err } - canonicalHash, err := rawdb.ReadCanonicalHash(tx, u.UnwindPoint) + canonicalHash, err := cfg.blockReader.CanonicalHash(ctx, tx, u.UnwindPoint) if err != nil { return err } diff --git a/eth/stagedsync/stage_snapshots.go b/eth/stagedsync/stage_snapshots.go index f540af1812e..a7dc9e7dde2 100644 --- a/eth/stagedsync/stage_snapshots.go +++ b/eth/stagedsync/stage_snapshots.go @@ -74,6 +74,8 @@ import ( "github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks" ) +const pruneMarkerSafeThreshold = 1000 // Keep 1000 blocks of markers in the DB below snapshot available blocks + type SnapshotsCfg struct { db kv.RwDB chainConfig chain.Config @@ -334,11 +336,24 @@ func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.R return nil } +func getPruneMarkerSafeThreshold(blockReader services.FullBlockReader) uint64 { + snapProgress := min(blockReader.FrozenBorBlocks(), blockReader.FrozenBlocks()) + if blockReader.BorSnapshots() == nil { + snapProgress = blockReader.FrozenBlocks() + } + if snapProgress < pruneMarkerSafeThreshold { + return 0 + } + return snapProgress - pruneMarkerSafeThreshold +} + func FillDBFromSnapshots(logPrefix string, ctx context.Context, tx kv.RwTx, dirs datadir.Dirs, blockReader services.FullBlockReader, agg *state.Aggregator, logger log.Logger) error { startTime := time.Now() blocksAvailable := blockReader.FrozenBlocks() logEvery := time.NewTicker(logInterval) defer logEvery.Stop() + pruneMarkerBlockThreshold := getPruneMarkerSafeThreshold(blockReader) + // updating the progress of further stages (but only forward) that are contained inside of snapshots for _, stage := range []stages.SyncStage{stages.Headers, stages.Bodies, stages.BlockHashes, stages.Senders} { progress, err := stages.GetStageProgress(tx, stage) @@ -373,15 +388,26 @@ func FillDBFromSnapshots(logPrefix string, ctx context.Context, tx kv.RwTx, dirs if blockNum > blocksAvailable { return nil // This can actually happen as FrozenBlocks() is SegmentIdMax() and not the last .seg } - if err := rawdb.WriteTd(tx, blockHash, blockNum, td); err != nil { - return err - } - if err := rawdb.WriteCanonicalHash(tx, blockHash, blockNum); err != nil { - return err + if !dbg.PruneTotalDifficulty() { + if err := rawdb.WriteTd(tx, blockHash, blockNum, td); err != nil { + return err + } } - binary.BigEndian.PutUint64(blockNumBytes, blockNum) - if err := h2n.Collect(blockHash[:], blockNumBytes); err != nil { - return err + + // Write marker for pruning only if we are above our safe threshold + if blockNum >= pruneMarkerBlockThreshold || blockNum == 0 { + if err := rawdb.WriteCanonicalHash(tx, blockHash, blockNum); err != nil { + return err + } + binary.BigEndian.PutUint64(blockNumBytes, blockNum) + if err := h2n.Collect(blockHash[:], blockNumBytes); err != nil { + return err + } + if dbg.PruneTotalDifficulty() { + if err := rawdb.WriteTd(tx, blockHash, blockNum, td); err != nil { + return err + } + } } select { case <-ctx.Done(): @@ -491,6 +517,35 @@ func FillDBFromSnapshots(logPrefix string, ctx context.Context, tx kv.RwTx, dirs return nil } +func pruneCanonicalMarkers(ctx context.Context, tx kv.RwTx, blockReader services.FullBlockReader) error { + pruneThreshold := getPruneMarkerSafeThreshold(blockReader) + if pruneThreshold == 0 { + return nil + } + + c, err := tx.RwCursor(kv.HeaderCanonical) // Number -> Hash + if err != nil { + return err + } + defer c.Close() + for k, v, err := c.First(); k != nil && err == nil; k, v, err = c.Next() { + blockNum := binary.BigEndian.Uint64(k) + if blockNum == 0 { // Do not prune genesis marker + continue + } + if blockNum >= pruneThreshold { + break + } + if err := tx.Delete(kv.HeaderNumber, v); err != nil { + return err + } + if err := c.DeleteCurrent(); err != nil { + return err + } + } + return nil +} + /* ====== PRUNING ====== */ // snapshots pruning sections works more as a retiring of blocks // retiring blocks means moving block data from db into snapshots @@ -569,6 +624,9 @@ func SnapshotsPrune(s *PruneState, cfg SnapshotsCfg, ctx context.Context, tx kv. if _, err := cfg.blockRetire.PruneAncientBlocks(tx, pruneLimit); err != nil { return err } + if err := pruneCanonicalMarkers(ctx, tx, cfg.blockReader); err != nil { + return err + } if cfg.snapshotUploader != nil { // if we're uploading make sure that the DB does not get too far diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index 55da813f6e6..8f8cd85f049 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -595,7 +595,7 @@ func (s *Service) reportHistory(conn *connWrapper, list []uint64) error { } else { // No indexes requested, send back the top ones headHash := rawdb.ReadHeadBlockHash(roTx) - headNumber := rawdb.ReadHeaderNumber(roTx, headHash) + headNumber, _ := s.blockReader.HeaderNumber(context.Background(), roTx, headHash) if headNumber == nil { return nil } diff --git a/polygon/bor/finality/api.go b/polygon/bor/finality/api.go index c249928bf45..1b053d1b4f0 100644 --- a/polygon/bor/finality/api.go +++ b/polygon/bor/finality/api.go @@ -63,6 +63,7 @@ func GetFinalizedBlockNumber(tx kv.Tx) uint64 { // CurrentFinalizedBlock retrieves the current finalized block of the canonical // chain. The block is retrieved from the blockchain's internal cache. func CurrentFinalizedBlock(tx kv.Tx, number uint64) *types.Block { + // Assuming block is in DB then canoninical hash must be in DB as well. hash, err := rawdb.ReadCanonicalHash(tx, number) if err != nil || hash == (common.Hash{}) { return nil diff --git a/turbo/engineapi/engine_helpers/fork_validator.go b/turbo/engineapi/engine_helpers/fork_validator.go index ccaa1025152..24f5ce9c411 100644 --- a/turbo/engineapi/engine_helpers/fork_validator.go +++ b/turbo/engineapi/engine_helpers/fork_validator.go @@ -202,7 +202,7 @@ func (fv *ForkValidator) ValidatePayload(tx kv.RwTx, header *types.Header, body return } var foundCanonical bool - foundCanonical, criticalError = rawdb.IsCanonicalHash(tx, hash, number) + foundCanonical, criticalError = fv.blockReader.IsCanonical(fv.ctx, tx, hash, number) if criticalError != nil { return } @@ -214,7 +214,7 @@ func (fv *ForkValidator) ValidatePayload(tx kv.RwTx, header *types.Header, body // Let's assemble the side fork backwards currentHash := header.ParentHash unwindPoint := number - 1 - foundCanonical, criticalError = rawdb.IsCanonicalHash(tx, currentHash, unwindPoint) + foundCanonical, criticalError = fv.blockReader.IsCanonical(fv.ctx, tx, currentHash, unwindPoint) if criticalError != nil { return } @@ -251,7 +251,7 @@ func (fv *ForkValidator) ValidatePayload(tx kv.RwTx, header *types.Header, body currentHash = header.ParentHash unwindPoint = header.Number.Uint64() - 1 - foundCanonical, criticalError = rawdb.IsCanonicalHash(tx, currentHash, unwindPoint) + foundCanonical, criticalError = fv.blockReader.IsCanonical(fv.ctx, tx, currentHash, unwindPoint) if criticalError != nil { return } @@ -322,7 +322,7 @@ func (fv *ForkValidator) validateAndStorePayload(txc wrap.TxContainer, header *t if criticalError != nil { return } - latestValidHash, criticalError = rawdb.ReadCanonicalHash(txc.Tx, latestValidNumber) + latestValidHash, criticalError = fv.blockReader.CanonicalHash(fv.ctx, txc.Tx, latestValidNumber) if criticalError != nil { return } diff --git a/turbo/execution/eth1/ethereum_execution.go b/turbo/execution/eth1/ethereum_execution.go index a80240a993a..be347ada84c 100644 --- a/turbo/execution/eth1/ethereum_execution.go +++ b/turbo/execution/eth1/ethereum_execution.go @@ -311,7 +311,10 @@ func (e *EthereumExecutionModule) ValidateChain(ctx context.Context, req *execut } func (e *EthereumExecutionModule) purgeBadChain(ctx context.Context, tx kv.RwTx, latestValidHash, headHash libcommon.Hash) error { - tip := rawdb.ReadHeaderNumber(tx, headHash) + tip, err := e.blockReader.HeaderNumber(ctx, tx, headHash) + if err != nil { + return err + } currentHash := headHash currentNumber := *tip @@ -358,7 +361,7 @@ func (e *EthereumExecutionModule) HasBlock(ctx context.Context, in *execution.Ge } blockHash := gointerfaces.ConvertH256ToHash(in.BlockHash) - num := rawdb.ReadHeaderNumber(tx, blockHash) + num, _ := e.blockReader.HeaderNumber(ctx, tx, blockHash) if num == nil { return &execution.HasBlockResponse{HasBlock: false}, nil } diff --git a/turbo/execution/eth1/forkchoice.go b/turbo/execution/eth1/forkchoice.go index 6d5673b277e..f088b51d7ec 100644 --- a/turbo/execution/eth1/forkchoice.go +++ b/turbo/execution/eth1/forkchoice.go @@ -82,9 +82,18 @@ func (e *EthereumExecutionModule) verifyForkchoiceHashes(ctx context.Context, tx // Client software MUST return -38002: Invalid forkchoice state error if the payload referenced by // forkchoiceState.headBlockHash is VALID and a payload referenced by either forkchoiceState.finalizedBlockHash or // forkchoiceState.safeBlockHash does not belong to the chain defined by forkchoiceState.headBlockHash - headNumber := rawdb.ReadHeaderNumber(tx, blockHash) - finalizedNumber := rawdb.ReadHeaderNumber(tx, finalizedHash) - safeNumber := rawdb.ReadHeaderNumber(tx, safeHash) + headNumber, err := e.blockReader.HeaderNumber(ctx, tx, blockHash) + if err != nil { + return false, err + } + finalizedNumber, err := e.blockReader.HeaderNumber(ctx, tx, finalizedHash) + if err != nil { + return false, err + } + safeNumber, err := e.blockReader.HeaderNumber(ctx, tx, safeHash) + if err != nil { + return false, err + } if finalizedHash != (common.Hash{}) && finalizedHash != blockHash { canonical, err := e.isCanonicalHash(ctx, tx, finalizedHash) @@ -165,9 +174,9 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original // Update the last new block seen. // This is used by eth_syncing as an heuristic to determine if the node is syncing or not. if err := e.db.Update(ctx, func(tx kv.RwTx) error { - num := rawdb.ReadHeaderNumber(tx, originalBlockHash) - if num == nil { - return nil + num, err := e.blockReader.HeaderNumber(ctx, tx, originalBlockHash) + if err != nil { + return err } return rawdb.WriteLastNewBlockSeen(tx, *num) }); err != nil { @@ -218,7 +227,7 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original log.Info("[sync] limited big jump", "from", finishProgressBefore, "amount", uint64(e.syncCfg.LoopBlockLimit)) } - canonicalHash, err := rawdb.ReadCanonicalHash(tx, fcuHeader.Number.Uint64()) + canonicalHash, err := e.canonicalHash(ctx, tx, fcuHeader.Number.Uint64()) if err != nil { sendForkchoiceErrorWithoutWaiting(e.logger, outcomeCh, err, false) return @@ -257,7 +266,7 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original currentParentHash := fcuHeader.ParentHash currentParentNumber := fcuHeader.Number.Uint64() - 1 - isCanonicalHash, err := rawdb.IsCanonicalHash(tx, currentParentHash, currentParentNumber) + isCanonicalHash, err := e.isCanonicalHash(ctx, tx, currentParentHash) if err != nil { sendForkchoiceErrorWithoutWaiting(e.logger, outcomeCh, err, false) return @@ -290,7 +299,7 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original panic("assert:uint64 underflow") //uint-underflow } currentParentNumber = currentHeader.Number.Uint64() - 1 - isCanonicalHash, err = rawdb.IsCanonicalHash(tx, currentParentHash, currentParentNumber) + isCanonicalHash, err = e.isCanonicalHash(ctx, tx, currentParentHash) if err != nil { sendForkchoiceErrorWithoutWaiting(e.logger, outcomeCh, err, false) return @@ -413,7 +422,12 @@ func (e *EthereumExecutionModule) updateForkChoice(ctx context.Context, original // if head hash was set then success otherwise no headHash := rawdb.ReadHeadBlockHash(tx) - headNumber := rawdb.ReadHeaderNumber(tx, headHash) + headNumber, err := e.blockReader.HeaderNumber(ctx, tx, headHash) + if err != nil { + sendForkchoiceErrorWithoutWaiting(e.logger, outcomeCh, err, flushExtendingFork) + return + } + log := headNumber != nil && e.logger != nil // Update forks... writeForkChoiceHashes(tx, blockHash, safeHash, finalizedHash) diff --git a/turbo/execution/eth1/getters.go b/turbo/execution/eth1/getters.go index e9865424f2d..40f98d24ec1 100644 --- a/turbo/execution/eth1/getters.go +++ b/turbo/execution/eth1/getters.go @@ -42,7 +42,11 @@ func (e *EthereumExecutionModule) parseSegmentRequest(ctx context.Context, tx kv // Case 1: Only hash is given. case req.BlockHash != nil && req.BlockNumber == nil: blockHash = gointerfaces.ConvertH256ToHash(req.BlockHash) - blockNumberPtr := rawdb.ReadHeaderNumber(tx, blockHash) + var blockNumberPtr *uint64 + blockNumberPtr, err = e.blockReader.HeaderNumber(ctx, tx, blockHash) + if err != nil { + return libcommon.Hash{}, 0, err + } if blockNumberPtr == nil { err = errNotFound return @@ -143,10 +147,9 @@ func (e *EthereumExecutionModule) GetBodiesByHashes(ctx context.Context, req *ex for _, hash := range req.Hashes { h := gointerfaces.ConvertH256ToHash(hash) - number := rawdb.ReadHeaderNumber(tx, h) - if number == nil { - bodies = append(bodies, nil) - continue + number, err := e.blockReader.HeaderNumber(ctx, tx, h) + if err != nil { + return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByHashes: HeaderNumber error %w", err) } body, err := e.getBody(ctx, tx, h, *number) if err != nil { @@ -185,7 +188,7 @@ func (e *EthereumExecutionModule) GetBodiesByRange(ctx context.Context, req *exe bodies := make([]*execution.BlockBody, 0, req.Count) for i := uint64(0); i < req.Count; i++ { - hash, err := rawdb.ReadCanonicalHash(tx, req.Start+i) + hash, err := e.canonicalHash(ctx, tx, req.Start+i) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.GetBodiesByRange: ReadCanonicalHash error %w", err) } @@ -238,18 +241,20 @@ func (e *EthereumExecutionModule) GetHeaderHashNumber(ctx context.Context, req * return nil, fmt.Errorf("ethereumExecutionModule.GetHeaderHashNumber: could not begin database tx %w", err) } defer tx.Rollback() - blockNumber := rawdb.ReadHeaderNumber(tx, gointerfaces.ConvertH256ToHash(req)) - if blockNumber == nil { - return &execution.GetHeaderHashNumberResponse{BlockNumber: nil}, nil + + blockNumber, err := e.blockReader.HeaderNumber(ctx, tx, gointerfaces.ConvertH256ToHash(req)) + if err != nil { + return nil, fmt.Errorf("ethereumExecutionModule.GetHeaderHashNumber: HeaderNumber error %w", err) } return &execution.GetHeaderHashNumberResponse{BlockNumber: blockNumber}, nil } func (e *EthereumExecutionModule) isCanonicalHash(ctx context.Context, tx kv.Tx, hash libcommon.Hash) (bool, error) { - blockNumber := rawdb.ReadHeaderNumber(tx, hash) - if blockNumber == nil { - return false, nil + blockNumber, err := e.blockReader.HeaderNumber(ctx, tx, hash) + if err != nil { + return false, fmt.Errorf("ethereumExecutionModule.isCanonicalHash: HeaderNumber error %w", err) } + expectedHash, err := e.canonicalHash(ctx, tx, *blockNumber) if err != nil { return false, fmt.Errorf("ethereumExecutionModule.isCanonicalHash: could not read canonical hash %w", err) @@ -286,7 +291,10 @@ func (e *EthereumExecutionModule) CurrentHeader(ctx context.Context, _ *emptypb. } defer tx.Rollback() hash := rawdb.ReadHeadHeaderHash(tx) - number := rawdb.ReadHeaderNumber(tx, hash) + number, err := e.blockReader.HeaderNumber(ctx, tx, hash) + if err != nil { + return nil, fmt.Errorf("ethereumExecutionModule.CurrentHeader: blockReader.HeaderNumber error %w", err) + } h, err := e.blockReader.Header(ctx, tx, hash, *number) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.CurrentHeader: blockReader.Header error %w", err) diff --git a/turbo/jsonrpc/bor_helper.go b/turbo/jsonrpc/bor_helper.go index abb15ad11b2..6ebacec50ce 100644 --- a/turbo/jsonrpc/bor_helper.go +++ b/turbo/jsonrpc/bor_helper.go @@ -74,7 +74,7 @@ func getHeaderByNumber(ctx context.Context, number rpc.BlockNumber, api *BorImpl return block.Header(), nil } - blockNum, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + blockNum, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/debug_api.go b/turbo/jsonrpc/debug_api.go index b17d09bfd78..fc572bc7f55 100644 --- a/turbo/jsonrpc/debug_api.go +++ b/turbo/jsonrpc/debug_api.go @@ -30,7 +30,6 @@ import ( "github.com/erigontech/erigon-lib/kv/order" "github.com/erigontech/erigon-lib/kv/rawdbv3" - "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/state" "github.com/erigontech/erigon/core/types/accounts" "github.com/erigontech/erigon/eth/stagedsync/stages" @@ -88,7 +87,10 @@ func (api *PrivateDebugAPIImpl) StorageRangeAt(ctx context.Context, blockHash co } defer tx.Rollback() - number := rawdb.ReadHeaderNumber(tx, blockHash) + number, err := api._blockReader.HeaderNumber(ctx, tx, blockHash) + if err != nil { + return StorageRangeResult{}, err + } if number == nil { return StorageRangeResult{}, errors.New("block not found") } @@ -296,9 +298,12 @@ func (api *PrivateDebugAPIImpl) AccountAt(ctx context.Context, blockHash common. } defer tx.Rollback() - number := rawdb.ReadHeaderNumber(tx, blockHash) + number, err := api._blockReader.HeaderNumber(ctx, tx, blockHash) + if err != nil { + return &AccountResult{}, err + } if number == nil { - return nil, nil + return nil, nil // not error, see https://github.com/erigontech/erigon/issues/1645 } canonicalHash, _ := api._blockReader.CanonicalHash(ctx, tx, *number) isCanonical := canonicalHash == blockHash @@ -349,7 +354,7 @@ func (api *PrivateDebugAPIImpl) GetRawHeader(ctx context.Context, blockNrOrHash return nil, err } defer tx.Rollback() - n, h, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + n, h, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -369,7 +374,7 @@ func (api *PrivateDebugAPIImpl) GetRawBlock(ctx context.Context, blockNrOrHash r return nil, err } defer tx.Rollback() - n, h, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + n, h, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/erigon_block.go b/turbo/jsonrpc/erigon_block.go index c27c031d1ae..39020f15cdc 100644 --- a/turbo/jsonrpc/erigon_block.go +++ b/turbo/jsonrpc/erigon_block.go @@ -56,7 +56,7 @@ func (api *ErigonImpl) GetHeaderByNumber(ctx context.Context, blockNumber rpc.Bl } defer tx.Rollback() - blockNum, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNumber), tx, api.filters) + blockNum, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNumber), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -223,12 +223,12 @@ func (api *ErigonImpl) GetBalanceChangesInBlock(ctx context.Context, blockNrOrHa defer tx.Rollback() balancesMapping := make(map[common.Address]*hexutil.Big) - latestState, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") + latestState, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, "") if err != nil { return nil, err } - blockNumber, _, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + blockNumber, _, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/erigon_receipts.go b/turbo/jsonrpc/erigon_receipts.go index 3a8b76e78c8..73315747dc1 100644 --- a/turbo/jsonrpc/erigon_receipts.go +++ b/turbo/jsonrpc/erigon_receipts.go @@ -331,11 +331,11 @@ func (api *ErigonImpl) GetBlockReceiptsByBlockHash(ctx context.Context, cannonic defer tx.Rollback() { - blockNum := rawdb.ReadHeaderNumber(tx, cannonicalBlockHash) - if blockNum == nil { - return nil, fmt.Errorf("the hash %s is not cannonical", cannonicalBlockHash) + blockNum, err := api._blockReader.HeaderNumber(ctx, tx, cannonicalBlockHash) + if err != nil { + return nil, err } - isCanonicalHash, err := rawdb.IsCanonicalHash(tx, cannonicalBlockHash, *blockNum) + isCanonicalHash, err := api._blockReader.IsCanonical(ctx, tx, cannonicalBlockHash, *blockNum) if err != nil { return nil, err } @@ -344,7 +344,7 @@ func (api *ErigonImpl) GetBlockReceiptsByBlockHash(ctx context.Context, cannonic } } - blockNum, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithHash(cannonicalBlockHash, true), tx, api.filters) + blockNum, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithHash(cannonicalBlockHash, true), tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/eth_accounts.go b/turbo/jsonrpc/eth_accounts.go index 84ecfe48810..8f3ce779760 100644 --- a/turbo/jsonrpc/eth_accounts.go +++ b/turbo/jsonrpc/eth_accounts.go @@ -43,7 +43,7 @@ func (api *APIImpl) GetBalance(ctx context.Context, address libcommon.Address, b return nil, fmt.Errorf("getBalance cannot open tx: %w", err1) } defer tx.Rollback() - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") + reader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, "") if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (api *APIImpl) GetTransactionCount(ctx context.Context, address libcommon.A return nil, fmt.Errorf("getTransactionCount cannot open tx: %w", err1) } defer tx.Rollback() - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") + reader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, "") if err != nil { return nil, err } @@ -102,7 +102,7 @@ func (api *APIImpl) GetCode(ctx context.Context, address libcommon.Address, bloc if err != nil { return nil, fmt.Errorf("read chain config: %v", err) } - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) + reader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, err } @@ -128,7 +128,7 @@ func (api *APIImpl) GetStorageAt(ctx context.Context, address libcommon.Address, } defer tx.Rollback() - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") + reader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, "") if err != nil { return hexutility.Encode(common.LeftPadBytes(empty, 32)), err } @@ -153,7 +153,7 @@ func (api *APIImpl) Exist(ctx context.Context, address libcommon.Address, blockN } defer tx.Rollback() - reader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, "") + reader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, "") if err != nil { return false, err } diff --git a/turbo/jsonrpc/eth_api.go b/turbo/jsonrpc/eth_api.go index a00c8b6877d..46c0c4e1bdc 100644 --- a/turbo/jsonrpc/eth_api.go +++ b/turbo/jsonrpc/eth_api.go @@ -208,7 +208,10 @@ func (api *BaseAPI) blockByHashWithSenders(ctx context.Context, tx kv.Tx, hash c return it, nil } } - number := rawdb.ReadHeaderNumber(tx, hash) + number, err := api._blockReader.HeaderNumber(ctx, tx, hash) + if err != nil { + return nil, err + } if number == nil { return nil, nil } @@ -274,7 +277,7 @@ func (api *BaseAPI) pendingBlock() *types.Block { } func (api *BaseAPI) blockByRPCNumber(ctx context.Context, number rpc.BlockNumber, tx kv.Tx) (*types.Block, error) { - n, h, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + n, h, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -285,7 +288,7 @@ func (api *BaseAPI) blockByRPCNumber(ctx context.Context, number rpc.BlockNumber } func (api *BaseAPI) headerByRPCNumber(ctx context.Context, number rpc.BlockNumber, tx kv.Tx) (*types.Header, error) { - n, h, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + n, h, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -296,7 +299,7 @@ func (api *BaseAPI) headerByRPCNumber(ctx context.Context, number rpc.BlockNumbe // block in state history or not. Some strange issues arise getting account // history for blocks that have been pruned away giving nonce too low errors // etc. as red herrings -func (api *BaseAPI) checkPruneHistory(tx kv.Tx, block uint64) error { +func (api *BaseAPI) checkPruneHistory(ctx context.Context, tx kv.Tx, block uint64) error { p, err := api.pruneMode(tx) if err != nil { return err @@ -306,7 +309,7 @@ func (api *BaseAPI) checkPruneHistory(tx kv.Tx, block uint64) error { return nil } if p.History.Enabled() { - latest, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), tx, api.filters) + latest, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber), tx, api._blockReader, api.filters) if err != nil { return err } diff --git a/turbo/jsonrpc/eth_block.go b/turbo/jsonrpc/eth_block.go index 79c0ec6a1fb..53ef0468304 100644 --- a/turbo/jsonrpc/eth_block.go +++ b/turbo/jsonrpc/eth_block.go @@ -91,7 +91,7 @@ func (api *APIImpl) CallBundle(ctx context.Context, txHashes []common.Hash, stat } defer func(start time.Time) { log.Trace("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) - stateBlockNumber, hash, latest, err := rpchelper.GetBlockNumber(stateBlockNumberOrHash, tx, api.filters) + stateBlockNumber, hash, latest, err := rpchelper.GetBlockNumber(ctx, stateBlockNumberOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -341,7 +341,7 @@ func (api *APIImpl) GetBlockTransactionCountByNumber(ctx context.Context, blockN return &n, nil } - blockNum, blockHash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNr), tx, api.filters) + blockNum, blockHash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNr), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -397,7 +397,7 @@ func (api *APIImpl) GetBlockTransactionCountByHash(ctx context.Context, blockHas } defer tx.Rollback() - blockNum, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHash{BlockHash: &blockHash}, tx, nil) + blockNum, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHash{BlockHash: &blockHash}, tx, api._blockReader, nil) if err != nil { // (Compatibility) Every other node just return `null` for when the block does not exist. log.Debug("eth_getBlockTransactionCountByHash GetBlockNumber failed", "err", err) diff --git a/turbo/jsonrpc/eth_call.go b/turbo/jsonrpc/eth_call.go index e5e226a6da7..0f6cc0d4e92 100644 --- a/turbo/jsonrpc/eth_call.go +++ b/turbo/jsonrpc/eth_call.go @@ -68,7 +68,7 @@ func (api *APIImpl) Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHa args.Gas = (*hexutil.Uint64)(&api.GasCap) } - blockNumber, hash, _, err := rpchelper.GetCanonicalBlockNumber(blockNrOrHash, tx, api.filters) // DoCall cannot be executed on non-canonical blocks + blockNumber, hash, _, err := rpchelper.GetCanonicalBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) // DoCall cannot be executed on non-canonical blocks if err != nil { return nil, err } @@ -80,7 +80,7 @@ func (api *APIImpl) Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHa return nil, nil } - stateReader, err := rpchelper.CreateStateReader(ctx, tx, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, err } @@ -104,7 +104,7 @@ func (api *APIImpl) Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHa // headerByNumberOrHash - intent to read recent headers only, tries from the lru cache before reading from the db func headerByNumberOrHash(ctx context.Context, tx kv.Tx, blockNrOrHash rpc.BlockNumberOrHash, api *APIImpl) (*types.Header, error) { - _, bNrOrHashHash, _, err := rpchelper.GetCanonicalBlockNumber(blockNrOrHash, tx, api.filters) + _, bNrOrHashHash, _, err := rpchelper.GetCanonicalBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func headerByNumberOrHash(ctx context.Context, tx kv.Tx, blockNrOrHash rpc.Block return block.Header(), nil } - blockNum, _, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + blockNum, _, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -239,7 +239,7 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs } engine := api.engine() - latestCanBlockNumber, latestCanHash, isLatest, err := rpchelper.GetCanonicalBlockNumber(latestNumOrHash, dbtx, api.filters) // DoCall cannot be executed on non-canonical blocks + latestCanBlockNumber, latestCanHash, isLatest, err := rpchelper.GetCanonicalBlockNumber(ctx, latestNumOrHash, dbtx, api._blockReader, api.filters) // DoCall cannot be executed on non-canonical blocks if err != nil { return 0, err } @@ -455,7 +455,7 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi2.CallArgs, } engine := api.engine() - blockNumber, hash, latest, err := rpchelper.GetCanonicalBlockNumber(bNrOrHash, tx, api.filters) // DoCall cannot be executed on non-canonical blocks + blockNumber, hash, latest, err := rpchelper.GetCanonicalBlockNumber(ctx, bNrOrHash, tx, api._blockReader, api.filters) // DoCall cannot be executed on non-canonical blocks if err != nil { return nil, err } diff --git a/turbo/jsonrpc/eth_callMany.go b/turbo/jsonrpc/eth_callMany.go index 8e36057e34c..e80cde41036 100644 --- a/turbo/jsonrpc/eth_callMany.go +++ b/turbo/jsonrpc/eth_callMany.go @@ -124,7 +124,7 @@ func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateCont defer func(start time.Time) { log.Trace("Executing EVM callMany finished", "runtime", time.Since(start)) }(time.Now()) - blockNum, hash, _, err := rpchelper.GetBlockNumber(simulateContext.BlockNumber, tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, simulateContext.BlockNumber, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -148,7 +148,7 @@ func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateCont replayTransactions = block.Transactions()[:transactionIndex] - stateReader, err := rpchelper.CreateStateReader(ctx, tx, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, err diff --git a/turbo/jsonrpc/eth_receipts.go b/turbo/jsonrpc/eth_receipts.go index 9febab96819..15a06c2c99a 100644 --- a/turbo/jsonrpc/eth_receipts.go +++ b/turbo/jsonrpc/eth_receipts.go @@ -76,7 +76,7 @@ func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) (t end = num } else { // Convert the RPC block numbers into internal representations - latest, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(rpc.LatestExecutedBlockNumber), tx, nil) + latest, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(rpc.LatestExecutedBlockNumber), tx, api._blockReader, nil) if err != nil { return nil, err } @@ -88,7 +88,7 @@ func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) (t begin = uint64(fromBlock) } else { blockNum := rpc.BlockNumber(fromBlock) - begin, _, _, err = rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNum), tx, api.filters) + begin, _, _, err = rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNum), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -102,7 +102,7 @@ func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) (t end = uint64(toBlock) } else { blockNum := rpc.BlockNumber(toBlock) - end, _, _, err = rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNum), tx, api.filters) + end, _, _, err = rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNum), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -497,7 +497,7 @@ func (api *APIImpl) GetBlockReceipts(ctx context.Context, numberOrHash rpc.Block } defer tx.Rollback() - blockNum, blockHash, _, err := rpchelper.GetBlockNumber(numberOrHash, tx, api.filters) + blockNum, blockHash, _, err := rpchelper.GetBlockNumber(ctx, numberOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/eth_txs.go b/turbo/jsonrpc/eth_txs.go index 878b72e0498..080ca9b62b5 100644 --- a/turbo/jsonrpc/eth_txs.go +++ b/turbo/jsonrpc/eth_txs.go @@ -250,7 +250,7 @@ func (api *APIImpl) GetTransactionByBlockNumberAndIndex(ctx context.Context, blo } // https://infura.io/docs/ethereum/json-rpc/eth-getTransactionByBlockNumberAndIndex - blockNum, hash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNr), tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNr), tx, api._blockReader, api.filters) if err != nil { return nil, err } diff --git a/turbo/jsonrpc/eth_uncles.go b/turbo/jsonrpc/eth_uncles.go index 055edfb9dae..edccf0dbe44 100644 --- a/turbo/jsonrpc/eth_uncles.go +++ b/turbo/jsonrpc/eth_uncles.go @@ -39,7 +39,7 @@ func (api *APIImpl) GetUncleByBlockNumberAndIndex(ctx context.Context, number rp } defer tx.Rollback() - blockNum, hash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func (api *APIImpl) GetUncleCountByBlockNumber(ctx context.Context, number rpc.B } defer tx.Rollback() - blockNum, blockHash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + blockNum, blockHash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return &n, err } @@ -134,7 +134,10 @@ func (api *APIImpl) GetUncleCountByBlockHash(ctx context.Context, hash common.Ha } defer tx.Rollback() - number := rawdb.ReadHeaderNumber(tx, hash) + number, err := api._blockReader.HeaderNumber(ctx, tx, hash) + if err != nil { + return nil, err + } if number == nil { return nil, nil // not error, see https://github.com/erigontech/erigon/issues/1645 } diff --git a/turbo/jsonrpc/graphql_api.go b/turbo/jsonrpc/graphql_api.go index ae95a4640b9..5a04960c7c0 100644 --- a/turbo/jsonrpc/graphql_api.go +++ b/turbo/jsonrpc/graphql_api.go @@ -133,7 +133,7 @@ func (api *GraphQLAPIImpl) getBlockWithSenders(ctx context.Context, number rpc.B return api.pendingBlock(), nil, nil } - blockHeight, blockHash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + blockHeight, blockHash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, nil, err } diff --git a/turbo/jsonrpc/otterscan_api.go b/turbo/jsonrpc/otterscan_api.go index a7f941e7a98..1fe4da75e2c 100644 --- a/turbo/jsonrpc/otterscan_api.go +++ b/turbo/jsonrpc/otterscan_api.go @@ -357,7 +357,7 @@ func (api *OtterscanAPIImpl) getBlockWithSenders(ctx context.Context, number rpc return api.pendingBlock(), nil, nil } - n, hash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(number), tx, api.filters) + n, hash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(number), tx, api._blockReader, api.filters) if err != nil { return nil, nil, err } diff --git a/turbo/jsonrpc/otterscan_block_details.go b/turbo/jsonrpc/otterscan_block_details.go index e96a21eb3d5..2a385718385 100644 --- a/turbo/jsonrpc/otterscan_block_details.go +++ b/turbo/jsonrpc/otterscan_block_details.go @@ -25,7 +25,6 @@ import ( "github.com/erigontech/erigon-lib/common" "github.com/erigontech/erigon-lib/kv" - "github.com/erigontech/erigon/core/rawdb" "github.com/erigontech/erigon/core/types" "github.com/erigontech/erigon/rpc" ) @@ -56,7 +55,10 @@ func (api *OtterscanAPIImpl) GetBlockDetailsByHash(ctx context.Context, hash com defer tx.Rollback() // b, senders, err := rawdb.ReadBlockByHashWithSenders(tx, hash) - blockNumber := rawdb.ReadHeaderNumber(tx, hash) + blockNumber, err := api._blockReader.HeaderNumber(ctx, tx, hash) + if err != nil { + return nil, err + } if blockNumber == nil { return nil, fmt.Errorf("couldn't find block number for hash %v", hash.Bytes()) } diff --git a/turbo/jsonrpc/otterscan_has_code.go b/turbo/jsonrpc/otterscan_has_code.go index 454031acbd1..a138c18ee6d 100644 --- a/turbo/jsonrpc/otterscan_has_code.go +++ b/turbo/jsonrpc/otterscan_has_code.go @@ -33,7 +33,7 @@ func (api *OtterscanAPIImpl) HasCode(ctx context.Context, address common.Address } defer tx.Rollback() - blockNumber, _, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + blockNumber, _, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return false, err } diff --git a/turbo/jsonrpc/overlay_api.go b/turbo/jsonrpc/overlay_api.go index 39943891c23..5fbf7760308 100644 --- a/turbo/jsonrpc/overlay_api.go +++ b/turbo/jsonrpc/overlay_api.go @@ -124,7 +124,7 @@ func (api *OverlayAPIImpl) CallConstructor(ctx context.Context, address common.A return nil, errors.New("contract construction txn not found") } - err = api.BaseAPI.checkPruneHistory(tx, blockNum) + err = api.BaseAPI.checkPruneHistory(ctx, tx, blockNum) if err != nil { return nil, err } @@ -150,7 +150,7 @@ func (api *OverlayAPIImpl) CallConstructor(ctx context.Context, address common.A replayTransactions = block.Transactions()[:transactionIndex] - stateReader, err := rpchelper.CreateStateReader(ctx, tx, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, err } @@ -310,7 +310,7 @@ func (api *OverlayAPIImpl) GetLogs(ctx context.Context, crit filters.FilterCrite } // try to recompute the state - stateReader, err := rpchelper.CreateStateReader(ctx, tx, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNumber-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNumber-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { results[task.idx] = &blockReplayResult{BlockNumber: task.BlockNumber, Error: err.Error()} continue @@ -420,7 +420,7 @@ func (api *OverlayAPIImpl) replayBlock(ctx context.Context, blockNum uint64, sta overrideBlockHash = make(map[uint64]common.Hash) blockNumber := rpc.BlockNumber(blockNum) - blockNum, hash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHash{BlockNumber: &blockNumber}, tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHash{BlockNumber: &blockNumber}, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -564,7 +564,7 @@ func getBeginEnd(ctx context.Context, tx kv.Tx, api *OverlayAPIImpl, crit filter end = num } else { // Convert the RPC block numbers into internal representations - latest, _, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(rpc.LatestExecutedBlockNumber), tx, nil) + latest, _, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(rpc.LatestExecutedBlockNumber), tx, api._blockReader, nil) if err != nil { return 0, 0, err } @@ -576,7 +576,7 @@ func getBeginEnd(ctx context.Context, tx kv.Tx, api *OverlayAPIImpl, crit filter begin = uint64(fromBlock) } else { blockNum := rpc.BlockNumber(fromBlock) - begin, _, _, err = rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNum), tx, api.filters) + begin, _, _, err = rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNum), tx, api._blockReader, api.filters) if err != nil { return 0, 0, err } @@ -590,7 +590,7 @@ func getBeginEnd(ctx context.Context, tx kv.Tx, api *OverlayAPIImpl, crit filter end = uint64(toBlock) } else { blockNum := rpc.BlockNumber(toBlock) - end, _, _, err = rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNum), tx, api.filters) + end, _, _, err = rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNum), tx, api._blockReader, api.filters) if err != nil { return 0, 0, err } diff --git a/turbo/jsonrpc/trace_adhoc.go b/turbo/jsonrpc/trace_adhoc.go index a3c1c6064ab..97687f12c34 100644 --- a/turbo/jsonrpc/trace_adhoc.go +++ b/turbo/jsonrpc/trace_adhoc.go @@ -870,7 +870,7 @@ func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrH return nil, err } - blockNumber, blockHash, _, err := rpchelper.GetBlockNumber(blockNrOrHash, tx, api.filters) + blockNumber, blockHash, _, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -945,12 +945,12 @@ func (api *TraceAPIImpl) Call(ctx context.Context, args TraceCallParam, traceTyp blockNrOrHash = &rpc.BlockNumberOrHash{BlockNumber: &num} } - blockNumber, hash, _, err := rpchelper.GetBlockNumber(*blockNrOrHash, tx, api.filters) + blockNumber, hash, _, err := rpchelper.GetBlockNumber(ctx, *blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { return nil, err } - stateReader, err := rpchelper.CreateStateReader(ctx, tx, *blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, *blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, err } @@ -1117,7 +1117,7 @@ func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, pa var num = rpc.LatestBlockNumber parentNrOrHash = &rpc.BlockNumberOrHash{BlockNumber: &num} } - blockNumber, hash, _, err := rpchelper.GetBlockNumber(*parentNrOrHash, dbtx, api.filters) + blockNumber, hash, _, err := rpchelper.GetBlockNumber(ctx, *parentNrOrHash, dbtx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -1163,11 +1163,11 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type var num = rpc.LatestBlockNumber parentNrOrHash = &rpc.BlockNumberOrHash{BlockNumber: &num} } - blockNumber, hash, _, err := rpchelper.GetBlockNumber(*parentNrOrHash, dbtx, api.filters) + blockNumber, hash, _, err := rpchelper.GetBlockNumber(ctx, *parentNrOrHash, dbtx, api._blockReader, api.filters) if err != nil { return nil, nil, err } - stateReader, err := rpchelper.CreateStateReader(ctx, dbtx, *parentNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, dbtx, api._blockReader, *parentNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { return nil, nil, err } diff --git a/turbo/jsonrpc/trace_filtering.go b/turbo/jsonrpc/trace_filtering.go index 78699917d23..03c20e920f4 100644 --- a/turbo/jsonrpc/trace_filtering.go +++ b/turbo/jsonrpc/trace_filtering.go @@ -189,7 +189,7 @@ func (api *TraceAPIImpl) Block(ctx context.Context, blockNr rpc.BlockNumber, gas return nil, err } defer tx.Rollback() - blockNum, hash, _, err := rpchelper.GetBlockNumber(rpc.BlockNumberOrHashWithNumber(blockNr), tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, rpc.BlockNumberOrHashWithNumber(blockNr), tx, api._blockReader, api.filters) if err != nil { return nil, err } @@ -323,7 +323,10 @@ func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gas } if req.ToBlock == nil { - headNumber := rawdb.ReadHeaderNumber(dbtx, rawdb.ReadHeadHeaderHash(dbtx)) + headNumber, err := api._blockReader.HeaderNumber(ctx, dbtx, rawdb.ReadHeadHeaderHash(dbtx)) + if err != nil { + return err + } toBlock = *headNumber } else { toBlock = uint64(*req.ToBlock) diff --git a/turbo/jsonrpc/tracing.go b/turbo/jsonrpc/tracing.go index f964b8cf523..6d755a9823b 100644 --- a/turbo/jsonrpc/tracing.go +++ b/turbo/jsonrpc/tracing.go @@ -63,7 +63,7 @@ func (api *PrivateDebugAPIImpl) traceBlock(ctx context.Context, blockNrOrHash rp } defer tx.Rollback() - blockNumber, hash, _, err := rpchelper.GetCanonicalBlockNumber(blockNrOrHash, tx, api.filters) + blockNumber, hash, _, err := rpchelper.GetCanonicalBlockNumber(ctx, blockNrOrHash, tx, api._blockReader, api.filters) if err != nil { stream.WriteNil() return err @@ -80,7 +80,7 @@ func (api *PrivateDebugAPIImpl) traceBlock(ctx context.Context, blockNrOrHash rp // if we've pruned this history away for this block then just return early // to save any red herring errors - err = api.BaseAPI.checkPruneHistory(tx, block.NumberU64()) + err = api.BaseAPI.checkPruneHistory(ctx, tx, block.NumberU64()) if err != nil { stream.WriteNil() return err @@ -267,7 +267,7 @@ func (api *PrivateDebugAPIImpl) TraceTransaction(ctx context.Context, hash commo } // check pruning to ensure we have history at this block level - err = api.BaseAPI.checkPruneHistory(tx, blockNum) + err = api.BaseAPI.checkPruneHistory(ctx, tx, blockNum) if err != nil { stream.WriteNil() return err @@ -342,19 +342,19 @@ func (api *PrivateDebugAPIImpl) TraceCall(ctx context.Context, args ethapi.CallA } engine := api.engine() - blockNumber, hash, isLatest, err := rpchelper.GetBlockNumber(blockNrOrHash, dbtx, api.filters) + blockNumber, hash, isLatest, err := rpchelper.GetBlockNumber(ctx, blockNrOrHash, dbtx, api._blockReader, api.filters) if err != nil { return fmt.Errorf("get block number: %v", err) } - err = api.BaseAPI.checkPruneHistory(dbtx, blockNumber) + err = api.BaseAPI.checkPruneHistory(ctx, dbtx, blockNumber) if err != nil { return err } var stateReader state.StateReader if config == nil || config.TxIndex == nil || isLatest { - stateReader, err = rpchelper.CreateStateReader(ctx, dbtx, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err = rpchelper.CreateStateReader(ctx, dbtx, api._blockReader, blockNrOrHash, 0, api.filters, api.stateCache, chainConfig.ChainName) } else { stateReader, err = rpchelper.CreateHistoryStateReader(dbtx, blockNumber, int(*config.TxIndex), chainConfig.ChainName) } @@ -439,13 +439,13 @@ func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bun defer func(start time.Time) { log.Trace("Tracing CallMany finished", "runtime", time.Since(start)) }(time.Now()) - blockNum, hash, _, err := rpchelper.GetBlockNumber(simulateContext.BlockNumber, tx, api.filters) + blockNum, hash, _, err := rpchelper.GetBlockNumber(ctx, simulateContext.BlockNumber, tx, api._blockReader, api.filters) if err != nil { stream.WriteNil() return err } - err = api.BaseAPI.checkPruneHistory(tx, blockNum) + err = api.BaseAPI.checkPruneHistory(ctx, tx, blockNum) if err != nil { return err } @@ -474,7 +474,7 @@ func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bun replayTransactions = block.Transactions()[:transactionIndex] - stateReader, err := rpchelper.CreateStateReader(ctx, tx, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) + stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName) if err != nil { stream.WriteNil() return err diff --git a/turbo/rpchelper/helper.go b/turbo/rpchelper/helper.go index f7805302340..5df50a39644 100644 --- a/turbo/rpchelper/helper.go +++ b/turbo/rpchelper/helper.go @@ -32,6 +32,7 @@ import ( borfinality "github.com/erigontech/erigon/polygon/bor/finality" "github.com/erigontech/erigon/polygon/bor/finality/whitelist" "github.com/erigontech/erigon/rpc" + "github.com/erigontech/erigon/turbo/services" ) // unable to decode supplied params, or an invalid number of parameters @@ -43,15 +44,15 @@ func (e nonCanonocalHashError) Error() string { return fmt.Sprintf("hash %x is not currently canonical", e.hash) } -func GetBlockNumber(blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, filters *Filters) (uint64, libcommon.Hash, bool, error) { - return _GetBlockNumber(blockNrOrHash.RequireCanonical, blockNrOrHash, tx, filters) +func GetBlockNumber(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, br services.FullBlockReader, filters *Filters) (uint64, libcommon.Hash, bool, error) { + return _GetBlockNumber(ctx, blockNrOrHash.RequireCanonical, blockNrOrHash, tx, br, filters) } -func GetCanonicalBlockNumber(blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, filters *Filters) (uint64, libcommon.Hash, bool, error) { - return _GetBlockNumber(true, blockNrOrHash, tx, filters) +func GetCanonicalBlockNumber(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, br services.FullBlockReader, filters *Filters) (uint64, libcommon.Hash, bool, error) { + return _GetBlockNumber(ctx, true, blockNrOrHash, tx, br, filters) } -func _GetBlockNumber(requireCanonical bool, blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, filters *Filters) (blockNumber uint64, hash libcommon.Hash, latest bool, err error) { +func _GetBlockNumber(ctx context.Context, requireCanonical bool, blockNrOrHash rpc.BlockNumberOrHash, tx kv.Tx, br services.FullBlockReader, filters *Filters) (blockNumber uint64, hash libcommon.Hash, latest bool, err error) { // Due to changed semantics of `lastest` block in RPC request, it is now distinct // from the block number corresponding to the plain state var plainStateBlockNumber uint64 @@ -102,18 +103,21 @@ func _GetBlockNumber(requireCanonical bool, blockNrOrHash rpc.BlockNumberOrHash, default: blockNumber = uint64(number.Int64()) } - hash, err = rawdb.ReadCanonicalHash(tx, blockNumber) + hash, err = br.CanonicalHash(ctx, tx, blockNumber) if err != nil { return 0, libcommon.Hash{}, false, err } } else { - number := rawdb.ReadHeaderNumber(tx, hash) + number, err := br.HeaderNumber(ctx, tx, hash) + if err != nil { + return 0, libcommon.Hash{}, false, err + } if number == nil { return 0, libcommon.Hash{}, false, fmt.Errorf("block %x not found", hash) } blockNumber = *number - ch, err := rawdb.ReadCanonicalHash(tx, blockNumber) + ch, err := br.CanonicalHash(ctx, tx, blockNumber) if err != nil { return 0, libcommon.Hash{}, false, err } @@ -124,8 +128,8 @@ func _GetBlockNumber(requireCanonical bool, blockNrOrHash rpc.BlockNumberOrHash, return blockNumber, hash, blockNumber == plainStateBlockNumber, nil } -func CreateStateReader(ctx context.Context, tx kv.Tx, blockNrOrHash rpc.BlockNumberOrHash, txnIndex int, filters *Filters, stateCache kvcache.Cache, chainName string) (state.StateReader, error) { - blockNumber, _, latest, err := _GetBlockNumber(true, blockNrOrHash, tx, filters) +func CreateStateReader(ctx context.Context, tx kv.Tx, br services.FullBlockReader, blockNrOrHash rpc.BlockNumberOrHash, txnIndex int, filters *Filters, stateCache kvcache.Cache, chainName string) (state.StateReader, error) { + blockNumber, _, latest, err := _GetBlockNumber(ctx, true, blockNrOrHash, tx, br, filters) if err != nil { return nil, err } diff --git a/turbo/services/interfaces.go b/turbo/services/interfaces.go index 42a9dcd2661..b79cfb01267 100644 --- a/turbo/services/interfaces.go +++ b/turbo/services/interfaces.go @@ -45,6 +45,7 @@ type BlockReader interface { type HeaderReader interface { Header(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (*types.Header, error) HeaderByNumber(ctx context.Context, tx kv.Getter, blockNum uint64) (*types.Header, error) + HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (*types.Header, error) ReadAncestor(db kv.Getter, hash common.Hash, number, ancestor uint64, maxNonCanonical *uint64) (common.Hash, uint64) @@ -79,6 +80,7 @@ type BorCheckpointReader interface { type CanonicalReader interface { CanonicalHash(ctx context.Context, tx kv.Getter, blockNum uint64) (common.Hash, error) + IsCanonical(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (bool, error) BadHeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (blockHeight *uint64, err error) } diff --git a/turbo/snapshotsync/freezeblocks/block_reader.go b/turbo/snapshotsync/freezeblocks/block_reader.go index db32f1c0172..b461dfad179 100644 --- a/turbo/snapshotsync/freezeblocks/block_reader.go +++ b/turbo/snapshotsync/freezeblocks/block_reader.go @@ -60,7 +60,10 @@ func (r *RemoteBlockReader) CanPruneTo(uint64) uint64 { } func (r *RemoteBlockReader) CurrentBlock(db kv.Tx) (*types.Block, error) { headHash := rawdb.ReadHeadBlockHash(db) - headNumber := rawdb.ReadHeaderNumber(db, headHash) + headNumber, err := r.HeaderNumber(context.Background(), db, headHash) + if err != nil { + return nil, fmt.Errorf("failed ReadCanonicalHash: %w", err) + } if headNumber == nil { return nil, nil } @@ -102,7 +105,10 @@ func (r *RemoteBlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number return block, err } func (r *RemoteBlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash common.Hash) (*types.Block, error) { - number := rawdb.ReadHeaderNumber(db, hash) + number, err := r.HeaderNumber(ctx, db, hash) + if err != nil { + return nil, err + } if number == nil { return nil, nil } @@ -110,7 +116,7 @@ func (r *RemoteBlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash comm return block, err } func (r *RemoteBlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHeight uint64) (*types.Header, error) { - canonicalHash, err := rawdb.ReadCanonicalHash(tx, blockHeight) + canonicalHash, err := r.CanonicalHash(ctx, tx, blockHeight) if err != nil { return nil, err } @@ -129,7 +135,10 @@ func (r *RemoteBlockReader) FrozenFiles() (list []string) { panic("not func (r *RemoteBlockReader) FreezingCfg() ethconfig.BlocksFreezing { panic("not supported") } func (r *RemoteBlockReader) HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (*types.Header, error) { - blockNum := rawdb.ReadHeaderNumber(tx, hash) + blockNum, err := r.HeaderNumber(ctx, tx, hash) + if err != nil { + return nil, err + } if blockNum == nil { return nil, nil } @@ -141,7 +150,11 @@ func (r *RemoteBlockReader) HeaderByHash(ctx context.Context, tx kv.Getter, hash } func (r *RemoteBlockReader) CanonicalHash(ctx context.Context, tx kv.Getter, blockHeight uint64) (common.Hash, error) { - return rawdb.ReadCanonicalHash(tx, blockHeight) + resp, err := r.client.CanonicalHash(ctx, &remote.CanonicalHashRequest{BlockNumber: blockHeight}) + if err != nil { + return common.Hash{}, err + } + return gointerfaces.ConvertH256ToHash(resp.Hash), nil } var _ services.FullBlockReader = &RemoteBlockReader{} @@ -231,6 +244,13 @@ func (r *RemoteBlockReader) Body(ctx context.Context, tx kv.Getter, hash common. } return block.Body(), uint32(len(block.Body().Transactions)), nil } +func (r *RemoteBlockReader) IsCanonical(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bool, error) { + expected, err := r.CanonicalHash(ctx, tx, blockHeight) + if err != nil { + return false, err + } + return expected == hash, nil +} func (r *RemoteBlockReader) BodyWithTransactions(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, err error) { block, _, err := r.BlockWithSenders(ctx, tx, hash, blockHeight) if err != nil { @@ -241,7 +261,16 @@ func (r *RemoteBlockReader) BodyWithTransactions(ctx context.Context, tx kv.Gett } return block.Body(), nil } - +func (r *RemoteBlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) { + resp, err := r.client.HeaderNumber(ctx, &remote.HeaderNumberRequest{Hash: gointerfaces.ConvertHashToH256(hash)}) + if err != nil { + return nil, err + } + if resp == nil { + return nil, nil + } + return resp.Number, nil +} func (r *RemoteBlockReader) BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp.RawValue, err error) { body, err := r.BodyWithTransactions(ctx, tx, hash, blockHeight) if err != nil { @@ -379,7 +408,7 @@ func (r *BlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHei } if tx != nil { - blockHash, err := rawdb.ReadCanonicalHash(tx, blockHeight) + blockHash, err := r.CanonicalHash(ctx, tx, blockHeight) if err != nil { return nil, err } @@ -424,6 +453,30 @@ func (r *BlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHei } return h, nil } +func (r *BlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error) { + ret := rawdb.ReadHeaderNumber(tx, hash) + if ret != nil { + return ret, nil + } + + h, err := r.HeaderByHash(ctx, tx, hash) + if err != nil { + return nil, err + } + if h == nil { + return nil, nil + } + ret = new(uint64) + *ret = h.Number.Uint64() + return ret, nil +} +func (r *BlockReader) IsCanonical(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bool, error) { + expected, err := r.CanonicalHash(ctx, tx, blockHeight) + if err != nil { + return false, err + } + return expected == hash, nil +} // HeaderByHash - will search header in all snapshots starting from recent func (r *BlockReader) HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (h *types.Header, err error) { @@ -460,7 +513,7 @@ var emptyHash = common.Hash{} func (r *BlockReader) CanonicalHash(ctx context.Context, tx kv.Getter, blockHeight uint64) (h common.Hash, err error) { h, err = rawdb.ReadCanonicalHash(tx, blockHeight) if err != nil { - return h, err + return emptyHash, err } if h != emptyHash { return h, nil @@ -468,7 +521,7 @@ func (r *BlockReader) CanonicalHash(ctx context.Context, tx kv.Getter, blockHeig seg, ok, release := r.sn.ViewSingleFile(coresnaptype.Headers, blockHeight) if !ok { - return + return h, nil } defer release() @@ -656,7 +709,7 @@ func (r *BlockReader) blockWithSenders(ctx context.Context, tx kv.Getter, hash c return nil, nil, nil } if forceCanonical { - canonicalHash, err := rawdb.ReadCanonicalHash(tx, blockHeight) + canonicalHash, err := r.CanonicalHash(ctx, tx, blockHeight) if err != nil { return nil, nil, fmt.Errorf("requested non-canonical hash %x. canonical=%x", hash, canonicalHash) } @@ -1005,7 +1058,7 @@ func (r *BlockReader) txnByHash(txnHash common.Hash, segments []*Segment, buf [] func (r *BlockReader) TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, txIdxInBlock int) (txn types.Transaction, err error) { maxBlockNumInFiles := r.sn.BlocksAvailable() if maxBlockNumInFiles == 0 || blockNum > maxBlockNumInFiles { - canonicalHash, err := rawdb.ReadCanonicalHash(tx, blockNum) + canonicalHash, err := r.CanonicalHash(ctx, tx, blockNum) if err != nil { return nil, err } @@ -1130,7 +1183,7 @@ func (r *BlockReader) BadHeaderNumber(ctx context.Context, tx kv.Getter, hash co return rawdb.ReadBadHeaderNumber(tx, hash) } func (r *BlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number uint64) (*types.Block, error) { - hash, err := rawdb.ReadCanonicalHash(db, number) + hash, err := r.CanonicalHash(ctx, db, number) if err != nil { return nil, fmt.Errorf("failed ReadCanonicalHash: %w", err) } @@ -1138,7 +1191,10 @@ func (r *BlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number uint64 return block, err } func (r *BlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash common.Hash) (*types.Block, error) { - number := rawdb.ReadHeaderNumber(db, hash) + number, err := r.HeaderNumber(ctx, db, hash) + if err != nil { + return nil, fmt.Errorf("failed HeaderNumber: %w", err) + } if number == nil { return nil, nil } @@ -1147,9 +1203,9 @@ func (r *BlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash common.Has } func (r *BlockReader) CurrentBlock(db kv.Tx) (*types.Block, error) { headHash := rawdb.ReadHeadBlockHash(db) - headNumber := rawdb.ReadHeaderNumber(db, headHash) - if headNumber == nil { - return nil, nil + headNumber, err := r.HeaderNumber(context.Background(), db, headHash) + if err != nil { + return nil, fmt.Errorf("failed HeaderNumber: %w", err) } block, _, err := r.blockWithSenders(context.Background(), db, headHash, *headNumber, true) return block, err diff --git a/turbo/stages/blockchain_test.go b/turbo/stages/blockchain_test.go index 96b954b8e7e..cd35629ad11 100644 --- a/turbo/stages/blockchain_test.go +++ b/turbo/stages/blockchain_test.go @@ -158,7 +158,10 @@ func testFork(t *testing.T, m *mock.MockSentry, i, n int, comparator func(td1, t } currentBlockHash := blockChainB.TopBlock.Hash() err = m.DB.View(context.Background(), func(tx kv.Tx) error { - number := rawdb.ReadHeaderNumber(tx, currentBlockHash) + number, err := m.BlockReader.HeaderNumber(context.Background(), tx, currentBlockHash) + if err != nil { + return err + } currentBlock, _, _ := m.BlockReader.BlockWithSenders(ctx, tx, currentBlockHash, *number) tdPost, err = rawdb.ReadTd(tx, currentBlockHash, currentBlock.NumberU64()) if err != nil {