onflow / onflow/flow-core-contracts
Add descriptive Error messages to the Crypto contract algorithm constructors
@joshuahannan is already working on this.
Since Dec 1, 2025.
- Dominant language
- Cadence
- Stars
- 93
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Issue to be solved
The Crypto contract's functions to construct a signature algorithm and hash algorithm current return nil if an invalid input is provided. This is definitely good to have, but additionally, it would be nice to have additional constructors that panic with a helpful error message so users can easily see what has gone wrong. An attempt at an error message like this is included here but it would make much more sense for this to be in the Crypto contract so we can have a standard format and not have to hard code the error message in transactions.
Suggested Solution
- Include new constructors for HashAlgorithm and SignatureAlgorithm that panic with a helpful error message like what was linked above if invalid inputs were provided.
- Constructors like this might also be useful for other types in the Crypto contract
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.