Skip to content

Commit

Permalink
Support EVMC_DELEGATED in go bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Sep 19, 2024
1 parent b13e713 commit 4f617bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,17 @@ type Result struct {
}

func (vm *VM) Execute(ctx HostContext, rev Revision,
kind CallKind, static bool, depth int, gas int64,
kind CallKind, static bool, delegated bool, depth int, gas int64,
recipient Address, sender Address, input []byte, value Hash,
code []byte) (res Result, err error) {

flags := C.uint32_t(0)
if static {
flags |= C.EVMC_STATIC
}
if delegated {
flags |= C.EVMC_DELEGATED
}

ctxId := addHostContext(ctx)
// FIXME: Clarify passing by pointer vs passing by value.
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/evmc/evmc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestExecuteEmptyCode(t *testing.T) {

addr := Address{}
h := Hash{}
result, err := vm.Execute(nil, Byzantium, Call, false, 1, 999, addr, addr, nil, h, nil)
result, err := vm.Execute(nil, Byzantium, Call, false, false, 1, 999, addr, addr, nil, h, nil)

if !bytes.Equal(result.Output, []byte("")) {
t.Errorf("execution unexpected output: %x", result.Output)
Expand Down
4 changes: 2 additions & 2 deletions bindings/go/evmc/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestGetBlockNumberFromTxContext(t *testing.T) {
host := &testHostContext{}
addr := Address{}
h := Hash{}
result, err := vm.Execute(host, Byzantium, Call, false, 1, 100, addr, addr, nil, h, code)
result, err := vm.Execute(host, Byzantium, Call, false, false, 1, 100, addr, addr, nil, h, code)
output := result.Output
gasLeft := result.GasLeft

Expand Down Expand Up @@ -121,7 +121,7 @@ func TestCall(t *testing.T) {
host := &testHostContext{}
addr := Address{}
h := Hash{}
result, err := vm.Execute(host, Byzantium, Call, false, 1, 100, addr, addr, nil, h, code)
result, err := vm.Execute(host, Byzantium, Call, false, false, 1, 100, addr, addr, nil, h, code)
output := result.Output
gasLeft := result.GasLeft

Expand Down

0 comments on commit 4f617bb

Please sign in to comment.