Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
fix: move KmsEndpointAddr to precompiles to avoid touching generated …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
immortal-tofu committed Feb 8, 2024
1 parent 8ad0c47 commit ad019f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fhevm/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"math/big"
"math/bits"
"os"
"time"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -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)")
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit ad019f0

Please sign in to comment.