From f3ebdcefa73e3ceb1f044e5997ba22d3dc4602aa Mon Sep 17 00:00:00 2001 From: Tudor Malene Date: Mon, 2 Dec 2024 13:07:03 +0000 Subject: [PATCH] Refactor the crypto services (#2170) * refactor the crypto services and generate true random entropy for da encryption * lint * generate random rpc key * address pr comments --- go/common/enclave.go | 3 + go/common/gethencoding/geth_encoding.go | 12 +- go/common/rpc/generated/enclave.pb.go | 1270 +++++++++-------- go/common/rpc/generated/enclave.proto | 7 + go/common/rpc/generated/enclave_grpc.pb.go | 40 +- go/enclave/components/attestation.go | 39 +- go/enclave/components/batch_executor.go | 7 +- go/enclave/components/enclave_key_service.go | 70 - go/enclave/components/rollup_compression.go | 10 +- .../components/shared_secret_process.go | 12 +- go/enclave/core/batch.go | 4 +- go/enclave/crypto/README.md | 8 +- go/enclave/crypto/crypto.go | 120 -- go/enclave/crypto/da_enc_service.go | 96 ++ go/enclave/crypto/data_enc_service.go | 77 - go/enclave/crypto/enclave_key.go | 50 - go/enclave/crypto/enclave_key_service.go | 79 + go/enclave/crypto/evm_entropy_service.go | 52 + go/enclave/crypto/rpc_key_service.go | 52 + go/enclave/crypto/shared_secret_service.go | 71 + go/enclave/crypto/utils.go | 34 + go/enclave/enclave.go | 149 +- go/enclave/enclave_admin_service.go | 25 +- go/enclave/enclave_init_service.go | 68 +- go/enclave/enclave_rpc_service.go | 13 +- go/enclave/enclave_test.go.tmp | 486 ------- go/enclave/evm/evm_facade.go | 5 +- go/enclave/nodetype/sequencer.go | 7 +- go/enclave/rpc/rpc_encryption_manager.go | 60 +- go/enclave/rpc_server.go | 9 + go/enclave/storage/interfaces.go | 4 +- go/enclave/storage/storage.go | 42 +- go/host/rpc/clientapi/client_api_ten.go | 8 + go/host/rpc/enclaverpc/enclave_client.go | 14 + go/rpc/client.go | 1 + go/rpc/encrypted_client.go | 10 +- go/rpc/network_client.go | 24 +- .../simulation/network/obscuro_node_utils.go | 6 +- .../simulation/p2p/in_mem_ten_client.go | 40 +- .../simulation/transaction_injector.go | 17 - tools/tenscan/backend/obscuroscan_backend.go | 16 +- tools/tenscan/backend/webserver/webserver.go | 9 +- 42 files changed, 1497 insertions(+), 1629 deletions(-) delete mode 100644 go/enclave/components/enclave_key_service.go delete mode 100644 go/enclave/crypto/crypto.go create mode 100644 go/enclave/crypto/da_enc_service.go delete mode 100644 go/enclave/crypto/data_enc_service.go delete mode 100644 go/enclave/crypto/enclave_key.go create mode 100644 go/enclave/crypto/enclave_key_service.go create mode 100644 go/enclave/crypto/evm_entropy_service.go create mode 100644 go/enclave/crypto/rpc_key_service.go create mode 100644 go/enclave/crypto/shared_secret_service.go create mode 100644 go/enclave/crypto/utils.go delete mode 100644 go/enclave/enclave_test.go.tmp diff --git a/go/common/enclave.go b/go/common/enclave.go index 18eab5287c..0370757fe0 100644 --- a/go/common/enclave.go +++ b/go/common/enclave.go @@ -57,6 +57,9 @@ type EnclaveInit interface { // EnclaveID - returns the enclave's ID EnclaveID(context.Context) (EnclaveID, SystemError) + + // RPCEncryptionKey - returns the key used + RPCEncryptionKey(context.Context) ([]byte, SystemError) } // EnclaveAdmin provides administrative functions for managing an enclave. diff --git a/go/common/gethencoding/geth_encoding.go b/go/common/gethencoding/geth_encoding.go index 83e34cf560..50b04a669e 100644 --- a/go/common/gethencoding/geth_encoding.go +++ b/go/common/gethencoding/geth_encoding.go @@ -52,12 +52,14 @@ type gethEncodingServiceImpl struct { storage storage.Storage logger gethlog.Logger cachingService *storage.CacheService + entropyService *crypto.EvmEntropyService } -func NewGethEncodingService(storage storage.Storage, cachingService *storage.CacheService, logger gethlog.Logger) EncodingService { +func NewGethEncodingService(storage storage.Storage, cachingService *storage.CacheService, entropyService *crypto.EvmEntropyService, logger gethlog.Logger) EncodingService { return &gethEncodingServiceImpl{ storage: storage, logger: logger, + entropyService: entropyService, cachingService: cachingService, } } @@ -265,16 +267,12 @@ func (enc *gethEncodingServiceImpl) CreateEthHeaderForBatch(ctx context.Context, // wrap in a caching layer return enc.cachingService.ReadConvertedHeader(ctx, h.Hash(), func(a any) (*types.Header, error) { // deterministically calculate the private randomness that will be exposed to the EVM - secret, err := enc.storage.FetchSecret(ctx) - if err != nil { - enc.logger.Crit("Could not fetch shared secret. Exiting.", log.ErrKey, err) - } - perBatchRandomness := crypto.CalculateRootBatchEntropy(secret[:], h.Number) + perBatchRandomness := enc.entropyService.BatchEntropy(h.Number) // calculate the converted hash of the parent, for a correct converted chain // default to the genesis convertedParentHash := common.GethGenesisParentHash - + var err error if h.SequencerOrderNo.Uint64() > common.L2GenesisSeqNo { convertedParentHash, err = enc.storage.FetchConvertedHash(ctx, h.ParentHash) if err != nil { diff --git a/go/common/rpc/generated/enclave.pb.go b/go/common/rpc/generated/enclave.pb.go index 0397deae6e..1757f9ced8 100644 --- a/go/common/rpc/generated/enclave.pb.go +++ b/go/common/rpc/generated/enclave.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.28.2 +// protoc v5.28.3 // source: enclave.proto package generated @@ -1808,6 +1808,99 @@ func (x *EnclaveIDResponse) GetSystemError() *SystemError { return nil } +type RPCEncryptionKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RPCEncryptionKeyRequest) Reset() { + *x = RPCEncryptionKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_enclave_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RPCEncryptionKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCEncryptionKeyRequest) ProtoMessage() {} + +func (x *RPCEncryptionKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_enclave_proto_msgTypes[36] + 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 RPCEncryptionKeyRequest.ProtoReflect.Descriptor instead. +func (*RPCEncryptionKeyRequest) Descriptor() ([]byte, []int) { + return file_enclave_proto_rawDescGZIP(), []int{36} +} + +type RPCEncryptionKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RpcPubKey []byte `protobuf:"bytes,1,opt,name=rpcPubKey,proto3" json:"rpcPubKey,omitempty"` + SystemError *SystemError `protobuf:"bytes,2,opt,name=systemError,proto3" json:"systemError,omitempty"` +} + +func (x *RPCEncryptionKeyResponse) Reset() { + *x = RPCEncryptionKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_enclave_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RPCEncryptionKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCEncryptionKeyResponse) ProtoMessage() {} + +func (x *RPCEncryptionKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_enclave_proto_msgTypes[37] + 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 RPCEncryptionKeyResponse.ProtoReflect.Descriptor instead. +func (*RPCEncryptionKeyResponse) Descriptor() ([]byte, []int) { + return file_enclave_proto_rawDescGZIP(), []int{37} +} + +func (x *RPCEncryptionKeyResponse) GetRpcPubKey() []byte { + if x != nil { + return x.RpcPubKey + } + return nil +} + +func (x *RPCEncryptionKeyResponse) GetSystemError() *SystemError { + if x != nil { + return x.SystemError + } + return nil +} + type StartRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1819,7 +1912,7 @@ type StartRequest struct { func (x *StartRequest) Reset() { *x = StartRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[36] + mi := &file_enclave_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1832,7 +1925,7 @@ func (x *StartRequest) String() string { func (*StartRequest) ProtoMessage() {} func (x *StartRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[36] + mi := &file_enclave_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1845,7 +1938,7 @@ func (x *StartRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StartRequest.ProtoReflect.Descriptor instead. func (*StartRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{36} + return file_enclave_proto_rawDescGZIP(), []int{38} } func (x *StartRequest) GetEncodedBlock() []byte { @@ -1866,7 +1959,7 @@ type StartResponse struct { func (x *StartResponse) Reset() { *x = StartResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[37] + mi := &file_enclave_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1879,7 +1972,7 @@ func (x *StartResponse) String() string { func (*StartResponse) ProtoMessage() {} func (x *StartResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[37] + mi := &file_enclave_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1892,7 +1985,7 @@ func (x *StartResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StartResponse.ProtoReflect.Descriptor instead. func (*StartResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{37} + return file_enclave_proto_rawDescGZIP(), []int{39} } func (x *StartResponse) GetSystemError() *SystemError { @@ -1914,7 +2007,7 @@ type SubmitBlockRequest struct { func (x *SubmitBlockRequest) Reset() { *x = SubmitBlockRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[38] + mi := &file_enclave_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1927,7 +2020,7 @@ func (x *SubmitBlockRequest) String() string { func (*SubmitBlockRequest) ProtoMessage() {} func (x *SubmitBlockRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[38] + mi := &file_enclave_proto_msgTypes[40] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1940,7 +2033,7 @@ func (x *SubmitBlockRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitBlockRequest.ProtoReflect.Descriptor instead. func (*SubmitBlockRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{38} + return file_enclave_proto_rawDescGZIP(), []int{40} } func (x *SubmitBlockRequest) GetEncodedBlock() []byte { @@ -1969,7 +2062,7 @@ type SubmitBlockResponse struct { func (x *SubmitBlockResponse) Reset() { *x = SubmitBlockResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[39] + mi := &file_enclave_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1982,7 +2075,7 @@ func (x *SubmitBlockResponse) String() string { func (*SubmitBlockResponse) ProtoMessage() {} func (x *SubmitBlockResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[39] + mi := &file_enclave_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1995,7 +2088,7 @@ func (x *SubmitBlockResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitBlockResponse.ProtoReflect.Descriptor instead. func (*SubmitBlockResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{39} + return file_enclave_proto_rawDescGZIP(), []int{41} } func (x *SubmitBlockResponse) GetBlockSubmissionResponse() *BlockSubmissionResponseMsg { @@ -2023,7 +2116,7 @@ type EncCallRequest struct { func (x *EncCallRequest) Reset() { *x = EncCallRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[40] + mi := &file_enclave_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2036,7 +2129,7 @@ func (x *EncCallRequest) String() string { func (*EncCallRequest) ProtoMessage() {} func (x *EncCallRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[40] + mi := &file_enclave_proto_msgTypes[42] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2049,7 +2142,7 @@ func (x *EncCallRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EncCallRequest.ProtoReflect.Descriptor instead. func (*EncCallRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{40} + return file_enclave_proto_rawDescGZIP(), []int{42} } func (x *EncCallRequest) GetEncryptedParams() []byte { @@ -2071,7 +2164,7 @@ type EncCallResponse struct { func (x *EncCallResponse) Reset() { *x = EncCallResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[41] + mi := &file_enclave_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2084,7 +2177,7 @@ func (x *EncCallResponse) String() string { func (*EncCallResponse) ProtoMessage() {} func (x *EncCallResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[41] + mi := &file_enclave_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2097,7 +2190,7 @@ func (x *EncCallResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EncCallResponse.ProtoReflect.Descriptor instead. func (*EncCallResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{41} + return file_enclave_proto_rawDescGZIP(), []int{43} } func (x *EncCallResponse) GetEncodedEnclaveResponse() []byte { @@ -2125,7 +2218,7 @@ type SubmitBatchRequest struct { func (x *SubmitBatchRequest) Reset() { *x = SubmitBatchRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[42] + mi := &file_enclave_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2138,7 +2231,7 @@ func (x *SubmitBatchRequest) String() string { func (*SubmitBatchRequest) ProtoMessage() {} func (x *SubmitBatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[42] + mi := &file_enclave_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2151,7 +2244,7 @@ func (x *SubmitBatchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitBatchRequest.ProtoReflect.Descriptor instead. func (*SubmitBatchRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{42} + return file_enclave_proto_rawDescGZIP(), []int{44} } func (x *SubmitBatchRequest) GetBatch() *ExtBatchMsg { @@ -2172,7 +2265,7 @@ type SubmitBatchResponse struct { func (x *SubmitBatchResponse) Reset() { *x = SubmitBatchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[43] + mi := &file_enclave_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2185,7 +2278,7 @@ func (x *SubmitBatchResponse) String() string { func (*SubmitBatchResponse) ProtoMessage() {} func (x *SubmitBatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[43] + mi := &file_enclave_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2198,7 +2291,7 @@ func (x *SubmitBatchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitBatchResponse.ProtoReflect.Descriptor instead. func (*SubmitBatchResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{43} + return file_enclave_proto_rawDescGZIP(), []int{45} } func (x *SubmitBatchResponse) GetSystemError() *SystemError { @@ -2217,7 +2310,7 @@ type StopRequest struct { func (x *StopRequest) Reset() { *x = StopRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[44] + mi := &file_enclave_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2230,7 +2323,7 @@ func (x *StopRequest) String() string { func (*StopRequest) ProtoMessage() {} func (x *StopRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[44] + mi := &file_enclave_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2243,7 +2336,7 @@ func (x *StopRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StopRequest.ProtoReflect.Descriptor instead. func (*StopRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{44} + return file_enclave_proto_rawDescGZIP(), []int{46} } type StopResponse struct { @@ -2257,7 +2350,7 @@ type StopResponse struct { func (x *StopResponse) Reset() { *x = StopResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[45] + mi := &file_enclave_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2270,7 +2363,7 @@ func (x *StopResponse) String() string { func (*StopResponse) ProtoMessage() {} func (x *StopResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[45] + mi := &file_enclave_proto_msgTypes[47] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2283,7 +2376,7 @@ func (x *StopResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StopResponse.ProtoReflect.Descriptor instead. func (*StopResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{45} + return file_enclave_proto_rawDescGZIP(), []int{47} } func (x *StopResponse) GetSystemError() *SystemError { @@ -2305,7 +2398,7 @@ type GetCodeRequest struct { func (x *GetCodeRequest) Reset() { *x = GetCodeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[46] + mi := &file_enclave_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2318,7 +2411,7 @@ func (x *GetCodeRequest) String() string { func (*GetCodeRequest) ProtoMessage() {} func (x *GetCodeRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[46] + mi := &file_enclave_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2331,7 +2424,7 @@ func (x *GetCodeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCodeRequest.ProtoReflect.Descriptor instead. func (*GetCodeRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{46} + return file_enclave_proto_rawDescGZIP(), []int{48} } func (x *GetCodeRequest) GetAddress() []byte { @@ -2360,7 +2453,7 @@ type GetCodeResponse struct { func (x *GetCodeResponse) Reset() { *x = GetCodeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[47] + mi := &file_enclave_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2373,7 +2466,7 @@ func (x *GetCodeResponse) String() string { func (*GetCodeResponse) ProtoMessage() {} func (x *GetCodeResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[47] + mi := &file_enclave_proto_msgTypes[49] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2386,7 +2479,7 @@ func (x *GetCodeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCodeResponse.ProtoReflect.Descriptor instead. func (*GetCodeResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{47} + return file_enclave_proto_rawDescGZIP(), []int{49} } func (x *GetCodeResponse) GetCode() []byte { @@ -2415,7 +2508,7 @@ type SubscribeRequest struct { func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[48] + mi := &file_enclave_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2428,7 +2521,7 @@ func (x *SubscribeRequest) String() string { func (*SubscribeRequest) ProtoMessage() {} func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[48] + mi := &file_enclave_proto_msgTypes[50] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2441,7 +2534,7 @@ func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{48} + return file_enclave_proto_rawDescGZIP(), []int{50} } func (x *SubscribeRequest) GetId() []byte { @@ -2469,7 +2562,7 @@ type SubscribeResponse struct { func (x *SubscribeResponse) Reset() { *x = SubscribeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[49] + mi := &file_enclave_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2482,7 +2575,7 @@ func (x *SubscribeResponse) String() string { func (*SubscribeResponse) ProtoMessage() {} func (x *SubscribeResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[49] + mi := &file_enclave_proto_msgTypes[51] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2495,7 +2588,7 @@ func (x *SubscribeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeResponse.ProtoReflect.Descriptor instead. func (*SubscribeResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{49} + return file_enclave_proto_rawDescGZIP(), []int{51} } func (x *SubscribeResponse) GetSystemError() *SystemError { @@ -2516,7 +2609,7 @@ type UnsubscribeRequest struct { func (x *UnsubscribeRequest) Reset() { *x = UnsubscribeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[50] + mi := &file_enclave_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2529,7 +2622,7 @@ func (x *UnsubscribeRequest) String() string { func (*UnsubscribeRequest) ProtoMessage() {} func (x *UnsubscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[50] + mi := &file_enclave_proto_msgTypes[52] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2542,7 +2635,7 @@ func (x *UnsubscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnsubscribeRequest.ProtoReflect.Descriptor instead. func (*UnsubscribeRequest) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{50} + return file_enclave_proto_rawDescGZIP(), []int{52} } func (x *UnsubscribeRequest) GetId() []byte { @@ -2563,7 +2656,7 @@ type UnsubscribeResponse struct { func (x *UnsubscribeResponse) Reset() { *x = UnsubscribeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[51] + mi := &file_enclave_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2576,7 +2669,7 @@ func (x *UnsubscribeResponse) String() string { func (*UnsubscribeResponse) ProtoMessage() {} func (x *UnsubscribeResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[51] + mi := &file_enclave_proto_msgTypes[53] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2589,7 +2682,7 @@ func (x *UnsubscribeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnsubscribeResponse.ProtoReflect.Descriptor instead. func (*UnsubscribeResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{51} + return file_enclave_proto_rawDescGZIP(), []int{53} } func (x *UnsubscribeResponse) GetSystemError() *SystemError { @@ -2611,7 +2704,7 @@ type HealthCheckResponse struct { func (x *HealthCheckResponse) Reset() { *x = HealthCheckResponse{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[52] + mi := &file_enclave_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2624,7 +2717,7 @@ func (x *HealthCheckResponse) String() string { func (*HealthCheckResponse) ProtoMessage() {} func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[52] + mi := &file_enclave_proto_msgTypes[54] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2637,7 +2730,7 @@ func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{52} + return file_enclave_proto_rawDescGZIP(), []int{54} } func (x *HealthCheckResponse) GetStatus() bool { @@ -2663,7 +2756,7 @@ type EmptyArgs struct { func (x *EmptyArgs) Reset() { *x = EmptyArgs{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[53] + mi := &file_enclave_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2676,7 +2769,7 @@ func (x *EmptyArgs) String() string { func (*EmptyArgs) ProtoMessage() {} func (x *EmptyArgs) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[53] + mi := &file_enclave_proto_msgTypes[55] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2689,7 +2782,7 @@ func (x *EmptyArgs) ProtoReflect() protoreflect.Message { // Deprecated: Use EmptyArgs.ProtoReflect.Descriptor instead. func (*EmptyArgs) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{53} + return file_enclave_proto_rawDescGZIP(), []int{55} } type AttestationReportMsg struct { @@ -2707,7 +2800,7 @@ type AttestationReportMsg struct { func (x *AttestationReportMsg) Reset() { *x = AttestationReportMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[54] + mi := &file_enclave_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2720,7 +2813,7 @@ func (x *AttestationReportMsg) String() string { func (*AttestationReportMsg) ProtoMessage() {} func (x *AttestationReportMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[54] + mi := &file_enclave_proto_msgTypes[56] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2733,7 +2826,7 @@ func (x *AttestationReportMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use AttestationReportMsg.ProtoReflect.Descriptor instead. func (*AttestationReportMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{54} + return file_enclave_proto_rawDescGZIP(), []int{56} } func (x *AttestationReportMsg) GetReport() []byte { @@ -2783,7 +2876,7 @@ type BlockSubmissionResponseMsg struct { func (x *BlockSubmissionResponseMsg) Reset() { *x = BlockSubmissionResponseMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[55] + mi := &file_enclave_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2796,7 +2889,7 @@ func (x *BlockSubmissionResponseMsg) String() string { func (*BlockSubmissionResponseMsg) ProtoMessage() {} func (x *BlockSubmissionResponseMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[55] + mi := &file_enclave_proto_msgTypes[57] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2809,7 +2902,7 @@ func (x *BlockSubmissionResponseMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockSubmissionResponseMsg.ProtoReflect.Descriptor instead. func (*BlockSubmissionResponseMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{55} + return file_enclave_proto_rawDescGZIP(), []int{57} } func (x *BlockSubmissionResponseMsg) GetProducedSecretResponses() []*SecretResponseMsg { @@ -2838,7 +2931,7 @@ type BlockSubmissionErrorMsg struct { func (x *BlockSubmissionErrorMsg) Reset() { *x = BlockSubmissionErrorMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[56] + mi := &file_enclave_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2851,7 +2944,7 @@ func (x *BlockSubmissionErrorMsg) String() string { func (*BlockSubmissionErrorMsg) ProtoMessage() {} func (x *BlockSubmissionErrorMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[56] + mi := &file_enclave_proto_msgTypes[58] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2864,7 +2957,7 @@ func (x *BlockSubmissionErrorMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockSubmissionErrorMsg.ProtoReflect.Descriptor instead. func (*BlockSubmissionErrorMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{56} + return file_enclave_proto_rawDescGZIP(), []int{58} } func (x *BlockSubmissionErrorMsg) GetCause() string { @@ -2896,7 +2989,7 @@ type CrossChainMsg struct { func (x *CrossChainMsg) Reset() { *x = CrossChainMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[57] + mi := &file_enclave_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2909,7 +3002,7 @@ func (x *CrossChainMsg) String() string { func (*CrossChainMsg) ProtoMessage() {} func (x *CrossChainMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[57] + mi := &file_enclave_proto_msgTypes[59] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2922,7 +3015,7 @@ func (x *CrossChainMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use CrossChainMsg.ProtoReflect.Descriptor instead. func (*CrossChainMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{57} + return file_enclave_proto_rawDescGZIP(), []int{59} } func (x *CrossChainMsg) GetSender() []byte { @@ -2973,7 +3066,7 @@ type ExtBatchMsg struct { func (x *ExtBatchMsg) Reset() { *x = ExtBatchMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[58] + mi := &file_enclave_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2986,7 +3079,7 @@ func (x *ExtBatchMsg) String() string { func (*ExtBatchMsg) ProtoMessage() {} func (x *ExtBatchMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[58] + mi := &file_enclave_proto_msgTypes[60] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2999,7 +3092,7 @@ func (x *ExtBatchMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtBatchMsg.ProtoReflect.Descriptor instead. func (*ExtBatchMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{58} + return file_enclave_proto_rawDescGZIP(), []int{60} } func (x *ExtBatchMsg) GetHeader() *BatchHeaderMsg { @@ -3052,7 +3145,7 @@ type BatchHeaderMsg struct { func (x *BatchHeaderMsg) Reset() { *x = BatchHeaderMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[59] + mi := &file_enclave_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3065,7 +3158,7 @@ func (x *BatchHeaderMsg) String() string { func (*BatchHeaderMsg) ProtoMessage() {} func (x *BatchHeaderMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[59] + mi := &file_enclave_proto_msgTypes[61] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3078,7 +3171,7 @@ func (x *BatchHeaderMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchHeaderMsg.ProtoReflect.Descriptor instead. func (*BatchHeaderMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{59} + return file_enclave_proto_rawDescGZIP(), []int{61} } func (x *BatchHeaderMsg) GetParentHash() []byte { @@ -3227,7 +3320,7 @@ type ExtRollupMsg struct { func (x *ExtRollupMsg) Reset() { *x = ExtRollupMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[60] + mi := &file_enclave_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3240,7 +3333,7 @@ func (x *ExtRollupMsg) String() string { func (*ExtRollupMsg) ProtoMessage() {} func (x *ExtRollupMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[60] + mi := &file_enclave_proto_msgTypes[62] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3253,7 +3346,7 @@ func (x *ExtRollupMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtRollupMsg.ProtoReflect.Descriptor instead. func (*ExtRollupMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{60} + return file_enclave_proto_rawDescGZIP(), []int{62} } func (x *ExtRollupMsg) GetHeader() *RollupHeaderMsg { @@ -3296,7 +3389,7 @@ type RollupHeaderMsg struct { func (x *RollupHeaderMsg) Reset() { *x = RollupHeaderMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[61] + mi := &file_enclave_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3309,7 +3402,7 @@ func (x *RollupHeaderMsg) String() string { func (*RollupHeaderMsg) ProtoMessage() {} func (x *RollupHeaderMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[61] + mi := &file_enclave_proto_msgTypes[63] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3322,7 +3415,7 @@ func (x *RollupHeaderMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use RollupHeaderMsg.ProtoReflect.Descriptor instead. func (*RollupHeaderMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{61} + return file_enclave_proto_rawDescGZIP(), []int{63} } func (x *RollupHeaderMsg) GetParentHash() []byte { @@ -3403,7 +3496,7 @@ type SecretResponseMsg struct { func (x *SecretResponseMsg) Reset() { *x = SecretResponseMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[62] + mi := &file_enclave_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3416,7 +3509,7 @@ func (x *SecretResponseMsg) String() string { func (*SecretResponseMsg) ProtoMessage() {} func (x *SecretResponseMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[62] + mi := &file_enclave_proto_msgTypes[64] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3429,7 +3522,7 @@ func (x *SecretResponseMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use SecretResponseMsg.ProtoReflect.Descriptor instead. func (*SecretResponseMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{62} + return file_enclave_proto_rawDescGZIP(), []int{64} } func (x *SecretResponseMsg) GetSecret() []byte { @@ -3480,7 +3573,7 @@ type WithdrawalMsg struct { func (x *WithdrawalMsg) Reset() { *x = WithdrawalMsg{} if protoimpl.UnsafeEnabled { - mi := &file_enclave_proto_msgTypes[63] + mi := &file_enclave_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3493,7 +3586,7 @@ func (x *WithdrawalMsg) String() string { func (*WithdrawalMsg) ProtoMessage() {} func (x *WithdrawalMsg) ProtoReflect() protoreflect.Message { - mi := &file_enclave_proto_msgTypes[63] + mi := &file_enclave_proto_msgTypes[65] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3506,7 +3599,7 @@ func (x *WithdrawalMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use WithdrawalMsg.ProtoReflect.Descriptor instead. func (*WithdrawalMsg) Descriptor() ([]byte, []int) { - return file_enclave_proto_rawDescGZIP(), []int{63} + return file_enclave_proto_rawDescGZIP(), []int{65} } func (x *WithdrawalMsg) GetAmount() []byte { @@ -3724,365 +3817,379 @@ var file_enclave_proto_rawDesc = []byte{ 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x22, 0x32, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x49, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, + 0x22, 0x19, 0x0a, 0x17, 0x52, 0x50, 0x43, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x72, 0x0a, 0x18, 0x52, + 0x50, 0x43, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x70, 0x63, 0x50, 0x75, + 0x62, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x70, 0x63, 0x50, + 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x62, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6e, 0x63, - 0x6f, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x63, - 0x6f, 0x64, 0x65, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x70, 0x74, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x13, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x17, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, - 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x4d, 0x73, 0x67, 0x52, 0x17, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3a, 0x0a, 0x0e, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0f, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x64, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x45, - 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, + 0x32, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x22, 0x49, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x62, + 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x65, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, + 0x74, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x13, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x17, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, + 0x73, 0x67, 0x52, 0x17, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3a, 0x0a, 0x0e, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, + 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0f, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, + 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x45, 0x6e, + 0x63, 0x6c, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, + 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x42, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, + 0x05, 0x62, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x78, 0x74, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x4d, 0x73, 0x67, 0x52, 0x05, 0x62, 0x61, 0x74, 0x63, 0x68, 0x22, 0x4f, 0x0a, 0x13, 0x53, + 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, + 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x0d, 0x0a, 0x0b, + 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0c, 0x53, + 0x74, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x50, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x72, 0x4f, 0x72, 0x48, 0x61, + 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x72, 0x4f, 0x72, 0x48, 0x61, 0x73, 0x68, 0x22, 0x5f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x42, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, - 0x0a, 0x05, 0x62, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x78, 0x74, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x4d, 0x73, 0x67, 0x52, 0x05, 0x62, 0x61, 0x74, 0x63, 0x68, 0x22, 0x4f, 0x0a, 0x13, - 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x0d, 0x0a, - 0x0b, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0c, - 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x50, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x72, 0x4f, 0x72, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x4e, 0x72, 0x4f, 0x72, 0x48, 0x61, 0x73, 0x68, 0x22, 0x5f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, - 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x58, 0x0a, 0x10, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x34, 0x0a, - 0x15, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x65, 0x6e, - 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x24, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x67, 0x0a, 0x13, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x0b, 0x0a, 0x09, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x22, - 0xc0, 0x01, 0x0a, 0x14, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6c, - 0x61, 0x76, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x45, 0x6e, 0x63, - 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x48, 0x6f, 0x73, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0xae, 0x01, 0x0a, 0x1a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, - 0x67, 0x12, 0x56, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, - 0x52, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x22, 0x47, 0x0a, 0x17, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x14, - 0x0a, 0x05, 0x63, 0x61, 0x75, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, - 0x61, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x22, 0x89, 0x01, 0x0a, - 0x0d, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x16, - 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x70, 0x69, - 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, - 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x6e, 0x0a, 0x0b, 0x45, 0x78, 0x74, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x4d, 0x73, 0x67, 0x12, 0x31, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, - 0x73, 0x67, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x78, - 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x74, 0x78, - 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x03, 0x74, 0x78, 0x73, 0x22, 0xaa, 0x05, 0x0a, 0x0e, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x50, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0a, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x50, - 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, - 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x72, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x10, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4e, - 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x73, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x47, 0x61, 0x73, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x07, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x12, 0x44, 0x0a, 0x1d, 0x4c, - 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, - 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x0e, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x1d, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, - 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x12, 0x40, 0x0a, 0x1b, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1b, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x48, 0x0a, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x6f, 0x73, - 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x52, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x22, 0x0a, - 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x12, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x26, 0x0a, - 0x0e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x72, 0x65, 0x65, 0x18, - 0x13, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x54, 0x72, 0x65, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x52, 0x6f, 0x6c, - 0x6c, 0x75, 0x70, 0x4d, 0x73, 0x67, 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, - 0x73, 0x67, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x62, 0x61, - 0x74, 0x63, 0x68, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0d, 0x62, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, - 0x12, 0x32, 0x0a, 0x14, 0x63, 0x61, 0x6c, 0x6c, 0x64, 0x61, 0x74, 0x61, 0x52, 0x6f, 0x6c, 0x6c, - 0x75, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, - 0x63, 0x61, 0x6c, 0x6c, 0x64, 0x61, 0x74, 0x61, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x22, 0xdb, 0x02, 0x0a, 0x0f, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x50, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, - 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x4c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x50, 0x72, 0x6f, - 0x6f, 0x66, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, - 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, - 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, - 0x49, 0x44, 0x12, 0x48, 0x0a, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x58, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x34, 0x0a, 0x15, + 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x65, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0x24, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, + 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x67, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0x0b, 0x0a, 0x09, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x22, 0xc0, + 0x01, 0x0a, 0x14, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6c, 0x61, + 0x76, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x45, 0x6e, 0x63, 0x6c, + 0x61, 0x76, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x48, 0x6f, 0x73, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0xae, 0x01, 0x0a, 0x1a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, + 0x12, 0x56, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x52, + 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x47, 0x0a, 0x17, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x61, 0x75, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x61, + 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x22, 0x89, 0x01, 0x0a, 0x0d, + 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, 0x0a, + 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x6e, 0x0a, 0x0b, 0x45, 0x78, 0x74, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x4d, 0x73, 0x67, 0x12, 0x31, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, + 0x67, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x78, 0x48, + 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x74, 0x78, 0x48, + 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x03, 0x74, 0x78, 0x73, 0x22, 0xaa, 0x05, 0x0a, 0x0e, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x50, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, + 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x72, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, + 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x73, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x47, 0x61, 0x73, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x07, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x12, 0x44, 0x0a, 0x1d, 0x4c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x1d, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, + 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x12, 0x40, 0x0a, 0x1b, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1b, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x48, 0x0a, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x52, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x4c, 0x61, - 0x73, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0e, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x71, - 0x4e, 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x61, - 0x0a, 0x0d, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, - 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, - 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x32, 0x9d, 0x10, 0x0a, 0x0c, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x3f, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x2e, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x74, - 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x20, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, - 0x49, 0x6e, 0x69, 0x74, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x65, - 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x45, 0x6e, 0x63, 0x6c, - 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, + 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, + 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x72, 0x65, 0x65, 0x18, 0x13, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x54, 0x72, 0x65, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x52, 0x6f, 0x6c, 0x6c, + 0x75, 0x70, 0x4d, 0x73, 0x67, 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, + 0x67, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0d, 0x62, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, + 0x32, 0x0a, 0x14, 0x63, 0x61, 0x6c, 0x6c, 0x64, 0x61, 0x74, 0x61, 0x52, 0x6f, 0x6c, 0x6c, 0x75, + 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x63, + 0x61, 0x6c, 0x6c, 0x64, 0x61, 0x74, 0x61, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x22, 0xdb, 0x02, 0x0a, 0x0f, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x50, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x31, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, + 0x31, 0x48, 0x65, 0x61, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, + 0x44, 0x12, 0x48, 0x0a, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x52, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x4c, 0x61, 0x73, + 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0e, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x71, 0x4e, + 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, + 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x49, + 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x0b, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x61, 0x0a, + 0x0d, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x16, + 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, + 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x32, 0xfc, 0x10, 0x0a, 0x0c, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x3f, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x2e, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x74, + 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x74, 0x74, + 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x57, 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x12, 0x20, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x49, + 0x6e, 0x69, 0x74, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x45, 0x6e, 0x63, 0x6c, 0x61, - 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x09, - 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x12, 0x1b, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, - 0x4c, 0x31, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x09, 0x45, + 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x12, 0x1b, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5d, 0x0a, 0x10, 0x52, 0x50, 0x43, 0x45, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x22, 0x2e, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4c, 0x31, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0c, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x65, 0x64, 0x52, 0x50, 0x43, 0x12, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, + 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x4e, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1d, + 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, + 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x39, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x6f, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x07, 0x47, 0x65, + 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, + 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x55, 0x6e, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0c, 0x45, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x65, 0x64, 0x52, 0x50, 0x43, 0x12, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, - 0x45, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, - 0x6d, 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x39, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, - 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, - 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x48, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1b, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x55, 0x6e, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x0b, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x14, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x1a, - 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x48, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x45, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1a, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x42, 0x79, 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x12, 0x21, 0x2e, 0x67, 0x65, + 0x65, 0x64, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x14, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x1e, 0x2e, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x45, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x42, 0x79, 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, - 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1f, - 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, - 0x6c, 0x6c, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x52, - 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, - 0x6c, 0x75, 0x70, 0x12, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x69, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, - 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x26, - 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x6c, 0x0a, 0x15, 0x44, 0x65, 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, - 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x5a, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x32, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x73, 0x12, 0x21, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x32, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x6c, 0x0a, 0x15, 0x47, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x42, 0x79, 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x12, 0x21, 0x2e, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x42, 0x79, + 0x53, 0x65, 0x71, 0x4e, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x6c, + 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x6c, + 0x6c, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x1d, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x51, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x75, + 0x70, 0x12, 0x1e, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x69, 0x0a, 0x14, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x72, + 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x26, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x43, + 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x6c, 0x0a, 0x15, 0x44, 0x65, 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x44, 0x65, + 0x62, 0x75, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5a, 0x0a, + 0x0f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x32, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, + 0x12, 0x21, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x4c, 0x32, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, + 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x6c, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, - 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x66, 0x0a, 0x13, 0x45, 0x6e, 0x63, - 0x6c, 0x61, 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x25, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, - 0x6c, 0x61, 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x4b, 0x0a, 0x0a, 0x4d, 0x61, 0x6b, 0x65, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, - 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x6b, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, + 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x66, 0x0a, 0x13, 0x45, 0x6e, 0x63, 0x6c, 0x61, + 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, + 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, + 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x2e, 0x45, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x4b, 0x0a, 0x0a, 0x4d, 0x61, 0x6b, 0x65, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x6b, 0x65, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, - 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x12, 0x1e, - 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, - 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x17, 0x5a, 0x15, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x2f, 0x72, 0x70, 0x63, - 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x4d, 0x61, 0x6b, 0x65, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0c, + 0x41, 0x64, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x17, 0x5a, 0x15, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x76, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4097,7 +4204,7 @@ func file_enclave_proto_rawDescGZIP() []byte { return file_enclave_proto_rawDescData } -var file_enclave_proto_msgTypes = make([]protoimpl.MessageInfo, 65) +var file_enclave_proto_msgTypes = make([]protoimpl.MessageInfo, 67) var file_enclave_proto_goTypes = []any{ (*EnclavePublicConfigRequest)(nil), // 0: generated.EnclavePublicConfigRequest (*EnclavePublicConfigResponse)(nil), // 1: generated.EnclavePublicConfigResponse @@ -4135,128 +4242,133 @@ var file_enclave_proto_goTypes = []any{ (*InitEnclaveResponse)(nil), // 33: generated.InitEnclaveResponse (*EnclaveIDRequest)(nil), // 34: generated.EnclaveIDRequest (*EnclaveIDResponse)(nil), // 35: generated.EnclaveIDResponse - (*StartRequest)(nil), // 36: generated.StartRequest - (*StartResponse)(nil), // 37: generated.StartResponse - (*SubmitBlockRequest)(nil), // 38: generated.SubmitBlockRequest - (*SubmitBlockResponse)(nil), // 39: generated.SubmitBlockResponse - (*EncCallRequest)(nil), // 40: generated.EncCallRequest - (*EncCallResponse)(nil), // 41: generated.EncCallResponse - (*SubmitBatchRequest)(nil), // 42: generated.SubmitBatchRequest - (*SubmitBatchResponse)(nil), // 43: generated.SubmitBatchResponse - (*StopRequest)(nil), // 44: generated.StopRequest - (*StopResponse)(nil), // 45: generated.StopResponse - (*GetCodeRequest)(nil), // 46: generated.GetCodeRequest - (*GetCodeResponse)(nil), // 47: generated.GetCodeResponse - (*SubscribeRequest)(nil), // 48: generated.SubscribeRequest - (*SubscribeResponse)(nil), // 49: generated.SubscribeResponse - (*UnsubscribeRequest)(nil), // 50: generated.UnsubscribeRequest - (*UnsubscribeResponse)(nil), // 51: generated.UnsubscribeResponse - (*HealthCheckResponse)(nil), // 52: generated.HealthCheckResponse - (*EmptyArgs)(nil), // 53: generated.EmptyArgs - (*AttestationReportMsg)(nil), // 54: generated.AttestationReportMsg - (*BlockSubmissionResponseMsg)(nil), // 55: generated.BlockSubmissionResponseMsg - (*BlockSubmissionErrorMsg)(nil), // 56: generated.BlockSubmissionErrorMsg - (*CrossChainMsg)(nil), // 57: generated.CrossChainMsg - (*ExtBatchMsg)(nil), // 58: generated.ExtBatchMsg - (*BatchHeaderMsg)(nil), // 59: generated.BatchHeaderMsg - (*ExtRollupMsg)(nil), // 60: generated.ExtRollupMsg - (*RollupHeaderMsg)(nil), // 61: generated.RollupHeaderMsg - (*SecretResponseMsg)(nil), // 62: generated.SecretResponseMsg - (*WithdrawalMsg)(nil), // 63: generated.WithdrawalMsg - nil, // 64: generated.EnclavePublicConfigResponse.PublicSystemContractsEntry + (*RPCEncryptionKeyRequest)(nil), // 36: generated.RPCEncryptionKeyRequest + (*RPCEncryptionKeyResponse)(nil), // 37: generated.RPCEncryptionKeyResponse + (*StartRequest)(nil), // 38: generated.StartRequest + (*StartResponse)(nil), // 39: generated.StartResponse + (*SubmitBlockRequest)(nil), // 40: generated.SubmitBlockRequest + (*SubmitBlockResponse)(nil), // 41: generated.SubmitBlockResponse + (*EncCallRequest)(nil), // 42: generated.EncCallRequest + (*EncCallResponse)(nil), // 43: generated.EncCallResponse + (*SubmitBatchRequest)(nil), // 44: generated.SubmitBatchRequest + (*SubmitBatchResponse)(nil), // 45: generated.SubmitBatchResponse + (*StopRequest)(nil), // 46: generated.StopRequest + (*StopResponse)(nil), // 47: generated.StopResponse + (*GetCodeRequest)(nil), // 48: generated.GetCodeRequest + (*GetCodeResponse)(nil), // 49: generated.GetCodeResponse + (*SubscribeRequest)(nil), // 50: generated.SubscribeRequest + (*SubscribeResponse)(nil), // 51: generated.SubscribeResponse + (*UnsubscribeRequest)(nil), // 52: generated.UnsubscribeRequest + (*UnsubscribeResponse)(nil), // 53: generated.UnsubscribeResponse + (*HealthCheckResponse)(nil), // 54: generated.HealthCheckResponse + (*EmptyArgs)(nil), // 55: generated.EmptyArgs + (*AttestationReportMsg)(nil), // 56: generated.AttestationReportMsg + (*BlockSubmissionResponseMsg)(nil), // 57: generated.BlockSubmissionResponseMsg + (*BlockSubmissionErrorMsg)(nil), // 58: generated.BlockSubmissionErrorMsg + (*CrossChainMsg)(nil), // 59: generated.CrossChainMsg + (*ExtBatchMsg)(nil), // 60: generated.ExtBatchMsg + (*BatchHeaderMsg)(nil), // 61: generated.BatchHeaderMsg + (*ExtRollupMsg)(nil), // 62: generated.ExtRollupMsg + (*RollupHeaderMsg)(nil), // 63: generated.RollupHeaderMsg + (*SecretResponseMsg)(nil), // 64: generated.SecretResponseMsg + (*WithdrawalMsg)(nil), // 65: generated.WithdrawalMsg + nil, // 66: generated.EnclavePublicConfigResponse.PublicSystemContractsEntry } var file_enclave_proto_depIdxs = []int32{ - 64, // 0: generated.EnclavePublicConfigResponse.publicSystemContracts:type_name -> generated.EnclavePublicConfigResponse.PublicSystemContractsEntry + 66, // 0: generated.EnclavePublicConfigResponse.publicSystemContracts:type_name -> generated.EnclavePublicConfigResponse.PublicSystemContractsEntry 11, // 1: generated.EnclavePublicConfigResponse.systemError:type_name -> generated.SystemError 11, // 2: generated.GetBatchResponse.systemError:type_name -> generated.SystemError 7, // 3: generated.GetRollupDataResponse.msg:type_name -> generated.PublicRollupDataMsg 11, // 4: generated.GetRollupDataResponse.systemError:type_name -> generated.SystemError 11, // 5: generated.GetTotalContractCountResponse.systemError:type_name -> generated.SystemError 11, // 6: generated.DebugTraceTransactionResponse.systemError:type_name -> generated.SystemError - 60, // 7: generated.CreateRollupResponse.msg:type_name -> generated.ExtRollupMsg + 62, // 7: generated.CreateRollupResponse.msg:type_name -> generated.ExtRollupMsg 11, // 8: generated.CreateRollupResponse.systemError:type_name -> generated.SystemError 11, // 9: generated.StatusResponse.systemError:type_name -> generated.SystemError 11, // 10: generated.MakeActiveResponse.systemError:type_name -> generated.SystemError 11, // 11: generated.AddSequencerResponse.systemError:type_name -> generated.SystemError - 54, // 12: generated.AttestationResponse.attestationReportMsg:type_name -> generated.AttestationReportMsg + 56, // 12: generated.AttestationResponse.attestationReportMsg:type_name -> generated.AttestationReportMsg 11, // 13: generated.AttestationResponse.systemError:type_name -> generated.SystemError 11, // 14: generated.GenerateSecretResponse.systemError:type_name -> generated.SystemError 11, // 15: generated.InitEnclaveResponse.systemError:type_name -> generated.SystemError 11, // 16: generated.EnclaveIDResponse.systemError:type_name -> generated.SystemError - 11, // 17: generated.StartResponse.systemError:type_name -> generated.SystemError - 55, // 18: generated.SubmitBlockResponse.blockSubmissionResponse:type_name -> generated.BlockSubmissionResponseMsg - 11, // 19: generated.SubmitBlockResponse.systemError:type_name -> generated.SystemError - 11, // 20: generated.EncCallResponse.systemError:type_name -> generated.SystemError - 58, // 21: generated.SubmitBatchRequest.batch:type_name -> generated.ExtBatchMsg - 11, // 22: generated.SubmitBatchResponse.systemError:type_name -> generated.SystemError - 11, // 23: generated.StopResponse.systemError:type_name -> generated.SystemError - 11, // 24: generated.GetCodeResponse.systemError:type_name -> generated.SystemError - 11, // 25: generated.SubscribeResponse.systemError:type_name -> generated.SystemError - 11, // 26: generated.UnsubscribeResponse.systemError:type_name -> generated.SystemError - 11, // 27: generated.HealthCheckResponse.systemError:type_name -> generated.SystemError - 11, // 28: generated.AttestationReportMsg.systemError:type_name -> generated.SystemError - 62, // 29: generated.BlockSubmissionResponseMsg.producedSecretResponses:type_name -> generated.SecretResponseMsg - 56, // 30: generated.BlockSubmissionResponseMsg.error:type_name -> generated.BlockSubmissionErrorMsg - 59, // 31: generated.ExtBatchMsg.header:type_name -> generated.BatchHeaderMsg - 57, // 32: generated.BatchHeaderMsg.CrossChainMessages:type_name -> generated.CrossChainMsg - 61, // 33: generated.ExtRollupMsg.header:type_name -> generated.RollupHeaderMsg - 57, // 34: generated.RollupHeaderMsg.CrossChainMessages:type_name -> generated.CrossChainMsg - 11, // 35: generated.SecretResponseMsg.systemError:type_name -> generated.SystemError - 22, // 36: generated.EnclaveProto.Status:input_type -> generated.StatusRequest - 28, // 37: generated.EnclaveProto.Attestation:input_type -> generated.AttestationRequest - 30, // 38: generated.EnclaveProto.GenerateSecret:input_type -> generated.GenerateSecretRequest - 32, // 39: generated.EnclaveProto.InitEnclave:input_type -> generated.InitEnclaveRequest - 34, // 40: generated.EnclaveProto.EnclaveID:input_type -> generated.EnclaveIDRequest - 38, // 41: generated.EnclaveProto.SubmitL1Block:input_type -> generated.SubmitBlockRequest - 40, // 42: generated.EnclaveProto.EncryptedRPC:input_type -> generated.EncCallRequest - 42, // 43: generated.EnclaveProto.SubmitBatch:input_type -> generated.SubmitBatchRequest - 44, // 44: generated.EnclaveProto.Stop:input_type -> generated.StopRequest - 46, // 45: generated.EnclaveProto.GetCode:input_type -> generated.GetCodeRequest - 48, // 46: generated.EnclaveProto.Subscribe:input_type -> generated.SubscribeRequest - 50, // 47: generated.EnclaveProto.Unsubscribe:input_type -> generated.UnsubscribeRequest - 53, // 48: generated.EnclaveProto.HealthCheck:input_type -> generated.EmptyArgs - 2, // 49: generated.EnclaveProto.GetBatch:input_type -> generated.GetBatchRequest - 3, // 50: generated.EnclaveProto.GetBatchBySeqNo:input_type -> generated.GetBatchBySeqNoRequest - 5, // 51: generated.EnclaveProto.GetRollupData:input_type -> generated.GetRollupDataRequest - 16, // 52: generated.EnclaveProto.CreateBatch:input_type -> generated.CreateBatchRequest - 18, // 53: generated.EnclaveProto.CreateRollup:input_type -> generated.CreateRollupRequest - 20, // 54: generated.EnclaveProto.ExportCrossChainData:input_type -> generated.ExportCrossChainDataRequest - 14, // 55: generated.EnclaveProto.DebugTraceTransaction:input_type -> generated.DebugTraceTransactionRequest - 8, // 56: generated.EnclaveProto.StreamL2Updates:input_type -> generated.StreamL2UpdatesRequest - 12, // 57: generated.EnclaveProto.GetTotalContractCount:input_type -> generated.GetTotalContractCountRequest - 0, // 58: generated.EnclaveProto.EnclavePublicConfig:input_type -> generated.EnclavePublicConfigRequest - 24, // 59: generated.EnclaveProto.MakeActive:input_type -> generated.MakeActiveRequest - 26, // 60: generated.EnclaveProto.AddSequencer:input_type -> generated.AddSequencerRequest - 23, // 61: generated.EnclaveProto.Status:output_type -> generated.StatusResponse - 29, // 62: generated.EnclaveProto.Attestation:output_type -> generated.AttestationResponse - 31, // 63: generated.EnclaveProto.GenerateSecret:output_type -> generated.GenerateSecretResponse - 33, // 64: generated.EnclaveProto.InitEnclave:output_type -> generated.InitEnclaveResponse - 35, // 65: generated.EnclaveProto.EnclaveID:output_type -> generated.EnclaveIDResponse - 39, // 66: generated.EnclaveProto.SubmitL1Block:output_type -> generated.SubmitBlockResponse - 41, // 67: generated.EnclaveProto.EncryptedRPC:output_type -> generated.EncCallResponse - 43, // 68: generated.EnclaveProto.SubmitBatch:output_type -> generated.SubmitBatchResponse - 45, // 69: generated.EnclaveProto.Stop:output_type -> generated.StopResponse - 47, // 70: generated.EnclaveProto.GetCode:output_type -> generated.GetCodeResponse - 49, // 71: generated.EnclaveProto.Subscribe:output_type -> generated.SubscribeResponse - 51, // 72: generated.EnclaveProto.Unsubscribe:output_type -> generated.UnsubscribeResponse - 52, // 73: generated.EnclaveProto.HealthCheck:output_type -> generated.HealthCheckResponse - 4, // 74: generated.EnclaveProto.GetBatch:output_type -> generated.GetBatchResponse - 4, // 75: generated.EnclaveProto.GetBatchBySeqNo:output_type -> generated.GetBatchResponse - 6, // 76: generated.EnclaveProto.GetRollupData:output_type -> generated.GetRollupDataResponse - 17, // 77: generated.EnclaveProto.CreateBatch:output_type -> generated.CreateBatchResponse - 19, // 78: generated.EnclaveProto.CreateRollup:output_type -> generated.CreateRollupResponse - 21, // 79: generated.EnclaveProto.ExportCrossChainData:output_type -> generated.ExportCrossChainDataResponse - 15, // 80: generated.EnclaveProto.DebugTraceTransaction:output_type -> generated.DebugTraceTransactionResponse - 9, // 81: generated.EnclaveProto.StreamL2Updates:output_type -> generated.EncodedUpdateResponse - 13, // 82: generated.EnclaveProto.GetTotalContractCount:output_type -> generated.GetTotalContractCountResponse - 1, // 83: generated.EnclaveProto.EnclavePublicConfig:output_type -> generated.EnclavePublicConfigResponse - 25, // 84: generated.EnclaveProto.MakeActive:output_type -> generated.MakeActiveResponse - 27, // 85: generated.EnclaveProto.AddSequencer:output_type -> generated.AddSequencerResponse - 61, // [61:86] is the sub-list for method output_type - 36, // [36:61] is the sub-list for method input_type - 36, // [36:36] is the sub-list for extension type_name - 36, // [36:36] is the sub-list for extension extendee - 0, // [0:36] is the sub-list for field type_name + 11, // 17: generated.RPCEncryptionKeyResponse.systemError:type_name -> generated.SystemError + 11, // 18: generated.StartResponse.systemError:type_name -> generated.SystemError + 57, // 19: generated.SubmitBlockResponse.blockSubmissionResponse:type_name -> generated.BlockSubmissionResponseMsg + 11, // 20: generated.SubmitBlockResponse.systemError:type_name -> generated.SystemError + 11, // 21: generated.EncCallResponse.systemError:type_name -> generated.SystemError + 60, // 22: generated.SubmitBatchRequest.batch:type_name -> generated.ExtBatchMsg + 11, // 23: generated.SubmitBatchResponse.systemError:type_name -> generated.SystemError + 11, // 24: generated.StopResponse.systemError:type_name -> generated.SystemError + 11, // 25: generated.GetCodeResponse.systemError:type_name -> generated.SystemError + 11, // 26: generated.SubscribeResponse.systemError:type_name -> generated.SystemError + 11, // 27: generated.UnsubscribeResponse.systemError:type_name -> generated.SystemError + 11, // 28: generated.HealthCheckResponse.systemError:type_name -> generated.SystemError + 11, // 29: generated.AttestationReportMsg.systemError:type_name -> generated.SystemError + 64, // 30: generated.BlockSubmissionResponseMsg.producedSecretResponses:type_name -> generated.SecretResponseMsg + 58, // 31: generated.BlockSubmissionResponseMsg.error:type_name -> generated.BlockSubmissionErrorMsg + 61, // 32: generated.ExtBatchMsg.header:type_name -> generated.BatchHeaderMsg + 59, // 33: generated.BatchHeaderMsg.CrossChainMessages:type_name -> generated.CrossChainMsg + 63, // 34: generated.ExtRollupMsg.header:type_name -> generated.RollupHeaderMsg + 59, // 35: generated.RollupHeaderMsg.CrossChainMessages:type_name -> generated.CrossChainMsg + 11, // 36: generated.SecretResponseMsg.systemError:type_name -> generated.SystemError + 22, // 37: generated.EnclaveProto.Status:input_type -> generated.StatusRequest + 28, // 38: generated.EnclaveProto.Attestation:input_type -> generated.AttestationRequest + 30, // 39: generated.EnclaveProto.GenerateSecret:input_type -> generated.GenerateSecretRequest + 32, // 40: generated.EnclaveProto.InitEnclave:input_type -> generated.InitEnclaveRequest + 34, // 41: generated.EnclaveProto.EnclaveID:input_type -> generated.EnclaveIDRequest + 36, // 42: generated.EnclaveProto.RPCEncryptionKey:input_type -> generated.RPCEncryptionKeyRequest + 40, // 43: generated.EnclaveProto.SubmitL1Block:input_type -> generated.SubmitBlockRequest + 42, // 44: generated.EnclaveProto.EncryptedRPC:input_type -> generated.EncCallRequest + 44, // 45: generated.EnclaveProto.SubmitBatch:input_type -> generated.SubmitBatchRequest + 46, // 46: generated.EnclaveProto.Stop:input_type -> generated.StopRequest + 48, // 47: generated.EnclaveProto.GetCode:input_type -> generated.GetCodeRequest + 50, // 48: generated.EnclaveProto.Subscribe:input_type -> generated.SubscribeRequest + 52, // 49: generated.EnclaveProto.Unsubscribe:input_type -> generated.UnsubscribeRequest + 55, // 50: generated.EnclaveProto.HealthCheck:input_type -> generated.EmptyArgs + 2, // 51: generated.EnclaveProto.GetBatch:input_type -> generated.GetBatchRequest + 3, // 52: generated.EnclaveProto.GetBatchBySeqNo:input_type -> generated.GetBatchBySeqNoRequest + 5, // 53: generated.EnclaveProto.GetRollupData:input_type -> generated.GetRollupDataRequest + 16, // 54: generated.EnclaveProto.CreateBatch:input_type -> generated.CreateBatchRequest + 18, // 55: generated.EnclaveProto.CreateRollup:input_type -> generated.CreateRollupRequest + 20, // 56: generated.EnclaveProto.ExportCrossChainData:input_type -> generated.ExportCrossChainDataRequest + 14, // 57: generated.EnclaveProto.DebugTraceTransaction:input_type -> generated.DebugTraceTransactionRequest + 8, // 58: generated.EnclaveProto.StreamL2Updates:input_type -> generated.StreamL2UpdatesRequest + 12, // 59: generated.EnclaveProto.GetTotalContractCount:input_type -> generated.GetTotalContractCountRequest + 0, // 60: generated.EnclaveProto.EnclavePublicConfig:input_type -> generated.EnclavePublicConfigRequest + 24, // 61: generated.EnclaveProto.MakeActive:input_type -> generated.MakeActiveRequest + 26, // 62: generated.EnclaveProto.AddSequencer:input_type -> generated.AddSequencerRequest + 23, // 63: generated.EnclaveProto.Status:output_type -> generated.StatusResponse + 29, // 64: generated.EnclaveProto.Attestation:output_type -> generated.AttestationResponse + 31, // 65: generated.EnclaveProto.GenerateSecret:output_type -> generated.GenerateSecretResponse + 33, // 66: generated.EnclaveProto.InitEnclave:output_type -> generated.InitEnclaveResponse + 35, // 67: generated.EnclaveProto.EnclaveID:output_type -> generated.EnclaveIDResponse + 37, // 68: generated.EnclaveProto.RPCEncryptionKey:output_type -> generated.RPCEncryptionKeyResponse + 41, // 69: generated.EnclaveProto.SubmitL1Block:output_type -> generated.SubmitBlockResponse + 43, // 70: generated.EnclaveProto.EncryptedRPC:output_type -> generated.EncCallResponse + 45, // 71: generated.EnclaveProto.SubmitBatch:output_type -> generated.SubmitBatchResponse + 47, // 72: generated.EnclaveProto.Stop:output_type -> generated.StopResponse + 49, // 73: generated.EnclaveProto.GetCode:output_type -> generated.GetCodeResponse + 51, // 74: generated.EnclaveProto.Subscribe:output_type -> generated.SubscribeResponse + 53, // 75: generated.EnclaveProto.Unsubscribe:output_type -> generated.UnsubscribeResponse + 54, // 76: generated.EnclaveProto.HealthCheck:output_type -> generated.HealthCheckResponse + 4, // 77: generated.EnclaveProto.GetBatch:output_type -> generated.GetBatchResponse + 4, // 78: generated.EnclaveProto.GetBatchBySeqNo:output_type -> generated.GetBatchResponse + 6, // 79: generated.EnclaveProto.GetRollupData:output_type -> generated.GetRollupDataResponse + 17, // 80: generated.EnclaveProto.CreateBatch:output_type -> generated.CreateBatchResponse + 19, // 81: generated.EnclaveProto.CreateRollup:output_type -> generated.CreateRollupResponse + 21, // 82: generated.EnclaveProto.ExportCrossChainData:output_type -> generated.ExportCrossChainDataResponse + 15, // 83: generated.EnclaveProto.DebugTraceTransaction:output_type -> generated.DebugTraceTransactionResponse + 9, // 84: generated.EnclaveProto.StreamL2Updates:output_type -> generated.EncodedUpdateResponse + 13, // 85: generated.EnclaveProto.GetTotalContractCount:output_type -> generated.GetTotalContractCountResponse + 1, // 86: generated.EnclaveProto.EnclavePublicConfig:output_type -> generated.EnclavePublicConfigResponse + 25, // 87: generated.EnclaveProto.MakeActive:output_type -> generated.MakeActiveResponse + 27, // 88: generated.EnclaveProto.AddSequencer:output_type -> generated.AddSequencerResponse + 63, // [63:89] is the sub-list for method output_type + 37, // [37:63] is the sub-list for method input_type + 37, // [37:37] is the sub-list for extension type_name + 37, // [37:37] is the sub-list for extension extendee + 0, // [0:37] is the sub-list for field type_name } func init() { file_enclave_proto_init() } @@ -4698,7 +4810,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[36].Exporter = func(v any, i int) any { - switch v := v.(*StartRequest); i { + switch v := v.(*RPCEncryptionKeyRequest); i { case 0: return &v.state case 1: @@ -4710,7 +4822,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[37].Exporter = func(v any, i int) any { - switch v := v.(*StartResponse); i { + switch v := v.(*RPCEncryptionKeyResponse); i { case 0: return &v.state case 1: @@ -4722,7 +4834,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[38].Exporter = func(v any, i int) any { - switch v := v.(*SubmitBlockRequest); i { + switch v := v.(*StartRequest); i { case 0: return &v.state case 1: @@ -4734,7 +4846,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[39].Exporter = func(v any, i int) any { - switch v := v.(*SubmitBlockResponse); i { + switch v := v.(*StartResponse); i { case 0: return &v.state case 1: @@ -4746,7 +4858,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[40].Exporter = func(v any, i int) any { - switch v := v.(*EncCallRequest); i { + switch v := v.(*SubmitBlockRequest); i { case 0: return &v.state case 1: @@ -4758,7 +4870,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[41].Exporter = func(v any, i int) any { - switch v := v.(*EncCallResponse); i { + switch v := v.(*SubmitBlockResponse); i { case 0: return &v.state case 1: @@ -4770,7 +4882,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[42].Exporter = func(v any, i int) any { - switch v := v.(*SubmitBatchRequest); i { + switch v := v.(*EncCallRequest); i { case 0: return &v.state case 1: @@ -4782,7 +4894,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[43].Exporter = func(v any, i int) any { - switch v := v.(*SubmitBatchResponse); i { + switch v := v.(*EncCallResponse); i { case 0: return &v.state case 1: @@ -4794,7 +4906,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[44].Exporter = func(v any, i int) any { - switch v := v.(*StopRequest); i { + switch v := v.(*SubmitBatchRequest); i { case 0: return &v.state case 1: @@ -4806,7 +4918,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[45].Exporter = func(v any, i int) any { - switch v := v.(*StopResponse); i { + switch v := v.(*SubmitBatchResponse); i { case 0: return &v.state case 1: @@ -4818,7 +4930,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[46].Exporter = func(v any, i int) any { - switch v := v.(*GetCodeRequest); i { + switch v := v.(*StopRequest); i { case 0: return &v.state case 1: @@ -4830,7 +4942,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[47].Exporter = func(v any, i int) any { - switch v := v.(*GetCodeResponse); i { + switch v := v.(*StopResponse); i { case 0: return &v.state case 1: @@ -4842,7 +4954,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[48].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeRequest); i { + switch v := v.(*GetCodeRequest); i { case 0: return &v.state case 1: @@ -4854,7 +4966,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[49].Exporter = func(v any, i int) any { - switch v := v.(*SubscribeResponse); i { + switch v := v.(*GetCodeResponse); i { case 0: return &v.state case 1: @@ -4866,7 +4978,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[50].Exporter = func(v any, i int) any { - switch v := v.(*UnsubscribeRequest); i { + switch v := v.(*SubscribeRequest); i { case 0: return &v.state case 1: @@ -4878,7 +4990,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[51].Exporter = func(v any, i int) any { - switch v := v.(*UnsubscribeResponse); i { + switch v := v.(*SubscribeResponse); i { case 0: return &v.state case 1: @@ -4890,7 +5002,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[52].Exporter = func(v any, i int) any { - switch v := v.(*HealthCheckResponse); i { + switch v := v.(*UnsubscribeRequest); i { case 0: return &v.state case 1: @@ -4902,7 +5014,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[53].Exporter = func(v any, i int) any { - switch v := v.(*EmptyArgs); i { + switch v := v.(*UnsubscribeResponse); i { case 0: return &v.state case 1: @@ -4914,7 +5026,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[54].Exporter = func(v any, i int) any { - switch v := v.(*AttestationReportMsg); i { + switch v := v.(*HealthCheckResponse); i { case 0: return &v.state case 1: @@ -4926,7 +5038,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[55].Exporter = func(v any, i int) any { - switch v := v.(*BlockSubmissionResponseMsg); i { + switch v := v.(*EmptyArgs); i { case 0: return &v.state case 1: @@ -4938,7 +5050,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[56].Exporter = func(v any, i int) any { - switch v := v.(*BlockSubmissionErrorMsg); i { + switch v := v.(*AttestationReportMsg); i { case 0: return &v.state case 1: @@ -4950,7 +5062,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[57].Exporter = func(v any, i int) any { - switch v := v.(*CrossChainMsg); i { + switch v := v.(*BlockSubmissionResponseMsg); i { case 0: return &v.state case 1: @@ -4962,7 +5074,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[58].Exporter = func(v any, i int) any { - switch v := v.(*ExtBatchMsg); i { + switch v := v.(*BlockSubmissionErrorMsg); i { case 0: return &v.state case 1: @@ -4974,7 +5086,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[59].Exporter = func(v any, i int) any { - switch v := v.(*BatchHeaderMsg); i { + switch v := v.(*CrossChainMsg); i { case 0: return &v.state case 1: @@ -4986,7 +5098,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[60].Exporter = func(v any, i int) any { - switch v := v.(*ExtRollupMsg); i { + switch v := v.(*ExtBatchMsg); i { case 0: return &v.state case 1: @@ -4998,7 +5110,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[61].Exporter = func(v any, i int) any { - switch v := v.(*RollupHeaderMsg); i { + switch v := v.(*BatchHeaderMsg); i { case 0: return &v.state case 1: @@ -5010,7 +5122,7 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[62].Exporter = func(v any, i int) any { - switch v := v.(*SecretResponseMsg); i { + switch v := v.(*ExtRollupMsg); i { case 0: return &v.state case 1: @@ -5022,6 +5134,30 @@ func file_enclave_proto_init() { } } file_enclave_proto_msgTypes[63].Exporter = func(v any, i int) any { + switch v := v.(*RollupHeaderMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_enclave_proto_msgTypes[64].Exporter = func(v any, i int) any { + switch v := v.(*SecretResponseMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_enclave_proto_msgTypes[65].Exporter = func(v any, i int) any { switch v := v.(*WithdrawalMsg); i { case 0: return &v.state @@ -5041,7 +5177,7 @@ func file_enclave_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_enclave_proto_rawDesc, NumEnums: 0, - NumMessages: 65, + NumMessages: 67, NumExtensions: 0, NumServices: 1, }, diff --git a/go/common/rpc/generated/enclave.proto b/go/common/rpc/generated/enclave.proto index fb826e0877..5f03ca7094 100644 --- a/go/common/rpc/generated/enclave.proto +++ b/go/common/rpc/generated/enclave.proto @@ -10,6 +10,7 @@ service EnclaveProto { rpc GenerateSecret(GenerateSecretRequest) returns (GenerateSecretResponse) {} rpc InitEnclave(InitEnclaveRequest) returns (InitEnclaveResponse) {} rpc EnclaveID(EnclaveIDRequest) returns (EnclaveIDResponse) {} + rpc RPCEncryptionKey(RPCEncryptionKeyRequest) returns (RPCEncryptionKeyResponse) {} rpc SubmitL1Block(SubmitBlockRequest) returns (SubmitBlockResponse) {} rpc EncryptedRPC(EncCallRequest) returns (EncCallResponse){} rpc SubmitBatch(SubmitBatchRequest) returns (SubmitBatchResponse) {} @@ -172,6 +173,12 @@ message EnclaveIDResponse { SystemError systemError = 2; } +message RPCEncryptionKeyRequest {} +message RPCEncryptionKeyResponse { + bytes rpcPubKey = 1; + SystemError systemError = 2; +} + message StartRequest { bytes encodedBlock = 1; } diff --git a/go/common/rpc/generated/enclave_grpc.pb.go b/go/common/rpc/generated/enclave_grpc.pb.go index f50a9cc026..0e7c2f63e7 100644 --- a/go/common/rpc/generated/enclave_grpc.pb.go +++ b/go/common/rpc/generated/enclave_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.28.2 +// - protoc v5.28.3 // source: enclave.proto package generated @@ -24,6 +24,7 @@ const ( EnclaveProto_GenerateSecret_FullMethodName = "/generated.EnclaveProto/GenerateSecret" EnclaveProto_InitEnclave_FullMethodName = "/generated.EnclaveProto/InitEnclave" EnclaveProto_EnclaveID_FullMethodName = "/generated.EnclaveProto/EnclaveID" + EnclaveProto_RPCEncryptionKey_FullMethodName = "/generated.EnclaveProto/RPCEncryptionKey" EnclaveProto_SubmitL1Block_FullMethodName = "/generated.EnclaveProto/SubmitL1Block" EnclaveProto_EncryptedRPC_FullMethodName = "/generated.EnclaveProto/EncryptedRPC" EnclaveProto_SubmitBatch_FullMethodName = "/generated.EnclaveProto/SubmitBatch" @@ -55,6 +56,7 @@ type EnclaveProtoClient interface { GenerateSecret(ctx context.Context, in *GenerateSecretRequest, opts ...grpc.CallOption) (*GenerateSecretResponse, error) InitEnclave(ctx context.Context, in *InitEnclaveRequest, opts ...grpc.CallOption) (*InitEnclaveResponse, error) EnclaveID(ctx context.Context, in *EnclaveIDRequest, opts ...grpc.CallOption) (*EnclaveIDResponse, error) + RPCEncryptionKey(ctx context.Context, in *RPCEncryptionKeyRequest, opts ...grpc.CallOption) (*RPCEncryptionKeyResponse, error) SubmitL1Block(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) EncryptedRPC(ctx context.Context, in *EncCallRequest, opts ...grpc.CallOption) (*EncCallResponse, error) SubmitBatch(ctx context.Context, in *SubmitBatchRequest, opts ...grpc.CallOption) (*SubmitBatchResponse, error) @@ -135,6 +137,16 @@ func (c *enclaveProtoClient) EnclaveID(ctx context.Context, in *EnclaveIDRequest return out, nil } +func (c *enclaveProtoClient) RPCEncryptionKey(ctx context.Context, in *RPCEncryptionKeyRequest, opts ...grpc.CallOption) (*RPCEncryptionKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RPCEncryptionKeyResponse) + err := c.cc.Invoke(ctx, EnclaveProto_RPCEncryptionKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *enclaveProtoClient) SubmitL1Block(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SubmitBlockResponse) @@ -353,6 +365,7 @@ type EnclaveProtoServer interface { GenerateSecret(context.Context, *GenerateSecretRequest) (*GenerateSecretResponse, error) InitEnclave(context.Context, *InitEnclaveRequest) (*InitEnclaveResponse, error) EnclaveID(context.Context, *EnclaveIDRequest) (*EnclaveIDResponse, error) + RPCEncryptionKey(context.Context, *RPCEncryptionKeyRequest) (*RPCEncryptionKeyResponse, error) SubmitL1Block(context.Context, *SubmitBlockRequest) (*SubmitBlockResponse, error) EncryptedRPC(context.Context, *EncCallRequest) (*EncCallResponse, error) SubmitBatch(context.Context, *SubmitBatchRequest) (*SubmitBatchResponse, error) @@ -398,6 +411,9 @@ func (UnimplementedEnclaveProtoServer) InitEnclave(context.Context, *InitEnclave func (UnimplementedEnclaveProtoServer) EnclaveID(context.Context, *EnclaveIDRequest) (*EnclaveIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EnclaveID not implemented") } +func (UnimplementedEnclaveProtoServer) RPCEncryptionKey(context.Context, *RPCEncryptionKeyRequest) (*RPCEncryptionKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RPCEncryptionKey not implemented") +} func (UnimplementedEnclaveProtoServer) SubmitL1Block(context.Context, *SubmitBlockRequest) (*SubmitBlockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitL1Block not implemented") } @@ -569,6 +585,24 @@ func _EnclaveProto_EnclaveID_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _EnclaveProto_RPCEncryptionKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RPCEncryptionKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EnclaveProtoServer).RPCEncryptionKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EnclaveProto_RPCEncryptionKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EnclaveProtoServer).RPCEncryptionKey(ctx, req.(*RPCEncryptionKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _EnclaveProto_SubmitL1Block_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SubmitBlockRequest) if err := dec(in); err != nil { @@ -949,6 +983,10 @@ var EnclaveProto_ServiceDesc = grpc.ServiceDesc{ MethodName: "EnclaveID", Handler: _EnclaveProto_EnclaveID_Handler, }, + { + MethodName: "RPCEncryptionKey", + Handler: _EnclaveProto_RPCEncryptionKey_Handler, + }, { MethodName: "SubmitL1Block", Handler: _EnclaveProto_SubmitL1Block_Handler, diff --git a/go/enclave/components/attestation.go b/go/enclave/components/attestation.go index c6dc7e19c9..6493cd4663 100644 --- a/go/enclave/components/attestation.go +++ b/go/enclave/components/attestation.go @@ -7,6 +7,9 @@ import ( "encoding/json" "fmt" + gethlog "github.com/ethereum/go-ethereum/log" + "github.com/ten-protocol/go-ten/go/enclave/crypto" + "github.com/ten-protocol/go-ten/go/common" "github.com/edgelesssys/ego/enclave" @@ -19,17 +22,29 @@ type IDData struct { HostAddress string } +// AttestationProvider creates and verifies attestation reports type AttestationProvider interface { - // GetReport returns the verifiable attestation report - GetReport(ctx context.Context, pubKey []byte, enclaveID gethcommon.Address, hostAddress string) (*common.AttestationReport, error) + // CreateAttestationReport returns the verifiable attestation report + CreateAttestationReport(ctx context.Context, hostAddress string) (*common.AttestationReport, error) // VerifyReport returns the embedded report data VerifyReport(att *common.AttestationReport) ([]byte, error) } -type EgoAttestationProvider struct{} +func NewAttestationProvider(enclaveKeyService *crypto.EnclaveAttestedKeyService, willAttest bool, logger gethlog.Logger) AttestationProvider { + if willAttest { + return &EgoAttestationProvider{enclaveKeyService: enclaveKeyService, logger: logger} + } + logger.Warn("WARNING - Attestation is not enabled, enclave will not create a verified attestation report.") + return &DummyAttestationProvider{enclaveKeyService: enclaveKeyService} +} + +type EgoAttestationProvider struct { + enclaveKeyService *crypto.EnclaveAttestedKeyService + logger gethlog.Logger +} -func (e *EgoAttestationProvider) GetReport(ctx context.Context, pubKey []byte, enclaveID gethcommon.Address, hostAddress string) (*common.AttestationReport, error) { - idHash, err := getIDHash(enclaveID, pubKey, hostAddress) +func (e *EgoAttestationProvider) CreateAttestationReport(ctx context.Context, hostAddress string) (*common.AttestationReport, error) { + idHash, err := getIDHash(e.enclaveKeyService.EnclaveID(), e.enclaveKeyService.PublicKeyBytes(), hostAddress) if err != nil { return nil, err } @@ -40,8 +55,8 @@ func (e *EgoAttestationProvider) GetReport(ctx context.Context, pubKey []byte, e return &common.AttestationReport{ Report: report, - PubKey: pubKey, - EnclaveID: enclaveID, + PubKey: e.enclaveKeyService.PublicKeyBytes(), + EnclaveID: e.enclaveKeyService.EnclaveID(), HostAddress: hostAddress, }, nil } @@ -55,13 +70,15 @@ func (e *EgoAttestationProvider) VerifyReport(att *common.AttestationReport) ([] return remoteReport.Data, nil } -type DummyAttestationProvider struct{} +type DummyAttestationProvider struct { + enclaveKeyService *crypto.EnclaveAttestedKeyService +} -func (e *DummyAttestationProvider) GetReport(ctx context.Context, pubKey []byte, enclaveID gethcommon.Address, hostAddress string) (*common.AttestationReport, error) { +func (e *DummyAttestationProvider) CreateAttestationReport(ctx context.Context, hostAddress string) (*common.AttestationReport, error) { return &common.AttestationReport{ Report: []byte("MOCK REPORT"), - PubKey: pubKey, - EnclaveID: enclaveID, + PubKey: e.enclaveKeyService.PublicKeyBytes(), + EnclaveID: e.enclaveKeyService.EnclaveID(), HostAddress: hostAddress, }, nil } diff --git a/go/enclave/components/batch_executor.go b/go/enclave/components/batch_executor.go index dc6012e5e5..050720f578 100644 --- a/go/enclave/components/batch_executor.go +++ b/go/enclave/components/batch_executor.go @@ -9,6 +9,8 @@ import ( "sort" "sync" + "github.com/ten-protocol/go-ten/go/enclave/crypto" + "github.com/ten-protocol/go-ten/lib/gethfork/rpc" "github.com/holiman/uint256" @@ -51,7 +53,7 @@ type batchExecutor struct { gasOracle gas.Oracle chainConfig *params.ChainConfig systemContracts system.SystemContractCallbacks - + entropyService *crypto.EvmEntropyService // stateDBMutex - used to protect calls to stateDB.Commit as it is not safe for async access. stateDBMutex sync.Mutex @@ -69,6 +71,7 @@ func NewBatchExecutor( chainConfig *params.ChainConfig, batchGasLimit uint64, systemContracts system.SystemContractCallbacks, + entropyService *crypto.EvmEntropyService, logger gethlog.Logger, ) BatchExecutor { return &batchExecutor{ @@ -84,6 +87,7 @@ func NewBatchExecutor( stateDBMutex: sync.Mutex{}, batchGasLimit: batchGasLimit, systemContracts: systemContracts, + entropyService: entropyService, } } @@ -588,6 +592,7 @@ func (executor *batchExecutor) processTransactions( var excludedTransactions []*common.L2Tx txResultsMap, err := evm.ExecuteTransactions( ctx, + executor.entropyService, txs, stateDB, batch.Header, diff --git a/go/enclave/components/enclave_key_service.go b/go/enclave/components/enclave_key_service.go deleted file mode 100644 index c4edd5a8f6..0000000000 --- a/go/enclave/components/enclave_key_service.go +++ /dev/null @@ -1,70 +0,0 @@ -package components - -import ( - "context" - "crypto/ecdsa" - "errors" - "fmt" - - gethcommon "github.com/ethereum/go-ethereum/common" - gethlog "github.com/ethereum/go-ethereum/log" - "github.com/ten-protocol/go-ten/go/common" - "github.com/ten-protocol/go-ten/go/common/errutil" - "github.com/ten-protocol/go-ten/go/common/log" - "github.com/ten-protocol/go-ten/go/common/signature" - "github.com/ten-protocol/go-ten/go/enclave/crypto" - "github.com/ten-protocol/go-ten/go/enclave/storage" -) - -type EnclaveKeyService struct { - storage storage.Storage - logger gethlog.Logger - enclaveKey *crypto.EnclaveKey -} - -func NewEnclaveKeyService(storage storage.Storage, logger gethlog.Logger) *EnclaveKeyService { - return &EnclaveKeyService{storage: storage, logger: logger} -} - -func (eks *EnclaveKeyService) LoadOrCreateEnclaveKey() error { - enclaveKey, err := eks.storage.GetEnclaveKey(context.Background()) - if err != nil { - if !errors.Is(err, errutil.ErrNotFound) { - eks.logger.Crit("Failed to fetch enclave key", log.ErrKey, err) - } - // enclave key not found - new key should be generated - // todo (#1053) - revisit the crypto for this key generation/lifecycle before production - eks.logger.Info("Generating new enclave key") - enclaveKey, err = crypto.GenerateEnclaveKey() - if err != nil { - eks.logger.Crit("Failed to generate enclave key.", log.ErrKey, err) - } - err = eks.storage.StoreEnclaveKey(context.Background(), enclaveKey) - if err != nil { - eks.logger.Crit("Failed to store enclave key.", log.ErrKey, err) - } - } - eks.logger.Info(fmt.Sprintf("Enclave key available. EnclaveID=%s, publicKey=%s", enclaveKey.EnclaveID(), gethcommon.Bytes2Hex(enclaveKey.PublicKeyBytes()))) - eks.enclaveKey = enclaveKey - return err -} - -func (eks *EnclaveKeyService) Sign(payload gethcommon.Hash) ([]byte, error) { - return signature.Sign(payload.Bytes(), eks.enclaveKey.PrivateKey()) -} - -func (eks *EnclaveKeyService) EnclaveID() common.EnclaveID { - return eks.enclaveKey.EnclaveID() -} - -func (eks *EnclaveKeyService) PublicKey() *ecdsa.PublicKey { - return eks.enclaveKey.PublicKey() -} - -func (eks *EnclaveKeyService) PublicKeyBytes() []byte { - return eks.enclaveKey.PublicKeyBytes() -} - -func (eks *EnclaveKeyService) Decrypt(s common.EncryptedSharedEnclaveSecret) (*crypto.SharedEnclaveSecret, error) { - return crypto.DecryptSecret(s, eks.enclaveKey.PrivateKey()) -} diff --git a/go/enclave/components/rollup_compression.go b/go/enclave/components/rollup_compression.go index 4bdff62194..5e630a99df 100644 --- a/go/enclave/components/rollup_compression.go +++ b/go/enclave/components/rollup_compression.go @@ -48,7 +48,7 @@ Eg. If the time between 2 batches is always 1second, there is no need to store a 5. The cross chain messages are calculated. */ type RollupCompression struct { - dataEncryptionService crypto.DataEncryptionService + daEncryptionService *crypto.DAEncryptionService dataCompressionService compression.DataCompressionService batchRegistry BatchRegistry batchExecutor BatchExecutor @@ -61,7 +61,7 @@ type RollupCompression struct { func NewRollupCompression( batchRegistry BatchRegistry, batchExecutor BatchExecutor, - dataEncryptionService crypto.DataEncryptionService, + daEncryptionService *crypto.DAEncryptionService, dataCompressionService compression.DataCompressionService, storage storage.Storage, gethEncodingService gethencoding.EncodingService, @@ -71,7 +71,7 @@ func NewRollupCompression( return &RollupCompression{ batchRegistry: batchRegistry, batchExecutor: batchExecutor, - dataEncryptionService: dataEncryptionService, + daEncryptionService: daEncryptionService, dataCompressionService: dataCompressionService, storage: storage, gethEncodingService: gethEncodingService, @@ -542,7 +542,7 @@ func (rc *RollupCompression) serialiseCompressAndEncrypt(obj any) ([]byte, error if err != nil { return nil, err } - encrypted, err := rc.dataEncryptionService.Encrypt(compressed) + encrypted, err := rc.daEncryptionService.Encrypt(compressed) if err != nil { return nil, err } @@ -550,7 +550,7 @@ func (rc *RollupCompression) serialiseCompressAndEncrypt(obj any) ([]byte, error } func (rc *RollupCompression) decryptDecompressAndDeserialise(blob []byte, obj any) error { - plaintextBlob, err := rc.dataEncryptionService.Decrypt(blob) + plaintextBlob, err := rc.daEncryptionService.Decrypt(blob) if err != nil { return err } diff --git a/go/enclave/components/shared_secret_process.go b/go/enclave/components/shared_secret_process.go index 5a59fb5691..3fdbfcc497 100644 --- a/go/enclave/components/shared_secret_process.go +++ b/go/enclave/components/shared_secret_process.go @@ -17,18 +17,20 @@ import ( type SharedSecretProcessor struct { mgmtContractLib mgmtcontractlib.MgmtContractLib + sharedSecretService *crypto.SharedSecretService attestationProvider AttestationProvider // interface for producing attestation reports and verifying them enclaveID gethcommon.Address storage storage.Storage logger gethlog.Logger } -func NewSharedSecretProcessor(mgmtcontractlib mgmtcontractlib.MgmtContractLib, attestationProvider AttestationProvider, enclaveID gethcommon.Address, storage storage.Storage, logger gethlog.Logger) *SharedSecretProcessor { +func NewSharedSecretProcessor(mgmtcontractlib mgmtcontractlib.MgmtContractLib, attestationProvider AttestationProvider, enclaveID gethcommon.Address, storage storage.Storage, sharedSecretService *crypto.SharedSecretService, logger gethlog.Logger) *SharedSecretProcessor { return &SharedSecretProcessor{ mgmtContractLib: mgmtcontractlib, attestationProvider: attestationProvider, enclaveID: enclaveID, storage: storage, + sharedSecretService: sharedSecretService, logger: logger, } } @@ -100,7 +102,7 @@ func (ssp *SharedSecretProcessor) processSecretRequest(ctx context.Context, req } // ShareSecret verifies the request and if it trusts the report and the public key it will return the secret encrypted with that public key. -func (ssp *SharedSecretProcessor) verifyAttestationAndEncryptSecret(ctx context.Context, att *common.AttestationReport) (common.EncryptedSharedEnclaveSecret, error) { +func (ssp *SharedSecretProcessor) verifyAttestationAndEncryptSecret(_ context.Context, att *common.AttestationReport) (common.EncryptedSharedEnclaveSecret, error) { // First we verify the attestation report has come from a valid obscuro enclave running in a verified TEE. data, err := ssp.attestationProvider.VerifyReport(att) if err != nil { @@ -112,11 +114,7 @@ func (ssp *SharedSecretProcessor) verifyAttestationAndEncryptSecret(ctx context. } ssp.logger.Info(fmt.Sprintf("Successfully verified attestation and identity. Owner: %s", att.EnclaveID)) - secret, err := ssp.storage.FetchSecret(ctx) - if err != nil { - return nil, fmt.Errorf("could not retrieve secret; this should not happen. Cause: %w", err) - } - return crypto.EncryptSecret(att.PubKey, *secret, ssp.logger) + return ssp.sharedSecretService.EncryptSecretWithKey(att.PubKey) } // storeAttestation stores the attested keys of other nodes so we can decrypt their rollups diff --git a/go/enclave/core/batch.go b/go/enclave/core/batch.go index 3d9e7298ef..098249c828 100644 --- a/go/enclave/core/batch.go +++ b/go/enclave/core/batch.go @@ -49,7 +49,7 @@ func (b *Batch) NumberU64() uint64 { return b.Header.Number.Uint64() } func (b *Batch) Number() *big.Int { return new(big.Int).Set(b.Header.Number) } func (b *Batch) SeqNo() *big.Int { return new(big.Int).Set(b.Header.SequencerOrderNo) } -func (b *Batch) ToExtBatch(transactionBlobCrypto crypto.DataEncryptionService, compression compression.DataCompressionService) (*common.ExtBatch, error) { +func (b *Batch) ToExtBatch(transactionBlobCrypto *crypto.DAEncryptionService, compression compression.DataCompressionService) (*common.ExtBatch, error) { txHashes := make([]gethcommon.Hash, len(b.Transactions)) for idx, tx := range b.Transactions { txHashes[idx] = tx.Hash() @@ -74,7 +74,7 @@ func (b *Batch) ToExtBatch(transactionBlobCrypto crypto.DataEncryptionService, c }, nil } -func ToBatch(extBatch *common.ExtBatch, transactionBlobCrypto crypto.DataEncryptionService, compression compression.DataCompressionService) (*Batch, error) { +func ToBatch(extBatch *common.ExtBatch, transactionBlobCrypto *crypto.DAEncryptionService, compression compression.DataCompressionService) (*Batch, error) { compressed, err := transactionBlobCrypto.Decrypt(extBatch.EncryptedTxBlob) if err != nil { return nil, err diff --git a/go/enclave/crypto/README.md b/go/enclave/crypto/README.md index 8adee3086b..352d39eb9a 100644 --- a/go/enclave/crypto/README.md +++ b/go/enclave/crypto/README.md @@ -1 +1,7 @@ -This package contains logic which implements the cryptographic requirements of Ten. \ No newline at end of file +This package contains logic which implements the cryptographic requirements of TEN. + +1. Manage the shared secret of the network.(SS) - shared_secret_service +2. Manage the "Ten RPC" encryption - which is the key used by all clients to communicate with the TEN network (key derived from SS) - rpc_key_service +3. Manage the Data availability(DA) (Rollup and Batches) Encryption/Decryption ( key derived from SS). - da_enc_service +4. Manage the enclave key signature/encryption/decryption/ id derivation. - enclave_key_service +5. Manage entropy per batch and tx - evm_entropy_service diff --git a/go/enclave/crypto/crypto.go b/go/enclave/crypto/crypto.go deleted file mode 100644 index ca1fb6a14d..0000000000 --- a/go/enclave/crypto/crypto.go +++ /dev/null @@ -1,120 +0,0 @@ -package crypto - -import ( - "bytes" - "crypto/ecdsa" - "crypto/rand" - "encoding/binary" - "errors" - "fmt" - "io" - "math/big" - - gethlog "github.com/ethereum/go-ethereum/log" - - "github.com/ten-protocol/go-ten/go/common/log" - - gethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ten-protocol/go-ten/go/common" -) - -const ( - // obscuroPrivateKeyHex is the private key used for sensitive communication with the enclave. - // todo (#1053) - replace this fixed key with a key derived from the master seed. - obscuroPrivateKeyHex = "81acce9620f0adf1728cb8df7f6b8b8df857955eb9e8b7aed6ef8390c09fc207" - sharedSecretLen = 32 -) - -// SharedEnclaveSecret - the entropy -type SharedEnclaveSecret [sharedSecretLen]byte - -func GetObscuroKey(logger gethlog.Logger) *ecdsa.PrivateKey { - key, err := crypto.HexToECDSA(obscuroPrivateKeyHex) - if err != nil { - logger.Crit("failed to create enclave private key", log.ErrKey, err) - } - return key -} - -func GenerateEntropy(logger gethlog.Logger) SharedEnclaveSecret { - secret := make([]byte, sharedSecretLen) - if _, err := io.ReadFull(rand.Reader, secret); err != nil { - logger.Crit("could not generate secret", log.ErrKey, err) - } - var temp [sharedSecretLen]byte - copy(temp[:], secret) - return temp -} - -func DecryptSecret(secret common.EncryptedSharedEnclaveSecret, privateKey *ecdsa.PrivateKey) (*SharedEnclaveSecret, error) { - if privateKey == nil { - return nil, errors.New("private key not found - shouldn't happen") - } - value, err := decryptWithPrivateKey(secret, privateKey) - if err != nil { - return nil, err - } - var temp SharedEnclaveSecret - copy(temp[:], value) - return &temp, nil -} - -func EncryptSecret(pubKeyEncoded []byte, secret SharedEnclaveSecret, logger gethlog.Logger) (common.EncryptedSharedEnclaveSecret, error) { - logger.Info(fmt.Sprintf("Encrypting secret with public key %s", gethcommon.Bytes2Hex(pubKeyEncoded))) - key, err := crypto.DecompressPubkey(pubKeyEncoded) - if err != nil { - return nil, fmt.Errorf("failed to parse public key %w", err) - } - - encKey, err := encryptWithPublicKey(secret[:], key) - if err != nil { - logger.Info(fmt.Sprintf("Failed to encrypt key, err: %s\nsecret: %v\npubkey: %v\nencKey:%v", err, secret, pubKeyEncoded, encKey)) - } - return encKey, err -} - -// Encrypts data with public key -func encryptWithPublicKey(msg []byte, pub *ecdsa.PublicKey) ([]byte, error) { - ciphertext, err := ecies.Encrypt(rand.Reader, ecies.ImportECDSAPublic(pub), msg, nil, nil) - if err != nil { - return nil, fmt.Errorf("failed to encrypt with public key. %w", err) - } - return ciphertext, nil -} - -// Decrypts data with private key -func decryptWithPrivateKey(ciphertext []byte, priv *ecdsa.PrivateKey) ([]byte, error) { - plaintext, err := ecies.ImportECDSA(priv).Decrypt(ciphertext, nil, nil) - if err != nil { - return nil, fmt.Errorf("could not decrypt with private key. %w", err) - } - return plaintext, nil -} - -// CalculateRootBatchEntropy - calculates entropy per batch -// In Obscuro, we use a root entropy per batch, which is then used to calculate randomness exposed to individual transactions -// The RootBatchEntropy is calculated based on the shared secret and the batch height -// This ensures that sibling batches will naturally use the same root entropy so that transactions will have the same results -// Note that this formula is vulnerable to the unlikely event of a secret leak. -// todo (crypto) - find a way to hash in timestamp or something else then it would make it harder for attacker, such that sibling batches naturally have the same entropy. -func CalculateRootBatchEntropy(rootEntropy []byte, batchHeight *big.Int) gethcommon.Hash { - return crypto.Keccak256Hash(rootEntropy, batchHeight.Bytes()) -} - -// CalculateTxRnd - calculates the randomness exposed to individual transactions -// In Obscuro, each tx must have its own randomness, independent from the others, because otherwise a malicious transaction -// could reveal information. -func CalculateTxRnd(rootBatchEntropy []byte, tCount int) gethcommon.Hash { - return crypto.Keccak256Hash(rootBatchEntropy, intToBytes(tCount)) -} - -func intToBytes(val int) []byte { - buf := new(bytes.Buffer) - err := binary.Write(buf, binary.LittleEndian, int64(val)) - if err != nil { - panic(fmt.Sprintf("Could not convert int to bytes. Cause: %s", err)) - } - return buf.Bytes() -} diff --git a/go/enclave/crypto/da_enc_service.go b/go/enclave/crypto/da_enc_service.go new file mode 100644 index 0000000000..a76d7cb5ec --- /dev/null +++ b/go/enclave/crypto/da_enc_service.go @@ -0,0 +1,96 @@ +package crypto + +import ( + "crypto/aes" + "crypto/cipher" + "errors" + "fmt" + + gethlog "github.com/ethereum/go-ethereum/log" + + "github.com/ten-protocol/go-ten/go/common/log" +) + +const ( + // GCMNonceLength is the nonce's length in bytes for encrypting and decrypting transactions. + GCMNonceLength = 12 + // daSuffix is used for generating the encryption key from the shared secret + daSuffix = 0 +) + +// DAEncryptionService - handles encryption/decryption of the data stored in the DA layer +type DAEncryptionService struct { + sharedSecretService *SharedSecretService + cipher *cipher.AEAD + logger gethlog.Logger +} + +func NewDAEncryptionService(sharedSecretService *SharedSecretService, logger gethlog.Logger) *DAEncryptionService { + da := &DAEncryptionService{ + sharedSecretService: sharedSecretService, + logger: logger, + } + + _ = da.Initialise() + + return da +} + +func (t *DAEncryptionService) Initialise() error { + if !t.sharedSecretService.IsInitialised() { + return errors.New("shared secret service is not initialised") + } + var err error + t.cipher, err = createCypher(t.sharedSecretService) + if err != nil { + return fmt.Errorf("error creating cypher: %w", err) + } + return nil +} + +func createCypher(sharedSecretService *SharedSecretService) (*cipher.AEAD, error) { + key := sharedSecretService.ExtendEntropy([]byte{byte(daSuffix)}) + block, err := aes.NewCipher(key) + if err != nil { + return nil, fmt.Errorf("could not initialise AES cipher for enclave DA key. cause %w", err) + } + cipher, err := cipher.NewGCM(block) + if err != nil { + return nil, fmt.Errorf("could not initialise GCM cipher for enclave DA key. cause %w", err) + } + return &cipher, nil +} + +func (t *DAEncryptionService) Encrypt(blob []byte) ([]byte, error) { + if t.cipher == nil { + return nil, errors.New("not initialised") + } + + nonce, err := generateSecureEntropy(GCMNonceLength) + if err != nil { + t.logger.Error("could not generate nonce to encrypt transactions.", log.ErrKey, err) + return nil, err + } + + ciphertext := (*t.cipher).Seal(nil, nonce, blob, nil) + // We prepend the nonce to the ciphertext, so that it can be retrieved when decrypting. + return append(nonce, ciphertext...), nil //nolint:makezero +} + +func (t *DAEncryptionService) Decrypt(blob []byte) ([]byte, error) { + if t.cipher == nil { + return nil, errors.New("not initialised") + } + + // The nonce is prepended to the ciphertext. + nonce := blob[0:GCMNonceLength] + ciphertext := blob[GCMNonceLength:] + + plaintext, err := (*t.cipher).Open(nil, nonce, ciphertext, nil) + if err != nil { + t.logger.Error("could not decrypt blob.", log.ErrKey, err) + return nil, err + } + + return plaintext, nil +} diff --git a/go/enclave/crypto/data_enc_service.go b/go/enclave/crypto/data_enc_service.go deleted file mode 100644 index 04d9c1dc37..0000000000 --- a/go/enclave/crypto/data_enc_service.go +++ /dev/null @@ -1,77 +0,0 @@ -package crypto - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "io" - - gethlog "github.com/ethereum/go-ethereum/log" - - "github.com/ten-protocol/go-ten/go/common/log" - - gethcommon "github.com/ethereum/go-ethereum/common" -) - -const ( - // RollupEncryptionKeyHex is the AES key used to encrypt and decrypt the transaction blob in rollups. - // todo (#1053) - replace this fixed key with derived, rotating keys. - RollupEncryptionKeyHex = "bddbc0d46a0666ce57a466168d99c1830b0c65e052d77188f2cbfc3f6486588c" - // NonceLength is the nonce's length in bytes for encrypting and decrypting transactions. - NonceLength = 12 -) - -// DataEncryptionService handles the encryption and decryption of the transaction blobs stored inside a rollup. -type DataEncryptionService interface { - Encrypt(blob []byte) ([]byte, error) - Decrypt(blob []byte) ([]byte, error) -} - -type dataEncryptionServiceImpl struct { - cipher cipher.AEAD - logger gethlog.Logger -} - -func NewDataEncryptionService(logger gethlog.Logger) DataEncryptionService { - key := gethcommon.Hex2Bytes(RollupEncryptionKeyHex) - block, err := aes.NewCipher(key) - if err != nil { - logger.Crit("could not initialise AES cipher for enclave rollup key.", log.ErrKey, err) - } - cipher, err := cipher.NewGCM(block) - if err != nil { - logger.Crit("could not initialise wrapper for AES cipher for enclave rollup key. ", log.ErrKey, err) - } - return dataEncryptionServiceImpl{ - cipher: cipher, - logger: logger, - } -} - -// todo (#1053) - modify this logic so that transactions with different reveal periods are in different blobs, as per the whitepaper. -func (t dataEncryptionServiceImpl) Encrypt(blob []byte) ([]byte, error) { - nonce := make([]byte, NonceLength) - if _, err := io.ReadFull(rand.Reader, nonce); err != nil { - t.logger.Error("could not generate nonce to encrypt transactions.", log.ErrKey, err) - return nil, err - } - - // todo - ensure this nonce is not used too many times (2^32?) with the same key, to avoid risk of repeat. - ciphertext := t.cipher.Seal(nil, nonce, blob, nil) - // We prepend the nonce to the ciphertext, so that it can be retrieved when decrypting. - return append(nonce, ciphertext...), nil //nolint:makezero -} - -func (t dataEncryptionServiceImpl) Decrypt(blob []byte) ([]byte, error) { - // The nonce is prepended to the ciphertext. - nonce := blob[0:NonceLength] - ciphertext := blob[NonceLength:] - - plaintext, err := t.cipher.Open(nil, nonce, ciphertext, nil) - if err != nil { - t.logger.Error("could not decrypt blob.", log.ErrKey, err) - return nil, err - } - - return plaintext, nil -} diff --git a/go/enclave/crypto/enclave_key.go b/go/enclave/crypto/enclave_key.go deleted file mode 100644 index 0e3d2b9caa..0000000000 --- a/go/enclave/crypto/enclave_key.go +++ /dev/null @@ -1,50 +0,0 @@ -package crypto - -import ( - "crypto/ecdsa" - "fmt" - - gethcrypto "github.com/ethereum/go-ethereum/crypto" - "github.com/ten-protocol/go-ten/go/common" -) - -func GenerateEnclaveKey() (*EnclaveKey, error) { - privKey, err := gethcrypto.GenerateKey() - if err != nil { - return nil, fmt.Errorf("could not generate enclave key. Cause: %w", err) - } - return NewEnclaveKey(privKey), nil -} - -func NewEnclaveKey(privKey *ecdsa.PrivateKey) *EnclaveKey { - pubKey := gethcrypto.CompressPubkey(&privKey.PublicKey) - enclaveID := gethcrypto.PubkeyToAddress(privKey.PublicKey) - return &EnclaveKey{ - privateKey: privKey, - publicKeyBytes: pubKey, - enclaveID: enclaveID, - } -} - -// EnclaveKey - encapsulates behaviour for the enclave's private key (used to identify the enclave and sign messages) -type EnclaveKey struct { - privateKey *ecdsa.PrivateKey // generated by the enclave at startup, used to sign messages - enclaveID common.EnclaveID // the enclave's ID, derived from the public key - publicKeyBytes []byte -} - -func (k *EnclaveKey) PrivateKey() *ecdsa.PrivateKey { - return k.privateKey -} - -func (k *EnclaveKey) PublicKey() *ecdsa.PublicKey { - return &k.privateKey.PublicKey -} - -func (k *EnclaveKey) EnclaveID() common.EnclaveID { - return k.enclaveID -} - -func (k *EnclaveKey) PublicKeyBytes() []byte { - return k.publicKeyBytes -} diff --git a/go/enclave/crypto/enclave_key_service.go b/go/enclave/crypto/enclave_key_service.go new file mode 100644 index 0000000000..4da0c87bb8 --- /dev/null +++ b/go/enclave/crypto/enclave_key_service.go @@ -0,0 +1,79 @@ +package crypto + +import ( + "crypto/ecdsa" + "crypto/rand" + "fmt" + + "github.com/ten-protocol/go-ten/go/common/log" + + gethcommon "github.com/ethereum/go-ethereum/common" + gethlog "github.com/ethereum/go-ethereum/log" + "github.com/ten-protocol/go-ten/go/common/signature" + + gethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/ten-protocol/go-ten/go/common" +) + +// enclavePrivateKey - the private key that was attested +type enclavePrivateKey struct { + privateKey *ecdsa.PrivateKey // generated by the enclave at startup, used to sign messages + enclaveID common.EnclaveID // the enclave's ID, derived from the public key + publicKeyBytes []byte +} + +// EnclaveAttestedKeyService manages the attestation key - including +type EnclaveAttestedKeyService struct { + logger gethlog.Logger + enclaveKey *enclavePrivateKey +} + +func NewEnclaveAttestedKeyService(logger gethlog.Logger) *EnclaveAttestedKeyService { + return &EnclaveAttestedKeyService{logger: logger} +} + +func (eks *EnclaveAttestedKeyService) Sign(payload gethcommon.Hash) ([]byte, error) { + return signature.Sign(payload.Bytes(), eks.enclaveKey.privateKey) +} + +func (eks *EnclaveAttestedKeyService) EnclaveID() common.EnclaveID { + return eks.enclaveKey.enclaveID +} + +func (eks *EnclaveAttestedKeyService) PublicKey() *ecdsa.PublicKey { + return &eks.enclaveKey.privateKey.PublicKey +} + +func (eks *EnclaveAttestedKeyService) PublicKeyBytes() []byte { + return eks.enclaveKey.publicKeyBytes +} + +func (eks *EnclaveAttestedKeyService) Decrypt(encBytes []byte) ([]byte, error) { + return decryptWithPrivateKey(encBytes, eks.enclaveKey.privateKey) +} + +func (eks *EnclaveAttestedKeyService) Encrypt(encBytes []byte) ([]byte, error) { + return encryptWithPublicKey(encBytes, &eks.enclaveKey.privateKey.PublicKey) +} + +func (eks *EnclaveAttestedKeyService) GenerateEnclaveKey() ([]byte, error) { + privKey, err := ecdsa.GenerateKey(gethcrypto.S256(), rand.Reader) + if err != nil { + return nil, fmt.Errorf("could not generate enclave key. Cause: %w", err) + } + return gethcrypto.FromECDSA(privKey), nil +} + +func (eks *EnclaveAttestedKeyService) SetEnclaveKey(keyBytes []byte) { + ecdsaKey, err := gethcrypto.ToECDSA(keyBytes) + if err != nil { + eks.logger.Crit("could not parse enclave key", log.ErrKey, err) + } + pubKey := gethcrypto.CompressPubkey(&ecdsaKey.PublicKey) + enclaveID := gethcrypto.PubkeyToAddress(ecdsaKey.PublicKey) + eks.enclaveKey = &enclavePrivateKey{ + privateKey: ecdsaKey, + publicKeyBytes: pubKey, + enclaveID: enclaveID, + } +} diff --git a/go/enclave/crypto/evm_entropy_service.go b/go/enclave/crypto/evm_entropy_service.go new file mode 100644 index 0000000000..23f52ac824 --- /dev/null +++ b/go/enclave/crypto/evm_entropy_service.go @@ -0,0 +1,52 @@ +package crypto + +import ( + "bytes" + "encoding/binary" + "fmt" + "math/big" + + gethlog "github.com/ethereum/go-ethereum/log" + + gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +// EvmEntropyService - generates the entropy that is injected into the EVM - unique for each transaction +type EvmEntropyService struct { + sharedSecretService *SharedSecretService + logger gethlog.Logger +} + +func NewEvmEntropyService(sc *SharedSecretService, logger gethlog.Logger) *EvmEntropyService { + return &EvmEntropyService{sharedSecretService: sc, logger: logger} +} + +// BatchEntropy - calculates entropy per batch +// In Obscuro, we use a root entropy per batch, which is then used to calculate randomness exposed to individual transactions +// The RootBatchEntropy is calculated based on the shared secret and the batch height +// This ensures that sibling batches will naturally use the same root entropy so that transactions will have the same results +// Note that this formula is vulnerable to the unlikely event of a secret leak. +// todo (crypto) - find a way to hash in timestamp or something else then it would make it harder for attacker, such that sibling batches naturally have the same entropy. +func (ees *EvmEntropyService) BatchEntropy(batchHeight *big.Int) gethcommon.Hash { + if !ees.sharedSecretService.IsInitialised() { + ees.logger.Crit("shared secret service is not initialised") + } + return gethcommon.BytesToHash(ees.sharedSecretService.ExtendEntropy(batchHeight.Bytes())) +} + +// TxEntropy - calculates the randomness exposed to individual transactions +// In TEN, each tx has its own independent randomness, because otherwise a malicious transaction from the same batch +// could reveal information. +func (ees *EvmEntropyService) TxEntropy(rootBatchEntropy []byte, tCount int) gethcommon.Hash { + return crypto.Keccak256Hash(rootBatchEntropy, intToBytes(tCount)) +} + +func intToBytes(val int) []byte { + buf := new(bytes.Buffer) + err := binary.Write(buf, binary.LittleEndian, int64(val)) + if err != nil { + panic(fmt.Sprintf("Could not convert int to bytes. Cause: %s", err)) + } + return buf.Bytes() +} diff --git a/go/enclave/crypto/rpc_key_service.go b/go/enclave/crypto/rpc_key_service.go new file mode 100644 index 0000000000..583bd815a6 --- /dev/null +++ b/go/enclave/crypto/rpc_key_service.go @@ -0,0 +1,52 @@ +package crypto + +import ( + gethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/ecies" + gethlog "github.com/ethereum/go-ethereum/log" + "github.com/ten-protocol/go-ten/go/common/log" +) + +const rpcSuffix = 1 + +// RPCKeyService - manages the "TEN - RPC key" used by clients (like the TEN gateway) to make RPC requests +type RPCKeyService struct { + privKey *ecies.PrivateKey + sharedSecretService *SharedSecretService + logger gethlog.Logger +} + +func NewRPCKeyService(sharedSecretService *SharedSecretService, logger gethlog.Logger) *RPCKeyService { + s := &RPCKeyService{ + sharedSecretService: sharedSecretService, + logger: logger, + } + if sharedSecretService.IsInitialised() { + err := s.Initialise() + if err != nil { + logger.Crit("Failed to initialise RPC key service ", log.ErrKey, err) + return nil + } + } + return s +} + +// Initialise - called when the shared secret is available +func (s *RPCKeyService) Initialise() error { + // the key is derived from the shared secret to allow transactions to be broadcast + bytes := s.sharedSecretService.ExtendEntropy([]byte{byte(rpcSuffix)}) + ecdsaKey, err := gethcrypto.ToECDSA(bytes) + if err != nil { + return err + } + s.privKey = ecies.ImportECDSA(ecdsaKey) + return nil +} + +func (s *RPCKeyService) DecryptRPCRequest(bytes []byte) ([]byte, error) { + return s.privKey.Decrypt(bytes, nil, nil) +} + +func (s *RPCKeyService) PublicKey() []byte { + return gethcrypto.CompressPubkey(s.privKey.PublicKey.ExportECDSA()) +} diff --git a/go/enclave/crypto/shared_secret_service.go b/go/enclave/crypto/shared_secret_service.go new file mode 100644 index 0000000000..3fa65bce22 --- /dev/null +++ b/go/enclave/crypto/shared_secret_service.go @@ -0,0 +1,71 @@ +package crypto + +import ( + "fmt" + + gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + gethlog "github.com/ethereum/go-ethereum/log" + "github.com/ten-protocol/go-ten/go/common" + "github.com/ten-protocol/go-ten/go/common/log" +) + +const ( + sharedSecretLenInBytes = 32 +) + +// SharedEnclaveSecret - the entropy +type SharedEnclaveSecret [sharedSecretLenInBytes]byte + +// SharedSecretService provides functionality to encapsulate, generate, extend, and encrypt the shared secret of the TEN network. +type SharedSecretService struct { + secret *SharedEnclaveSecret + logger gethlog.Logger +} + +func NewSharedSecretService(logger gethlog.Logger) *SharedSecretService { + return &SharedSecretService{logger: logger} +} + +// GenerateSharedSecret - called only by the genesis +func (sss *SharedSecretService) GenerateSharedSecret() { + secret, err := generateSecureEntropy(sharedSecretLenInBytes) + if err != nil { + sss.logger.Crit("could not generate secret", log.ErrKey, err) + } + var tempSecret SharedEnclaveSecret + copy(tempSecret[:], secret) + sss.secret = &tempSecret +} + +// Secret - should only be used before storing it +func (sss *SharedSecretService) Secret() *SharedEnclaveSecret { + return sss.secret +} + +func (sss *SharedSecretService) SetSharedSecret(ss *SharedEnclaveSecret) { + sss.secret = ss +} + +// ExtendEntropy derives more entropy from the shared secret +func (sss *SharedSecretService) ExtendEntropy(extra []byte) []byte { + return crypto.Keccak256(sss.secret[:], extra) +} + +func (sss *SharedSecretService) EncryptSecretWithKey(pubKey []byte) (common.EncryptedSharedEnclaveSecret, error) { + sss.logger.Info(fmt.Sprintf("Encrypting secret with public key %s", gethcommon.Bytes2Hex(pubKey))) + key, err := crypto.DecompressPubkey(pubKey) + if err != nil { + return nil, fmt.Errorf("failed to parse public key %w", err) + } + + encKey, err := encryptWithPublicKey(sss.secret[:], key) + if err != nil { + sss.logger.Info("Failed to encrypt key", log.ErrKey, err) + } + return encKey, err +} + +func (sss *SharedSecretService) IsInitialised() bool { + return sss.secret != nil +} diff --git a/go/enclave/crypto/utils.go b/go/enclave/crypto/utils.go new file mode 100644 index 0000000000..eb9b1ae2f1 --- /dev/null +++ b/go/enclave/crypto/utils.go @@ -0,0 +1,34 @@ +package crypto + +import ( + "crypto/ecdsa" + "crypto/rand" + "fmt" + "io" + + "github.com/ethereum/go-ethereum/crypto/ecies" +) + +func generateSecureEntropy(nrBytes int) ([]byte, error) { + rndBytes := make([]byte, nrBytes) + if _, err := io.ReadFull(rand.Reader, rndBytes); err != nil { + return nil, err + } + return rndBytes, nil +} + +func encryptWithPublicKey(msg []byte, pub *ecdsa.PublicKey) ([]byte, error) { + ciphertext, err := ecies.Encrypt(rand.Reader, ecies.ImportECDSAPublic(pub), msg, nil, nil) + if err != nil { + return nil, fmt.Errorf("failed to encrypt with public key. %w", err) + } + return ciphertext, nil +} + +func decryptWithPrivateKey(ciphertext []byte, priv *ecdsa.PrivateKey) ([]byte, error) { + plaintext, err := ecies.ImportECDSA(priv).Decrypt(ciphertext, nil, nil) + if err != nil { + return nil, fmt.Errorf("could not decrypt with private key. %w", err) + } + return plaintext, nil +} diff --git a/go/enclave/enclave.go b/go/enclave/enclave.go index 6846cc4198..2565b36668 100644 --- a/go/enclave/enclave.go +++ b/go/enclave/enclave.go @@ -7,6 +7,8 @@ import ( "fmt" "math/big" + "github.com/ten-protocol/go-ten/go/enclave/crypto" + enclaveconfig "github.com/ten-protocol/go-ten/go/enclave/config" "github.com/ten-protocol/go-ten/go/enclave/evm/ethchainadapter" "github.com/ten-protocol/go-ten/go/enclave/gas" @@ -40,10 +42,11 @@ import ( ) type enclaveImpl struct { - initService common.EnclaveInit - adminService common.EnclaveAdmin - rpcService common.EnclaveClientRPC - stopControl *stopcontrol.StopControl + initAPI common.EnclaveInit + adminAPI common.EnclaveAdmin + rpcAPI common.EnclaveClientRPC + + stopControl *stopcontrol.StopControl } // NewEnclave creates and initializes all the services of the enclave. @@ -62,13 +65,21 @@ func NewEnclave(config *enclaveconfig.EnclaveConfig, genesis *genesis.Genesis, m // attempt to fetch the enclave key from the database // the enclave key is part of the attestation and identifies the current enclave - enclaveKeyService := components.NewEnclaveKeyService(storage, logger) - err := enclaveKeyService.LoadOrCreateEnclaveKey() + // if this is the first time the enclave starts, it has to generate a new key + enclaveKeyService := crypto.NewEnclaveAttestedKeyService(logger) + err := loadOrCreateEnclaveKey(storage, enclaveKeyService, logger) + if err != nil { + logger.Crit("Failed to load or create enclave key", log.ErrKey, err) + } + + sharedSecretService := crypto.NewSharedSecretService(logger) + err = loadSharedSecret(storage, sharedSecretService, logger) if err != nil { - logger.Crit("Failed to load or create enclave key", "err", err) + logger.Crit("Failed to load shared secret", log.ErrKey, err) } - gethEncodingService := gethencoding.NewGethEncodingService(storage, cachingService, logger) + daEncryptionService := crypto.NewDAEncryptionService(sharedSecretService, logger) + rpcKeyService := crypto.NewRPCKeyService(sharedSecretService, logger) crossChainProcessors := crosschain.New(&config.MessageBusAddress, storage, big.NewInt(config.ObscuroChainID), logger) @@ -81,8 +92,10 @@ func NewEnclave(config *enclaveconfig.EnclaveConfig, genesis *genesis.Genesis, m gasOracle := gas.NewGasOracle() blockProcessor := components.NewBlockProcessor(storage, crossChainProcessors, gasOracle, logger) + evmEntropyService := crypto.NewEvmEntropyService(sharedSecretService, logger) + gethEncodingService := gethencoding.NewGethEncodingService(storage, cachingService, evmEntropyService, logger) batchRegistry := components.NewBatchRegistry(storage, config, gethEncodingService, logger) - batchExecutor := components.NewBatchExecutor(storage, batchRegistry, *config, gethEncodingService, crossChainProcessors, genesis, gasOracle, chainConfig, config.GasBatchExecutionLimit, scb, logger) + batchExecutor := components.NewBatchExecutor(storage, batchRegistry, *config, gethEncodingService, crossChainProcessors, genesis, gasOracle, chainConfig, config.GasBatchExecutionLimit, scb, evmEntropyService, logger) // ensure cached chain state data is up-to-date using the persisted batch data err = restoreStateDBCache(context.Background(), storage, batchRegistry, batchExecutor, genesis, logger) @@ -99,40 +112,35 @@ func NewEnclave(config *enclaveconfig.EnclaveConfig, genesis *genesis.Genesis, m subscriptionManager := events.NewSubscriptionManager(storage, batchRegistry, config.ObscuroChainID, logger) // todo (#1474) - make sure the enclave cannot be started in production with WillAttest=false - var attestationProvider components.AttestationProvider - if config.WillAttest { - attestationProvider = &components.EgoAttestationProvider{} - } else { - logger.Info("WARNING - Attestation is not enabled, enclave will not create a verified attestation report.") - attestationProvider = &components.DummyAttestationProvider{} - } + attestationProvider := components.NewAttestationProvider(enclaveKeyService, config.WillAttest, logger) // signal to stop the enclave stopControl := stopcontrol.New() - initService := NewEnclaveInitService(config, storage, logger, blockProcessor, enclaveKeyService, attestationProvider) - adminService := NewEnclaveAdminService(config, storage, logger, blockProcessor, batchRegistry, batchExecutor, gethEncodingService, stopControl, subscriptionManager, enclaveKeyService, mempool, chainConfig, mgmtContractLib, attestationProvider) - rpcService := NewEnclaveRPCService(config, storage, logger, blockProcessor, batchRegistry, gethEncodingService, cachingService, mempool, chainConfig, crossChainProcessors, scb, subscriptionManager, genesis, gasOracle) + // these services are directly exposed as the API of the Enclave + initAPI := NewEnclaveInitAPI(config, storage, logger, blockProcessor, enclaveKeyService, attestationProvider, sharedSecretService, daEncryptionService, rpcKeyService) + adminAPI := NewEnclaveAdminAPI(config, storage, logger, blockProcessor, batchRegistry, batchExecutor, gethEncodingService, stopControl, subscriptionManager, enclaveKeyService, mempool, chainConfig, mgmtContractLib, attestationProvider, sharedSecretService, daEncryptionService) + rpcAPI := NewEnclaveRPCAPI(config, storage, logger, blockProcessor, batchRegistry, gethEncodingService, cachingService, mempool, chainConfig, crossChainProcessors, scb, subscriptionManager, genesis, gasOracle, sharedSecretService, rpcKeyService) logger.Info("Enclave service created successfully.", log.EnclaveIDKey, enclaveKeyService.EnclaveID()) return &enclaveImpl{ - initService: initService, - adminService: adminService, - rpcService: rpcService, - stopControl: stopControl, + initAPI: initAPI, + adminAPI: adminAPI, + rpcAPI: rpcAPI, + stopControl: stopControl, } } // Status is only implemented by the RPC wrapper func (e *enclaveImpl) Status(ctx context.Context) (common.Status, common.SystemError) { - return e.initService.Status(ctx) + return e.initAPI.Status(ctx) } func (e *enclaveImpl) Attestation(ctx context.Context) (*common.AttestationReport, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.initService.Attestation(ctx) + return e.initAPI.Attestation(ctx) } // GenerateSecret - the genesis enclave is responsible with generating the secret entropy @@ -140,108 +148,115 @@ func (e *enclaveImpl) GenerateSecret(ctx context.Context) (common.EncryptedShare if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.initService.GenerateSecret(ctx) + return e.initAPI.GenerateSecret(ctx) } // InitEnclave - initialise an enclave with a seed received by another enclave func (e *enclaveImpl) InitEnclave(ctx context.Context, s common.EncryptedSharedEnclaveSecret) common.SystemError { - return e.initService.InitEnclave(ctx, s) + return e.initAPI.InitEnclave(ctx, s) } func (e *enclaveImpl) EnclaveID(ctx context.Context) (common.EnclaveID, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return common.EnclaveID{}, systemError } - return e.initService.EnclaveID(ctx) + return e.initAPI.EnclaveID(ctx) +} + +func (e *enclaveImpl) RPCEncryptionKey(ctx context.Context) ([]byte, common.SystemError) { + if systemError := checkStopping(e.stopControl); systemError != nil { + return nil, systemError + } + return e.initAPI.RPCEncryptionKey(ctx) } func (e *enclaveImpl) DebugTraceTransaction(ctx context.Context, txHash gethcommon.Hash, config *tracers.TraceConfig) (json.RawMessage, common.SystemError) { - return e.rpcService.DebugTraceTransaction(ctx, txHash, config) + return e.rpcAPI.DebugTraceTransaction(ctx, txHash, config) } func (e *enclaveImpl) GetTotalContractCount(ctx context.Context) (*big.Int, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.rpcService.GetTotalContractCount(ctx) + return e.rpcAPI.GetTotalContractCount(ctx) } func (e *enclaveImpl) EnclavePublicConfig(ctx context.Context) (*common.EnclavePublicConfig, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.rpcService.EnclavePublicConfig(ctx) + return e.rpcAPI.EnclavePublicConfig(ctx) } func (e *enclaveImpl) EncryptedRPC(ctx context.Context, encryptedParams common.EncryptedRequest) (*responses.EnclaveResponse, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.rpcService.EncryptedRPC(ctx, encryptedParams) + return e.rpcAPI.EncryptedRPC(ctx, encryptedParams) } func (e *enclaveImpl) GetCode(ctx context.Context, address gethcommon.Address, blockNrOrHash gethrpc.BlockNumberOrHash) ([]byte, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.rpcService.GetCode(ctx, address, blockNrOrHash) + return e.rpcAPI.GetCode(ctx, address, blockNrOrHash) } func (e *enclaveImpl) Subscribe(ctx context.Context, id gethrpc.ID, encryptedSubscription common.EncryptedParamsLogSubscription) common.SystemError { - return e.rpcService.Subscribe(ctx, id, encryptedSubscription) + return e.rpcAPI.Subscribe(ctx, id, encryptedSubscription) } func (e *enclaveImpl) Unsubscribe(id gethrpc.ID) common.SystemError { if systemError := checkStopping(e.stopControl); systemError != nil { return systemError } - return e.rpcService.Unsubscribe(id) + return e.rpcAPI.Unsubscribe(id) } func (e *enclaveImpl) AddSequencer(id common.EnclaveID, proof types.Receipt) common.SystemError { if systemError := checkStopping(e.stopControl); systemError != nil { return systemError } - return e.adminService.AddSequencer(id, proof) + return e.adminAPI.AddSequencer(id, proof) } func (e *enclaveImpl) MakeActive() common.SystemError { if systemError := checkStopping(e.stopControl); systemError != nil { return systemError } - return e.adminService.MakeActive() + return e.adminAPI.MakeActive() } func (e *enclaveImpl) ExportCrossChainData(ctx context.Context, fromSeqNo uint64, toSeqNo uint64) (*common.ExtCrossChainBundle, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.ExportCrossChainData(ctx, fromSeqNo, toSeqNo) + return e.adminAPI.ExportCrossChainData(ctx, fromSeqNo, toSeqNo) } func (e *enclaveImpl) GetBatch(ctx context.Context, hash common.L2BatchHash) (*common.ExtBatch, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.GetBatch(ctx, hash) + return e.adminAPI.GetBatch(ctx, hash) } func (e *enclaveImpl) GetBatchBySeqNo(ctx context.Context, seqNo uint64) (*common.ExtBatch, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.GetBatchBySeqNo(ctx, seqNo) + return e.adminAPI.GetBatchBySeqNo(ctx, seqNo) } func (e *enclaveImpl) GetRollupData(ctx context.Context, hash common.L2RollupHash) (*common.PublicRollupMetadata, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.GetRollupData(ctx, hash) + return e.adminAPI.GetRollupData(ctx, hash) } func (e *enclaveImpl) StreamL2Updates() (chan common.StreamL2UpdatesResponse, func()) { - return e.adminService.StreamL2Updates() + return e.adminAPI.StreamL2Updates() } // SubmitL1Block is used to update the enclave with an additional L1 block. @@ -249,28 +264,28 @@ func (e *enclaveImpl) SubmitL1Block(ctx context.Context, blockHeader *types.Head if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.SubmitL1Block(ctx, blockHeader, receipts) + return e.adminAPI.SubmitL1Block(ctx, blockHeader, receipts) } func (e *enclaveImpl) SubmitBatch(ctx context.Context, extBatch *common.ExtBatch) common.SystemError { if systemError := checkStopping(e.stopControl); systemError != nil { return systemError } - return e.adminService.SubmitBatch(ctx, extBatch) + return e.adminAPI.SubmitBatch(ctx, extBatch) } func (e *enclaveImpl) CreateBatch(ctx context.Context, skipBatchIfEmpty bool) common.SystemError { if systemError := checkStopping(e.stopControl); systemError != nil { return systemError } - return e.adminService.CreateBatch(ctx, skipBatchIfEmpty) + return e.adminAPI.CreateBatch(ctx, skipBatchIfEmpty) } func (e *enclaveImpl) CreateRollup(ctx context.Context, fromSeqNo uint64) (*common.ExtRollup, common.SystemError) { if systemError := checkStopping(e.stopControl); systemError != nil { return nil, systemError } - return e.adminService.CreateRollup(ctx, fromSeqNo) + return e.adminAPI.CreateRollup(ctx, fromSeqNo) } // HealthCheck returns whether the enclave is deemed healthy @@ -278,16 +293,16 @@ func (e *enclaveImpl) HealthCheck(ctx context.Context) (bool, common.SystemError if systemError := checkStopping(e.stopControl); systemError != nil { return false, systemError } - return e.adminService.HealthCheck(ctx) + return e.adminAPI.HealthCheck(ctx) } // StopClient is only implemented by the RPC wrapper func (e *enclaveImpl) StopClient() common.SystemError { - return e.adminService.StopClient() + return e.adminAPI.StopClient() } func (e *enclaveImpl) Stop() common.SystemError { - return e.adminService.Stop() + return e.adminAPI.Stop() } func checkStopping(s *stopcontrol.StopControl) common.SystemError { @@ -296,3 +311,39 @@ func checkStopping(s *stopcontrol.StopControl) common.SystemError { } return nil } + +func loadSharedSecret(storage storage.Storage, sharedSecretService *crypto.SharedSecretService, logger gethlog.Logger) error { + sharedSecret, err := storage.FetchSecret(context.Background()) + if err != nil && !errors.Is(err, errutil.ErrNotFound) { + logger.Crit("Failed to fetch secret", "err", err) + } + if sharedSecret != nil { + sharedSecretService.SetSharedSecret(sharedSecret) + } + return nil +} + +func loadOrCreateEnclaveKey(storage storage.Storage, enclaveKeyService *crypto.EnclaveAttestedKeyService, logger gethlog.Logger) error { + enclaveKey, err := storage.GetEnclaveKey(context.Background()) + if err != nil && !errors.Is(err, errutil.ErrNotFound) { + return fmt.Errorf("failed to load enclave key: %w", err) + } + if enclaveKey != nil { + enclaveKeyService.SetEnclaveKey(enclaveKey) + return nil + } + + // enclave key not found - new key should be generated + logger.Info("Generating new enclave key") + enclaveKey, err = enclaveKeyService.GenerateEnclaveKey() + if err != nil { + return fmt.Errorf("failed to generate enclave key: %w", err) + } + err = storage.StoreEnclaveKey(context.Background(), enclaveKey) + if err != nil { + return fmt.Errorf("failed to store enclave key: %w", err) + } + + enclaveKeyService.SetEnclaveKey(enclaveKey) + return nil +} diff --git a/go/enclave/enclave_admin_service.go b/go/enclave/enclave_admin_service.go index 6b259ddb4b..9384d3ed5f 100644 --- a/go/enclave/enclave_admin_service.go +++ b/go/enclave/enclave_admin_service.go @@ -46,18 +46,19 @@ type enclaveAdminService struct { sharedSecretProcessor *components.SharedSecretProcessor rollupConsumer components.RollupConsumer registry components.BatchRegistry - dataEncryptionService crypto.DataEncryptionService + daEncryptionService *crypto.DAEncryptionService dataCompressionService compression.DataCompressionService storage storage.Storage gethEncodingService gethencoding.EncodingService stopControl *stopcontrol.StopControl profiler *profiler.Profiler subscriptionManager *events.SubscriptionManager - enclaveKeyService *components.EnclaveKeyService + enclaveKeyService *crypto.EnclaveAttestedKeyService mempool *txpool.TxPool + sharedSecretService *crypto.SharedSecretService } -func NewEnclaveAdminService(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, blockProcessor components.L1BlockProcessor, registry components.BatchRegistry, batchExecutor components.BatchExecutor, gethEncodingService gethencoding.EncodingService, stopControl *stopcontrol.StopControl, subscriptionManager *events.SubscriptionManager, enclaveKeyService *components.EnclaveKeyService, mempool *txpool.TxPool, chainConfig *params.ChainConfig, mgmtContractLib mgmtcontractlib.MgmtContractLib, attestationProvider components.AttestationProvider) common.EnclaveAdmin { +func NewEnclaveAdminAPI(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, blockProcessor components.L1BlockProcessor, registry components.BatchRegistry, batchExecutor components.BatchExecutor, gethEncodingService gethencoding.EncodingService, stopControl *stopcontrol.StopControl, subscriptionManager *events.SubscriptionManager, enclaveKeyService *crypto.EnclaveAttestedKeyService, mempool *txpool.TxPool, chainConfig *params.ChainConfig, mgmtContractLib mgmtcontractlib.MgmtContractLib, attestationProvider components.AttestationProvider, sharedSecretService *crypto.SharedSecretService, daEncryptionService *crypto.DAEncryptionService) common.EnclaveAdmin { var prof *profiler.Profiler // don't run a profiler on an attested enclave if !config.WillAttest && config.ProfilerEnabled { @@ -67,16 +68,15 @@ func NewEnclaveAdminService(config *enclaveconfig.EnclaveConfig, storage storage logger.Crit("unable to start the profiler", log.ErrKey, err) } } - sharedSecretProcessor := components.NewSharedSecretProcessor(mgmtContractLib, attestationProvider, enclaveKeyService.EnclaveID(), storage, logger) + sharedSecretProcessor := components.NewSharedSecretProcessor(mgmtContractLib, attestationProvider, enclaveKeyService.EnclaveID(), storage, sharedSecretService, logger) sigVerifier, err := components.NewSignatureValidator(storage) if err != nil { logger.Crit("Could not initialise the signature validator", log.ErrKey, err) } - dataEncryptionService := crypto.NewDataEncryptionService(logger) dataCompressionService := compression.NewBrotliDataCompressionService() - rollupCompression := components.NewRollupCompression(registry, batchExecutor, dataEncryptionService, dataCompressionService, storage, gethEncodingService, chainConfig, logger) + rollupCompression := components.NewRollupCompression(registry, batchExecutor, daEncryptionService, dataCompressionService, storage, gethEncodingService, chainConfig, logger) rollupProducer := components.NewRollupProducer(enclaveKeyService.EnclaveID(), storage, registry, logger) rollupConsumer := components.NewRollupConsumer(mgmtContractLib, registry, rollupCompression, storage, logger, sigVerifier) @@ -88,7 +88,7 @@ func NewEnclaveAdminService(config *enclaveconfig.EnclaveConfig, storage storage BaseFee: config.BaseFee, } - sequencerService := nodetype.NewSequencer(blockProcessor, batchExecutor, registry, rollupProducer, rollupCompression, gethEncodingService, logger, chainConfig, enclaveKeyService, mempool, storage, dataEncryptionService, dataCompressionService, seqSettings) + sequencerService := nodetype.NewSequencer(blockProcessor, batchExecutor, registry, rollupProducer, rollupCompression, gethEncodingService, logger, chainConfig, enclaveKeyService, mempool, storage, dataCompressionService, seqSettings) validatorService := nodetype.NewValidator(blockProcessor, batchExecutor, registry, chainConfig, storage, sigVerifier, mempool, logger) eas := &enclaveAdminService{ @@ -102,7 +102,7 @@ func NewEnclaveAdminService(config *enclaveconfig.EnclaveConfig, storage storage sharedSecretProcessor: sharedSecretProcessor, rollupConsumer: rollupConsumer, registry: registry, - dataEncryptionService: dataEncryptionService, + daEncryptionService: daEncryptionService, dataCompressionService: dataCompressionService, storage: storage, gethEncodingService: gethEncodingService, @@ -111,6 +111,7 @@ func NewEnclaveAdminService(config *enclaveconfig.EnclaveConfig, storage storage subscriptionManager: subscriptionManager, enclaveKeyService: enclaveKeyService, mempool: mempool, + sharedSecretService: sharedSecretService, } // if the current enclave was already marked as an active/backup sequencer, it needs to set the right mempool mode @@ -222,7 +223,7 @@ func (e *enclaveAdminService) SubmitBatch(ctx context.Context, extBatch *common. } } - batch, err := core.ToBatch(extBatch, e.dataEncryptionService, e.dataCompressionService) + batch, err := core.ToBatch(extBatch, e.daEncryptionService, e.dataCompressionService) if err != nil { return responses.ToInternalError(fmt.Errorf("could not convert batch. Cause: %w", err)) } @@ -315,7 +316,7 @@ func (e *enclaveAdminService) GetBatch(ctx context.Context, hash common.L2BatchH return nil, responses.ToInternalError(fmt.Errorf("failed getting batch. Cause: %w", err)) } - b, err := batch.ToExtBatch(e.dataEncryptionService, e.dataCompressionService) + b, err := batch.ToExtBatch(e.daEncryptionService, e.dataCompressionService) if err != nil { return nil, responses.ToInternalError(err) } @@ -328,7 +329,7 @@ func (e *enclaveAdminService) GetBatchBySeqNo(ctx context.Context, seqNo uint64) return nil, responses.ToInternalError(fmt.Errorf("failed getting batch. Cause: %w", err)) } - b, err := batch.ToExtBatch(e.dataEncryptionService, e.dataCompressionService) + b, err := batch.ToExtBatch(e.daEncryptionService, e.dataCompressionService) if err != nil { return nil, responses.ToInternalError(err) } @@ -443,7 +444,7 @@ func (e *enclaveAdminService) sendBatch(batch *core.Batch, outChannel chan commo } else { e.logger.Debug("Streaming batch to host", log.BatchHashKey, batch.Hash(), log.BatchSeqNoKey, batch.SeqNo()) } - extBatch, err := batch.ToExtBatch(e.dataEncryptionService, e.dataCompressionService) + extBatch, err := batch.ToExtBatch(e.daEncryptionService, e.dataCompressionService) if err != nil { // this error is unrecoverable e.logger.Crit("failed to convert batch", log.ErrKey, err) diff --git a/go/enclave/enclave_init_service.go b/go/enclave/enclave_init_service.go index e4c5941f6d..ebf8760fc3 100644 --- a/go/enclave/enclave_init_service.go +++ b/go/enclave/enclave_init_service.go @@ -11,8 +11,6 @@ import ( "github.com/ten-protocol/go-ten/go/enclave/storage" "github.com/ten-protocol/go-ten/go/responses" - "github.com/ten-protocol/go-ten/go/common/errutil" - "github.com/ten-protocol/go-ten/go/common" "github.com/ten-protocol/go-ten/go/common/log" _ "github.com/ten-protocol/go-ten/go/common/tracers/native" // make sure the tracers are loaded @@ -29,11 +27,14 @@ type enclaveInitService struct { storage storage.Storage l1BlockProcessor components.L1BlockProcessor logger gethlog.Logger - enclaveKeyService *components.EnclaveKeyService // the enclave's private key (used to identify the enclave and sign messages) - attestationProvider components.AttestationProvider // interface for producing attestation reports and verifying them + sharedSecretService *crypto.SharedSecretService + enclaveKeyService *crypto.EnclaveAttestedKeyService // the enclave's private key (used to identify the enclave and sign messages) + attestationProvider components.AttestationProvider // interface for producing attestation reports and verifying them + daEncryptionService *crypto.DAEncryptionService + rpcKeyService *crypto.RPCKeyService } -func NewEnclaveInitService(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, l1BlockProcessor components.L1BlockProcessor, enclaveKeyService *components.EnclaveKeyService, attestationProvider components.AttestationProvider) common.EnclaveInit { +func NewEnclaveInitAPI(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, l1BlockProcessor components.L1BlockProcessor, enclaveKeyService *crypto.EnclaveAttestedKeyService, attestationProvider components.AttestationProvider, sharedSecretService *crypto.SharedSecretService, daEncryptionService *crypto.DAEncryptionService, rpcKeyService *crypto.RPCKeyService) common.EnclaveInit { return &enclaveInitService{ config: config, storage: storage, @@ -41,17 +42,17 @@ func NewEnclaveInitService(config *enclaveconfig.EnclaveConfig, storage storage. logger: logger, enclaveKeyService: enclaveKeyService, attestationProvider: attestationProvider, + sharedSecretService: sharedSecretService, + daEncryptionService: daEncryptionService, + rpcKeyService: rpcKeyService, } } // Status is only implemented by the RPC wrapper func (e *enclaveInitService) Status(ctx context.Context) (common.Status, common.SystemError) { - _, err := e.storage.FetchSecret(ctx) - if err != nil { - if errors.Is(err, errutil.ErrNotFound) { - return common.Status{StatusCode: common.AwaitingSecret, L2Head: _noHeadBatch}, nil - } - return common.Status{StatusCode: common.Unavailable}, responses.ToInternalError(err) + initialised := e.sharedSecretService.IsInitialised() + if !initialised { + return common.Status{StatusCode: common.AwaitingSecret, L2Head: _noHeadBatch}, nil } var l1HeadHash gethcommon.Hash l1Head, err := e.l1BlockProcessor.GetHead(ctx) @@ -79,7 +80,7 @@ func (e *enclaveInitService) Attestation(ctx context.Context) (*common.Attestati if e.enclaveKeyService.PublicKey() == nil { return nil, responses.ToInternalError(fmt.Errorf("public key not initialized, we can't produce the attestation report")) } - report, err := e.attestationProvider.GetReport(ctx, e.enclaveKeyService.PublicKeyBytes(), e.enclaveKeyService.EnclaveID(), e.config.HostAddress) + report, err := e.attestationProvider.CreateAttestationReport(ctx, e.config.HostAddress) if err != nil { return nil, responses.ToInternalError(fmt.Errorf("could not produce remote report. Cause %w", err)) } @@ -87,33 +88,64 @@ func (e *enclaveInitService) Attestation(ctx context.Context) (*common.Attestati } // GenerateSecret - the genesis enclave is responsible with generating the secret entropy +// it returns it encrypted with the enclave key func (e *enclaveInitService) GenerateSecret(ctx context.Context) (common.EncryptedSharedEnclaveSecret, common.SystemError) { - secret := crypto.GenerateEntropy(e.logger) - err := e.storage.StoreSecret(ctx, secret) + e.sharedSecretService.GenerateSharedSecret() + secret := e.sharedSecretService.Secret() + if secret == nil { + return nil, responses.ToInternalError(errors.New("Failed to generate secret")) + } + err := e.storage.StoreSecret(ctx, *secret) if err != nil { return nil, responses.ToInternalError(fmt.Errorf("could not store secret. Cause: %w", err)) } - encSec, err := crypto.EncryptSecret(e.enclaveKeyService.PublicKeyBytes(), secret, e.logger) + + err = e.notifyCryptoServices(*secret) + if err != nil { + return nil, responses.ToInternalError(err) + } + + encSec, err := e.enclaveKeyService.Encrypt(secret[:]) if err != nil { return nil, responses.ToInternalError(fmt.Errorf("failed to encrypt secret. Cause: %w", err)) } return encSec, nil } -// InitEnclave - initialise an enclave with a seed received by another enclave +// InitEnclave - initialise an enclave with a shared secret received from another enclave func (e *enclaveInitService) InitEnclave(ctx context.Context, s common.EncryptedSharedEnclaveSecret) common.SystemError { secret, err := e.enclaveKeyService.Decrypt(s) if err != nil { return responses.ToInternalError(err) } - err = e.storage.StoreSecret(ctx, *secret) + err = e.storage.StoreSecret(ctx, crypto.SharedEnclaveSecret(secret)) if err != nil { return responses.ToInternalError(fmt.Errorf("could not store secret. Cause: %w", err)) } - e.logger.Trace(fmt.Sprintf("Secret decrypted and stored. Secret: %v", secret)) + var fixedSizeSecret crypto.SharedEnclaveSecret + copy(fixedSizeSecret[:], secret) + + // notify the encryption services that depend on the shared secret + err = e.notifyCryptoServices(fixedSizeSecret) + if err != nil { + return responses.ToInternalError(err) + } return nil } +func (e *enclaveInitService) notifyCryptoServices(sharedSecret crypto.SharedEnclaveSecret) error { + e.sharedSecretService.SetSharedSecret(&sharedSecret) + err := e.rpcKeyService.Initialise() + if err != nil { + return err + } + return e.daEncryptionService.Initialise() +} + func (e *enclaveInitService) EnclaveID(context.Context) (common.EnclaveID, common.SystemError) { return e.enclaveKeyService.EnclaveID(), nil } + +func (e *enclaveInitService) RPCEncryptionKey(ctx context.Context) ([]byte, common.SystemError) { + return e.rpcKeyService.PublicKey(), nil +} diff --git a/go/enclave/enclave_rpc_service.go b/go/enclave/enclave_rpc_service.go index 77cb191eb7..9152320741 100644 --- a/go/enclave/enclave_rpc_service.go +++ b/go/enclave/enclave_rpc_service.go @@ -7,11 +7,11 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/crypto/ecies" + "github.com/ten-protocol/go-ten/go/enclave/crypto" + gethlog "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ten-protocol/go-ten/go/common/gethencoding" - "github.com/ten-protocol/go-ten/go/enclave/crypto" "github.com/ten-protocol/go-ten/go/enclave/gas" "github.com/ten-protocol/go-ten/go/enclave/genesis" "github.com/ten-protocol/go-ten/go/enclave/l2chain" @@ -42,10 +42,11 @@ type enclaveRPCService struct { storage storage.Storage crossChainProcessors *crosschain.Processors scb system.SystemContractCallbacks + rpcKeyService *crypto.RPCKeyService logger gethlog.Logger } -func NewEnclaveRPCService(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, blockProcessor components.L1BlockProcessor, batchRegistry components.BatchRegistry, gethEncodingService gethencoding.EncodingService, cachingService *storage.CacheService, mempool *txpool.TxPool, chainConfig *params.ChainConfig, crossChainProcessors *crosschain.Processors, scb system.SystemContractCallbacks, subscriptionManager *events.SubscriptionManager, genesis *genesis.Genesis, gasOracle gas.Oracle) common.EnclaveClientRPC { +func NewEnclaveRPCAPI(config *enclaveconfig.EnclaveConfig, storage storage.Storage, logger gethlog.Logger, blockProcessor components.L1BlockProcessor, batchRegistry components.BatchRegistry, gethEncodingService gethencoding.EncodingService, cachingService *storage.CacheService, mempool *txpool.TxPool, chainConfig *params.ChainConfig, crossChainProcessors *crosschain.Processors, scb system.SystemContractCallbacks, subscriptionManager *events.SubscriptionManager, genesis *genesis.Genesis, gasOracle gas.Oracle, sharedSecretService *crypto.SharedSecretService, rpcKeyService *crypto.RPCKeyService) common.EnclaveClientRPC { // TODO ensure debug is allowed/disallowed chain := l2chain.NewChain( storage, @@ -59,10 +60,7 @@ func NewEnclaveRPCService(config *enclaveconfig.EnclaveConfig, storage storage.S ) debug := debugger.New(chain, storage, chainConfig) - // todo - security - obscuroKey := crypto.GetObscuroKey(logger) - - rpcEncryptionManager := rpc.NewEncryptionManager(ecies.ImportECDSA(obscuroKey), storage, cachingService, batchRegistry, mempool, crossChainProcessors, config, gasOracle, storage, blockProcessor, chain, logger) + rpcEncryptionManager := rpc.NewEncryptionManager(storage, cachingService, batchRegistry, mempool, crossChainProcessors, config, gasOracle, storage, blockProcessor, chain, rpcKeyService, logger) return &enclaveRPCService{ rpcEncryptionManager: rpcEncryptionManager, @@ -73,6 +71,7 @@ func NewEnclaveRPCService(config *enclaveconfig.EnclaveConfig, storage storage.S storage: storage, crossChainProcessors: crossChainProcessors, scb: scb, + rpcKeyService: rpcKeyService, logger: logger, } } diff --git a/go/enclave/enclave_test.go.tmp b/go/enclave/enclave_test.go.tmp deleted file mode 100644 index dcb048a395..0000000000 --- a/go/enclave/enclave_test.go.tmp +++ /dev/null @@ -1,486 +0,0 @@ -package enclave - -import ( - "crypto/rand" - "encoding/json" - "fmt" - "math/big" - "testing" - "time" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/trie" - "github.com/ten-protocol/go-ten/contracts/generated/ManagementContract" - "github.com/ten-protocol/go-ten/go/common" - "github.com/ten-protocol/go-ten/go/common/log" - "github.com/ten-protocol/go-ten/go/common/viewingkey" - "github.com/ten-protocol/go-ten/go/config" - "github.com/ten-protocol/go-ten/go/enclave/core" - "github.com/ten-protocol/go-ten/go/enclave/genesis" - "github.com/ten-protocol/go-ten/go/obsclient" - "github.com/ten-protocol/go-ten/go/responses" - "github.com/ten-protocol/go-ten/go/wallet" - "github.com/ten-protocol/go-ten/integration" - "github.com/ten-protocol/go-ten/integration/datagenerator" - "github.com/stretchr/testify/assert" - - gethcommon "github.com/ethereum/go-ethereum/common" - gethlog "github.com/ethereum/go-ethereum/log" -) - -const _testEnclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a044551f0f0cbec74d0bc5e" - -// _successfulRollupGasPrice can be deterministically calculated when evaluating the management smart contract. -// It should change only when there are changes to the smart contract or if the gas estimation algorithm is modified. -// Other changes would mean something is broken. -const _successfulRollupGasPrice = 372008 - -var _enclavePubKey *ecies.PublicKey - -func init() { //nolint:gochecknoinits - // fetch the usable enclave pub key - enclPubECDSA, err := crypto.DecompressPubkey(gethcommon.Hex2Bytes(_testEnclavePublicKeyHex)) - if err != nil { - panic(err) - } - - _enclavePubKey = ecies.ImportECDSAPublic(enclPubECDSA) -} - -// TestGasEstimation runs the GasEstimation tests -func TestGasEstimation(t *testing.T) { - tests := map[string]func(t *testing.T, w wallet.Wallet, enclave common.Enclave, vk *viewingkey.ViewingKey){ - "gasEstimateSuccess": gasEstimateSuccess, - "gasEstimateNoCallMsgFrom": gasEstimateNoCallMsgFrom, - "gasEstimateInvalidBytes": gasEstimateInvalidBytes, - "gasEstimateInvalidNumParams": gasEstimateInvalidNumParams, - "gasEstimateInvalidParamParsing": gasEstimateInvalidParamParsing, - } - - idx := 100 - for name, test := range tests { - // create the enclave - testEnclave, err := createTestEnclave(nil, idx) - idx++ - if err != nil { - t.Fatal(err) - } - - // create the wallet - w := datagenerator.RandomWallet(integration.ObscuroChainID) - - // create a VK - vk, err := viewingkey.GenerateViewingKeyForWallet(w) - if err != nil { - t.Fatal(err) - } - - // execute the tests - t.Run(name, func(t *testing.T) { - test(t, w, testEnclave, vk) - }) - } -} - -func gasEstimateSuccess(t *testing.T, w wallet.Wallet, enclave common.Enclave, vk *viewingkey.ViewingKey) { - // create the callMsg - to := datagenerator.RandomAddress() - callMsg := ðereum.CallMsg{ - From: w.Address(), - To: &to, - Data: []byte(ManagementContract.ManagementContractMetaData.Bin), - } - - // create the request payload - req := []interface{}{ - []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - }, - obsclient.ToCallArg(*callMsg), - nil, - } - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - gas, _ := enclave.EstimateGas(encryptedParams) - if gas.Error() != nil { - t.Fatal(gas.Error()) - } - - // decrypt with the VK - decryptedResult, err := vk.PrivateKey.Decrypt(gas.EncUserResponse, nil, nil) - if err != nil { - t.Fatal(err) - } - - gasEstimate, err := responses.DecodeResponse[string](decryptedResult) - if err != nil { - t.Fatal(err) - } - - // parse it to Uint64 - decodeUint64, err := hexutil.DecodeUint64(*gasEstimate) - if err != nil { - t.Fatal(err) - } - - if decodeUint64 != _successfulRollupGasPrice { - t.Fatalf("unexpected gas price %d", decodeUint64) - } -} - -func gasEstimateNoCallMsgFrom(t *testing.T, _ wallet.Wallet, enclave common.Enclave, vk *viewingkey.ViewingKey) { - // create the callMsg - callMsg := datagenerator.CreateCallMsg() - - // create the request - req := []interface{}{ - []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - }, - obsclient.ToCallArg(*callMsg), - nil, - } - delete(req[1].(map[string]interface{}), "from") - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - resp, _ := enclave.EstimateGas(encryptedParams) - if !assert.ErrorContains(t, resp.Error(), "no from address provided") { - t.Fatalf("unexpected error - %s", resp.Error()) - } -} - -func gasEstimateInvalidBytes(t *testing.T, w wallet.Wallet, enclave common.Enclave, _ *viewingkey.ViewingKey) { - // create the callMsg - callMsg := datagenerator.CreateCallMsg() - callMsg.From = w.Address() - - // create the request - req := []interface{}{obsclient.ToCallArg(*callMsg), nil} - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - reqBytes = append(reqBytes, []byte("this should break stuff")...) - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - resp, _ := enclave.EstimateGas(encryptedParams) - if !assert.ErrorContains(t, resp.Error(), "invalid character") { - t.Fatalf("unexpected error - %s", resp.Error()) - } -} - -func gasEstimateInvalidNumParams(t *testing.T, _ wallet.Wallet, enclave common.Enclave, vk *viewingkey.ViewingKey) { - // create the request - req := []interface{}{ - []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - }, - } - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - resp, _ := enclave.EstimateGas(encryptedParams) - if !assert.ErrorContains(t, resp.Error(), "unexpected number of parameters") { - t.Fatal("unexpected error") - } -} - -func gasEstimateInvalidParamParsing(t *testing.T, w wallet.Wallet, enclave common.Enclave, vk *viewingkey.ViewingKey) { - // create the callMsg - callMsg := datagenerator.CreateCallMsg() - callMsg.From = w.Address() - - // create the request - req := []interface{}{ - []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - }, - callMsg, - } - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the Enclave Key - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - resp, _ := enclave.EstimateGas(encryptedParams) - if !assert.ErrorContains(t, resp.Error(), "unexpected type supplied in") { - t.Fatal("unexpected error") - } -} - -// TestGetBalance runs the GetBalance tests -func TestGetBalance(t *testing.T) { - tests := map[string]func(t *testing.T, prefund []genesis.Account, enclave common.Enclave, vk *viewingkey.ViewingKey){ - "getBalanceSuccess": getBalanceSuccess, - "getBalanceRequestUnsuccessful": getBalanceRequestUnsuccessful, - } - - idx := 0 - for name, test := range tests { - // create the wallet - w := datagenerator.RandomWallet(integration.ObscuroChainID) - - // prefund the wallet - prefundedAddresses := []genesis.Account{ - { - Address: w.Address(), - Amount: big.NewInt(123_000_000), - }, - } - - // create the enclave - testEnclave, err := createTestEnclave(prefundedAddresses, idx) - idx++ - if err != nil { - t.Fatal(err) - } - - // create a VK - vk, err := viewingkey.GenerateViewingKeyForWallet(w) - if err != nil { - t.Fatal(err) - } - - // execute the tests - t.Run(name, func(t *testing.T) { - test(t, prefundedAddresses, testEnclave, vk) - }) - } -} - -func getBalanceSuccess(t *testing.T, prefund []genesis.Account, enclave common.Enclave, vk *viewingkey.ViewingKey) { - // create the request payload - req := []interface{}{ - []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - }, - prefund[0].Address.Hex(), - "latest", - } - reqBytes, err := json.Marshal(req) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - gas, _ := enclave.GetBalance(encryptedParams) - if err != nil { - t.Fatal(err) - } - - // decrypt with the VK - decryptedResult, err := vk.PrivateKey.Decrypt(gas.EncUserResponse, nil, nil) - if err != nil { - t.Fatal(err) - } - - // parse it - balance, err := responses.DecodeResponse[hexutil.Big](decryptedResult) - if err != nil { - t.Fatal(err) - } - - // make sure its de expected value - if prefund[0].Amount.Cmp(balance.ToInt()) != 0 { - t.Errorf("unexpected balance, expected %d, got %d", prefund[0].Amount, balance.ToInt()) - } -} - -func getBalanceRequestUnsuccessful(t *testing.T, prefund []genesis.Account, enclave common.Enclave, vk *viewingkey.ViewingKey) { - type errorTest struct { - request []interface{} - errorStr string - } - vkSerialized := []interface{}{ - hexutil.Encode(vk.PublicKey), - hexutil.Encode(vk.Signature), - } - - for subtestName, test := range map[string]errorTest{ - "No1stArg": { - request: []interface{}{vkSerialized, nil, "latest"}, - errorStr: "no address specified", - }, - "No2ndArg": { - request: []interface{}{vkSerialized, prefund[0].Address.Hex()}, - errorStr: "unexpected number of parameters", - }, - "Nil2ndArg": { - request: []interface{}{vkSerialized, prefund[0].Address.Hex(), nil}, - errorStr: "unable to extract requested block number - not found", - }, - "Rubbish2ndArg": { - request: []interface{}{vkSerialized, prefund[0].Address.Hex(), "Rubbish"}, - errorStr: "hex string without 0x prefix", - }, - } { - t.Run(subtestName, func(t *testing.T) { - reqBytes, err := json.Marshal(test.request) - if err != nil { - t.Fatal(err) - } - - // callMsg encrypted with the VK - encryptedParams, err := ecies.Encrypt(rand.Reader, _enclavePubKey, reqBytes, nil, nil) - if err != nil { - t.Fatalf("could not encrypt the following request params with enclave public key - %s", err) - } - - // Run gas Estimation - enclaveResp, _ := enclave.GetBalance(encryptedParams) - err = enclaveResp.Error() - - // If there is no enclave error we must get - // the internal user error - if err == nil { - encodedResp, encErr := vk.PrivateKey.Decrypt(enclaveResp.EncUserResponse, nil, nil) - if encErr != nil { - t.Fatal(encErr) - } - _, err = responses.DecodeResponse[hexutil.Big](encodedResp) - } - - if !assert.ErrorContains(t, err, test.errorStr) { - t.Fatal("unexpected error") - } - }) - } -} - -// createTestEnclave returns a test instance of the enclave -func createTestEnclave(prefundedAddresses []genesis.Account, idx int) (common.Enclave, error) { - enclaveConfig := &config.EnclaveConfig{ - HostID: gethcommon.BigToAddress(big.NewInt(int64(idx))), - L1ChainID: integration.EthereumChainID, - ObscuroChainID: integration.ObscuroChainID, - WillAttest: false, - UseInMemoryDB: true, - MinGasPrice: big.NewInt(1), - } - logger := log.New(log.TestLogCmp, int(gethlog.LvlError), log.SysOut) - - obsGenesis := &genesis.TestnetGenesis - if len(prefundedAddresses) > 0 { - obsGenesis = &genesis.Genesis{Accounts: prefundedAddresses} - } - enclave := NewEnclave(enclaveConfig, obsGenesis, nil, logger) - - _, err := enclave.GenerateSecret() - if err != nil { - return nil, err - } - - err = createFakeGenesis(enclave, prefundedAddresses) - if err != nil { - return nil, err - } - - return enclave, nil -} - -func createFakeGenesis(enclave common.Enclave, addresses []genesis.Account) error { - // Random Layer 1 block where the genesis rollup is set - blk := types.NewBlock(&types.Header{}, nil, nil, nil, &trie.StackTrie{}) - _, err := enclave.SubmitL1Block(*blk, make(types.Receipts, 0), true) - if err != nil { - return err - } - - // make sure the state is updated otherwise balances will not be available - genesisPreallocStateDB, err := enclave.(*enclaveImpl).storage.EmptyStateDB() - if err != nil { - return fmt.Errorf("could not initialise empty state DB. Cause: %w", err) - } - - for _, prefundedAddr := range addresses { - genesisPreallocStateDB.SetBalance(prefundedAddr.Address, prefundedAddr.Amount) - } - - _, err = genesisPreallocStateDB.Commit(0, false) - if err != nil { - return err - } - - genesisBatch := dummyBatch(blk.Hash(), common.L2GenesisHeight, genesisPreallocStateDB) - - // We update the database - err = enclave.(*enclaveImpl).storage.StoreBatch(genesisBatch) - if err != nil { - return err - } - return enclave.(*enclaveImpl).storage.StoreExecutedBatch(genesisBatch, nil) -} - -func dummyBatch(blkHash gethcommon.Hash, height uint64, state *state.StateDB) *core.Batch { - h := common.BatchHeader{ - ParentHash: common.L1BlockHash{}, - L1Proof: blkHash, - Root: state.IntermediateRoot(true), - Number: big.NewInt(int64(height)), - SequencerOrderNo: big.NewInt(int64(height + 1)), // seq number starts at 1 so need to offset - ReceiptHash: types.EmptyRootHash, - Time: uint64(time.Now().Unix()), - } - return &core.Batch{ - Header: &h, - Transactions: []*common.L2Tx{}, - } -} diff --git a/go/enclave/evm/evm_facade.go b/go/enclave/evm/evm_facade.go index e506b1d226..7809242d4c 100644 --- a/go/enclave/evm/evm_facade.go +++ b/go/enclave/evm/evm_facade.go @@ -44,6 +44,7 @@ var ErrGasNotEnoughForL1 = errors.New("gas limit too low to pay for execution an // fromTxIndex - for the receipts and events, the evm needs to know for each transaction the order in which it was executed in the block. func ExecuteTransactions( ctx context.Context, + entropyService *crypto.EvmEntropyService, txs common.L2PricedTransactions, s *state.StateDB, header *common.BatchHeader, @@ -89,6 +90,7 @@ func ExecuteTransactions( for i, t := range txs { txResult := executeTransaction( s, + entropyService, chainConfig, chain, &gp, @@ -127,6 +129,7 @@ const ( func executeTransaction( s *state.StateDB, + entropyService *crypto.EvmEntropyService, cc *params.ChainConfig, chain *ObscuroChainContext, gp *gethcore.GasPool, @@ -168,7 +171,7 @@ func executeTransaction( before := header.MixDigest // calculate a random value per transaction - header.MixDigest = crypto.CalculateTxRnd(before.Bytes(), tCount) + header.MixDigest = entropyService.TxEntropy(before.Bytes(), tCount) var vmenv *vm.EVM applyTx := func( diff --git a/go/enclave/nodetype/sequencer.go b/go/enclave/nodetype/sequencer.go index a6bd6182af..5518432a77 100644 --- a/go/enclave/nodetype/sequencer.go +++ b/go/enclave/nodetype/sequencer.go @@ -49,10 +49,9 @@ type sequencer struct { logger gethlog.Logger chainConfig *params.ChainConfig - enclaveKeyService *components.EnclaveKeyService + enclaveKeyService *crypto.EnclaveAttestedKeyService mempool *txpool.TxPool storage storage.Storage - dataEncryptionService crypto.DataEncryptionService dataCompressionService compression.DataCompressionService settings SequencerSettings } @@ -66,10 +65,9 @@ func NewSequencer( gethEncodingService gethencoding.EncodingService, logger gethlog.Logger, chainConfig *params.ChainConfig, - enclaveKeyService *components.EnclaveKeyService, + enclaveKeyService *crypto.EnclaveAttestedKeyService, mempool *txpool.TxPool, storage storage.Storage, - dataEncryptionService crypto.DataEncryptionService, dataCompressionService compression.DataCompressionService, settings SequencerSettings, ) ActiveSequencer { @@ -85,7 +83,6 @@ func NewSequencer( enclaveKeyService: enclaveKeyService, mempool: mempool, storage: storage, - dataEncryptionService: dataEncryptionService, dataCompressionService: dataCompressionService, settings: settings, } diff --git a/go/enclave/rpc/rpc_encryption_manager.go b/go/enclave/rpc/rpc_encryption_manager.go index 963e05974e..04b70830d3 100644 --- a/go/enclave/rpc/rpc_encryption_manager.go +++ b/go/enclave/rpc/rpc_encryption_manager.go @@ -3,6 +3,8 @@ package rpc import ( "fmt" + "github.com/ten-protocol/go-ten/go/enclave/crypto" + "github.com/ten-protocol/go-ten/go/enclave/txpool" "github.com/ten-protocol/go-ten/go/common/privacy" @@ -14,48 +16,46 @@ import ( "github.com/ten-protocol/go-ten/go/enclave/crosschain" "github.com/ten-protocol/go-ten/go/enclave/l2chain" "github.com/ten-protocol/go-ten/go/enclave/storage" - - "github.com/ethereum/go-ethereum/crypto/ecies" ) // EncryptionManager manages the decryption and encryption of enclave comms. type EncryptionManager struct { - chain l2chain.ObscuroChain - enclavePrivateKeyECIES *ecies.PrivateKey - storage storage.Storage - cacheService *storage.CacheService - registry components.BatchRegistry - processors *crosschain.Processors - mempool *txpool.TxPool - gasOracle gas.Oracle - blockResolver storage.BlockResolver - l1BlockProcessor components.L1BlockProcessor - config *enclaveconfig.EnclaveConfig - logger gethlog.Logger - storageSlotWhitelist *privacy.Whitelist + chain l2chain.ObscuroChain + rpcKeyService *crypto.RPCKeyService + storage storage.Storage + cacheService *storage.CacheService + registry components.BatchRegistry + processors *crosschain.Processors + mempool *txpool.TxPool + gasOracle gas.Oracle + blockResolver storage.BlockResolver + l1BlockProcessor components.L1BlockProcessor + config *enclaveconfig.EnclaveConfig + logger gethlog.Logger + storageSlotWhitelist *privacy.Whitelist } -func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage storage.Storage, cacheService *storage.CacheService, registry components.BatchRegistry, mempool *txpool.TxPool, processors *crosschain.Processors, config *enclaveconfig.EnclaveConfig, oracle gas.Oracle, blockResolver storage.BlockResolver, l1BlockProcessor components.L1BlockProcessor, chain l2chain.ObscuroChain, logger gethlog.Logger) *EncryptionManager { +func NewEncryptionManager(storage storage.Storage, cacheService *storage.CacheService, registry components.BatchRegistry, mempool *txpool.TxPool, processors *crosschain.Processors, config *enclaveconfig.EnclaveConfig, oracle gas.Oracle, blockResolver storage.BlockResolver, l1BlockProcessor components.L1BlockProcessor, chain l2chain.ObscuroChain, rpcKeyService *crypto.RPCKeyService, logger gethlog.Logger) *EncryptionManager { return &EncryptionManager{ - storage: storage, - cacheService: cacheService, - registry: registry, - processors: processors, - chain: chain, - config: config, - blockResolver: blockResolver, - l1BlockProcessor: l1BlockProcessor, - gasOracle: oracle, - logger: logger, - enclavePrivateKeyECIES: enclavePrivateKeyECIES, - storageSlotWhitelist: privacy.NewWhitelist(), - mempool: mempool, + storage: storage, + cacheService: cacheService, + registry: registry, + processors: processors, + chain: chain, + config: config, + blockResolver: blockResolver, + l1BlockProcessor: l1BlockProcessor, + gasOracle: oracle, + logger: logger, + rpcKeyService: rpcKeyService, + storageSlotWhitelist: privacy.NewWhitelist(), + mempool: mempool, } } // DecryptBytes decrypts the bytes with the enclave's private key. func (rpc *EncryptionManager) DecryptBytes(encryptedBytes []byte) ([]byte, error) { - bytes, err := rpc.enclavePrivateKeyECIES.Decrypt(encryptedBytes, nil, nil) + bytes, err := rpc.rpcKeyService.DecryptRPCRequest(encryptedBytes) if err != nil { return nil, fmt.Errorf("could not decrypt bytes with enclave private key. Cause: %w", err) } diff --git a/go/enclave/rpc_server.go b/go/enclave/rpc_server.go index b1e4ce46ec..90d2f6b572 100644 --- a/go/enclave/rpc_server.go +++ b/go/enclave/rpc_server.go @@ -132,6 +132,15 @@ func (s *RPCServer) EnclaveID(ctx context.Context, _ *generated.EnclaveIDRequest return &generated.EnclaveIDResponse{EnclaveID: id.Bytes()}, nil } +func (s *RPCServer) RPCEncryptionKey(ctx context.Context, _ *generated.RPCEncryptionKeyRequest) (*generated.RPCEncryptionKeyResponse, error) { + key, sysError := s.enclave.RPCEncryptionKey(ctx) + if sysError != nil { + s.logger.Error("Error getting enclave ID", log.ErrKey, sysError) + return &generated.RPCEncryptionKeyResponse{SystemError: toRPCError(sysError)}, nil + } + return &generated.RPCEncryptionKeyResponse{RpcPubKey: key}, nil +} + func (s *RPCServer) SubmitL1Block(ctx context.Context, request *generated.SubmitBlockRequest) (*generated.SubmitBlockResponse, error) { bl, err := s.decodeBlock(request.EncodedBlock) if err != nil { diff --git a/go/enclave/storage/interfaces.go b/go/enclave/storage/interfaces.go index 0affc1f4b0..fa0bb6194c 100644 --- a/go/enclave/storage/interfaces.go +++ b/go/enclave/storage/interfaces.go @@ -117,8 +117,8 @@ type CrossChainMessagesStorage interface { } type EnclaveKeyStorage interface { - StoreEnclaveKey(ctx context.Context, enclaveKey *crypto.EnclaveKey) error - GetEnclaveKey(ctx context.Context) (*crypto.EnclaveKey, error) + StoreEnclaveKey(ctx context.Context, enclaveKey []byte) error + GetEnclaveKey(ctx context.Context) ([]byte, error) } // Storage is the enclave's interface for interacting with the enclave's datastore diff --git a/go/enclave/storage/storage.go b/go/enclave/storage/storage.go index cdc22c20ef..77248a5df0 100644 --- a/go/enclave/storage/storage.go +++ b/go/enclave/storage/storage.go @@ -52,10 +52,9 @@ type AttestedEnclave struct { // todo - this file needs splitting up based on concerns type storageImpl struct { - db enclavedb.EnclaveDB - cachingService *CacheService - eventsStorage *eventsStorage - cachedSharedSecret *crypto.SharedEnclaveSecret + db enclavedb.EnclaveDB + cachingService *CacheService + eventsStorage *eventsStorage stateCache state.Database chainConfig *params.ChainConfig @@ -344,20 +343,13 @@ func (s *storageImpl) StoreSecret(ctx context.Context, secret crypto.SharedEncla if err != nil { return fmt.Errorf("could not shared secret in DB. Cause: %w", err) } - err = dbTx.Commit() - if err != nil { - return err - } - return nil + return dbTx.Commit() } +// FetchSecret - this returns the most important secret, and should only be called during startup func (s *storageImpl) FetchSecret(ctx context.Context) (*crypto.SharedEnclaveSecret, error) { defer s.logDuration("FetchSecret", measure.NewStopwatch()) - if s.cachedSharedSecret != nil { - return s.cachedSharedSecret, nil - } - var ss crypto.SharedEnclaveSecret cfg, err := enclavedb.FetchConfig(ctx, s.db.GetSQLDB(), masterSeedCfg) @@ -368,8 +360,7 @@ func (s *storageImpl) FetchSecret(ctx context.Context) (*crypto.SharedEnclaveSec return nil, fmt.Errorf("could not decode shared secret") } - s.cachedSharedSecret = &ss - return s.cachedSharedSecret, nil + return &ss, nil } func (s *storageImpl) IsAncestor(ctx context.Context, block *types.Header, maybeAncestor *types.Header) bool { @@ -735,36 +726,27 @@ func (s *storageImpl) GetL1Transfers(ctx context.Context, blockHash common.L1Blo return enclavedb.FetchL1Messages[common.ValueTransferEvent](ctx, s.db.GetSQLDB(), blockHash, true) } -func (s *storageImpl) StoreEnclaveKey(ctx context.Context, enclaveKey *crypto.EnclaveKey) error { +func (s *storageImpl) StoreEnclaveKey(ctx context.Context, enclaveKey []byte) error { defer s.logDuration("StoreEnclaveKey", measure.NewStopwatch()) - if enclaveKey == nil { - return errors.New("enclaveKey cannot be nil") + if len(enclaveKey) == 0 { + return errors.New("enclaveKey cannot be empty") } - keyBytes := gethcrypto.FromECDSA(enclaveKey.PrivateKey()) dbTx, err := s.db.NewDBTransaction(ctx) if err != nil { return fmt.Errorf("could not create DB transaction - %w", err) } defer dbTx.Rollback() - _, err = enclavedb.WriteConfig(ctx, dbTx, enclaveKeyCfg, keyBytes) + _, err = enclavedb.WriteConfig(ctx, dbTx, enclaveKeyCfg, enclaveKey) if err != nil { return err } return dbTx.Commit() } -func (s *storageImpl) GetEnclaveKey(ctx context.Context) (*crypto.EnclaveKey, error) { +func (s *storageImpl) GetEnclaveKey(ctx context.Context) ([]byte, error) { defer s.logDuration("GetEnclaveKey", measure.NewStopwatch()) - keyBytes, err := enclavedb.FetchConfig(ctx, s.db.GetSQLDB(), enclaveKeyCfg) - if err != nil { - return nil, err - } - ecdsaKey, err := gethcrypto.ToECDSA(keyBytes) - if err != nil { - return nil, fmt.Errorf("unable to construct ECDSA private key from enclave key bytes - %w", err) - } - return crypto.NewEnclaveKey(ecdsaKey), nil + return enclavedb.FetchConfig(ctx, s.db.GetSQLDB(), enclaveKeyCfg) } func (s *storageImpl) StoreRollup(ctx context.Context, rollup *common.ExtRollup, internalHeader *common.CalldataRollupHeader) error { diff --git a/go/host/rpc/clientapi/client_api_ten.go b/go/host/rpc/clientapi/client_api_ten.go index b2f2c32028..a8977cd2a7 100644 --- a/go/host/rpc/clientapi/client_api_ten.go +++ b/go/host/rpc/clientapi/client_api_ten.go @@ -45,6 +45,14 @@ func (api *TenAPI) Config() (*ChecksumFormattedTenNetworkConfig, error) { return checksumFormatted(config), nil } +func (api *TenAPI) RpcKey() ([]byte, error) { + key, err := api.host.EnclaveClient().RPCEncryptionKey(context.Background()) + if err != nil { + return nil, err + } + return key, nil +} + func (api *TenAPI) EncryptedRPC(ctx context.Context, encryptedParams common.EncryptedRPCRequest) (responses.EnclaveResponse, error) { var enclaveResponse *responses.EnclaveResponse var sysError error diff --git a/go/host/rpc/enclaverpc/enclave_client.go b/go/host/rpc/enclaverpc/enclave_client.go index 268afe7c7a..67fc38dd76 100644 --- a/go/host/rpc/enclaverpc/enclave_client.go +++ b/go/host/rpc/enclaverpc/enclave_client.go @@ -198,6 +198,20 @@ func (c *Client) EnclaveID(ctx context.Context) (common.EnclaveID, common.System return common.EnclaveID(response.EnclaveID), nil } +func (c *Client) RPCEncryptionKey(ctx context.Context) ([]byte, common.SystemError) { + timeoutCtx, cancel := context.WithTimeout(ctx, c.enclaveRPCTimeout) + defer cancel() + + response, err := c.protoClient.RPCEncryptionKey(timeoutCtx, &generated.RPCEncryptionKeyRequest{}) + if err != nil { + return nil, syserr.NewRPCError(err) + } + if response != nil && response.SystemError != nil { + return nil, syserr.NewInternalError(fmt.Errorf("%s", response.SystemError.ErrorString)) + } + return response.RpcPubKey, nil +} + func (c *Client) SubmitL1Block(ctx context.Context, blockHeader *types.Header, txsReceiptsAndBlobs []*common.TxAndReceiptAndBlobs) (*common.BlockSubmissionResponse, common.SystemError) { var buffer bytes.Buffer if err := blockHeader.EncodeRLP(&buffer); err != nil { diff --git a/go/rpc/client.go b/go/rpc/client.go index a7cd4b0e38..2553046aea 100644 --- a/go/rpc/client.go +++ b/go/rpc/client.go @@ -17,6 +17,7 @@ const ( Health = "ten_health" Config = "ten_config" + RPCKey = "ten_rpcKey" StopHost = "test_stopHost" SubscribeNamespace = "ten" diff --git a/go/rpc/encrypted_client.go b/go/rpc/encrypted_client.go index 0cdb89bbcd..d9ed541f95 100644 --- a/go/rpc/encrypted_client.go +++ b/go/rpc/encrypted_client.go @@ -25,11 +25,6 @@ import ( gethlog "github.com/ethereum/go-ethereum/log" ) -const ( - // todo: this is a convenience for testnet testing and will eventually be retrieved from the L1 - enclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a044551f0f0cbec74d0bc5e" -) - // EncRPCClient is a Client wrapper that implements Client but also has extra functionality for managing viewing key registration and decryption type EncRPCClient struct { obscuroClient Client @@ -39,9 +34,8 @@ type EncRPCClient struct { } // NewEncRPCClient wrapper over rpc clients with a viewing key for encrypted communication -func NewEncRPCClient(client Client, viewingKey *viewingkey.ViewingKey, logger gethlog.Logger) (*EncRPCClient, error) { - // todo: this is a convenience for testnet but needs to replaced by a parameter and/or retrieved from the target host - enclPubECDSA, err := crypto.DecompressPubkey(gethcommon.Hex2Bytes(enclavePublicKeyHex)) +func NewEncRPCClient(client Client, viewingKey *viewingkey.ViewingKey, enclavePublicKeyBytes []byte, logger gethlog.Logger) (*EncRPCClient, error) { + enclPubECDSA, err := crypto.DecompressPubkey(enclavePublicKeyBytes) if err != nil { return nil, fmt.Errorf("failed to decompress key for RPC client: %w", err) } diff --git a/go/rpc/network_client.go b/go/rpc/network_client.go index 2814aa009f..a426f07508 100644 --- a/go/rpc/network_client.go +++ b/go/rpc/network_client.go @@ -1,6 +1,9 @@ package rpc import ( + "context" + "fmt" + "github.com/ten-protocol/go-ten/go/common/viewingkey" "github.com/ten-protocol/go-ten/lib/gethfork/rpc" gethrpc "github.com/ten-protocol/go-ten/lib/gethfork/rpc" @@ -14,7 +17,11 @@ func NewEncNetworkClient(rpcAddress string, viewingKey *viewingkey.ViewingKey, l if err != nil { return nil, err } - encClient, err := NewEncRPCClient(rpcClient, viewingKey, logger) + enclavePublicKeyBytes, err := ReadEnclaveKey(rpcClient) + if err != nil { + return nil, fmt.Errorf("error reading enclave public key: %v", err) + } + encClient, err := NewEncRPCClient(rpcClient, viewingKey, enclavePublicKeyBytes, logger) if err != nil { return nil, err } @@ -22,7 +29,11 @@ func NewEncNetworkClient(rpcAddress string, viewingKey *viewingkey.ViewingKey, l } func NewEncNetworkClientFromConn(connection *gethrpc.Client, viewingKey *viewingkey.ViewingKey, logger gethlog.Logger) (*EncRPCClient, error) { - encClient, err := NewEncRPCClient(connection, viewingKey, logger) + enclavePublicKeyBytes, err := ReadEnclaveKey(connection) + if err != nil { + return nil, fmt.Errorf("error reading enclave public key: %v", err) + } + encClient, err := NewEncRPCClient(connection, viewingKey, enclavePublicKeyBytes, logger) if err != nil { return nil, err } @@ -33,3 +44,12 @@ func NewEncNetworkClientFromConn(connection *gethrpc.Client, viewingKey *viewing func NewNetworkClient(address string) (Client, error) { return rpc.Dial(address) } + +func ReadEnclaveKey(connection Client) ([]byte, error) { + var enclavePublicKeyBytes []byte + err := connection.CallContext(context.Background(), &enclavePublicKeyBytes, RPCKey) + if err != nil { + return nil, err + } + return enclavePublicKeyBytes, nil +} diff --git a/integration/simulation/network/obscuro_node_utils.go b/integration/simulation/network/obscuro_node_utils.go index 667fcd2640..ea6bc8b319 100644 --- a/integration/simulation/network/obscuro_node_utils.go +++ b/integration/simulation/network/obscuro_node_utils.go @@ -95,6 +95,10 @@ func createAuthClientsPerWallet(clients []rpc.Client, wallets *params.SimWallets } func CreateAuthClients(clients []rpc.Client, wal wallet.Wallet) []*obsclient.AuthObsClient { + rpcKey, err := rpc.ReadEnclaveKey(clients[0]) + if err != nil { + return nil + } authClients := make([]*obsclient.AuthObsClient, len(clients)) for i, client := range clients { vk, err := viewingkey.GenerateViewingKeyForWallet(wal) @@ -102,7 +106,7 @@ func CreateAuthClients(clients []rpc.Client, wal wallet.Wallet) []*obsclient.Aut panic(err) } // todo - use a child logger - encClient, err := rpc.NewEncRPCClient(client, vk, testlog.Logger()) + encClient, err := rpc.NewEncRPCClient(client, vk, rpcKey, testlog.Logger()) if err != nil { panic(err) } diff --git a/integration/simulation/p2p/in_mem_ten_client.go b/integration/simulation/p2p/in_mem_ten_client.go index 7fe042fe0d..38009f5a83 100644 --- a/integration/simulation/p2p/in_mem_ten_client.go +++ b/integration/simulation/p2p/in_mem_ten_client.go @@ -9,7 +9,6 @@ import ( tenrpc "github.com/ten-protocol/go-ten/go/common/rpc" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ten-protocol/go-ten/go/common" "github.com/ten-protocol/go-ten/go/common/gethencoding" @@ -25,38 +24,24 @@ import ( gethrpc "github.com/ten-protocol/go-ten/lib/gethfork/rpc" ) -const ( - // todo: this is a convenience for testnet testing and will eventually be retrieved from the L1 - enclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a044551f0f0cbec74d0bc5e" -) - // todo - move this from the P2P folder // An in-memory implementation of `rpc.Client` that speaks directly to the node. type inMemTenClient struct { - tenAPI *clientapi.TenAPI - ethAPI *clientapi.ChainAPI - filterAPI *clientapi.FilterAPI - tenScanAPI *clientapi.ScanAPI - testAPI *clientapi.TestAPI - enclavePublicKey *ecies.PublicKey + tenAPI *clientapi.TenAPI + ethAPI *clientapi.ChainAPI + filterAPI *clientapi.FilterAPI + tenScanAPI *clientapi.ScanAPI + testAPI *clientapi.TestAPI } func NewInMemTenClient(hostContainer *container.HostContainer) rpc.Client { logger := testlog.Logger().New(log.CmpKey, log.RPCClientCmp) - // todo: this is a convenience for testnet but needs to replaced by a parameter and/or retrieved from the target host - enclPubECDSA, err := crypto.DecompressPubkey(gethcommon.Hex2Bytes(enclavePublicKeyHex)) - if err != nil { - panic(err) - } - enclPubKey := ecies.ImportECDSAPublic(enclPubECDSA) - return &inMemTenClient{ - tenAPI: clientapi.NewTenAPI(hostContainer.Host(), logger), - ethAPI: clientapi.NewChainAPI(hostContainer.Host(), logger), - filterAPI: clientapi.NewFilterAPI(hostContainer.Host(), logger), - tenScanAPI: clientapi.NewScanAPI(hostContainer.Host(), logger), - testAPI: clientapi.NewTestAPI(hostContainer), - enclavePublicKey: enclPubKey, + tenAPI: clientapi.NewTenAPI(hostContainer.Host(), logger), + ethAPI: clientapi.NewChainAPI(hostContainer.Host(), logger), + filterAPI: clientapi.NewFilterAPI(hostContainer.Host(), logger), + tenScanAPI: clientapi.NewScanAPI(hostContainer.Host(), logger), + testAPI: clientapi.NewTestAPI(hostContainer), } } @@ -118,6 +103,11 @@ func (c *inMemTenClient) Call(result interface{}, method string, args ...interfa case rpc.Config: return c.tenConfig(result) + case rpc.RPCKey: + key, err := c.tenAPI.RpcKey() + *result.(*[]byte) = key + return err + case rpc.GetCode: return c.getCode(result, args) diff --git a/integration/simulation/transaction_injector.go b/integration/simulation/transaction_injector.go index e0729c1575..6888055def 100644 --- a/integration/simulation/transaction_injector.go +++ b/integration/simulation/transaction_injector.go @@ -3,7 +3,6 @@ package simulation import ( "context" "encoding/json" - "fmt" "math/big" "math/rand" "sync/atomic" @@ -12,8 +11,6 @@ import ( "github.com/FantasyJony/openzeppelin-merkle-tree-go/standard_merkle_tree" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" "github.com/ten-protocol/go-ten/contracts/generated/ManagementContract" "github.com/ten-protocol/go-ten/contracts/generated/MessageBus" "github.com/ten-protocol/go-ten/go/common" @@ -37,10 +34,6 @@ import ( const ( nonceTimeoutMillis = 30000 // The timeout in millis to wait for an updated nonce for a wallet. - - // EnclavePublicKeyHex is the public key of the enclave. - // todo (@stefan) - retrieve this key from the management contract instead - EnclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a044551f0f0cbec74d0bc5e" ) // TransactionInjector is a structure that generates, issues and tracks transactions @@ -67,8 +60,6 @@ type TransactionInjector struct { interruptRun *int32 fullyStoppedChan chan bool - enclavePublicKey *ecies.PublicKey - // The number of transactions of each type to issue, or 0 for unlimited transactions txsToIssue int @@ -94,13 +85,6 @@ func NewTransactionInjector( ) *TransactionInjector { interrupt := int32(0) - // We retrieve the enclave public key to encrypt transactions. - enclavePublicKey, err := crypto.DecompressPubkey(gethcommon.Hex2Bytes(EnclavePublicKeyHex)) - if err != nil { - panic(fmt.Errorf("could not decompress enclave public key from hex. Cause: %w", err)) - } - enclavePublicKeyEcies := ecies.ImportECDSAPublic(enclavePublicKey) - return &TransactionInjector{ avgBlockDuration: avgBlockDuration, stats: stats, @@ -112,7 +96,6 @@ func NewTransactionInjector( erc20ContractLib: erc20ContractLib, wallets: wallets, TxTracker: newCounter(), - enclavePublicKey: enclavePublicKeyEcies, txsToIssue: txsToIssue, params: params, ctx: context.Background(), // for now we create a new context here, should allow it to be passed in diff --git a/tools/tenscan/backend/obscuroscan_backend.go b/tools/tenscan/backend/obscuroscan_backend.go index 2522550401..caf424305c 100644 --- a/tools/tenscan/backend/obscuroscan_backend.go +++ b/tools/tenscan/backend/obscuroscan_backend.go @@ -1,16 +1,8 @@ package backend import ( - "crypto/aes" - "crypto/cipher" - "encoding/base64" - "fmt" "math/big" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ten-protocol/go-ten/go/common/compression" - "github.com/ten-protocol/go-ten/go/enclave/crypto" - "github.com/ten-protocol/go-ten/go/common" "github.com/ten-protocol/go-ten/go/obsclient" @@ -127,7 +119,7 @@ func (b *Backend) GetBatchTransactions(hash gethcommon.Hash) (*common.Transactio return b.obsClient.GetBatchTransactions(hash) } -func (b *Backend) DecryptTxBlob(payload string) ([]*common.L2Tx, error) { +/*func (b *Backend) DecryptTxBlob(payload string) ([]*common.L2Tx, error) { encryptedTxBytes, err := base64.StdEncoding.DecodeString(payload) if err != nil { return nil, fmt.Errorf("could not decode encrypted transaction blob from Base64. Cause: %w", err) @@ -144,8 +136,8 @@ func (b *Backend) DecryptTxBlob(payload string) ([]*common.L2Tx, error) { } // The nonce is prepended to the ciphertext. - nonce := encryptedTxBytes[0:crypto.NonceLength] - ciphertext := encryptedTxBytes[crypto.NonceLength:] + nonce := encryptedTxBytes[0:crypto.GCMNonceLength] + ciphertext := encryptedTxBytes[crypto.GCMNonceLength:] compressedTxs, err := transactionCipher.Open(nil, nonce, ciphertext, nil) if err != nil { return nil, fmt.Errorf("could not decrypt encrypted L2 transactions. Cause: %w", err) @@ -164,7 +156,7 @@ func (b *Backend) DecryptTxBlob(payload string) ([]*common.L2Tx, error) { } return cleartextTxs, nil -} +}*/ func (b *Backend) GetConfig() (*common.TenNetworkInfo, error) { return b.obsClient.GetConfig() diff --git a/tools/tenscan/backend/webserver/webserver.go b/tools/tenscan/backend/webserver/webserver.go index 871cf47901..bf8fdac4f2 100644 --- a/tools/tenscan/backend/webserver/webserver.go +++ b/tools/tenscan/backend/webserver/webserver.go @@ -2,8 +2,6 @@ package webserver import ( "context" - "encoding/json" - "fmt" "net/http" "time" @@ -49,7 +47,8 @@ func New(backend *backend.Backend, bindAddress string, logger log.Logger) *WebSe r.GET("/health/", server.health) r.GET("/batchHeader/:hash", server.getBatchHeader) r.GET("/tx/:hash", server.getTransaction) - r.POST("/actions/decryptTxBlob/", server.decryptTxBlob) + // no longer available because the key is not public any more + // r.POST("/actions/decryptTxBlob/", server.decryptTxBlob) return server } @@ -88,7 +87,7 @@ func (w *WebServer) health(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"healthy": true}) } -func (w *WebServer) decryptTxBlob(c *gin.Context) { +/*func (w *WebServer) decryptTxBlob(c *gin.Context) { // Read the payload as a string payloadBytes, err := c.GetRawData() if err != nil { @@ -110,7 +109,7 @@ func (w *WebServer) decryptTxBlob(c *gin.Context) { } c.JSON(http.StatusOK, gin.H{"result": result}) -} +}*/ type PostData struct { StrData string `json:"strData"`