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:
Bastian Köcher
2019-10-09 15:50:30 +02:00
committed by GitHub
parent 984c6ac839
commit 8a39be474e
95 changed files with 1600 additions and 1420 deletions
+5 -5
View File
@@ -20,11 +20,11 @@
use super::*;
use crate::mock::{Indices, new_test_ext, make_account, kill_account, TestIsDeadAccount};
use runtime_io::with_externalities;
use sr_primitives::set_and_run_with_externalities;
#[test]
fn indexing_lookup_should_work() {
with_externalities(
set_and_run_with_externalities(
&mut new_test_ext(),
|| {
assert_eq!(Indices::lookup_index(0), Some(1));
@@ -38,7 +38,7 @@ fn indexing_lookup_should_work() {
#[test]
fn default_indexing_on_new_accounts_should_work() {
with_externalities(
set_and_run_with_externalities(
&mut new_test_ext(),
|| {
assert_eq!(Indices::lookup_index(4), None);
@@ -50,7 +50,7 @@ fn default_indexing_on_new_accounts_should_work() {
#[test]
fn reclaim_indexing_on_new_accounts_should_work() {
with_externalities(
set_and_run_with_externalities(
&mut new_test_ext(),
|| {
assert_eq!(Indices::lookup_index(1), Some(2));
@@ -66,7 +66,7 @@ fn reclaim_indexing_on_new_accounts_should_work() {
#[test]
fn alive_account_should_prevent_reclaim() {
with_externalities(
set_and_run_with_externalities(
&mut new_test_ext(),
|| {
assert!(!TestIsDeadAccount::is_dead_account(&2));