diff --git a/fhevm/evm.go b/fhevm/evm.go index 48a3bc6..fd8d306 100644 --- a/fhevm/evm.go +++ b/fhevm/evm.go @@ -1,8 +1,32 @@ package fhevm +import "fmt" + // A Logger interface for the EVM. type Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) Error(msg string, keyvals ...interface{}) } + +// A default Logger implementation that logs to stdout. +type DefaultLogger struct{} + +func toString(keyvals ...interface{}) (ret string) { + for _, element := range keyvals { + ret += fmt.Sprintf("%v", element) + " " + } + return +} + +func (*DefaultLogger) Debug(msg string, keyvals ...interface{}) { + fmt.Println("Debug: "+msg, toString(keyvals...)) +} + +func (*DefaultLogger) Info(msg string, keyvals ...interface{}) { + fmt.Println("Info: "+msg, toString(keyvals...)) +} + +func (*DefaultLogger) Error(msg string, keyvals ...interface{}) { + fmt.Println("Error: "+msg, toString(keyvals...)) +} diff --git a/fhevm/instructions.go b/fhevm/instructions.go index 6d6f69f..af4ff95 100644 --- a/fhevm/instructions.go +++ b/fhevm/instructions.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/holiman/uint256" - "github.com/zama-ai/fhevm/crypto" + "github.com/zama-ai/fhevm-go/crypto" ) // A list of slots that we consider reserved in protected storage. diff --git a/fhevm/interface.go b/fhevm/interface.go index 6018672..abbd170 100644 --- a/fhevm/interface.go +++ b/fhevm/interface.go @@ -15,12 +15,12 @@ type EVMEnvironment interface { // EVM Logger GetLogger() Logger - // TODO: clarify the meaning of those names + // TODO: clarify meaning of the following IsCommitting() bool IsEthCall() bool IsReadOnly() bool - GetFhevmData() FhevmData + GetFhevmData() *FhevmData } type FhevmData struct { diff --git a/go.mod b/go.mod index 7840e63..d3268b6 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/zama-ai/fhevm +module github.com/zama-ai/fhevm-go go 1.20 @@ -7,7 +7,7 @@ require github.com/ethereum/go-ethereum v1.13.0 require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/holiman/uint256 v1.2.3 // indirect + github.com/holiman/uint256 v1.2.3 golang.org/x/crypto v0.13.0 // indirect golang.org/x/sys v0.12.0 // indirect )