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

RPC client create_validator uses the configuration as input #3226

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rpc-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ enum Command {

/// Shows and modifies validator information.
/// Create, signs and send transactions referring to the local validator.
/// These operations only work if the current client is configured as a validator.
#[clap(flatten)]
Validator(ValidatorCommand),

Expand Down
21 changes: 7 additions & 14 deletions rpc-client/src/subcommands/validator_subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ pub enum ValidatorCommand {
/// Returns the voting key of the local validator.
ValidatorVotingKey {},

/// Sends a `new_validator` transaction to the network. You need to provide the address of a basic
/// Sends a transaction to the network to create this validator. You need to provide the address of a basic
/// account (the sender wallet) to pay the transaction fee and the validator deposit. The sender wallet must be unlocked
/// prior to this command.
/// The sender_wallet must be unlocked prior to this command.
/// Since JSON doesn't have a primitive for Option (it just has the null primitive), we can't
/// have a double Option. This becomes an issue when creating an update_validator transaction.
/// Instead we use the following work-around. We define the empty String to be None. So, in
Expand All @@ -42,12 +41,6 @@ pub enum ValidatorCommand {
/// The fee will be paid from this address. This address must be already unlocked.
sender_wallet: Address,

/// The new validator address. This wallet must be already unlocked.
validator_wallet: Address,

/// The Schnorr signing key used by the validator.
signing_secret_key: String,

/// The BLS key used by the validator.
voting_secret_key: String,

Expand Down Expand Up @@ -154,20 +147,20 @@ impl HandleSubcommand for ValidatorCommand {

ValidatorCommand::CreateNewValidator {
sender_wallet,
validator_wallet,
signing_secret_key,
voting_secret_key,
reward_address,
signal_data,
tx_commons,
} => {
let validator_address = client.validator.get_address().await?.data;
let key_data = client.validator.get_signing_key().await?.data;
if tx_commons.dry {
let tx = client
.consensus
.create_new_validator_transaction(
sender_wallet,
validator_wallet,
signing_secret_key,
validator_address,
key_data,
voting_secret_key,
reward_address,
signal_data,
Expand All @@ -181,8 +174,8 @@ impl HandleSubcommand for ValidatorCommand {
.consensus
.send_new_validator_transaction(
sender_wallet,
validator_wallet,
signing_secret_key,
validator_address,
key_data,
voting_secret_key,
reward_address,
signal_data,
Expand Down
Loading