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

fix(SecretKey): remove Default implementation #845

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

rymnc
Copy link
Member

@rymnc rymnc commented Sep 30, 2024

Fixes #830

Description

Deriving Default for the SecretKey doesn't exactly make too much sense given that we don't use it anywhere in this codebase, and the fact that k256::SecretKey throws an error if the provided byte slice is 0 -

image

We could have a default impl by using rng, but we should expect consumers of this library to use their own impl, or use SecretKey::random()

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@rymnc rymnc added the breaking A breaking api change label Sep 30, 2024
@rymnc rymnc self-assigned this Sep 30, 2024
@rymnc rymnc marked this pull request as ready for review September 30, 2024 09:52
@rymnc rymnc requested a review from a team September 30, 2024 09:54
rafal-ch
rafal-ch previously approved these changes Sep 30, 2024
Copy link
Contributor

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

xgreenx
xgreenx previously approved these changes Oct 1, 2024
Copy link
Collaborator

@xgreenx xgreenx left a comment

Choose a reason for hiding this comment

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

It would be nice to add a default implementation under the test-helpers and rand features. In this case in tests we can generate them easily

@rymnc rymnc dismissed stale reviews from xgreenx and rafal-ch via 8a34cd6 October 1, 2024 07:53
@rymnc
Copy link
Member Author

rymnc commented Oct 1, 2024

It would be nice to add a default implementation under the test-helpers and rand features. In this case in tests we can generate them easily

addressed in 8a34cd6

@rymnc rymnc requested review from xgreenx and rafal-ch October 1, 2024 07:55
@rymnc rymnc enabled auto-merge October 1, 2024 08:17
@rymnc rymnc added this pull request to the merge queue Oct 1, 2024
Merged via the queue into master with commit 7184653 Oct 1, 2024
39 checks passed
@rymnc rymnc deleted the fix/remove-default-impl-for-secret-key branch October 1, 2024 14:23
@xgreenx xgreenx mentioned this pull request Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SecretKey::default is an invalid secret key
3 participants