From ed46bad9ae99d4d95b6b327c959fab07792a9714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 00:40:14 +0100 Subject: [PATCH 1/8] fix: add FheType for Euint64 for kms --- fhevm/precompiles.go | 2 ++ kms/kms.pb.go | 1 + 2 files changed, 3 insertions(+) diff --git a/fhevm/precompiles.go b/fhevm/precompiles.go index 4012881..483af34 100644 --- a/fhevm/precompiles.go +++ b/fhevm/precompiles.go @@ -2099,6 +2099,8 @@ func reencryptRun(environment EVMEnvironment, caller common.Address, addr common fheType = kms.FheType_Euint16 case FheUint32: fheType = kms.FheType_Euint32 + case FheUint64: + fheType = kms.FheType_Euint64 } pubKey := input[32:64] diff --git a/kms/kms.pb.go b/kms/kms.pb.go index 26318df..baa840b 100644 --- a/kms/kms.pb.go +++ b/kms/kms.pb.go @@ -27,6 +27,7 @@ const ( FheType_Euint8 FheType = 1 FheType_Euint16 FheType = 2 FheType_Euint32 FheType = 3 + FheType_Euint64 FheType = 4 ) // Enum value maps for FheType. From 23996fd76089ffd767ca52250fe9a8fe47d42b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 10:00:32 +0100 Subject: [PATCH 2/8] fix: update protobuf --- kms/kms.pb.go | 239 +++++++++++++++++++++++---------------------- kms/kms_grpc.pb.go | 11 +-- proto/kms.proto | 3 +- 3 files changed, 126 insertions(+), 127 deletions(-) diff --git a/kms/kms.pb.go b/kms/kms.pb.go index baa840b..5bd0015 100644 --- a/kms/kms.pb.go +++ b/kms/kms.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.1 -// source: kms.proto +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: proto/kms.proto package kms @@ -37,12 +37,14 @@ var ( 1: "Euint8", 2: "Euint16", 3: "Euint32", + 4: "Euint64", } FheType_value = map[string]int32{ "Bool": 0, "Euint8": 1, "Euint16": 2, "Euint32": 3, + "Euint64": 4, } ) @@ -57,11 +59,11 @@ func (x FheType) String() string { } func (FheType) Descriptor() protoreflect.EnumDescriptor { - return file_kms_proto_enumTypes[0].Descriptor() + return file_proto_kms_proto_enumTypes[0].Descriptor() } func (FheType) Type() protoreflect.EnumType { - return &file_kms_proto_enumTypes[0] + return &file_proto_kms_proto_enumTypes[0] } func (x FheType) Number() protoreflect.EnumNumber { @@ -70,7 +72,7 @@ func (x FheType) Number() protoreflect.EnumNumber { // Deprecated: Use FheType.Descriptor instead. func (FheType) EnumDescriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{0} + return file_proto_kms_proto_rawDescGZIP(), []int{0} } type Proof struct { @@ -85,7 +87,7 @@ type Proof struct { func (x *Proof) Reset() { *x = Proof{} if protoimpl.UnsafeEnabled { - mi := &file_kms_proto_msgTypes[0] + mi := &file_proto_kms_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98,7 +100,7 @@ func (x *Proof) String() string { func (*Proof) ProtoMessage() {} func (x *Proof) ProtoReflect() protoreflect.Message { - mi := &file_kms_proto_msgTypes[0] + mi := &file_proto_kms_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111,7 +113,7 @@ func (x *Proof) ProtoReflect() protoreflect.Message { // Deprecated: Use Proof.ProtoReflect.Descriptor instead. func (*Proof) Descriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{0} + return file_proto_kms_proto_rawDescGZIP(), []int{0} } func (x *Proof) GetHeight() uint32 { @@ -142,7 +144,7 @@ type DecryptionRequest struct { func (x *DecryptionRequest) Reset() { *x = DecryptionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_kms_proto_msgTypes[1] + mi := &file_proto_kms_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -155,7 +157,7 @@ func (x *DecryptionRequest) String() string { func (*DecryptionRequest) ProtoMessage() {} func (x *DecryptionRequest) ProtoReflect() protoreflect.Message { - mi := &file_kms_proto_msgTypes[1] + mi := &file_proto_kms_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -168,7 +170,7 @@ func (x *DecryptionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DecryptionRequest.ProtoReflect.Descriptor instead. func (*DecryptionRequest) Descriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{1} + return file_proto_kms_proto_rawDescGZIP(), []int{1} } func (x *DecryptionRequest) GetFheType() FheType { @@ -206,13 +208,13 @@ type DecryptionResponse struct { Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` FheType FheType `protobuf:"varint,2,opt,name=fhe_type,json=fheType,proto3,enum=kms.FheType" json:"fhe_type,omitempty"` - Plaintext uint32 `protobuf:"varint,3,opt,name=plaintext,proto3" json:"plaintext,omitempty"` + Plaintext uint64 `protobuf:"varint,3,opt,name=plaintext,proto3" json:"plaintext,omitempty"` } func (x *DecryptionResponse) Reset() { *x = DecryptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_kms_proto_msgTypes[2] + mi := &file_proto_kms_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -225,7 +227,7 @@ func (x *DecryptionResponse) String() string { func (*DecryptionResponse) ProtoMessage() {} func (x *DecryptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_kms_proto_msgTypes[2] + mi := &file_proto_kms_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -238,7 +240,7 @@ func (x *DecryptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DecryptionResponse.ProtoReflect.Descriptor instead. func (*DecryptionResponse) Descriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{2} + return file_proto_kms_proto_rawDescGZIP(), []int{2} } func (x *DecryptionResponse) GetSignature() []byte { @@ -255,7 +257,7 @@ func (x *DecryptionResponse) GetFheType() FheType { return FheType_Bool } -func (x *DecryptionResponse) GetPlaintext() uint32 { +func (x *DecryptionResponse) GetPlaintext() uint64 { if x != nil { return x.Plaintext } @@ -276,7 +278,7 @@ type ReencryptionRequest struct { func (x *ReencryptionRequest) Reset() { *x = ReencryptionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_kms_proto_msgTypes[3] + mi := &file_proto_kms_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -289,7 +291,7 @@ func (x *ReencryptionRequest) String() string { func (*ReencryptionRequest) ProtoMessage() {} func (x *ReencryptionRequest) ProtoReflect() protoreflect.Message { - mi := &file_kms_proto_msgTypes[3] + mi := &file_proto_kms_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -302,7 +304,7 @@ func (x *ReencryptionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReencryptionRequest.ProtoReflect.Descriptor instead. func (*ReencryptionRequest) Descriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{3} + return file_proto_kms_proto_rawDescGZIP(), []int{3} } func (x *ReencryptionRequest) GetFheType() FheType { @@ -345,7 +347,7 @@ type ReencryptionResponse struct { func (x *ReencryptionResponse) Reset() { *x = ReencryptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_kms_proto_msgTypes[4] + mi := &file_proto_kms_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -358,7 +360,7 @@ func (x *ReencryptionResponse) String() string { func (*ReencryptionResponse) ProtoMessage() {} func (x *ReencryptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_kms_proto_msgTypes[4] + mi := &file_proto_kms_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -371,7 +373,7 @@ func (x *ReencryptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReencryptionResponse.ProtoReflect.Descriptor instead. func (*ReencryptionResponse) Descriptor() ([]byte, []int) { - return file_kms_proto_rawDescGZIP(), []int{4} + return file_proto_kms_proto_rawDescGZIP(), []int{4} } func (x *ReencryptionResponse) GetReencryptedCiphertext() []byte { @@ -388,92 +390,93 @@ func (x *ReencryptionResponse) GetFheType() FheType { return FheType_Bool } -var File_kms_proto protoreflect.FileDescriptor - -var file_kms_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x6b, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6b, 0x6d, 0x73, - 0x22, 0x53, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x72, - 0x69, 0x63, 0x69, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x13, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, - 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x98, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, - 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, - 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, - 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, - 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, - 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x22, 0x79, 0x0a, 0x12, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x13, - 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, - 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x76, 0x0a, 0x14, 0x52, 0x65, 0x65, 0x6e, - 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x35, 0x0a, 0x16, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, - 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x15, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x43, 0x69, 0x70, - 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, - 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x2a, 0x39, 0x0a, 0x07, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x42, - 0x6f, 0x6f, 0x6c, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x38, 0x10, - 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x31, 0x36, 0x10, 0x02, 0x12, 0x0b, - 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x10, 0x03, 0x32, 0xa3, 0x02, 0x0a, 0x0b, - 0x4b, 0x6d, 0x73, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x14, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x64, 0x65, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, - 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x18, - 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, - 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x16, +var File_proto_kms_proto protoreflect.FileDescriptor + +var file_proto_kms_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x03, 0x6b, 0x6d, 0x73, 0x22, 0x53, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, + 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x65, 0x72, 0x6b, 0x6c, + 0x65, 0x5f, 0x70, 0x61, 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x50, 0x61, + 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x98, 0x01, 0x0a, 0x11, + 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, + 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, + 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, + 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x79, 0x0a, 0x12, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, + 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, + 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, + 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, + 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, + 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x76, + 0x0a, 0x14, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x65, 0x64, 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, + 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, + 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2a, 0x46, 0x0a, 0x07, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, + 0x75, 0x69, 0x6e, 0x74, 0x38, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, + 0x31, 0x36, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x10, + 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x10, 0x04, 0x32, 0xa3, + 0x02, 0x0a, 0x0b, 0x4b, 0x6d, 0x73, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x47, + 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x64, + 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x40, 0x0a, 0x09, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x18, 0x2e, 0x6b, - 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, - 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x7a, 0x61, 0x6d, 0x61, 0x2d, 0x61, 0x69, 0x2f, 0x66, 0x68, 0x65, 0x76, 0x6d, 0x2d, 0x67, 0x6f, - 0x2f, 0x6b, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x12, 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, + 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, + 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, + 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, + 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x7a, 0x61, 0x6d, 0x61, 0x2d, 0x61, 0x69, 0x2f, 0x66, 0x68, 0x65, 0x76, 0x6d, + 0x2d, 0x67, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_kms_proto_rawDescOnce sync.Once - file_kms_proto_rawDescData = file_kms_proto_rawDesc + file_proto_kms_proto_rawDescOnce sync.Once + file_proto_kms_proto_rawDescData = file_proto_kms_proto_rawDesc ) -func file_kms_proto_rawDescGZIP() []byte { - file_kms_proto_rawDescOnce.Do(func() { - file_kms_proto_rawDescData = protoimpl.X.CompressGZIP(file_kms_proto_rawDescData) +func file_proto_kms_proto_rawDescGZIP() []byte { + file_proto_kms_proto_rawDescOnce.Do(func() { + file_proto_kms_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_kms_proto_rawDescData) }) - return file_kms_proto_rawDescData + return file_proto_kms_proto_rawDescData } -var file_kms_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_kms_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_kms_proto_goTypes = []interface{}{ +var file_proto_kms_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_kms_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_proto_kms_proto_goTypes = []interface{}{ (FheType)(0), // 0: kms.FheType (*Proof)(nil), // 1: kms.Proof (*DecryptionRequest)(nil), // 2: kms.DecryptionRequest @@ -481,7 +484,7 @@ var file_kms_proto_goTypes = []interface{}{ (*ReencryptionRequest)(nil), // 4: kms.ReencryptionRequest (*ReencryptionResponse)(nil), // 5: kms.ReencryptionResponse } -var file_kms_proto_depIdxs = []int32{ +var file_proto_kms_proto_depIdxs = []int32{ 0, // 0: kms.DecryptionRequest.fhe_type:type_name -> kms.FheType 1, // 1: kms.DecryptionRequest.proof:type_name -> kms.Proof 0, // 2: kms.DecryptionResponse.fhe_type:type_name -> kms.FheType @@ -503,13 +506,13 @@ var file_kms_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_kms_proto_init() } -func file_kms_proto_init() { - if File_kms_proto != nil { +func init() { file_proto_kms_proto_init() } +func file_proto_kms_proto_init() { + if File_proto_kms_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_kms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_proto_kms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Proof); i { case 0: return &v.state @@ -521,7 +524,7 @@ func file_kms_proto_init() { return nil } } - file_kms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_proto_kms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DecryptionRequest); i { case 0: return &v.state @@ -533,7 +536,7 @@ func file_kms_proto_init() { return nil } } - file_kms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_proto_kms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DecryptionResponse); i { case 0: return &v.state @@ -545,7 +548,7 @@ func file_kms_proto_init() { return nil } } - file_kms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_proto_kms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReencryptionRequest); i { case 0: return &v.state @@ -557,7 +560,7 @@ func file_kms_proto_init() { return nil } } - file_kms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_proto_kms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReencryptionResponse); i { case 0: return &v.state @@ -574,19 +577,19 @@ func file_kms_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_kms_proto_rawDesc, + RawDescriptor: file_proto_kms_proto_rawDesc, NumEnums: 1, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_kms_proto_goTypes, - DependencyIndexes: file_kms_proto_depIdxs, - EnumInfos: file_kms_proto_enumTypes, - MessageInfos: file_kms_proto_msgTypes, + GoTypes: file_proto_kms_proto_goTypes, + DependencyIndexes: file_proto_kms_proto_depIdxs, + EnumInfos: file_proto_kms_proto_enumTypes, + MessageInfos: file_proto_kms_proto_msgTypes, }.Build() - File_kms_proto = out.File - file_kms_proto_rawDesc = nil - file_kms_proto_goTypes = nil - file_kms_proto_depIdxs = nil + File_proto_kms_proto = out.File + file_proto_kms_proto_rawDesc = nil + file_proto_kms_proto_goTypes = nil + file_proto_kms_proto_depIdxs = nil } diff --git a/kms/kms_grpc.pb.go b/kms/kms_grpc.pb.go index f832c06..3072cf4 100644 --- a/kms/kms_grpc.pb.go +++ b/kms/kms_grpc.pb.go @@ -1,15 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 -// source: kms.proto +// - protoc v4.25.2 +// source: proto/kms.proto package kms import ( context "context" - "os" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -20,9 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -// URL of the KMS gRPC endpoint -var KmsEndpointAddr = os.Getenv("KMS_ENDPOINT_ADDR") - const ( KmsEndpoint_ValidateAndDecrypt_FullMethodName = "/kms.KmsEndpoint/Validate_and_decrypt" KmsEndpoint_ValidateAndReencrypt_FullMethodName = "/kms.KmsEndpoint/Validate_and_reencrypt" @@ -221,5 +216,5 @@ var KmsEndpoint_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "kms.proto", + Metadata: "proto/kms.proto", } diff --git a/proto/kms.proto b/proto/kms.proto index fe2cc7a..79a8ce1 100644 --- a/proto/kms.proto +++ b/proto/kms.proto @@ -15,6 +15,7 @@ enum FheType { Euint8 = 1; Euint16 = 2; Euint32 = 3; + Euint64 = 4; } message Proof { @@ -32,7 +33,7 @@ message DecryptionRequest { message DecryptionResponse { bytes signature = 1; FheType fhe_type = 2; - uint32 plaintext = 3; + uint64 plaintext = 3; } message ReencryptionRequest { From 729801ab69828964329a8f62f6479ae11f9dc10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 11:18:26 +0100 Subject: [PATCH 3/8] fix: fix protobug and update README with the correct command --- README.md | 10 +- kms/kms.pb.go | 230 ++++++++++++++++++++++----------------------- kms/kms_grpc.pb.go | 4 +- 3 files changed, 125 insertions(+), 119 deletions(-) diff --git a/README.md b/README.md index 54bf15f..b1f64f1 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,17 @@ **fhEVM-go** is an open-source library used to easily integrate the [fhEVM](https://docs.zama.ai/fhevm) into an EVM-compatible blockchain. - ## Main features fhEVM-go gives your EVM the ability to compute on encrypted data using fully homomorphic encryption by: + - a collection of operations on encrypted data via precompiled contracts - various additional EVM components that support encrypted computation - ## Getting started In order to use the library, you need to clone the repository and build it. This is required because the library depends on the `tfhe-rs` library that needs to be built from source (for now), and Go doesn't support such a build. + ```bash $ git clone https://github.com/zama-ai/fhevm-go $ cd fhevm-go @@ -38,6 +38,7 @@ $ make build ``` That's it! You can now use it in your project by adding it to `go.mod`, and adding a `replace` to point to your local build. An example using `fhevm-go` v1.0.0: + ``` ... require( @@ -57,6 +58,11 @@ replace( > [!NOTE] > The replace in necessary for now as Go build system can't build the `tfhe-rs` library that `fhevm-go` needs. It's therefore necessary that we build it manually as mentioned above, then point to our ready-to-use directory in `go.mod`. +## Regenerate protobuff files + +To re-generate this file, install `protoc` and run protoc +`cd proto && protoc --go_out=../kms --go_opt=paths=source_relative --go-grpc_out=../kms --go-grpc_opt=paths=source_relative kms.proto && cd ..`. + ## Documentation Full, comprehensive documentation is available at [https://docs.zama.ai/fhevm-go](https://docs.zama.ai/fhevm-go). diff --git a/kms/kms.pb.go b/kms/kms.pb.go index 5bd0015..6c467ce 100644 --- a/kms/kms.pb.go +++ b/kms/kms.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.25.2 -// source: proto/kms.proto +// source: kms.proto package kms @@ -59,11 +59,11 @@ func (x FheType) String() string { } func (FheType) Descriptor() protoreflect.EnumDescriptor { - return file_proto_kms_proto_enumTypes[0].Descriptor() + return file_kms_proto_enumTypes[0].Descriptor() } func (FheType) Type() protoreflect.EnumType { - return &file_proto_kms_proto_enumTypes[0] + return &file_kms_proto_enumTypes[0] } func (x FheType) Number() protoreflect.EnumNumber { @@ -72,7 +72,7 @@ func (x FheType) Number() protoreflect.EnumNumber { // Deprecated: Use FheType.Descriptor instead. func (FheType) EnumDescriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{0} + return file_kms_proto_rawDescGZIP(), []int{0} } type Proof struct { @@ -87,7 +87,7 @@ type Proof struct { func (x *Proof) Reset() { *x = Proof{} if protoimpl.UnsafeEnabled { - mi := &file_proto_kms_proto_msgTypes[0] + mi := &file_kms_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100,7 +100,7 @@ func (x *Proof) String() string { func (*Proof) ProtoMessage() {} func (x *Proof) ProtoReflect() protoreflect.Message { - mi := &file_proto_kms_proto_msgTypes[0] + mi := &file_kms_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113,7 +113,7 @@ func (x *Proof) ProtoReflect() protoreflect.Message { // Deprecated: Use Proof.ProtoReflect.Descriptor instead. func (*Proof) Descriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{0} + return file_kms_proto_rawDescGZIP(), []int{0} } func (x *Proof) GetHeight() uint32 { @@ -144,7 +144,7 @@ type DecryptionRequest struct { func (x *DecryptionRequest) Reset() { *x = DecryptionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_kms_proto_msgTypes[1] + mi := &file_kms_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -157,7 +157,7 @@ func (x *DecryptionRequest) String() string { func (*DecryptionRequest) ProtoMessage() {} func (x *DecryptionRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_kms_proto_msgTypes[1] + mi := &file_kms_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -170,7 +170,7 @@ func (x *DecryptionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DecryptionRequest.ProtoReflect.Descriptor instead. func (*DecryptionRequest) Descriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{1} + return file_kms_proto_rawDescGZIP(), []int{1} } func (x *DecryptionRequest) GetFheType() FheType { @@ -214,7 +214,7 @@ type DecryptionResponse struct { func (x *DecryptionResponse) Reset() { *x = DecryptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_kms_proto_msgTypes[2] + mi := &file_kms_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -227,7 +227,7 @@ func (x *DecryptionResponse) String() string { func (*DecryptionResponse) ProtoMessage() {} func (x *DecryptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_kms_proto_msgTypes[2] + mi := &file_kms_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -240,7 +240,7 @@ func (x *DecryptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DecryptionResponse.ProtoReflect.Descriptor instead. func (*DecryptionResponse) Descriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{2} + return file_kms_proto_rawDescGZIP(), []int{2} } func (x *DecryptionResponse) GetSignature() []byte { @@ -278,7 +278,7 @@ type ReencryptionRequest struct { func (x *ReencryptionRequest) Reset() { *x = ReencryptionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_kms_proto_msgTypes[3] + mi := &file_kms_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -291,7 +291,7 @@ func (x *ReencryptionRequest) String() string { func (*ReencryptionRequest) ProtoMessage() {} func (x *ReencryptionRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_kms_proto_msgTypes[3] + mi := &file_kms_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -304,7 +304,7 @@ func (x *ReencryptionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReencryptionRequest.ProtoReflect.Descriptor instead. func (*ReencryptionRequest) Descriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{3} + return file_kms_proto_rawDescGZIP(), []int{3} } func (x *ReencryptionRequest) GetFheType() FheType { @@ -347,7 +347,7 @@ type ReencryptionResponse struct { func (x *ReencryptionResponse) Reset() { *x = ReencryptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_kms_proto_msgTypes[4] + mi := &file_kms_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -360,7 +360,7 @@ func (x *ReencryptionResponse) String() string { func (*ReencryptionResponse) ProtoMessage() {} func (x *ReencryptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_kms_proto_msgTypes[4] + mi := &file_kms_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -373,7 +373,7 @@ func (x *ReencryptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReencryptionResponse.ProtoReflect.Descriptor instead. func (*ReencryptionResponse) Descriptor() ([]byte, []int) { - return file_proto_kms_proto_rawDescGZIP(), []int{4} + return file_kms_proto_rawDescGZIP(), []int{4} } func (x *ReencryptionResponse) GetReencryptedCiphertext() []byte { @@ -390,93 +390,93 @@ func (x *ReencryptionResponse) GetFheType() FheType { return FheType_Bool } -var File_proto_kms_proto protoreflect.FileDescriptor - -var file_proto_kms_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x03, 0x6b, 0x6d, 0x73, 0x22, 0x53, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, - 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x65, 0x72, 0x6b, 0x6c, - 0x65, 0x5f, 0x70, 0x61, 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x50, 0x61, - 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x98, 0x01, 0x0a, 0x11, - 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, - 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, - 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, - 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x79, 0x0a, 0x12, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, - 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, - 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, - 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, - 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x76, - 0x0a, 0x14, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x65, 0x64, 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, - 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, - 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2a, 0x46, 0x0a, 0x07, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, - 0x75, 0x69, 0x6e, 0x74, 0x38, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, - 0x31, 0x36, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x10, - 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x10, 0x04, 0x32, 0xa3, - 0x02, 0x0a, 0x0b, 0x4b, 0x6d, 0x73, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x47, - 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x64, - 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, - 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x12, 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, +var File_kms_proto protoreflect.FileDescriptor + +var file_kms_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x6b, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6b, 0x6d, 0x73, + 0x22, 0x53, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x72, + 0x69, 0x63, 0x69, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x13, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x72, 0x69, 0x63, 0x69, 0x61, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x98, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, + 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, + 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, + 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, + 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, + 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x22, 0x79, 0x0a, 0x12, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x13, + 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x46, 0x68, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, + 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x76, 0x0a, 0x14, 0x52, 0x65, 0x65, 0x6e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x35, 0x0a, 0x16, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, + 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x15, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x43, 0x69, 0x70, + 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x66, 0x68, 0x65, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, + 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x66, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x2a, 0x46, 0x0a, 0x07, 0x46, 0x68, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x42, + 0x6f, 0x6f, 0x6c, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x38, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x31, 0x36, 0x10, 0x02, 0x12, 0x0b, + 0x0a, 0x07, 0x45, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x45, + 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x10, 0x04, 0x32, 0xa3, 0x02, 0x0a, 0x0b, 0x4b, 0x6d, 0x73, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x64, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, + 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, + 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4d, 0x0a, 0x16, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, + 0x64, 0x5f, 0x72, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, - 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, - 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, - 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x7a, 0x61, 0x6d, 0x61, 0x2d, 0x61, 0x69, 0x2f, 0x66, 0x68, 0x65, 0x76, 0x6d, - 0x2d, 0x67, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3a, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x6b, 0x6d, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, + 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x18, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, + 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6b, 0x6d, 0x73, 0x2e, 0x52, 0x65, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x21, + 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x7a, 0x61, 0x6d, + 0x61, 0x2d, 0x61, 0x69, 0x2f, 0x66, 0x68, 0x65, 0x76, 0x6d, 0x2d, 0x67, 0x6f, 0x2f, 0x6b, 0x6d, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_proto_kms_proto_rawDescOnce sync.Once - file_proto_kms_proto_rawDescData = file_proto_kms_proto_rawDesc + file_kms_proto_rawDescOnce sync.Once + file_kms_proto_rawDescData = file_kms_proto_rawDesc ) -func file_proto_kms_proto_rawDescGZIP() []byte { - file_proto_kms_proto_rawDescOnce.Do(func() { - file_proto_kms_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_kms_proto_rawDescData) +func file_kms_proto_rawDescGZIP() []byte { + file_kms_proto_rawDescOnce.Do(func() { + file_kms_proto_rawDescData = protoimpl.X.CompressGZIP(file_kms_proto_rawDescData) }) - return file_proto_kms_proto_rawDescData + return file_kms_proto_rawDescData } -var file_proto_kms_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_kms_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_proto_kms_proto_goTypes = []interface{}{ +var file_kms_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_kms_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_kms_proto_goTypes = []interface{}{ (FheType)(0), // 0: kms.FheType (*Proof)(nil), // 1: kms.Proof (*DecryptionRequest)(nil), // 2: kms.DecryptionRequest @@ -484,7 +484,7 @@ var file_proto_kms_proto_goTypes = []interface{}{ (*ReencryptionRequest)(nil), // 4: kms.ReencryptionRequest (*ReencryptionResponse)(nil), // 5: kms.ReencryptionResponse } -var file_proto_kms_proto_depIdxs = []int32{ +var file_kms_proto_depIdxs = []int32{ 0, // 0: kms.DecryptionRequest.fhe_type:type_name -> kms.FheType 1, // 1: kms.DecryptionRequest.proof:type_name -> kms.Proof 0, // 2: kms.DecryptionResponse.fhe_type:type_name -> kms.FheType @@ -506,13 +506,13 @@ var file_proto_kms_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_proto_kms_proto_init() } -func file_proto_kms_proto_init() { - if File_proto_kms_proto != nil { +func init() { file_kms_proto_init() } +func file_kms_proto_init() { + if File_kms_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_proto_kms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_kms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Proof); i { case 0: return &v.state @@ -524,7 +524,7 @@ func file_proto_kms_proto_init() { return nil } } - file_proto_kms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_kms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DecryptionRequest); i { case 0: return &v.state @@ -536,7 +536,7 @@ func file_proto_kms_proto_init() { return nil } } - file_proto_kms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_kms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DecryptionResponse); i { case 0: return &v.state @@ -548,7 +548,7 @@ func file_proto_kms_proto_init() { return nil } } - file_proto_kms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_kms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReencryptionRequest); i { case 0: return &v.state @@ -560,7 +560,7 @@ func file_proto_kms_proto_init() { return nil } } - file_proto_kms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_kms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReencryptionResponse); i { case 0: return &v.state @@ -577,19 +577,19 @@ func file_proto_kms_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_kms_proto_rawDesc, + RawDescriptor: file_kms_proto_rawDesc, NumEnums: 1, NumMessages: 5, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_kms_proto_goTypes, - DependencyIndexes: file_proto_kms_proto_depIdxs, - EnumInfos: file_proto_kms_proto_enumTypes, - MessageInfos: file_proto_kms_proto_msgTypes, + GoTypes: file_kms_proto_goTypes, + DependencyIndexes: file_kms_proto_depIdxs, + EnumInfos: file_kms_proto_enumTypes, + MessageInfos: file_kms_proto_msgTypes, }.Build() - File_proto_kms_proto = out.File - file_proto_kms_proto_rawDesc = nil - file_proto_kms_proto_goTypes = nil - file_proto_kms_proto_depIdxs = nil + File_kms_proto = out.File + file_kms_proto_rawDesc = nil + file_kms_proto_goTypes = nil + file_kms_proto_depIdxs = nil } diff --git a/kms/kms_grpc.pb.go b/kms/kms_grpc.pb.go index 3072cf4..fa5c1f5 100644 --- a/kms/kms_grpc.pb.go +++ b/kms/kms_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.3.0 // - protoc v4.25.2 -// source: proto/kms.proto +// source: kms.proto package kms @@ -216,5 +216,5 @@ var KmsEndpoint_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "proto/kms.proto", + Metadata: "kms.proto", } From 8ad0c4730b380cca54c42a39f2da8339f6d4b552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 11:19:45 +0100 Subject: [PATCH 4/8] fix: add all needed packages --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1f64f1..4cdf2a1 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ replace( ## Regenerate protobuff files -To re-generate this file, install `protoc` and run protoc +To re-generate these files, install `protoc`, `protoc-gen-go` and `protoc-gen-go-grpc` and run protoc `cd proto && protoc --go_out=../kms --go_opt=paths=source_relative --go-grpc_out=../kms --go-grpc_opt=paths=source_relative kms.proto && cd ..`. ## Documentation From ad019f0e5aeca668e2d9244776c01fc791fd61a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 11:36:45 +0100 Subject: [PATCH 5/8] fix: move KmsEndpointAddr to precompiles to avoid touching generated files --- fhevm/precompiles.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fhevm/precompiles.go b/fhevm/precompiles.go index 483af34..e6bb4ba 100644 --- a/fhevm/precompiles.go +++ b/fhevm/precompiles.go @@ -10,6 +10,7 @@ import ( "fmt" "math/big" "math/bits" + "os" "time" "github.com/ethereum/go-ethereum/common" @@ -30,7 +31,8 @@ type PrecompiledContract interface { RequiredGas(environment *EVMEnvironment, input []byte) uint64 // RequiredGas calculates the contract gas use Run(environment *EVMEnvironment, caller common.Address, addr common.Address, input []byte, readOnly bool) (ret []byte, err error) } - +// URL of the KMS gRPC endpoint +var KmsEndpointAddr = os.Getenv("KMS_ENDPOINT_ADDR") var signatureFheAdd = makeKeccakSignature("fheAdd(uint256,uint256,bytes1)") var signatureCast = makeKeccakSignature("cast(uint256,bytes1)") var signatureDecrypt = makeKeccakSignature("decrypt(uint256)") @@ -2118,7 +2120,7 @@ func reencryptRun(environment EVMEnvironment, caller common.Address, addr common Proof: proof, } - conn, err := grpc.Dial(kms.KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, errors.New("kms unreachable") } @@ -2247,7 +2249,7 @@ func decryptValue(environment EVMEnvironment, ct *tfheCiphertext) (uint64, error Proof: proof, } - conn, err := grpc.Dial(kms.KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return 0, errors.New("kms unreachable") } From 793dcb3ae854bd1742060f741d71a9eb9e6430a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 13:35:36 +0100 Subject: [PATCH 6/8] fix: add missing type for decrypt --- fhevm/precompiles.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fhevm/precompiles.go b/fhevm/precompiles.go index e6bb4ba..b395c2b 100644 --- a/fhevm/precompiles.go +++ b/fhevm/precompiles.go @@ -2234,6 +2234,8 @@ func decryptValue(environment EVMEnvironment, ct *tfheCiphertext) (uint64, error fheType = kms.FheType_Euint16 case FheUint32: fheType = kms.FheType_Euint32 + case FheUint64: + fheType = kms.FheType_Euint64 } // TODO: generate merkle proof for some data From 0c8a3f24bd2c63f7f3a640a1c5c5530ce1cb963a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 13:39:49 +0100 Subject: [PATCH 7/8] fix: moving constant KmsEndpointAddr --- fhevm/precompiles.go | 6 ++---- kms/constants.go | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 kms/constants.go diff --git a/fhevm/precompiles.go b/fhevm/precompiles.go index b395c2b..ac4892e 100644 --- a/fhevm/precompiles.go +++ b/fhevm/precompiles.go @@ -10,7 +10,6 @@ import ( "fmt" "math/big" "math/bits" - "os" "time" "github.com/ethereum/go-ethereum/common" @@ -32,7 +31,6 @@ type PrecompiledContract interface { Run(environment *EVMEnvironment, caller common.Address, addr common.Address, input []byte, readOnly bool) (ret []byte, err error) } // URL of the KMS gRPC endpoint -var KmsEndpointAddr = os.Getenv("KMS_ENDPOINT_ADDR") var signatureFheAdd = makeKeccakSignature("fheAdd(uint256,uint256,bytes1)") var signatureCast = makeKeccakSignature("cast(uint256,bytes1)") var signatureDecrypt = makeKeccakSignature("decrypt(uint256)") @@ -2120,7 +2118,7 @@ func reencryptRun(environment EVMEnvironment, caller common.Address, addr common Proof: proof, } - conn, err := grpc.Dial(KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(kms.KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, errors.New("kms unreachable") } @@ -2251,7 +2249,7 @@ func decryptValue(environment EVMEnvironment, ct *tfheCiphertext) (uint64, error Proof: proof, } - conn, err := grpc.Dial(KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial(kms.KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return 0, errors.New("kms unreachable") } diff --git a/kms/constants.go b/kms/constants.go new file mode 100644 index 0000000..108414e --- /dev/null +++ b/kms/constants.go @@ -0,0 +1,6 @@ +package kms + +import "os" + +// URL of the KMS gRPC endpoint +var KmsEndpointAddr = os.Getenv("KMS_ENDPOINT_ADDR") \ No newline at end of file From 5b8f2dd04c1cbaa9c2513260750190949e8a8ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 8 Feb 2024 16:54:51 +0100 Subject: [PATCH 8/8] fix: remove useless comment --- fhevm/precompiles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhevm/precompiles.go b/fhevm/precompiles.go index ac4892e..b7762f8 100644 --- a/fhevm/precompiles.go +++ b/fhevm/precompiles.go @@ -30,7 +30,7 @@ type PrecompiledContract interface { RequiredGas(environment *EVMEnvironment, input []byte) uint64 // RequiredGas calculates the contract gas use Run(environment *EVMEnvironment, caller common.Address, addr common.Address, input []byte, readOnly bool) (ret []byte, err error) } -// URL of the KMS gRPC endpoint + var signatureFheAdd = makeKeccakSignature("fheAdd(uint256,uint256,bytes1)") var signatureCast = makeKeccakSignature("cast(uint256,bytes1)") var signatureDecrypt = makeKeccakSignature("decrypt(uint256)")