mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-25 22:21:08 +00:00
Move Externalities into its own crate (#3775)
* Move `Externalities` into `substrate-externalities` - `Externalities` now support generic extensions - Split of `primtives-storage` for storage primitive types * Move the externalities scoping into `substrate-externalities` * Fix compilation * Review feedback * Adds macro for declaring extensions * Fix benchmarks * Introduce `ExtensionStore` trait * Last review comments * Implement it for `ExtensionStore`
This commit is contained in:
@@ -26,7 +26,7 @@ use sr_primitives::{
|
||||
};
|
||||
use support::{impl_outer_origin, parameter_types};
|
||||
use runtime_io;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use primitives::H256;
|
||||
|
||||
impl_outer_origin!{
|
||||
pub enum Origin for Test {}
|
||||
@@ -73,7 +73,7 @@ impl Trait for Test {
|
||||
type AuthorityId = AuthorityId;
|
||||
}
|
||||
|
||||
pub fn new_test_ext(authorities: Vec<u64>) -> runtime_io::TestExternalities<Blake2Hasher> {
|
||||
pub fn new_test_ext(authorities: Vec<u64>) -> runtime_io::TestExternalities {
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
GenesisConfig::<Test>{
|
||||
authorities: authorities.into_iter().map(|a| UintAuthorityId(a).to_public_key()).collect(),
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use runtime_io::with_externalities;
|
||||
use sr_primitives::set_and_run_with_externalities;
|
||||
use crate::mock::{Aura, new_test_ext};
|
||||
|
||||
#[test]
|
||||
fn initial_values() {
|
||||
with_externalities(&mut new_test_ext(vec![0, 1, 2, 3]), || {
|
||||
set_and_run_with_externalities(&mut new_test_ext(vec![0, 1, 2, 3]), || {
|
||||
assert_eq!(Aura::last(), 0u64);
|
||||
assert_eq!(Aura::authorities().len(), 4);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user