Skip to content

Commit

Permalink
fix(): use new protobuf API version
Browse files Browse the repository at this point in the history
  • Loading branch information
tremblaythibaultl committed Dec 11, 2023
1 parent 87efb89 commit fb2cfa5
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 86 deletions.
31 changes: 21 additions & 10 deletions fhevm/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -1908,25 +1908,36 @@ func reencryptRun(environment EVMEnvironment, caller common.Address, addr common
ct := getVerifiedCiphertext(environment, common.BytesToHash(input[0:32]))
if ct != nil {
// Make sure we don't decrypt before any optimistic requires are checked.
optReqResult, optReqErr := evaluateRemainingOptimisticRequires(environment)
if optReqErr != nil {
return nil, optReqErr
} else if !optReqResult {
return nil, ErrExecutionReverted
// optReqResult, optReqErr := evaluateRemainingOptimisticRequires(environment)
// if optReqErr != nil {
// return nil, optReqErr
// } else if !optReqResult {
// return nil, ErrExecutionReverted
// }

var fheType kms.FheType
switch ct.ciphertext.fheUintType {
case FheUint8:
fheType = kms.FheType_Euint8
case FheUint16:
fheType = kms.FheType_Euint16
case FheUint32:
fheType = kms.FheType_Euint32
}

// TODO: generate merkle proof for some data (handle? ciphertext bytes?)
pubKey := input[32:64]

// TODO: generate merkle proof for some data
proof := &kms.Proof{
Height: 5,
Height: 3,
MerklePatriciaProof: []byte{},
}

pubKey := input[32:64]

reencryptionRequest := &kms.ReencryptionRequest{
FheType: fheType,
Ciphertext: ct.ciphertext.serialization,
Request: pubKey, // TODO: change according to the structure of `Request`
Proof: proof,
PublicKey: pubKey,
}

conn, err := grpc.Dial(kms.KmsEndpointAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
Expand Down
Loading

0 comments on commit fb2cfa5

Please sign in to comment.