Skip to content

Commit d83d425

Browse files
committed
temporarily comment tests for eligibility proxy until update to Substrate 3 for treasury
1 parent 87d810b commit d83d425

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

runtime/tests/cli_integration_tests_mining_tokens.rs

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// extern crate env as env;
2+
extern crate membership_supernodes as membership_supernodes;
23
extern crate mining_claims_token as mining_claims_token;
34
extern crate mining_config_token as mining_config_token;
5+
// extern crate mining_eligibility_proxy as mining_eligibility_proxy;
46
extern crate mining_eligibility_token as mining_eligibility_token;
57
extern crate mining_execution_token as mining_execution_token;
68
extern crate mining_rates_token as mining_rates_token;
@@ -15,11 +17,13 @@ mod tests {
1517
assert_ok,
1618
impl_outer_origin,
1719
parameter_types,
20+
traits::EnsureOrigin,
1821
weights::{
1922
IdentityFee,
2023
Weight,
2124
},
2225
};
26+
use frame_system::EnsureRoot;
2327

2428
use sp_core::H256;
2529
use sp_runtime::{
@@ -30,10 +34,16 @@ mod tests {
3034
Zero,
3135
},
3236
DispatchResult,
37+
ModuleId,
3338
Perbill,
39+
Percent,
3440
Permill,
3541
};
3642
// Import Trait for each runtime module being tested
43+
use membership_supernodes::{
44+
Module as MembershipSupernodesModule,
45+
Trait as MembershipSupernodesTrait,
46+
};
3747
use mining_claims_token::{
3848
MiningClaimsTokenClaimResult,
3949
Module as MiningClaimsTokenModule,
@@ -45,6 +55,12 @@ mod tests {
4555
Module as MiningConfigTokenModule,
4656
Trait as MiningConfigTokenTrait,
4757
};
58+
// use mining_eligibility_proxy::{
59+
// MiningEligibilityProxyClaimRewardeeData,
60+
// MiningEligibilityProxyResult,
61+
// Module as MiningEligibilityProxyModule,
62+
// Trait as MiningEligibilityProxyTrait,
63+
// };
4864
use mining_eligibility_token::{
4965
MiningEligibilityTokenResult,
5066
Module as MiningEligibilityTokenModule,
@@ -123,13 +139,61 @@ mod tests {
123139
type MaxLocks = ();
124140
type WeightInfo = ();
125141
}
142+
type BlockNumber = u32;
126143
impl pallet_transaction_payment::Trait for Test {
127144
type Currency = Balances;
128145
type FeeMultiplierUpdate = ();
129146
type OnTransactionPayment = ();
130147
type TransactionByteFee = ();
131148
type WeightToFee = IdentityFee<u64>;
132149
}
150+
// parameter_types! {
151+
// pub const ProposalBond: Permill = Permill::from_percent(5);
152+
// pub const ProposalBondMinimum: BlockNumber = 1_000_000_000_000_000_000;
153+
// pub const SpendPeriod: BlockNumber = 1;
154+
// pub const Burn: Permill = Permill::from_percent(0);
155+
// pub const TipCountdown: BlockNumber = 1;
156+
// pub const TipFindersFee: Percent = Percent::from_percent(20);
157+
// pub const TipReportDepositBase: u32 = 1_000_000_000_000_000_000;
158+
// pub const MaximumReasonLength: u32 = 16384;
159+
// pub const BountyValueMinimum: u64 = 1;
160+
// pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
161+
// pub const BountyDepositBase: u64 = 80;
162+
// pub const BountyDepositPayoutDelay: u32 = 3;
163+
// pub const BountyUpdatePeriod: u32 = 20;
164+
// pub const DataDepositPerByte: u64 = 1;
165+
// pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
166+
// }
167+
168+
// impl pallet_treasury::Trait for Test {
169+
// // type ApproveOrigin = pallet_collective::EnsureMembers<_4, AccountId, GeneralCouncilInstance>;
170+
// type ApproveOrigin = EnsureRoot<u64>;
171+
// type BountyCuratorDeposit = BountyCuratorDeposit;
172+
// type BountyDepositBase = BountyDepositBase;
173+
// type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
174+
// type BountyUpdatePeriod = BountyUpdatePeriod;
175+
// type BountyValueMinimum = BountyValueMinimum;
176+
// type Burn = Burn;
177+
// type BurnDestination = ();
178+
// type Currency = Balances;
179+
// type DataDepositPerByte = DataDepositPerByte;
180+
// type Event = ();
181+
// type MaximumReasonLength = MaximumReasonLength;
182+
// type ModuleId = TreasuryModuleId;
183+
// type OnSlash = ();
184+
// type ProposalBond = ProposalBond;
185+
// type ProposalBondMinimum = ProposalBondMinimum;
186+
// // type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, GeneralCouncilInstance>;
187+
// type RejectOrigin = EnsureRoot<u64>;
188+
// type SpendPeriod = SpendPeriod;
189+
// type TipCountdown = TipCountdown;
190+
// type TipFindersFee = TipFindersFee;
191+
// type TipReportDepositBase = TipReportDepositBase;
192+
// // FIXME - upgrade to Substrate 3 since does not use Tippers, only then
193+
// // can we add tests for the eligibility/proxy code
194+
// // type Tippers = GeneralCouncilProvider;
195+
// type WeightInfo = ();
196+
// }
133197
// FIXME - remove this when figure out how to use these types within mining-speed-boost runtime module itself
134198
impl roaming_operators::Trait for Test {
135199
type Currency = Balances;
@@ -170,6 +234,12 @@ mod tests {
170234
type MiningEligibilityTokenLockedPercentage = u32;
171235
// type MiningEligibilityTokenAuditorAccountID = u64;
172236
}
237+
// impl MiningEligibilityProxyTrait for Test {
238+
// type Currency = Balances;
239+
// type Event = ();
240+
// type MembershipSource = MembershipSupernodes;
241+
// type MiningEligibilityProxyIndex = u64;
242+
// }
173243
impl MiningClaimsTokenTrait for Test {
174244
type Event = ();
175245
type MiningClaimsTokenClaimAmount = u64;
@@ -179,16 +249,22 @@ mod tests {
179249
type Event = ();
180250
type MiningExecutionTokenIndex = u64;
181251
}
252+
impl MembershipSupernodesTrait for Test {
253+
type Event = ();
254+
}
182255

183256
type System = frame_system::Module<Test>;
184257
pub type Balances = pallet_balances::Module<Test>;
185258
pub type MiningConfigTokenTestModule = MiningConfigTokenModule<Test>;
186259
pub type MiningRatesTokenTestModule = MiningRatesTokenModule<Test>;
187260
pub type MiningSamplingTokenTestModule = MiningSamplingTokenModule<Test>;
188261
pub type MiningEligibilityTokenTestModule = MiningEligibilityTokenModule<Test>;
262+
// pub type MiningEligibilityProxyTestModule = MiningEligibilityProxyModule<Test>;
189263
pub type MiningClaimsTokenTestModule = MiningClaimsTokenModule<Test>;
190264
pub type MiningExecutionTokenTestModule = MiningExecutionTokenModule<Test>;
265+
pub type MembershipSupernodesTestModule = MembershipSupernodesModule<Test>;
191266
type Randomness = pallet_randomness_collective_flip::Module<Test>;
267+
type MembershipSupernodes = membership_supernodes::Module<Test>;
192268

193269
// This function basically just builds a genesis storage key/value store according to
194270
// our desired mockup.
@@ -459,6 +535,46 @@ mod tests {
459535
);
460536
// TODO - check that the locked amount has actually been locked and check that a sampling, eligibility, and
461537
// claim were all run automatically afterwards assert!(false);
538+
539+
// TODO - restore the below after update to Substrate 3
540+
541+
// // Eligibility Proxy Tests
542+
// assert_ok!(MiningEligibilityProxyTestModule::create(Origin::signed(0)));
543+
544+
// let rewardee_data = MiningEligibilityProxyClaimRewardeeData {
545+
// proxy_claim_rewardee_account_id: 0,
546+
// proxy_claim_reward_amount: 1000,
547+
// proxy_claim_start_block: 0,
548+
// proxy_claim_interval_blocks: 10,
549+
// };
550+
// let mut proxy_claim_rewardees_data: Vec<MiningEligibilityProxyClaimRewardeeData<u64, u64, u64, u64>> =
551+
// Vec::new();
552+
// proxy_claim_rewardees_data.push(rewardee_data);
553+
554+
// // Override by DAO if necessary
555+
// assert_ok!(MiningEligibilityProxyTestModule::proxy_eligibility_claim(
556+
// Origin::signed(0),
557+
// 0, // mining_eligibility_proxy_id
558+
// 1000, // _proxy_claim_total_reward_amount
559+
// Some(proxy_claim_rewardees_data),
560+
// ));
561+
562+
// // Verify Storage
563+
// assert_eq!(MiningEligibilityProxyTestModule::mining_eligibility_proxy_count(), 1);
564+
// assert!(MiningEligibilityProxyTestModule::mining_eligibility_proxy(0).is_some());
565+
// assert_eq!(MiningEligibilityProxyTestModule::mining_eligibility_proxy_owner(0), Some(0));
566+
567+
// // Check that data about the proxy claim and rewardee data has been stored.
568+
569+
// assert_eq!(
570+
// MiningEligibilityProxyTestModule::mining_eligibility_proxy_eligibility_results(0),
571+
// Some(MiningEligibilityProxyResult {
572+
// proxy_claim_requestor_account_id: 0u64,
573+
// proxy_claim_total_reward_amount: 1000u64,
574+
// proxy_claim_rewardees_data: proxy_claim_rewardees_data,
575+
// proxy_claim_block_redeemed: 11u64, // current block
576+
// })
577+
// );
462578
});
463579
}
464580
}

0 commit comments

Comments
 (0)