Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
onboard and begin retirement no longer exist
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Feb 8, 2021
1 parent 900a37f commit 2e100fd
Showing 1 changed file with 0 additions and 151 deletions.
151 changes: 0 additions & 151 deletions runtime/common/src/crowdloan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,157 +841,6 @@ mod tests {
});
}

/*
#[test]
fn onboard_works() {
new_test_ext().execute_with(|| {
// Set up a crowdloan
//assert_ok!(Slots::new_auction(Origin::root(), 5, 1));
assert_ok!(TestRegistrar::<Test>::make_parathread(0.into()));
TestRegistrar::<Test>::set_manager(0.into(), 1);
assert_ok!(Crowdloan::create(Origin::signed(1), 0.into(), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
// Fund crowdloan
assert_ok!(Crowdloan::contribute(Origin::signed(2), 0.into(), 1000));
run_to_block(10);
// Endings count incremented
assert_eq!(Crowdloan::endings_count(), 1);
let fund = Crowdloan::funds(ParaId::from(0)).unwrap();
// Parathread is now a parachain
assert!(TestRegistrar::<Test>::is_parachain(0.into()));
});
}
#[test]
fn onboard_handles_basic_errors() {
new_test_ext().execute_with(|| {
// Set up a crowdloan
assert_ok!(Slots::new_auction(Origin::root(), 5, 1));
assert_ok!(Crowdloan::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
// Fund crowdloan
assert_ok!(Crowdloan::contribute(Origin::signed(2), 0, 1000));
run_to_block(10);
// Cannot onboard invalid fund index
assert_noop!(Crowdloan::onboard(Origin::signed(1), 1, 0.into()), Error::<Test>::InvalidParaId);
// Cannot onboard crowdloan without deploy data
assert_noop!(Crowdloan::onboard(Origin::signed(1), 0, 0.into()), Error::<Test>::UnsetDeployData);
// Add deploy data
assert_ok!(Crowdloan::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
// Cannot onboard fund with incorrect parachain id
assert_noop!(Crowdloan::onboard(Origin::signed(1), 0, 1.into()), SlotsError::<Test>::ParaNotOnboarding);
// Onboard crowdloan
assert_ok!(Crowdloan::onboard(Origin::signed(1), 0, 0.into()));
// Cannot onboard fund again
assert_noop!(Crowdloan::onboard(Origin::signed(1), 0, 0.into()), Error::<Test>::AlreadyOnboard);
});
}
#[test]
fn begin_retirement_works() {
new_test_ext().execute_with(|| {
// Set up a crowdloan
assert_ok!(Slots::new_auction(Origin::root(), 5, 1));
assert_ok!(Crowdloan::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
// Add deploy data
assert_ok!(Crowdloan::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
// Fund crowdloan
assert_ok!(Crowdloan::contribute(Origin::signed(2), 0, 1000));
run_to_block(10);
// Onboard crowdloan
assert_ok!(Crowdloan::onboard(Origin::signed(1), 0, 0.into()));
// Fund is assigned a parachain id
let fund = Crowdloan::funds(0).unwrap();
assert_eq!(fund.parachain, Some(0.into()));
// Off-boarding is set to the crowdloan account
assert_eq!(Slots::offboarding(ParaId::from(0)), Crowdloan::fund_account_id(0));
run_to_block(50);
// Retire crowdloan to remove parachain id
assert_ok!(Crowdloan::begin_retirement(Origin::signed(1), 0));
// Fund should no longer have parachain id
let fund = Crowdloan::funds(0).unwrap();
assert_eq!(fund.parachain, None);
});
}
#[test]
fn begin_retirement_handles_basic_errors() {
new_test_ext().execute_with(|| {
// Set up a crowdloan
assert_ok!(Slots::new_auction(Origin::root(), 5, 1));
assert_ok!(Crowdloan::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
// Add deploy data
assert_ok!(Crowdloan::fix_deploy_data(
Origin::signed(1),
0,
<Test as frame_system::Config>::Hash::default(),
0,
vec![0].into(),
));
// Fund crowdloan
assert_ok!(Crowdloan::contribute(Origin::signed(2), 0, 1000));
run_to_block(10);
// Cannot retire fund that is not onboarded
assert_noop!(Crowdloan::begin_retirement(Origin::signed(1), 0), Error::<Test>::NotParachain);
// Onboard crowdloan
assert_ok!(Crowdloan::onboard(Origin::signed(1), 0, 0.into()));
// Fund is assigned a parachain id
let fund = Crowdloan::funds(0).unwrap();
assert_eq!(fund.parachain, Some(0.into()));
// Cannot retire fund whose deposit has not been returned
assert_noop!(Crowdloan::begin_retirement(Origin::signed(1), 0), Error::<Test>::ParaAlive);
run_to_block(50);
// Cannot retire invalid fund index
assert_noop!(Crowdloan::begin_retirement(Origin::signed(1), 1), Error::<Test>::InvalidParaId);
// Cannot retire twice
assert_ok!(Crowdloan::begin_retirement(Origin::signed(1), 0));
assert_noop!(Crowdloan::begin_retirement(Origin::signed(1), 0), Error::<Test>::NotParachain);
});
}
*/
#[test]
fn withdraw_works() {
new_test_ext().execute_with(|| {
Expand Down

0 comments on commit 2e100fd

Please sign in to comment.