Skip to content

Commit

Permalink
Fail if expiration options not comparable
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Sep 26, 2020
1 parent a940f54 commit bab274e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contracts/cw3-fixed-multisig/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ pub fn handle_propose<S: Storage, A: Api, Q: Querier>(
// max expires also used as default
let max_expires = cfg.max_voting_period.after(&env.block);
let mut expires = latest.unwrap_or(max_expires);
// FIXME: partial_cmp() fails when expires is height based, but max_expires is time-based (by example)
if expires.partial_cmp(&max_expires) != Some(Ordering::Less) {
let comp = expires.partial_cmp(&max_expires);
if let Some(Ordering::Greater) = comp {
expires = max_expires;
} else if let None = comp {
return Err(StdError::generic_err("Wrong expiration option"));
}

// create a proposal
Expand Down

0 comments on commit bab274e

Please sign in to comment.