-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Description
EIP: Title: Opcode for exceptions that don't drain gas Author: Nikolai Mushegian (nikolai@nexusdev.us) Discussions-To: Status: Draft Type: Standards Track Created: Replaces: Superseded-By: Resolution:
I tried to find an existing EIP for this and couldn't. This surprises me! Please help find existing discussion.
Abstract
Right now rolling back state requires manually triggering an EVM exception (eg invalid jump), which drains all gas for the subcall. I prefer throw-oriented error handling despite all the drawbacks (no error details, drains gas) because reverting all state when something unexpected happens feels much safer.
The REVERT opcode would let you throw an exception without draining all the gas that the caller allocated to you.
Related issues:
#62
ewasm/design#43
Details
Extra things to consider
- Per Change ABI to provide a string reason for a throw in Solidity #62, it would be useful to be able to pass back a return value to be interpreted as an error when an exception is thrown. Solidity already re-throws when the stack is 0 so this backwards compatible in terms of Solidity semantics but may not be if someone has done ASM hacking where they read the "return". This is a nice-to-have, if it can't be done than a simplified version which gives you back no useful information is still much better than "deliberate invalid jump".
rainbreak, holiman, pipermerriam, VoR0220, dbrock and 4 more
Metadata
Metadata
Assignees
Labels
No labels