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

feat: Implement ECDSA key support for yahcli accounts create #17293

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mhess-swl
Copy link
Member

This PR adds a command line param to Yahcli's accounts create command, --keyType, that allows for creating accounts with either an ED25519 key (default) or an SECP256K1 ECDSA key. Its behavior should match the ED25519 case as closely as possible.

Further ECDSA support will be added in #17288.

Closes #17236

@mhess-swl mhess-swl requested review from a team as code owners January 9, 2025 18:56
@mhess-swl mhess-swl added this to the v0.59 milestone Jan 9, 2025
Signed-off-by: Matt Hess <[email protected]>
Copy link

codacy-production bot commented Jan 9, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.12% (target: -1.00%) 90.48%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (70c450e) 96090 68316 71.10%
Head commit (814de3f) 96140 (+50) 68463 (+147) 71.21% (+0.12%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#17293) 42 38 90.48%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@Nana-EC Nana-EC requested review from beeradb and natanasow January 9, 2025 19:20
Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turn around.
One note on the naming confusion were we do ecdsa logic under an ed25519 class.
Also a request for an additional test.

@@ -115,7 +115,7 @@ protected boolean submitOp(HapiSpec spec) throws Throwable {
if (immediateExportLoc.isPresent() && immediateExportPass.isPresent()) {
final var exportLoc = immediateExportLoc.get();
final var exportPass = finalPassphrase.orElse(immediateExportPass.get());
exportWithPass(spec, name, exportLoc, exportPass);
exportEd25519WithPass(spec, name, exportLoc, exportPass);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a missing test in this PR for the new EC case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yahcli doesn't have test cases, at least not in the traditional sense. Is there something specific you expected to see?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I was expecting a test that check the command work for the ECDSA case.
There would be a check for a valid account with a valid ECDSA key

Copy link
Member Author

@mhess-swl mhess-swl Jan 10, 2025

Choose a reason for hiding this comment

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

I guess I'm not sure I know what you're referring to. Yahcli doesn't have any automated tests. There are some very rudimentary shell scripts, but they look more like basic smoke tests; there are no automated tests set up to run in CI, and no suite of tests to run locally. Yahcli is written for exactly one customer (devops), and is essentially a hack that uses the existing hapi test framework; it's never been deemed worth having any automated testing. We did manually verify the new behavior in testnet, and this feature will presumably be used very soon by devops; I'm not sure how much better we can do with only one development day left.

I suppose we could write a new testing framework specifically for yahcli operations, but we definitely wouldn't be able to write it and get it set up quickly.

Are there other ideas for how we might write and run a quicker test?

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 6 lines in your changes missing coverage. Please review.

Project coverage is 67.35%. Comparing base (70c450e) to head (814de3f).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
.../com/hedera/node/app/hapi/utils/keys/KeyUtils.java 85.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #17293      +/-   ##
============================================
+ Coverage     67.24%   67.35%   +0.11%     
- Complexity    21991    22043      +52     
============================================
  Files          2583     2586       +3     
  Lines         96307    96384      +77     
  Branches      10054    10069      +15     
============================================
+ Hits          64763    64924     +161     
+ Misses        27839    27746      -93     
- Partials       3705     3714       +9     
Files with missing lines Coverage Δ
.../hedera/node/app/hapi/utils/keys/Ed25519Utils.java 100.00% <100.00%> (+6.45%) ⬆️
.../com/hedera/node/app/hapi/utils/keys/KeyUtils.java 85.00% <85.00%> (ø)

... and 30 files with indirect coverage changes

Impacted file tree graph

@mhess-swl mhess-swl requested a review from Nana-EC January 9, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ECDSA key support to yahcli
3 participants