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

Convert errors to coded exceptions in @solana/keys #2245

Conversation

steveluscher
Copy link
Collaborator

@steveluscher steveluscher commented Mar 4, 2024

Addresses #2118.

@steveluscher steveluscher force-pushed the 03-04-Let_the_new_coded_exceptions_from_codecs-core_bubble_up_as-is_through_solana/options_ branch from f7dd0d1 to ea29eaa Compare March 4, 2024 20:34
@steveluscher steveluscher changed the base branch from 03-04-Let_the_new_coded_exceptions_from_codecs-core_bubble_up_as-is_through_solana/options_ to 03-04-Create_coded_exceptions_for_invariant_violations March 4, 2024 20:34
@steveluscher steveluscher force-pushed the 03-04-Convert_errors_to_coded_exceptions_in_solana/keys_ branch 2 times, most recently from 877e37b to 4d0a5cd Compare March 4, 2024 20:40
Copy link
Collaborator

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keys

Copy link
Collaborator

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from one naming comment, I'm happy with this!

Comment on lines 55 to 57
export const SOLANA_ERROR__KEYS_PRIVATE_KEY_BYTE_LENGTH_OUT_OF_RANGE = 3704000 as const;
export const SOLANA_ERROR__KEYS_SIGNATURE_BYTE_LENGTH_OUT_OF_RANGE = 3704001 as const;
export const SOLANA_ERROR__KEYS_SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704002 as const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only SIGNATURE_STRING_LENGTH_OUT_OF_RANGE is a valid "out of range" errors. It feels weird to me to get SIGNATURE_BYTE_LENGTH_OUT_OF_RANGE for signature bytes. In fact, just reading this PR, I let myself thinking "What? I didn't know our signatures could be anything else than 64 bytes long". So I think we should make the following change:

Suggested change
export const SOLANA_ERROR__KEYS_PRIVATE_KEY_BYTE_LENGTH_OUT_OF_RANGE = 3704000 as const;
export const SOLANA_ERROR__KEYS_SIGNATURE_BYTE_LENGTH_OUT_OF_RANGE = 3704001 as const;
export const SOLANA_ERROR__KEYS_SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704002 as const;
export const SOLANA_ERROR__KEYS_INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704000 as const;
export const SOLANA_ERROR__KEYS_INVALID_SIGNATURE_BYTE_LENGTH = 3704001 as const;
export const SOLANA_ERROR__KEYS_SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704002 as const;

@steveluscher steveluscher force-pushed the 03-04-Create_coded_exceptions_for_invariant_violations branch from 097c92d to 1041fb6 Compare March 4, 2024 22:57
@steveluscher steveluscher force-pushed the 03-04-Convert_errors_to_coded_exceptions_in_solana/keys_ branch 2 times, most recently from 0d0495c to 70e1e81 Compare March 4, 2024 22:59
@steveluscher
Copy link
Collaborator Author

steveluscher commented Mar 4, 2024

Merge activity

  • Mar 4, 3:29 PM PST: @steveluscher started a stack merge that includes this pull request via Graphite.
  • Mar 4, 3:30 PM PST: Graphite rebased this pull request as part of a merge.
  • Mar 4, 3:31 PM PST: @steveluscher merged this pull request with Graphite.

Base automatically changed from 03-04-Create_coded_exceptions_for_invariant_violations to master March 4, 2024 23:30
@steveluscher steveluscher force-pushed the 03-04-Convert_errors_to_coded_exceptions_in_solana/keys_ branch from 70e1e81 to 1fbcafc Compare March 4, 2024 23:30
@steveluscher steveluscher merged commit e374ac6 into master Mar 4, 2024
7 checks passed
@steveluscher steveluscher deleted the 03-04-Convert_errors_to_coded_exceptions_in_solana/keys_ branch March 4, 2024 23:31
Copy link
Contributor

github-actions bot commented Mar 7, 2024

🎉 This PR is included in version 1.91.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants