onflow / onflow/flow-core-contracts

Add descriptive Error messages to the Crypto contract algorithm constructors

Open
#458 1 comment 1 reaction 1 assignee View on GitHub

@joshuahannan is already working on this.

Since Dec 1, 2025.

Feature Feedback
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.