Skip to content

Commit

Permalink
test/tx_redelegate: filter out invalid redelegations
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Nov 28, 2023
1 parent 7f4a845 commit 7303dfe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions wasm/wasm_source/proptest-regressions/tx_redelegate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cc 90825d666558e208bb8f4f46c746177abf8bf9499114dcdac1525ab600b7c6ce

22 changes: 14 additions & 8 deletions wasm/wasm_source/src/tx_redelegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,21 @@ mod tests {
address::testing::arb_non_internal_address(),
token::testing::arb_amount_non_zero_ceiled(max_amount),
)
.prop_map(
.prop_filter_map(
"Src and dest validator must not be the same",
|(src_validator, dest_validator, owner, amount)| {
let src_validator = Address::Established(src_validator);
let dest_validator = Address::Established(dest_validator);
transaction::pos::Redelegation {
src_validator,
dest_validator,
owner,
amount,
if src_validator == dest_validator {
None
} else {
let src_validator = Address::Established(src_validator);
let dest_validator =
Address::Established(dest_validator);
Some(transaction::pos::Redelegation {
src_validator,
dest_validator,
owner,
amount,
})
}
},
)
Expand Down

0 comments on commit 7303dfe

Please sign in to comment.