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

Improve error message for invalid public key #1665

Merged
merged 1 commit into from
May 20, 2022

Conversation

SaveTheRbtz
Copy link
Contributor

@SaveTheRbtz SaveTheRbtz commented May 20, 2022

Description

This diff improves error message in the InvalidPublicKeyError to provide information on not only what but also why public key validation failed:

before:

invalid public key: [248, 71, ..., 3, 232]

after:

invalid public key: [248, 71, ..., 3, 232], err: input has incorrect ECDSA_P256 key size

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@codecov
Copy link

codecov bot commented May 20, 2022

Codecov Report

Merging #1665 (c89326d) into master (66eac2a) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1665      +/-   ##
==========================================
- Coverage   76.50%   76.50%   -0.01%     
==========================================
  Files         291      291              
  Lines       60995    60995              
==========================================
- Hits        46666    46663       -3     
- Misses      12719    12720       +1     
- Partials     1610     1612       +2     
Flag Coverage Δ
unittests 76.50% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/interpreter/errors.go 22.11% <100.00%> (ø)
runtime/sema/checker.go 90.33% <0.00%> (-0.12%) ⬇️
runtime/sema/type.go 88.94% <0.00%> (-0.08%) ⬇️
runtime/sema/simple_type.go 96.15% <0.00%> (+3.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66eac2a...c89326d. Read the comment docs.

@turbolent
Copy link
Member

The reason why the key is invalid to the error message is definitely very helpful! Thank you for adding this

Could you please improve the title of the PR, e.g. to "Improve error message for invalid public key", and follow the checklist that was in the PR template? e.g. add a label instead of prefixing the title.
See https://github.com/onflow/cadence/blob/master/.github/pull_request_template.md

Thank you!

@turbolent
Copy link
Member

Also: Feel free to create a branch in / PR from the repo directly (It does not matter for this PR, but PRs from other repositories do not run the benchmarking / performance regression suite)

@SaveTheRbtz SaveTheRbtz changed the title chore(interpreter): improve error message Improve error message for invalid public key May 20, 2022
@turbolent turbolent removed the Chore label May 20, 2022
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice! First PR 👏 🎉

@turbolent turbolent merged commit f2d3418 into onflow:master May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants