Commit 2e100fd9 authored by Shawn Tabrizi's avatar Shawn Tabrizi
Browse files

onboard and begin retirement no longer exist

parent 900a37fc
Pipeline #123362 failed with stages
in 5 minutes and 36 seconds
......@@ -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(|| {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment