VIP: Support for ERC 1066 aka FISSION codes aka "Revert with Reason" #1345
Fission Codes follow an HTTP Status Code-like syntax to allow smart contracts to describe exceptional conditions to other smart contracts and wider tooling in a machine- and human-readable format, that is easily localized to different spoken languages for better UX.
This will allow us to enable functionality for broader support of better UX and DX flows for smart contracts and dapps developed via the Vyper compiler.
This proposal would add a new type
@public @constant def check_authorization_status() -> Reason: if self.isAuthorized[msg.sender]: return Reason(permission.ALLOWED) # in this case, just a byte (0x11) return Reason(permission.DISALLOWED) # in this case, just a byte (0x10) @public def make_changes(_delegate: address): if not self.isAuthorized[msg.sender]: # reverts and emits `Reason` event raise Reason(permission.DISALLOWED) # Reason 0x10 self.isAuthorized[_delegate] = True
It would be nice if we could think about enum support for this
This would change the current semantics of "revert with reason string" to allow a Fission Code to be used in it's stead.
Relevant to #1342, not dependant
Copyright and related rights waived via CC0
The text was updated successfully, but these errors were encountered:
@fubuloubu I think we can perhaps have a dependent VIP that make the vyper clamps emit
On the implementation side one could have static scratch pad that would work as a lookup table, that grows as one uses Reason, the compiler would grow it larger than 32bytes if needed - but in most cases it will only be one 32byte word.