From 4f617bb252159b68370673f53b95548997906d17 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Thu, 19 Sep 2024 15:11:55 +0200 Subject: [PATCH] Support EVMC_DELEGATED in go bindings --- bindings/go/evmc/evmc.go | 5 ++++- bindings/go/evmc/evmc_test.go | 2 +- bindings/go/evmc/host_test.go | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bindings/go/evmc/evmc.go b/bindings/go/evmc/evmc.go index bf6ac8912..c0817e129 100644 --- a/bindings/go/evmc/evmc.go +++ b/bindings/go/evmc/evmc.go @@ -205,7 +205,7 @@ 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) { @@ -213,6 +213,9 @@ func (vm *VM) Execute(ctx HostContext, rev Revision, if static { flags |= C.EVMC_STATIC } + if delegated { + flags |= C.EVMC_DELEGATED + } ctxId := addHostContext(ctx) // FIXME: Clarify passing by pointer vs passing by value. diff --git a/bindings/go/evmc/evmc_test.go b/bindings/go/evmc/evmc_test.go index fd6da980a..0c00772a4 100644 --- a/bindings/go/evmc/evmc_test.go +++ b/bindings/go/evmc/evmc_test.go @@ -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) diff --git a/bindings/go/evmc/host_test.go b/bindings/go/evmc/host_test.go index 11eebf3fe..7c092f854 100644 --- a/bindings/go/evmc/host_test.go +++ b/bindings/go/evmc/host_test.go @@ -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 @@ -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