Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add descriptive Error messages to the Crypto contract algorithm constructors #458

Open
joshuahannan opened this issue Oct 17, 2024 · 1 comment

Comments

@joshuahannan
Copy link
Member

joshuahannan commented Oct 17, 2024

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
@turbolent
Copy link
Member

Great idea!

Related: onflow/cadence#3135. It might be easiest to first move the Crypto contract out of the Cadence codebase, and then it should be more easy to make improvements to it.

@j1010001 j1010001 transferred this issue from onflow/cadence Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants