Add Many Sanity Checks to Crowdloans (#2745)

* Add many sanity checks to Crowdloans

* fix tests

* test contribution block in integration test

* fix rococo build

* remove leaser from crowdloans

* fix docs and terms

* fix compile
This commit is contained in:
Shawn Tabrizi
2021-03-29 16:52:55 +02:00
committed by GitHub
parent 7c21dbbdf4
commit 76db00f398
4 changed files with 148 additions and 90 deletions
@@ -360,7 +360,7 @@ fn basic_end_to_end_works() {
910, // Amount
));
// User 2 will be a contribute to crowdfund for parachain 2
// User 2 will be a contribute to crowdloan for parachain 2
Balances::make_free_balance_be(&2, 1_000);
assert_ok!(Crowdloan::contribute(Origin::signed(2), ParaId::from(2), 920, None));
@@ -388,6 +388,10 @@ fn basic_end_to_end_works() {
vec![None, None, None, None, None, Some((crowdloan_account, 920)), Some((crowdloan_account, 920))],
);
// Should not be able to contribute to a winning crowdloan
Balances::make_free_balance_be(&3, 1_000);
assert_noop!(Crowdloan::contribute(Origin::signed(3), ParaId::from(2), 10, None), CrowdloanError::<Test>::BidOrLeaseActive);
// New leases will start on block 400
let lease_start_block = 400;
run_to_block(lease_start_block);
@@ -616,7 +620,7 @@ fn competing_bids() {
n * 900, // Amount
));
} else {
// User 20 will be a contribute to crowdfund for parachain 2
// User 20 will be a contribute to crowdloan for parachain 2
assert_ok!(Crowdloan::contribute(
Origin::signed(n * 10),
ParaId::from(para),