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

exit_early #18

Open
wants to merge 1 commit into
base: testnet-2
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions include/hostio.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ VM_HOOK(read_return_data) size_t read_return_data(uint8_t * dest, size_t offset,
*/
VM_HOOK(write_result) void write_result(const uint8_t * data, size_t len);

/**
* Exits program execution early with the given status code.
* If `0`, the program returns successfully with any data supplied by `write_result`.
* Otherwise, the program reverts and treats any `write_result` data as revert data.
*
* The semantics are equivalent to that of the EVM's [`Return`] and [`Revert`] opcodes.
*
* [`Return`]: https://www.evm.codes/#f3
* [`Revert`]: https://www.evm.codes/#fd
*/
VM_HOOK(exit_early) void exit_early(uint32_t status);

/**
* Returns the length of the last EVM call or deployment return result, or `0` if neither have
* happened during the program's execution. The semantics are equivalent to that of the EVM's
Expand Down