Skip to content

Commit 7d81d4d

Browse files
committed
make check and make test working
updates to impl design doc
1 parent fe6a8ca commit 7d81d4d

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

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

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

156182
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
@@ -218,6 +218,9 @@ impl pallet_capacity::Config for Test {
218218
type EpochNumber = u32;
219219
type CapacityPerToken = TestCapacityPerToken;
220220
type RuntimeFreezeReason = RuntimeFreezeReason;
221+
type RewardEra = u32;
222+
type EraLength = ConstU32<5>;
223+
type StakingRewardsPastErasMax = ConstU32<2>;
221224
}
222225

223226
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
@@ -81,7 +81,7 @@ pub use common_runtime::{
8181
};
8282
use frame_support::traits::Contains;
8383

84-
use common_primitives::capacity::StakingRewardsProvider;
84+
// use common_primitives::capacity::StakingRewardsProvider;
8585
#[cfg(feature = "try-runtime")]
8686
use frame_support::traits::{TryStateSelect, UpgradeCheckSelect};
8787

@@ -488,10 +488,10 @@ impl pallet_capacity::Config for Runtime {
488488
type EpochNumber = u32;
489489
type CapacityPerToken = CapacityPerToken;
490490
type RuntimeFreezeReason = RuntimeFreezeReason;
491-
type Era = RewardEra;
491+
type RewardEra = RewardEra;
492492
type EraLength = ConstU32<{ 14 * DAYS }>;
493493
type StakingRewardsPastErasMax = ConstU32<26u32>; // 1 year
494-
type RewardsProvider = StakingRewardsProvider;
494+
// type RewardsProvider = StakingRewardsProvider;
495495
}
496496

497497
impl pallet_schemas::Config for Runtime {
@@ -845,7 +845,7 @@ use pallet_frequency_tx_payment::Call as FrequencyPaymentCall;
845845
use pallet_handles::Call as HandlesCall;
846846
use pallet_messages::Call as MessagesCall;
847847
use pallet_msa::Call as MsaCall;
848-
use pallet_stateful_storage::{types::ItemAction::Delete, Call as StatefulStorageCall};
848+
use pallet_stateful_storage::Call as StatefulStorageCall;
849849

850850
pub struct CapacityEligibleCalls;
851851
impl GetStableWeight<RuntimeCall, Weight> for CapacityEligibleCalls {

0 commit comments

Comments
 (0)