Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
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() -> reasonCode: if self.isAuthorized[msg.sender]: return 0x11 # OR return Reason(permission.ALLOWED) # in this case, just a byte return 0x10 # OR return Reason(permission.DISALLOWED) # in this case, just a byte @public def make_changes(_delegate: address): if not self.isAuthorized[msg.sender]: # reverts and emits `Reason` event raise 0x10 # OR raise Reason(permission.DISALLOWED) 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
@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.