Skip to content

Commit

Permalink
Upgrade pre-genesis wallet with new public key format. Provide a defa…
Browse files Browse the repository at this point in the history
…ult fee payer for reveal PK transactions.
  • Loading branch information
murisi committed Nov 10, 2023
1 parent 90ff630 commit 0b9f1a2
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ index-set = {git = "https://github.com/heliaxdev/index-set", tag = "v0.8.0", fea
itertools = "0.10.0"
k256 = { version = "0.13.0", default-features = false, features = ["ecdsa", "pkcs8", "precomputed-tables", "serde", "std"]}
lazy_static = "1.4.0"
ledger-namada-rs = { git = "https://github.com/heliaxdev/ledger-namada", branch = "murisi/fix-rs-0.24.0" }
ledger-namada-rs = { git = "https://github.com/heliaxdev/ledger-namada", rev = "7e861c440de0fdabaf51e30d97f5c8736be348f3" }
ledger-transport-hid = "0.10.0"
libc = "0.2.97"
libloading = "0.7.2"
Expand Down
14 changes: 7 additions & 7 deletions genesis/localnet/src/pre-genesis/wallet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ faucet-key = "unencrypted:00548aa8393422b88dce5f4be8ee0320638061c3e0649ada1b0dac
validator-0-balance-key = "unencrypted:000b9c8cb8f3ad6b8a387b064a11c0e98189814e9733aa7bb1e802425f6356f98a"

[public_keys]
albert-key = "ED25519_PK_PREFIXpktest1qz0aphcsrw37j8fy742cjwhphu9jwx7esd3ad4xxtxrkwv07ff63wnnul44"
bertha-key = "ED25519_PK_PREFIXpktest1qpyfnrl6qdqvguah9kknvp9t6ajcrec7fge56pcgaa655zkua3ndsl9tn4a"
christel-key = "ED25519_PK_PREFIXpktest1qp6uy52q0fldjxupznuskm69fkuswx3fq3vw9kekzp4enkh5h7pmzy242c2"
daewon = "ED25519_PK_PREFIXpktest1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkyuzdckd"
ester = "SECP256K1_PK_PREFIXpktest1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqsafsprd"
faucet-key = "ED25519_PK_PREFIXpktest1qzh2d8vk9wvj2j63fa3cvjru9uldpdjctjjxpafl5r8vwwf56pdgy2dpher"
validator-0-balance-key = "ED25519_PK_PREFIXpktest1qzp22w6trhmxmp2dx5h883c2l684z0e20a9egusmxaat62wvaa4agcthpup"
albert-key = "ED25519_PK_PREFIXtpknam1qz0aphcsrw37j8fy742cjwhphu9jwx7esd3ad4xxtxrkwv07ff63we33t3r"
bertha-key = "ED25519_PK_PREFIXtpknam1qpyfnrl6qdqvguah9kknvp9t6ajcrec7fge56pcgaa655zkua3nds48x83t"
christel-key = "ED25519_PK_PREFIXtpknam1qp6uy52q0fldjxupznuskm69fkuswx3fq3vw9kekzp4enkh5h7pmzwgc7uu"
daewon = "ED25519_PK_PREFIXtpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm"
ester = "SECP256K1_PK_PREFIXtpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4"
faucet-key = "ED25519_PK_PREFIXtpknam1qzh2d8vk9wvj2j63fa3cvjru9uldpdjctjjxpafl5r8vwwf56pdgyq0vra4"
validator-0-balance-key = "ED25519_PK_PREFIXtpknam1qzp22w6trhmxmp2dx5h883c2l684z0e20a9egusmxaat62wvaa4agjf64ch"

[derivation_paths]

Expand Down
11 changes: 3 additions & 8 deletions sdk/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use prost::Message;
use rand::rngs::OsRng;
use serde::{Deserialize, Serialize};
use sha2::Digest;
use zeroize::Zeroizing;

use super::masp::{ShieldedContext, ShieldedTransfer};
use crate::args::SdkTypes;
Expand Down Expand Up @@ -87,7 +86,6 @@ pub struct SigningTxData {
pub async fn find_pk<'a>(
context: &impl Namada<'a>,
addr: &Address,
password: Option<Zeroizing<String>>,
) -> Result<common::PublicKey, Error> {
match addr {
Address::Established(_) => {
Expand All @@ -106,16 +104,15 @@ pub async fn find_pk<'a>(
Address::Implicit(ImplicitAddress(pkh)) => Ok(context
.wallet_mut()
.await
.find_key_by_pkh(pkh, password)
.find_public_key_by_pkh(pkh)
.map_err(|err| {
Error::Other(format!(
"Unable to load the keypair from the wallet for the \
implicit address {}. Failed with: {}",
addr.encode(),
err
))
})?
.ref_to()),
})?),
Address::Internal(_) => other_err(format!(
"Internal address {} doesn't have any signing keys.",
addr
Expand Down Expand Up @@ -187,9 +184,7 @@ pub async fn tx_signers<'a>(
match signer {
Some(signer) if signer == masp() => Ok(vec![masp_tx_key().ref_to()]),

Some(signer) => Ok(vec![
find_pk(context, &signer, args.password.clone()).await?,
]),
Some(signer) => Ok(vec![find_pk(context, &signer).await?]),
None => other_err(
"All transactions must be signed; please either specify the key \
or the address from which to look up the signing key."
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ pub async fn build_reveal_pk<'a>(
public_key: &common::PublicKey,
) -> Result<(Tx, SigningTxData, Option<Epoch>)> {
let signing_data =
signing::aux_signing_data(context, args, None, None).await?;
signing::aux_signing_data(context, args, None, Some(public_key.into()))
.await?;

build(
context,
Expand Down
42 changes: 21 additions & 21 deletions wasm/checksums.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"tx_bond.wasm": "tx_bond.fbe498589d64ed3acecf8d8eddb6126f264e53d6afbf40ae1586296cec95fa60.wasm",
"tx_bridge_pool.wasm": "tx_bridge_pool.07fcfa9627d6a2d160234b70f14b7162507016c158fd072d81e34b91fbaa4178.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.9c04a672607733dded08535880ca77f08b81331ab4ab20890209f052748dbba2.wasm",
"tx_ibc.wasm": "tx_ibc.0668e4bfd9f920313903622d7a640e57e4bba95fb345a788eb53fdb4d82f369f.wasm",
"tx_init_account.wasm": "tx_init_account.ef6852b8b4bbea38b2de7c8d28e61dc72f7e8a42dd8ae6ebc130cbee1874948c.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.b8387ef40c06514161dbc84c2b9cd9a0e63f6d65753b7fd6c3d4de91f815134f.wasm",
"tx_init_validator.wasm": "tx_init_validator.42aaf2081e5f480f82770a1c3f54a3467334f9c2e0459d829e47e5a2ab8f96cc.wasm",
"tx_redelegate.wasm": "tx_redelegate.5d53095cd3861c6cac818f683492e455cd8cd7c11fa5eaffda7728abc0b8fc4c.wasm",
"tx_resign_steward.wasm": "tx_resign_steward.f11372d848753feb60f3681a641282f3e7d76d486b083efbac6e4c58e2d39e29.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.63a3be41bf03364bc77c4e9792cf795f33105b9d803ad4d040cf452ebca5e90c.wasm",
"tx_transfer.wasm": "tx_transfer.fc84bb83ad62d7aab618e165c99c8603515213b531b6986b7166f198dfe35eff.wasm",
"tx_unbond.wasm": "tx_unbond.9d89ca2f854e5be3863dfacd8c5ea49e872b92913dc1ac23150dddefb13179d4.wasm",
"tx_unjail_validator.wasm": "tx_unjail_validator.321aa22df71c9f5209eceaae8f6036abb320fc209d5c258c608074809e5686c1.wasm",
"tx_update_account.wasm": "tx_update_account.faf576ce31c485eeb4e2a14b7a857a00d2bed1370a014e025b3e876f477664e5.wasm",
"tx_update_steward_commission.wasm": "tx_update_steward_commission.19793a7b32d0873902d60e32c7540a4c35fdcc0bbf657aa36bce5b32e366bf54.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.30149b3a3399cb3b33190a4ad0998d00ddbb51eb2c159b2b4e44a54eae429f74.wasm",
"tx_withdraw.wasm": "tx_withdraw.5a4f1e624ce7fa9498c77221bb3d8df5a7f1d469fb07e44b6fe6ec7ee1850a0d.wasm",
"vp_implicit.wasm": "vp_implicit.425c90b1b60d355334c650270415a88477dc90f5122311db4341003d6b09c3b8.wasm",
"vp_masp.wasm": "vp_masp.7e927e27f4338b55ea065e876a3c36d6398cd03fbbe4d7574f7f4df4a53aee4e.wasm",
"vp_user.wasm": "vp_user.b13865d5281e1157e51e02338983d7077b53cd16d1527e48e30b8ec4326a83c4.wasm",
"vp_validator.wasm": "vp_validator.2c6a51e0f9e9f3d72b808908124a48e9f46e9da4da40495ec7a985b898296178.wasm"
"tx_bond.wasm": "tx_bond.0279f45f0edebb084ce5782b67c671aad1d3e9e61c2c3de4ada52e35296f15b9.wasm",
"tx_bridge_pool.wasm": "tx_bridge_pool.76dd9e9de75a45e7f670a7fd652695b00929b000605d14caf63d2c61a41d4444.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.5ebf7b4d75a9e82e7aeee3012e6f5879205baa1a4978ffb1d51328afd60f4c6e.wasm",
"tx_ibc.wasm": "tx_ibc.c936d8eb93f165d5c9169051c9a06e127a09831f0c4ad375bd0533901eb3b060.wasm",
"tx_init_account.wasm": "tx_init_account.f543f589596cfa1766198e552efb7cc4fc399763a70f8bdba6db09ab8653d204.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.8b96b58d7242f0b454106fb358fcd7dd306850e32ac6ea51609c5e8b37fbc8c5.wasm",
"tx_init_validator.wasm": "tx_init_validator.5d76d17f21ce23a8addd446e443c72f55f71272cd7dfa46ce18bb02eb27e220e.wasm",
"tx_redelegate.wasm": "tx_redelegate.69afbfde1de4831424cc2ffe3dcc24e3796b27bcdb19435d4da3f98a56aff098.wasm",
"tx_resign_steward.wasm": "tx_resign_steward.5f09e4592cf8546e8140c924cd5133f5328a4cf3da2741676051ee7f9472cc28.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.5fbc00768dee480840ea1d6982d64f293793edb3da3033e43443982fb6cf7791.wasm",
"tx_transfer.wasm": "tx_transfer.6cea4189db7bbaf5d6216412d22bb662d2b22842da834b80df023693ddb079a1.wasm",
"tx_unbond.wasm": "tx_unbond.68650450915a402041ab8094456cf7e2bf891256812e89f7ba73c0f4a62d5dee.wasm",
"tx_unjail_validator.wasm": "tx_unjail_validator.80f1404ae615a72c28c63a277d22bca94057382a41c333a47fcdd278f4816319.wasm",
"tx_update_account.wasm": "tx_update_account.13ebad88e552f469e4824dbb80306f6e4d9711006306e410fa44d92efff24fb0.wasm",
"tx_update_steward_commission.wasm": "tx_update_steward_commission.d39d19b2b8b0fc96c593cd3a589806e308d475646abacc0f0cd2fa8b3b2dc3d6.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.8c64c1a2e2fe9f0f7ccbf8e11b04e9e0a50d79c7f04d33cf90812268c52df94d.wasm",
"tx_withdraw.wasm": "tx_withdraw.b5836bda34deb6dac15214906d110cc88c80df5b545554349bead726cb25a602.wasm",
"vp_implicit.wasm": "vp_implicit.1121aad98b2075848c092b3cb2d67eae519c41ef7e9534799dc14a8a6690baee.wasm",
"vp_masp.wasm": "vp_masp.bfe7aad08002010ed53e41daded66e4ac435654826fa4931c8f4470bf7c00822.wasm",
"vp_user.wasm": "vp_user.e6732f90da4940598826a394ddde286953c5dc476af7180e96eea6bc225149f1.wasm",
"vp_validator.wasm": "vp_validator.332c457b2a6896634f8f92bf6025f511947b767fcf594fd21028a9c6351a8b1b.wasm"
}
Binary file modified wasm_for_tests/tx_memory_limit.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_mint_tokens.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_no_op.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_proposal_code.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_read_storage_key.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_write.wasm
Binary file not shown.
Binary file modified wasm_for_tests/tx_write_storage_key.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_always_false.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_always_true.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_eval.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_memory_limit.wasm
Binary file not shown.
Binary file modified wasm_for_tests/vp_read_storage_key.wasm
Binary file not shown.

0 comments on commit 0b9f1a2

Please sign in to comment.