diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 9c96aa000..041a719a3 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -91,18 +91,10 @@ impl pallet_timestamp::Config for Test { type WeightInfo = (); } -parameter_types! { - pub const BondingDuration: EraIndex = 10; - pub const DdcAccountsPalletId: PalletId = PalletId(*b"accounts"); -} - impl crate::pallet::Config for Test { - type BondingDuration = BondingDuration; type Currency = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; type WeightInfo = (); - type StakersPayoutSource = DdcAccountsPalletId; type ClusterVisitor = TestClusterVisitor; } @@ -125,8 +117,14 @@ impl ClusterVisitor for TestClusterVisitor { fn get_chill_delay( _cluster_id: &ClusterId, _node_type: NodeType, - ) -> Result { - Ok(10) + ) -> Result { + Ok(T::BlockNumber::from(10u32)) + } + fn get_unbonding_delay( + _cluster_id: &ClusterId, + _node_type: NodeType, + ) -> Result { + Ok(T::BlockNumber::from(10u32)) } } pub struct ExtBuilder { diff --git a/pallets/ddc-staking/src/tests.rs b/pallets/ddc-staking/src/tests.rs index 7bc66787d..10f325b46 100644 --- a/pallets/ddc-staking/src/tests.rs +++ b/pallets/ddc-staking/src/tests.rs @@ -113,9 +113,9 @@ fn staking_should_work() { assert_ok!(DdcStaking::chill(RuntimeOrigin::signed(4))); // Removal is scheduled, stashed value of 4 is still lock. - let chilling = DdcStaking::current_era().unwrap() + - TestClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN) - .unwrap_or(10_u32); + let chilling = System::block_number() + BlockNumber::from(10u64); + // TestClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN) + // .unwrap_or(10_u64); assert_eq!( DdcStaking::ledger(&4), Some(StakingLedger { @@ -131,7 +131,7 @@ fn staking_should_work() { assert_ok!(Balances::reserve(&3, 409)); // Set `CurrentEra` to the value allows us to chill. - while DdcStaking::current_era().unwrap() < chilling { + while System::block_number() < chilling { System::set_block_number(System::block_number() + 1); Timestamp::set_timestamp(System::block_number() * BLOCK_TIME + INIT_TIMESTAMP); DdcStaking::on_finalize(System::block_number());