From 23a1518d56dfd1db19680f3b9614692bd4aac8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Fri, 19 May 2023 13:05:28 +0200 Subject: [PATCH 1/4] app/wallet: rm empty keys mod --- apps/src/lib/wallet/keys.rs | 1 - apps/src/lib/wallet/mod.rs | 1 - 2 files changed, 2 deletions(-) delete mode 100644 apps/src/lib/wallet/keys.rs diff --git a/apps/src/lib/wallet/keys.rs b/apps/src/lib/wallet/keys.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/apps/src/lib/wallet/keys.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/apps/src/lib/wallet/mod.rs b/apps/src/lib/wallet/mod.rs index 04aae73dc6..96a2138520 100644 --- a/apps/src/lib/wallet/mod.rs +++ b/apps/src/lib/wallet/mod.rs @@ -1,5 +1,4 @@ pub mod defaults; -mod keys; pub mod pre_genesis; mod store; From 4e6adf9d0e3d650d0f7930112cc98a8a95aac620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Sat, 20 May 2023 09:33:45 +0200 Subject: [PATCH 2/4] cli: add missing `--wallet-alias-force` and `--alias-force` --- apps/src/lib/cli.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index daecbf5eee..d6145a73e0 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -3201,6 +3201,9 @@ pub mod args { initialized, the alias will be the prefix of each new \ address joined with a number.", )) + .arg(WALLET_ALIAS_FORCE.def().about( + "Override the alias without confirmation if it already exists.", + )) .arg(GAS_AMOUNT.def().about( "The amount being paid for the inclusion of this transaction", )) @@ -3318,6 +3321,9 @@ pub mod args { .def() .about("An alias to be associated with the new entry."), ) + .arg(ALIAS_FORCE.def().about( + "Override the alias without confirmation if it already exists.", + )) .arg( MASP_VALUE .def() @@ -3386,6 +3392,9 @@ pub mod args { "An alias to be associated with the payment address.", ), ) + .arg(ALIAS_FORCE.def().about( + "Override the alias without confirmation if it already exists.", + )) .arg(VIEWING_KEY.def().about("The viewing key.")) .arg(PIN.def().about( "Require that the single transaction to this address be \ @@ -3418,6 +3427,9 @@ pub mod args { "The key and address alias. If none provided, the alias will \ be the public key hash.", )) + .arg(ALIAS_FORCE.def().about( + "Override the alias without confirmation if it already exists.", + )) .arg(UNSAFE_DONT_ENCRYPT.def().about( "UNSAFE: Do not encrypt the keypair. Do not use this for keys \ used in a live network.", @@ -3586,6 +3598,9 @@ pub mod args { .def() .about("An alias to be associated with the address."), ) + .arg(ALIAS_FORCE.def().about( + "Override the alias without confirmation if it already exists.", + )) .arg( RAW_ADDRESS .def() From 9d3614daecb80f97931e6ec9c8d588f43361fe70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Sat, 20 May 2023 11:12:25 +0200 Subject: [PATCH 3/4] shared/tx/submit_validator_commission_change: print err even with force --- shared/src/ledger/tx.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/shared/src/ledger/tx.rs b/shared/src/ledger/tx.rs index 8b2a9d85ed..d9d7cdf410 100644 --- a/shared/src/ledger/tx.rs +++ b/shared/src/ledger/tx.rs @@ -528,18 +528,11 @@ pub async fn submit_validator_commission_change< let validator = args.validator.clone(); if rpc::is_validator(client, &validator).await { if args.rate < Decimal::ZERO || args.rate > Decimal::ONE { - if args.tx.force { - eprintln!( - "Invalid new commission rate, received {}", - args.rate - ); - Ok(()) - } else { - Err(Error::InvalidCommisionRate(args.rate)) + eprintln!("Invalid new commission rate, received {}", args.rate); + if !args.tx.force { + return Err(Error::InvalidCommisionRate(args.rate)); } - } else { - Ok(()) - }?; + } let pipeline_epoch_minus_one = epoch + params.pipeline_len - 1; From de50551e3c0e0fbf078991b53908416545017044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Sat, 20 May 2023 14:52:16 +0200 Subject: [PATCH 4/4] cli: rename Tx arg `tx_code_path` to `tx_reveal_code_path` --- apps/src/lib/cli.rs | 6 +++--- shared/src/ledger/args.rs | 4 ++-- shared/src/ledger/tx.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index daecbf5eee..a833d3b274 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -3165,7 +3165,7 @@ pub mod args { gas_limit: self.gas_limit, signing_key: self.signing_key.map(|x| ctx.get_cached(&x)), signer: self.signer.map(|x| ctx.get(&x)), - tx_code_path: ctx.read_wasm(self.tx_code_path), + tx_reveal_code_path: ctx.read_wasm(self.tx_reveal_code_path), password: self.password, expiration: self.expiration, chain_id: self.chain_id, @@ -3251,7 +3251,7 @@ pub mod args { let expiration = EXPIRATION_OPT.parse(matches); let signing_key = SIGNING_KEY_OPT.parse(matches); let signer = SIGNER.parse(matches); - let tx_code_path = PathBuf::from(TX_REVEAL_PK); + let tx_reveal_code_path = PathBuf::from(TX_REVEAL_PK); let chain_id = CHAIN_ID_OPT.parse(matches); let password = None; Self { @@ -3268,7 +3268,7 @@ pub mod args { expiration, signing_key, signer, - tx_code_path, + tx_reveal_code_path, password, chain_id, } diff --git a/shared/src/ledger/args.rs b/shared/src/ledger/args.rs index 738c371ef3..bfff93b41f 100644 --- a/shared/src/ledger/args.rs +++ b/shared/src/ledger/args.rs @@ -400,8 +400,8 @@ pub struct Tx { pub signing_key: Option, /// Sign the tx with the keypair of the public key of the given address pub signer: Option, - /// Path to the TX WASM code file - pub tx_code_path: C::Data, + /// Path to the TX WASM code file to reveal PK + pub tx_reveal_code_path: C::Data, /// Password to decrypt key pub password: Option, } diff --git a/shared/src/ledger/tx.rs b/shared/src/ledger/tx.rs index 8b2a9d85ed..dd412e2f71 100644 --- a/shared/src/ledger/tx.rs +++ b/shared/src/ledger/tx.rs @@ -285,7 +285,7 @@ pub async fn submit_reveal_pk_aux< let addr: Address = public_key.into(); println!("Submitting a tx to reveal the public key for address {addr}..."); let tx_data = public_key.try_to_vec().map_err(Error::EncodeKeyFailure)?; - let tx_code = args.tx_code_path.clone(); + let tx_code = args.tx_reveal_code_path.clone(); let tx = Tx::new( tx_code, Some(tx_data),