Skip to content

Commit

Permalink
rename to fhevm-go, add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
tremblaythibaultl committed Sep 15, 2023
1 parent 14d4271 commit d80371f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
24 changes: 24 additions & 0 deletions fhevm/evm.go
Original file line number Diff line number Diff line change
@@ -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...))
}
2 changes: 1 addition & 1 deletion fhevm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions fhevm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/zama-ai/fhevm
module github.com/zama-ai/fhevm-go

go 1.20

Expand All @@ -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
)

0 comments on commit d80371f

Please sign in to comment.