#![cfg(test)]
use super::*;
use frame_support::{
construct_runtime,
traits::{ConstU32, ConstU64, Everything},
};
use sp_core::H256;
use sp_runtime::{traits::IdentityLookup, BuildStorage};
use crate as gradually_update;
pub type AccountId = u128;
impl frame_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}
impl Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UpdateFrequency = ConstU64<10>;
type DispatchOrigin = frame_system::EnsureRoot<AccountId>;
type WeightInfo = ();
type MaxGraduallyUpdate = ConstU32<3>;
type MaxStorageKeyBytes = ConstU32<100_000>;
type MaxStorageValueBytes = ConstU32<100_000>;
}
type Block = frame_system::mocking::MockBlock<Runtime>;
construct_runtime!(
pub enum Runtime {
System: frame_system,
GraduallyUpdateModule: gradually_update,
}
);
pub struct ExtBuilder;
impl Default for ExtBuilder {
fn default() -> Self {
ExtBuilder
}
}
impl ExtBuilder {
pub fn build(self) -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::<Runtime>::default()
.build_storage()
.unwrap();
t.into()
}
}