From 8784202d47db23c4d15e6e612176a27084890b45 Mon Sep 17 00:00:00 2001 From: Zeev Manilovich Date: Wed, 12 Feb 2025 14:16:19 +0200 Subject: [PATCH 1/3] add address to validator candidate --- crates/sui/src/validator_commands.rs | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/crates/sui/src/validator_commands.rs b/crates/sui/src/validator_commands.rs index 3d316210e996..9714c947c577 100644 --- a/crates/sui/src/validator_commands.rs +++ b/crates/sui/src/validator_commands.rs @@ -48,7 +48,7 @@ use sui_json_rpc_types::{ use sui_keys::{ key_derive::generate_new_key, keypair_file::{ - read_authority_keypair_from_file, read_keypair_from_file, read_network_keypair_from_file, + read_authority_keypair_from_file, read_network_keypair_from_file, write_authority_keypair_to_file, write_keypair_to_file, }, }; @@ -78,6 +78,7 @@ pub enum SuiValidatorCommand { project_url: String, host_name: String, gas_price: u64, + account_address: SuiAddress, }, #[clap(name = "become-candidate")] BecomeCandidate { @@ -214,7 +215,7 @@ pub enum SuiValidatorCommand { pub enum SuiValidatorCommandResponse { MakeValidatorInfo, DisplayMetadata, - BecomeCandidate(SuiTransactionBlockResponse), + BecomeCandidate(TransactionData), JoinCommittee(SuiTransactionBlockResponse), LeaveCommittee(SuiTransactionBlockResponse), UpdateMetadata(SuiTransactionBlockResponse), @@ -282,6 +283,7 @@ impl SuiValidatorCommand { project_url, host_name, gas_price, + account_address, } => { let dir = std::env::current_dir()?; let protocol_key_file_name = dir.join("protocol.key"); @@ -291,29 +293,28 @@ impl SuiValidatorCommand { "Other account key types supported yet, please use Ed25519 keys for now." ), }; - let account_key_file_name = dir.join("account.key"); + // let account_key_file_name = dir.join("account.key"); let network_key_file_name = dir.join("network.key"); let worker_key_file_name = dir.join("worker.key"); make_key_files(protocol_key_file_name.clone(), true, None)?; - make_key_files(account_key_file_name.clone(), false, Some(account_key))?; + // make_key_files(account_key_file_name.clone(), false, Some(account_key))?; make_key_files(network_key_file_name.clone(), false, None)?; make_key_files(worker_key_file_name.clone(), false, None)?; let keypair: AuthorityKeyPair = read_authority_keypair_from_file(protocol_key_file_name)?; - let account_keypair: SuiKeyPair = read_keypair_from_file(account_key_file_name)?; + // let account_keypair: SuiKeyPair = read_keypair_from_file(account_key_file_name)?; let worker_keypair: NetworkKeyPair = read_network_keypair_from_file(worker_key_file_name)?; let network_keypair: NetworkKeyPair = read_network_keypair_from_file(network_key_file_name)?; - let pop = - generate_proof_of_possession(&keypair, (&account_keypair.public()).into()); + let pop = generate_proof_of_possession(&keypair, account_address); let validator_info = GenesisValidatorInfo { info: sui_genesis_builder::validator_info::ValidatorInfo { name, protocol_key: keypair.public().into(), worker_key: worker_keypair.public().clone(), - account_address: SuiAddress::from(&account_keypair.public()), + account_address, network_key: network_keypair.public().clone(), gas_price, commission_rate: sui_config::node::DEFAULT_COMMISSION_RATE, @@ -390,8 +391,14 @@ impl SuiValidatorCommand { CallArg::Pure(bcs::to_bytes(&validator.gas_price()).unwrap()), CallArg::Pure(bcs::to_bytes(&validator.commission_rate()).unwrap()), ]; - let response = - call_0x5(context, "request_add_validator_candidate", args, gas_budget).await?; + let response = construct_unsigned_0x5_txn( + context, + validator.account_address, + "request_add_validator_candidate", + args, + gas_budget, + ) + .await?; SuiValidatorCommandResponse::BecomeCandidate(response) } @@ -891,7 +898,7 @@ impl Display for SuiValidatorCommandResponse { SuiValidatorCommandResponse::MakeValidatorInfo => {} SuiValidatorCommandResponse::DisplayMetadata => {} SuiValidatorCommandResponse::BecomeCandidate(response) => { - write!(writer, "{}", write_transaction_response(response)?)?; + write!(writer, "{:?}", response)?; } SuiValidatorCommandResponse::JoinCommittee(response) => { write!(writer, "{}", write_transaction_response(response)?)?; From a5d75adfe84458e94927b9e2d44db619793e3588 Mon Sep 17 00:00:00 2001 From: Zeev Manilovich Date: Wed, 12 Feb 2025 22:34:15 +0200 Subject: [PATCH 2/3] change response --- crates/sui/src/validator_commands.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/sui/src/validator_commands.rs b/crates/sui/src/validator_commands.rs index 9714c947c577..4f53ed27f7f2 100644 --- a/crates/sui/src/validator_commands.rs +++ b/crates/sui/src/validator_commands.rs @@ -897,8 +897,12 @@ impl Display for SuiValidatorCommandResponse { match self { SuiValidatorCommandResponse::MakeValidatorInfo => {} SuiValidatorCommandResponse::DisplayMetadata => {} - SuiValidatorCommandResponse::BecomeCandidate(response) => { - write!(writer, "{:?}", response)?; + SuiValidatorCommandResponse::BecomeCandidate(tx_data) => { + writeln!( + writer, + "{}", + fastcrypto::encoding::Base64::encode(bcs::to_bytes(tx_data).unwrap()) + )?; } SuiValidatorCommandResponse::JoinCommittee(response) => { write!(writer, "{}", write_transaction_response(response)?)?; From 3e1e59a078542f94a01948f4692399792ae401c6 Mon Sep 17 00:00:00 2001 From: destinyae <109734765+destinyae@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:55:33 +0100 Subject: [PATCH 3/3] Fix broken link fixed code of conduct link. --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index a05b27356742..c9a74492c3c8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -44,7 +44,7 @@ Sui is for the community. Contribute for the benefit of all. - [Repo contributing guidelines](https://docs.sui.io/contribute-to-sui-repos) - [Style guide](https://docs.sui.io/style-guide) - [Localization](https://docs.sui.io/localize-sui-docs) -- [Code of conduct](https://docs.sui.io/contribute/code-of-conduct) +- [Code of conduct](https://docs.sui.io/code-of-conduct) ## License