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

EVM runtime: handle REVERT #811

Closed
raulk opened this issue Aug 26, 2022 · 3 comments
Closed

EVM runtime: handle REVERT #811

raulk opened this issue Aug 26, 2022 · 3 comments

Comments

@raulk
Copy link
Member

raulk commented Aug 26, 2022

REVERT is equivalent to an FVM abort syscall. It interrupts the callee but returns control to the caller. However, REVERT is capable of returning a payload, which Filecoin disallows in combination with a non-zero exit code (originating in an abort). Thus, supporting this as an abort may require a protocol extension. There are alternative solutions that @Stebalien will document shortly.

@vyzo
Copy link
Contributor

vyzo commented Aug 26, 2022

Possibly the simplest way to handle this is to return a struct from InvokeContract in the EvmContractActor, which includes a boolean on whether it was a revert, together with the return value.

@Stebalien
Copy link
Member

Stebalien commented Aug 26, 2022

Proposal: Replace abort with an exit syscall.

fn exit(code: u32,       // Exit code.
        value: u32,      // Block ID (return value).
        msg: *const u8,  // Optional message.
        msg_len: u32);
  • If code is non-zero, revert.
  • Always return the value where 0 identifies the "empty" value.
  • The message is optional and only for tracing (it doesn't affect consensus).

@maciejwitowski
Copy link
Contributor

REVERT implementation filecoin-project/builtin-actors#633
As per notes:

REVERT doesn't propagate return data yet; this will be fixed in a subsequent pr, as it requires fvm support for aborting with data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants