Skip to content

Commit

Permalink
fix bug for deleting metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Mar 8, 2024
1 parent 70e6b87 commit 39a62fc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions wasm/wasm_source/src/vp_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ fn validate_pos_changes(
// metadata is manipulated
let is_valid_metadata_change = || {
let validator = is_validator_metadata_key(key);
let metadata = ctx
.post()
.read::<String>(key)?
.expect("Metadata should exist in post state");
let valid_len = (metadata.len() as u64) <= MAX_VALIDATOR_METADATA_LEN; // FIXME: hard-code for now
let metadata = ctx.post().read::<String>(key)?;
let valid_len = if let Some(metadata) = metadata {
(metadata.len() as u64) <= MAX_VALIDATOR_METADATA_LEN
} else {
true
};
let is_valid = match validator {
Some(address) => valid_len && address == owner && **valid_sig,
None => false,
Expand Down

0 comments on commit 39a62fc

Please sign in to comment.