Skip to content

Commit eec8a90

Browse files
committed
Reverts the logic of inner_tx_signers
1 parent 8111e2d commit eec8a90

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

crates/sdk/src/signing.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,29 @@ pub fn find_key_by_pk<U: WalletIo>(
230230
/// Given CLI arguments and some defaults, determine the rightful transaction
231231
/// signer.
232232
///
233-
/// Return the given signing key or public key of the given signer if
234-
/// possible. If no explicit signer given, use the `default`. If no `default`
235-
/// is given, an `Error` is returned.
233+
/// When `signing_keys` are provided, these will be returned. Otherwise, if a
234+
/// `default_signer` is provided, its key will be returned (provided that it can
235+
/// be found in the wallet). Finally, if neither of the previous cases, an empty
236+
/// set of signers will be returned.
236237
async fn inner_tx_signers(
237238
context: &impl Namada,
238-
mut signing_keys: Vec<common::PublicKey>,
239+
signing_keys: Vec<common::PublicKey>,
239240
default_signer: Option<&Address>,
240241
) -> Result<HashSet<common::PublicKey>, Error> {
241-
if let Some(signer) = default_signer {
242-
// Use the signer determined by the caller, fetch the signing key and
243-
// apply it
244-
signing_keys.push(find_pk(context, signer).await?)
245-
}
242+
let keys = if signing_keys.is_empty() {
243+
match default_signer {
244+
// When provided, use the signer determined by the caller, fetch the
245+
// public key and apply it
246+
Some(signer) => vec![find_pk(context, signer).await?],
247+
// In this case return no signer
248+
None => Default::default(),
249+
}
250+
} else {
251+
// Otherwise just use the provided public keys
252+
signing_keys
253+
};
246254

247-
Ok(signing_keys.into_iter().collect())
255+
Ok(keys.into_iter().collect())
248256
}
249257

250258
/// The different parts of a transaction that can be signed. Note that it's

crates/tests/src/e2e/ledger_tests.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,12 +1815,7 @@ fn test_invalid_validator_txs() -> Result<()> {
18151815
run_as!(test, Who::Validator(0), Bin::Client, tx_args, Some(40))?;
18161816
client.exp_string(TX_REJECTED)?;
18171817
client.assert_success();
1818-
// FIXME: also need to rebase on main again
18191818

1820-
// FIXME: all of these are broken because the owner is joined with the
1821-
// signing keys se we attach the right signature. Either I remove this test
1822-
// or I revert the logic (in this case I should also bring back the unit
1823-
// test I removed) Try to deactivate validator-1 as validator-0
18241819
let tx_args = vec![
18251820
"deactivate-validator",
18261821
"--validator",

0 commit comments

Comments
 (0)