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

Include validator avatar in their medatada #2359

Merged
merged 4 commits into from
Jan 13, 2024
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
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/2359-validator-avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Include validator avatar url in their medatada
([\#2359](https://github.com/anoma/namada/pull/2359))
22 changes: 22 additions & 0 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,7 @@ pub mod args {
pub const ALLOW_DUPLICATE_IP: ArgFlag = flag("allow-duplicate-ip");
pub const AMOUNT: Arg<token::DenominatedAmount> = arg("amount");
pub const ARCHIVE_DIR: ArgOpt<PathBuf> = arg_opt("archive-dir");
pub const AVATAR_OPT: ArgOpt<String> = arg_opt("avatar");
pub const BALANCE_OWNER: ArgOpt<WalletBalanceOwner> = arg_opt("owner");
pub const BASE_DIR: ArgDefault<PathBuf> = arg_default(
"base-dir",
Expand Down Expand Up @@ -4042,6 +4043,7 @@ pub mod args {
description: self.description,
website: self.website,
discord_handle: self.discord_handle,
avatar: self.avatar,
unsafe_dont_encrypt: self.unsafe_dont_encrypt,
tx_code_path: self.tx_code_path.to_path_buf(),
}
Expand All @@ -4064,6 +4066,7 @@ pub mod args {
let description = DESCRIPTION_OPT.parse(matches);
let website = WEBSITE_OPT.parse(matches);
let discord_handle = DISCORD_OPT.parse(matches);
let avatar = AVATAR_OPT.parse(matches);
let unsafe_dont_encrypt = UNSAFE_DONT_ENCRYPT.parse(matches);
let tx_code_path = PathBuf::from(TX_BECOME_VALIDATOR_WASM);
Self {
Expand All @@ -4080,6 +4083,7 @@ pub mod args {
description,
website,
discord_handle,
avatar,
unsafe_dont_encrypt,
tx_code_path,
}
Expand Down Expand Up @@ -4128,6 +4132,7 @@ pub mod args {
.arg(DESCRIPTION_OPT.def().help("The validator's description."))
.arg(WEBSITE_OPT.def().help("The validator's website."))
.arg(DISCORD_OPT.def().help("The validator's discord handle."))
.arg(AVATAR_OPT.def().help("The validator's avatar."))
.arg(VALIDATOR_CODE_PATH.def().help(
"The path to the validity predicate WASM code to be used \
for the validator account. Uses the default validator VP \
Expand Down Expand Up @@ -4163,6 +4168,7 @@ pub mod args {
description: self.description,
website: self.website,
discord_handle: self.discord_handle,
avatar: self.avatar,
validator_vp_code_path: self
.validator_vp_code_path
.to_path_buf(),
Expand Down Expand Up @@ -4193,6 +4199,7 @@ pub mod args {
let description = DESCRIPTION_OPT.parse(matches);
let website = WEBSITE_OPT.parse(matches);
let discord_handle = DISCORD_OPT.parse(matches);
let avatar = AVATAR_OPT.parse(matches);
let validator_vp_code_path = VALIDATOR_CODE_PATH
.parse(matches)
.unwrap_or_else(|| PathBuf::from(VP_USER_WASM));
Expand All @@ -4216,6 +4223,7 @@ pub mod args {
description,
website,
discord_handle,
avatar,
validator_vp_code_path,
unsafe_dont_encrypt,
tx_init_account_code_path,
Expand Down Expand Up @@ -4268,6 +4276,7 @@ pub mod args {
.arg(DESCRIPTION_OPT.def().help("The validator's description."))
.arg(WEBSITE_OPT.def().help("The validator's website."))
.arg(DISCORD_OPT.def().help("The validator's discord handle."))
.arg(AVATAR_OPT.def().help("The validator's avatar."))
.arg(VALIDATOR_CODE_PATH.def().help(
"The path to the validity predicate WASM code to be used \
for the validator account. Uses the default validator VP \
Expand Down Expand Up @@ -5331,6 +5340,7 @@ pub mod args {
description: self.description,
website: self.website,
discord_handle: self.discord_handle,
avatar: self.avatar,
commission_rate: self.commission_rate,
tx_code_path: self.tx_code_path.to_path_buf(),
}
Expand All @@ -5345,6 +5355,7 @@ pub mod args {
let description = DESCRIPTION_OPT.parse(matches);
let website = WEBSITE_OPT.parse(matches);
let discord_handle = DISCORD_OPT.parse(matches);
let avatar = AVATAR_OPT.parse(matches);
let commission_rate = COMMISSION_RATE_OPT.parse(matches);
let tx_code_path = PathBuf::from(TX_CHANGE_METADATA_WASM);
Self {
Expand All @@ -5354,6 +5365,7 @@ pub mod args {
description,
website,
discord_handle,
avatar,
commission_rate,
tx_code_path,
}
Expand Down Expand Up @@ -5382,6 +5394,10 @@ pub mod args {
existing discord handle, pass an empty string to this \
argument.",
))
.arg(AVATAR_OPT.def().help(
"The desired new validator avatar url. To remove the \
existing avatar, pass an empty string to this argument.",
))
.arg(
COMMISSION_RATE_OPT
.def()
Expand Down Expand Up @@ -6707,6 +6723,7 @@ pub mod args {
pub description: Option<String>,
pub website: Option<String>,
pub discord_handle: Option<String>,
pub avatar: Option<String>,
pub address: EstablishedAddress,
pub tx_path: PathBuf,
}
Expand All @@ -6726,6 +6743,7 @@ pub mod args {
let description = DESCRIPTION_OPT.parse(matches);
let website = WEBSITE_OPT.parse(matches);
let discord_handle = DISCORD_OPT.parse(matches);
let avatar = AVATAR_OPT.parse(matches);
let address = RAW_ADDRESS_ESTABLISHED.parse(matches);
let tx_path = PATH.parse(matches);
Self {
Expand All @@ -6740,6 +6758,7 @@ pub mod args {
description,
website,
discord_handle,
avatar,
tx_path,
address,
}
Expand Down Expand Up @@ -6797,6 +6816,9 @@ pub mod args {
"The validator's discord handle. This is an optional \
parameter.",
))
.arg(AVATAR_OPT.def().help(
"The validator's avatar. This is an optional parameter.",
))
}
}

Expand Down
6 changes: 6 additions & 0 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,7 @@ pub async fn query_and_print_metadata(
description,
website,
discord_handle,
avatar,
}) => {
display_line!(
context.io(),
Expand All @@ -2018,6 +2019,11 @@ pub async fn query_and_print_metadata(
} else {
display_line!(context.io(), "No discord handle");
}
if let Some(avatar) = avatar {
display_line!(context.io(), "Avatar: {}", avatar);
} else {
display_line!(context.io(), "No avatar");
}
}
None => display_line!(
context.io(),
Expand Down
4 changes: 4 additions & 0 deletions apps/src/lib/client/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ pub async fn submit_become_validator(
website,
description,
discord_handle,
avatar,
unsafe_dont_encrypt,
tx_code_path,
}: args::TxBecomeValidator,
Expand Down Expand Up @@ -710,6 +711,7 @@ pub async fn submit_become_validator(
description,
website,
discord_handle,
avatar,
};

// Put together all the PKs that we have to sign with to verify ownership
Expand Down Expand Up @@ -845,6 +847,7 @@ pub async fn submit_init_validator(
website,
description,
discord_handle,
avatar,
validator_vp_code_path,
unsafe_dont_encrypt,
tx_init_account_code_path,
Expand Down Expand Up @@ -896,6 +899,7 @@ pub async fn submit_init_validator(
description,
website,
discord_handle,
avatar,
tx_code_path: tx_become_validator_code_path,
unsafe_dont_encrypt,
},
Expand Down
2 changes: 2 additions & 0 deletions apps/src/lib/client/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ pub fn init_genesis_validator(
description,
website,
discord_handle,
avatar,
tx_path,
address,
}: args::InitGenesisValidator,
Expand Down Expand Up @@ -884,6 +885,7 @@ pub fn init_genesis_validator(
description,
website,
discord_handle,
avatar,
},
&validator_wallet,
);
Expand Down
1 change: 1 addition & 0 deletions apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ pub fn make_dev_genesis(
description: None,
website: None,
discord_handle: None,
avatar: None,
},
net_address: SocketAddr::new(
IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
Expand Down
4 changes: 4 additions & 0 deletions apps/src/lib/config/genesis/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pub struct GenesisValidatorData {
pub description: Option<String>,
pub website: Option<String>,
pub discord_handle: Option<String>,
pub avatar: Option<String>,
}

/// Panics if given `txs.validator_accounts` is not empty, because validator
Expand Down Expand Up @@ -269,6 +270,7 @@ pub fn init_validator(
description,
website,
discord_handle,
avatar,
}: GenesisValidatorData,
validator_wallet: &ValidatorWallet,
) -> (Address, UnsignedTransactions) {
Expand Down Expand Up @@ -302,6 +304,7 @@ pub fn init_validator(
description,
website,
discord_handle,
avatar,
},
};
let unsigned_validator_addr =
Expand Down Expand Up @@ -613,6 +616,7 @@ impl TxToSign for ValidatorAccountTx<SignedPk> {
description: self.metadata.description.clone(),
website: self.metadata.website.clone(),
discord_handle: self.metadata.discord_handle.clone(),
avatar: self.metadata.avatar.clone(),
},
)
}
Expand Down
2 changes: 2 additions & 0 deletions benches/txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ fn become_validator(c: &mut Criterion) {
description: None,
website: None,
discord_handle: None,
avatar: None,
};
let tx = shell.generate_tx(
TX_BECOME_VALIDATOR_WASM,
Expand Down Expand Up @@ -722,6 +723,7 @@ fn change_validator_metadata(c: &mut Criterion) {
description: Some("I will change this piece of data".to_string()),
website: None,
discord_handle: None,
avatar: None,
commission_rate: None,
};

Expand Down
9 changes: 9 additions & 0 deletions core/src/types/transaction/pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub struct BecomeValidator {
pub website: Option<String>,
/// The validator's discord handle
pub discord_handle: Option<String>,
/// URL that points to a picture (e.g. PNG),
/// identifying the validator
pub avatar: Option<String>,
}

/// A bond is a validator's self-bond or a delegation from non-validator to a
Expand Down Expand Up @@ -183,6 +186,8 @@ pub struct MetaDataChange {
pub website: Option<String>,
/// Validator's discord handle
pub discord_handle: Option<String>,
/// Validator's avatar url
pub avatar: Option<String>,
/// Validator's commission rate
pub commission_rate: Option<Dec>,
}
Expand Down Expand Up @@ -267,6 +272,7 @@ pub mod tests {
description in option::of("[a-zA-Z0-9_]*"),
website in option::of("[a-zA-Z0-9_]*"),
discord_handle in option::of("[a-zA-Z0-9_]*"),
avatar in option::of("[a-zA-Z0-9_]*"),
commission_rate in option::of(arb_dec()),
) -> MetaDataChange {
MetaDataChange {
Expand All @@ -275,6 +281,7 @@ pub mod tests {
description,
website,
discord_handle,
avatar,
commission_rate,
}
}
Expand Down Expand Up @@ -307,6 +314,7 @@ pub mod tests {
description in option::of("[a-zA-Z0-9_]*"),
website in option::of("[a-zA-Z0-9_]*"),
discord_handle in option::of("[a-zA-Z0-9_]*"),
avatar in option::of("[a-zA-Z0-9_]*"),
) -> BecomeValidator {
BecomeValidator {
address,
Expand All @@ -320,6 +328,7 @@ pub mod tests {
description,
website,
discord_handle,
avatar,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ net_address = "127.0.0.1:27656"

[validator_account.consensus_key]
pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg"
authorization = "signam1qqxx2kpu0yla6jy958t58c649m5gf8v5rjqk5rqemkvxa3xynfxgznjwx2yzre20l7n7mvul2p4vdpsunmjt33fu9c94tu26caevrvgdllk4mx"
authorization = "signam1qqxsgw7k5yu200657evhu7kuenf5zw86lvx8nw7wk9zrgt0tx3xpf492f2k054ml6zu6x7p6d3j6rmdm33747ptwrxtvmwdaenyqvvcp3v9gpn"

[validator_account.protocol_key]
pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa"
authorization = "signam1qqfz3hym66j8my6exzfv88c8e829gulwr4eycyzn5j4a5tns8wj6md6j2kwly4kdr2ts8jwln7mta6weacgf2xjh08scykl3yzqeers899d9fn"
authorization = "signam1qpnjzsgnvgfnfjld89wtjtn7w843dhw39tktuxgw49tcyj678u03hdaufdsf6rakmrjfa6ywjnngy7hmwvwsgkjr60330w9jwl7azus20tcmwj"

[validator_account.tendermint_node_key]
pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3"
authorization = "signam1qpev0rmgakenvsec34xlyz8e2cpyc64u0fex6dv2us2x0yg9plyfrmfwcpxg2png7xl8404fmm6vp4h0afz25jclvc0yavjrc2vncps8wqqgds"
authorization = "signam1qq8d8k43779lxsz3hx3pkpucetdd4kzrl56hk52nwa5dfu97y2gq9axxffftx726e5n8ch2na4c8wn98yxcjpzzdpdkj86655g4hynsgwf35af"

[validator_account.eth_hot_key]
pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx"
authorization = "signam1qy04m2dqtvwrkk7rjxzpeua89hag2yc38rm3z9ljeg9c7ymp35tuqfd7yk0w4epnsydfvdyd682lvcrtzf28rdkd8snzmmyj846r36zyqq77j5s0"
authorization = "signam1q8t7shqzpmdwtfumrahs022mt96mazwq2d843sad4dgcvz9prlj6x37qp7nvhpluclq8ta4sjkg7da77e9xlvyh4eujc3v936egqqf4eqytrku9n"

[validator_account.eth_cold_key]
pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv"
authorization = "signam1q8pmqdqcqh9v8djeqlrzy4mv845v9harnm9u5z54nwlrhwkyvc9y79sv0ucaa08c7y3xypcn7wqj6qvjqzfzs9h89hesuxttlujswz5wqyux24m9"
authorization = "signam1qxe6c5h7sfrsampxlhsxdkq33zmetwg45y2lqxxhf4v7sy7sa933xat3m9f4g76dpzvpnaedrdy4d7t5xfmwmu0u9cdgdu8pgwqx9k8zqyzkce99"

[validator_account.metadata]
email = "[email protected]"

[validator_account.signatures]
tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qz3ylgxm3sr9d68ktwf078vt89dn9v8xj0c7tnytevnsd0v29kh6wmnqsfxd5mke8nrdlwve850l3uwcquxw2e7nltqt8eufds6ns6cqfzastc"
tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qqtljxqp03xhfcfg7vpnmxeuke97kqz5etmdzwvkmr08r4x9wj4ckzf6wlqzse8d05p3t70yyn3pd34kjvx87fzp3sytn4vp6adajrgx5uk8my"

[[bond]]
source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx"
Expand Down
12 changes: 6 additions & 6 deletions genesis/localnet/transactions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ net_address = "127.0.0.1:27656"

[validator_account.consensus_key]
pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg"
authorization = "signam1qqxx2kpu0yla6jy958t58c649m5gf8v5rjqk5rqemkvxa3xynfxgznjwx2yzre20l7n7mvul2p4vdpsunmjt33fu9c94tu26caevrvgdllk4mx"
authorization = "signam1qqxsgw7k5yu200657evhu7kuenf5zw86lvx8nw7wk9zrgt0tx3xpf492f2k054ml6zu6x7p6d3j6rmdm33747ptwrxtvmwdaenyqvvcp3v9gpn"

[validator_account.protocol_key]
pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa"
authorization = "signam1qqfz3hym66j8my6exzfv88c8e829gulwr4eycyzn5j4a5tns8wj6md6j2kwly4kdr2ts8jwln7mta6weacgf2xjh08scykl3yzqeers899d9fn"
authorization = "signam1qpnjzsgnvgfnfjld89wtjtn7w843dhw39tktuxgw49tcyj678u03hdaufdsf6rakmrjfa6ywjnngy7hmwvwsgkjr60330w9jwl7azus20tcmwj"

[validator_account.tendermint_node_key]
pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3"
authorization = "signam1qpev0rmgakenvsec34xlyz8e2cpyc64u0fex6dv2us2x0yg9plyfrmfwcpxg2png7xl8404fmm6vp4h0afz25jclvc0yavjrc2vncps8wqqgds"
authorization = "signam1qq8d8k43779lxsz3hx3pkpucetdd4kzrl56hk52nwa5dfu97y2gq9axxffftx726e5n8ch2na4c8wn98yxcjpzzdpdkj86655g4hynsgwf35af"

[validator_account.eth_hot_key]
pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx"
authorization = "signam1qy04m2dqtvwrkk7rjxzpeua89hag2yc38rm3z9ljeg9c7ymp35tuqfd7yk0w4epnsydfvdyd682lvcrtzf28rdkd8snzmmyj846r36zyqq77j5s0"
authorization = "signam1q8t7shqzpmdwtfumrahs022mt96mazwq2d843sad4dgcvz9prlj6x37qp7nvhpluclq8ta4sjkg7da77e9xlvyh4eujc3v936egqqf4eqytrku9n"

[validator_account.eth_cold_key]
pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv"
authorization = "signam1q8pmqdqcqh9v8djeqlrzy4mv845v9harnm9u5z54nwlrhwkyvc9y79sv0ucaa08c7y3xypcn7wqj6qvjqzfzs9h89hesuxttlujswz5wqyux24m9"
authorization = "signam1qxe6c5h7sfrsampxlhsxdkq33zmetwg45y2lqxxhf4v7sy7sa933xat3m9f4g76dpzvpnaedrdy4d7t5xfmwmu0u9cdgdu8pgwqx9k8zqyzkce99"

[validator_account.metadata]
email = "[email protected]"

[validator_account.signatures]
tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qz3ylgxm3sr9d68ktwf078vt89dn9v8xj0c7tnytevnsd0v29kh6wmnqsfxd5mke8nrdlwve850l3uwcquxw2e7nltqt8eufds6ns6cqfzastc"
tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qqtljxqp03xhfcfg7vpnmxeuke97kqz5etmdzwvkmr08r4x9wj4ckzf6wlqzse8d05p3t70yyn3pd34kjvx87fzp3sytn4vp6adajrgx5uk8my"

[[bond]]
source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx"
Expand Down
Loading
Loading