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

tests(core): add tests for Ed25519 Evolution Node key derivation #221

Merged
merged 4 commits into from
Jul 20, 2023

Conversation

HashEngineering
Copy link
Collaborator

@HashEngineering HashEngineering commented Jul 17, 2023

Issue being fixed or feature implemented

What was done?

  • Add unit tests
  • Add reset function

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@HashEngineering HashEngineering self-assigned this Jul 17, 2023
Comment on lines +127 to +131
IDeterministicKey first = masterKey.deriveChildKey(ChildNumber.NINE_HARDENED);
IDeterministicKey second = first.deriveChildKey(ChildNumber.FIVE_HARDENED);
IDeterministicKey third = second.deriveChildKey(new ChildNumber(3, true));
IDeterministicKey fourth = third.deriveChildKey(new ChildNumber(4, true));
IDeterministicKey fifth = fourth.deriveChildKey(new ChildNumber(0, true));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here derivation is done manually.

IDeterministicKey votingKey = mnext.getKeyChain(AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING).getKey(0);
IDeterministicKey ownerKey = mnext.getKeyChain(AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER).getKey(0);
IDeterministicKey operatorKey = mnext.getKeyChain(AuthenticationKeyChain.KeyChainType.MASTERNODE_OPERATOR).getKey(0);
IDeterministicKey platformKey = mnext.getKeyChain(AuthenticationKeyChain.KeyChainType.MASTERNODE_PLATFORM_OPERATOR).getKey(0, true);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, the key derivation is handled by the AuthenticationGroupExtension object.

@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Patch coverage: 92.85% and project coverage change: +0.16% 🎉

Comparison is base (764f50f) 46.88% compared to head (ea90e36) 47.05%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #221      +/-   ##
============================================
+ Coverage     46.88%   47.05%   +0.16%     
- Complexity     6431     6467      +36     
============================================
  Files           408      408              
  Lines         45882    45906      +24     
  Branches       6482     6485       +3     
============================================
+ Hits          21512    21599      +87     
+ Misses        21988    21930      -58     
+ Partials       2382     2377       -5     
Files Changed Coverage Δ
...ava/org/bitcoinj/wallet/DerivationPathFactory.java 76.47% <80.00%> (-0.53%) ⬇️
...t/authentication/AuthenticationGroupExtension.java 49.04% <94.11%> (+11.67%) ⬆️
...tcoinj/crypto/ed25519/Ed25519DeterministicKey.java 42.80% <100.00%> (+1.17%) ⬆️

... and 17 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

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

Looks good

@HashEngineering HashEngineering merged commit bf38a9e into master Jul 20, 2023
7 checks passed
@HashEngineering HashEngineering deleted the bugfix-masternode-keys-tests branch August 18, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants