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

Secp v3 keystore files bulk loading in eth1 mode #892

Merged
merged 15 commits into from
Sep 5, 2023

Conversation

usmansaleem
Copy link
Contributor

@usmansaleem usmansaleem commented Aug 29, 2023

PR Description

SECP wallet files bulk loading in eth1 mode. Introduced following cli options:

  • --keystores-path The path to a directory storing v3 wallet files. Wallet files must use a .json file extension.
  • --keystores-passwords-path The path to a directory with the corresponding password files for the wallet files. Filename must match the corresponding wallet filename but with a .txt extension. This cannot be set if --keystores-password-file is also specified.
  • --keystores-password-file The path to a file that contains the password that all wallets use. This cannot be set if --keystores-passwords-path is also specified.

Summary of code changes:

  • commandline/src/main/java/tech/pegasys/web3signer/commandline/config/PicoV3KeystoresBulkloadParameters.java
    V3 Keystores bulkloading CLI options. Implements KeystoresParameters interface which enforces same method names as BLS Bulk loading in ETH2 mode. The description for each parameter is different.
  • commandline/src/main/java/tech/pegasys/web3signer/commandline/subcommands/Eth1SubCommand.java
    Mixin and validation of cli options. Either password directory or password file can be specified (not both).
  • core/src/main/java/tech/pegasys/web3signer/core/Eth1Runner.java
    bulkLoadSigners method is modified to wire SecpWalletBulkloader.
  • signing/src/main/java/tech/pegasys/web3signer/signing/bulkloading/BlsKeystoreBulkLoader.java
    Common code has been extracted.
  • signing/src/main/java/tech/pegasys/web3signer/signing/bulkloading/SecpV3KeystoresBulkLoader.java
    Load v3 wallet files from specified directory by using either password file or corresponding password files from a directory.
  • acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl
    Added acceptance test that covers using password path (dir), password file with direct cli options and using config file.

Fixed Issue(s)

Fixes #833

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Testing

  • I thought about testing these changes in a realistic/non-local environment.

 -- Add cli options
 -- Add SecpWalletBulkLoader and test
 -- Refactor some common code from BlsBulkloader
@usmansaleem usmansaleem added the doc-change-required Indicates an issue or PR that requires doc to be updated label Aug 29, 2023
@usmansaleem usmansaleem self-assigned this Aug 29, 2023
@usmansaleem usmansaleem marked this pull request as ready for review August 30, 2023 05:33
@usmansaleem usmansaleem requested review from gfukushima, siladu and jframe and removed request for gfukushima and siladu August 30, 2023 05:34
Copy link
Contributor

@siladu siladu 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 decent summary of changes 👍


import picocli.CommandLine.Option;

public class PicoV3WalletBulkloadParameters implements KeystoresParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we want to regard wallets as a type of keystore then the CLI arg should reflect that and also be called --keystores-path. That would mean it's the mode that determines the reading of the keystore, rather than the option name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, think this should be --keystores-path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. Modified various instance variables/class names to use v3Keystores as well (instead of wallet).


final String jsonBody = healthcheckResponse.body().asString();
final int keysLoaded =
getHealthCheckKeysCheckData(jsonBody, KEYS_CHECK_V3_WALLET_BULK_LOADING, "keys-loaded");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this getHealthCheckKeysCheckData be also used in the bulk loading ATs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored other places where healthcheck was used.

final String jsonBody = healthcheckResponse.body().asString();
final int keysLoaded =
getHealthCheckKeysCheckData(jsonBody, KEYS_CHECK_V3_WALLET_BULK_LOADING, "keys-loaded");
assertThat(keysLoaded).isEqualTo(publicKeys.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

can the error count also be checked as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.


import picocli.CommandLine.Option;

public class PicoV3WalletBulkloadParameters implements KeystoresParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, think this should be --keystores-path

@usmansaleem usmansaleem changed the title Secp wallet files bulk loading in eth1 mode Secp v3 keystore files bulk loading in eth1 mode Sep 4, 2023
Copy link
Contributor

@siladu siladu left a comment

Choose a reason for hiding this comment

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

LGTM

@usmansaleem usmansaleem merged commit a8d93dd into Consensys:master Sep 5, 2023
2 checks passed
@usmansaleem usmansaleem deleted the secp_bulk branch September 5, 2023 00:30
@bgravenorst bgravenorst removed the doc-change-required Indicates an issue or PR that requires doc to be updated label Sep 5, 2023
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.

Eth secp wallet file bulk loading
4 participants