Skip to content

Commit

Permalink
Check that total weight does not exceed maximum
Browse files Browse the repository at this point in the history
  • Loading branch information
maltekliemann committed Mar 28, 2022
1 parent b386e84 commit 256281a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions zrml/swaps/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,28 @@ fn create_pool_fails_on_weight_above_maximum_weight() {
});
}

#[test]
fn create_pool_fails_on_total_weight_above_maximum_total_weight() {
ExtBuilder::default().build().execute_with(|| {
ASSETS.iter().cloned().for_each(|asset| {
let _ = Currencies::deposit(asset, &BOB, _100);
});
let weight = <Runtime as crate::Config>::MaxTotalWeight::get() / 4 + 100;
assert_noop!(
Swaps::create_pool(
BOB,
ASSETS.iter().cloned().collect(),
Some(ASSETS.last().unwrap().clone()),
0,
ScoringRule::CPMM,
Some(0),
Some(vec![weight; 4]),
),
crate::Error::<Runtime>::MaxTotalWeight,
);
});
}

fn alice_signed() -> Origin {
Origin::signed(ALICE)
}
Expand Down

0 comments on commit 256281a

Please sign in to comment.