mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Fix cli for structopt 0.3.7 and pin to that version (#4509)
* Fix cli for structopt 0.3.7 and pin to that version This is just some hotfix to make everything compile. In the future it will require another pr to not depend on internals of StructOpt, but that will probably also require some additions to StructOpt itself. To not break the code again with another StructOpt, this also pins the StructOpt version. * Fix benches * Fix for fix
This commit is contained in:
@@ -18,8 +18,7 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use std::collections::HashSet;
|
||||
use ref_thread_local::{ref_thread_local, RefThreadLocal};
|
||||
use std::{cell::RefCell, collections::HashSet};
|
||||
use sp_runtime::testing::Header;
|
||||
use sp_runtime::Perbill;
|
||||
use sp_core::H256;
|
||||
@@ -30,23 +29,23 @@ impl_outer_origin!{
|
||||
pub enum Origin for Runtime where system = frame_system {}
|
||||
}
|
||||
|
||||
ref_thread_local! {
|
||||
static managed ALIVE: HashSet<u64> = HashSet::new();
|
||||
thread_local! {
|
||||
static ALIVE: RefCell<HashSet<u64>> = Default::default();
|
||||
}
|
||||
|
||||
pub fn make_account(who: u64) {
|
||||
ALIVE.borrow_mut().insert(who);
|
||||
ALIVE.with(|a| a.borrow_mut().insert(who));
|
||||
Indices::on_new_account(&who);
|
||||
}
|
||||
|
||||
pub fn kill_account(who: u64) {
|
||||
ALIVE.borrow_mut().remove(&who);
|
||||
ALIVE.with(|a| a.borrow_mut().remove(&who));
|
||||
}
|
||||
|
||||
pub struct TestIsDeadAccount {}
|
||||
impl IsDeadAccount<u64> for TestIsDeadAccount {
|
||||
fn is_dead_account(who: &u64) -> bool {
|
||||
!ALIVE.borrow_mut().contains(who)
|
||||
!ALIVE.with(|a| a.borrow_mut().contains(who))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +69,7 @@ parameter_types! {
|
||||
pub const MaximumBlockLength: u32 = 2 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -88,6 +88,7 @@ impl frame_system::Trait for Runtime {
|
||||
type Version = ();
|
||||
type ModuleToIndex = ();
|
||||
}
|
||||
|
||||
impl Trait for Runtime {
|
||||
type AccountIndex = u64;
|
||||
type IsDeadAccount = TestIsDeadAccount;
|
||||
@@ -97,9 +98,11 @@ impl Trait for Runtime {
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
{
|
||||
let mut h = ALIVE.borrow_mut();
|
||||
h.clear();
|
||||
for i in 1..5 { h.insert(i); }
|
||||
ALIVE.with(|a| {
|
||||
let mut h = a.borrow_mut();
|
||||
h.clear();
|
||||
for i in 1..5 { h.insert(i); }
|
||||
});
|
||||
}
|
||||
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user