Open skeletor-spaceman opened 2 years ago
meeting notes: punt for now as testing frameworks can use other means of error detection. implement if some production smart contracts require handling or issuing of specific custom errors.
idea for how we can export for debugging:
# example: x, y and z are local variables
if x > 10:
raise # @error My Custom Error, @trace x,y
# no runtime reason, tooling should print something like "My Custom Error, x = 11, y = ..."
Here's a use-case where production smart contracts require issuing of specific custom errors: https://eips.ethereum.org/EIPS/eip-3668
Contracts wishing to support lookup of data from external sources may, instead of returning the data directly, revert using
OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData)
. Clients supporting this specification then make an RPC call to a URL fromurls
, supplyingcallData
, and getting back an opaque byte stringresponse
. Finally, clients call the function specified bycallbackFunction
on the contract, providingresponse
andextraData
. The contract can then decode and verify the returned data using an implementation-specific method.
raw_revert as implemented in https://github.com/vyperlang/vyper/pull/3136 should address this particular use case
We should consider adding custom errors to .vyi
files since they are already part of some EIPs: https://eips.ethereum.org/EIPS/eip-6093.
custom errors is basically a requirement now
Version Information
vyper --version
): 0.3.3python --version
): 3.8What's your issue about?
I want to mimic the behavior of custom errors in solidity: https://blog.soliditylang.org/2021/04/21/custom-errors/ Right now I'm just trying to
raise
an error without parameters, adding parameters would be nice to have.Should be able to
raise
bytes4 | Bytes[4]
but encountering following errors:vyper.exceptions.TypeMismatch: Given reference has type Bytes[4], expected String[1024]
vyper.exceptions.InvalidType: Expected String[1024] but literal can only be cast as bytes4
Tried all these different options with no success: