Skip to content

Commit 9ab8161

Browse files
committed
make check and make test working
updates to impl design doc
1 parent 0f8978b commit 9ab8161

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

common/primitives/src/capacity.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
use crate::msa::MessageSourceId;
12
use codec::{Encode, MaxEncodedLen};
2-
use crate::{
3-
msa::MessageSourceId,
4-
};
53
use frame_support::traits::tokens::Balance;
64
use scale_info::TypeInfo;
75
use sp_api::Decode;
8-
use sp_runtime::{
9-
DispatchError,
10-
};
6+
use sp_runtime::DispatchError;
117

128
/// A trait for checking that a target MSA can be staked to.
139
pub trait TargetValidator {

pallets/capacity/src/tests/mock.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ use sp_runtime::{
1414
traits::{BlakeTwo256, Convert, IdentityLookup},
1515
AccountId32, BuildStorage, DispatchError, Perbill,
1616
};
17+
// use common_primitives::node::{Balance, Hash, RewardEra};
18+
use common_primitives::node::RewardEra;
19+
// use crate::{BalanceOf, StakingRewardClaim, StakingRewardsProvider};
1720

1821
type Block = frame_system::mocking::MockBlockU32<Test>;
1922

@@ -128,6 +131,25 @@ impl pallet_msa::Config for Test {
128131
type MaxSignaturesStored = ConstU32<8000>;
129132
}
130133

134+
// pub struct TestStakingRewardsProvider {}
135+
// impl StakingRewardsProvider<Test> for TestStakingRewardsProvider {
136+
// fn reward_pool_size(era: RewardEra) -> BalanceOf<Test> {
137+
// Balance::from(10_000u64);
138+
// }
139+
//
140+
// fn staking_reward_total(account_id: AccountId, from_era: RewardEra, to_era: RewardEra) -> BalanceOf<Test> {
141+
// Balance::from(10u64)
142+
// }
143+
//
144+
// fn validate_staking_reward_claim(account_id: AccountId, proof: Hash, payload: StakingRewardClaim<Test>) -> bool {
145+
// true
146+
// }
147+
//
148+
// fn payout_eligible(account_id: AccountId) -> bool {
149+
// true
150+
// }
151+
// }
152+
131153
// Needs parameter_types! for the Perbill
132154
parameter_types! {
133155
pub const TestCapacityPerToken: Perbill = Perbill::from_percent(10);
@@ -149,6 +171,10 @@ impl pallet_capacity::Config for Test {
149171
type MaxEpochLength = ConstU32<100>;
150172
type EpochNumber = u32;
151173
type CapacityPerToken = TestCapacityPerToken;
174+
type RewardEra = u32;
175+
type EraLength = ConstU32<10>;
176+
type StakingRewardsPastErasMax = ConstU32<5>;
177+
// type RewardsProvider = TestStakingRewardsProvider;
152178
}
153179

154180
pub fn new_test_ext() -> sp_io::TestExternalities {

pallets/frequency-tx-payment/src/tests/mock.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ impl pallet_capacity::Config for Test {
216216
type MaxEpochLength = ConstU32<100>;
217217
type EpochNumber = u32;
218218
type CapacityPerToken = TestCapacityPerToken;
219+
type RewardEra = u32;
220+
type EraLength = ConstU32<5>;
221+
type StakingRewardsPastErasMax = ConstU32<2>;
219222
}
220223

221224
use pallet_balances::Call as BalancesCall;

runtime/frequency/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub use common_runtime::{
7272
};
7373
use frame_support::traits::Contains;
7474

75-
use common_primitives::capacity::StakingRewardsProvider;
75+
// use common_primitives::capacity::StakingRewardsProvider;
7676
#[cfg(feature = "try-runtime")]
7777
use frame_support::traits::{TryStateSelect, UpgradeCheckSelect};
7878

@@ -415,10 +415,10 @@ impl pallet_capacity::Config for Runtime {
415415
type MaxEpochLength = CapacityMaxEpochLength;
416416
type EpochNumber = u32;
417417
type CapacityPerToken = CapacityPerToken;
418-
type Era = RewardEra;
418+
type RewardEra = RewardEra;
419419
type EraLength = ConstU32<{ 14 * DAYS }>;
420420
type StakingRewardsPastErasMax = ConstU32<26u32>; // 1 year
421-
type RewardsProvider = StakingRewardsProvider;
421+
// type RewardsProvider = StakingRewardsProvider;
422422
}
423423

424424
impl pallet_schemas::Config for Runtime {
@@ -746,7 +746,7 @@ use pallet_frequency_tx_payment::Call as FrequencyPaymentCall;
746746
use pallet_handles::Call as HandlesCall;
747747
use pallet_messages::Call as MessagesCall;
748748
use pallet_msa::Call as MsaCall;
749-
use pallet_stateful_storage::{types::ItemAction::Delete, Call as StatefulStorageCall};
749+
use pallet_stateful_storage::Call as StatefulStorageCall;
750750

751751
pub struct CapacityEligibleCalls;
752752
impl GetStableWeight<RuntimeCall, Weight> for CapacityEligibleCalls {

0 commit comments

Comments
 (0)