Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EVMC_DELEGATED flag #720

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ enum evmc_call_kind
/** The flags for ::evmc_message. */
enum evmc_flags
{
EVMC_STATIC = 1 /**< Static call mode. */
EVMC_STATIC = 1, /**< Static call mode. */
EVMC_DELEGATED = 2 /**< Delegated call mode (EIP-7702). Valid since Prague. */
};

/**
Expand Down