Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Check the string length of the validator name in provided metadata.
([\#3779](https://github.com/anoma/namada/pull/3779))
9 changes: 9 additions & 0 deletions crates/apps_lib/src/config/genesis/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,15 @@ pub fn validate_validator_account(
);
}
}
if let Some(name) = metadata.name.as_ref() {
if name.len() as u64 > MAX_VALIDATOR_METADATA_LEN {
panic!(
"The name metadata of the validator with address {} is too \
long, must be within {MAX_VALIDATOR_METADATA_LEN} characters",
signed_tx.data.address
);
}
}

// Check signature
let mut is_valid = {
Expand Down
12 changes: 12 additions & 0 deletions crates/sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,18 @@ pub async fn build_validator_metadata_change(
}
}
}
if let Some(name) = name.as_ref() {
if name.len() as u64 > MAX_VALIDATOR_METADATA_LEN {
edisplay_line!(
context.io(),
"Name provided is too long, must be within \
{MAX_VALIDATOR_METADATA_LEN} characters"
);
if !tx_args.force {
return Err(Error::from(TxSubmitError::MetadataTooLong));
}
}
}

// If there's a new commission rate, it must be valid
if let Some(rate) = commission_rate.as_ref() {
Expand Down