mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 14:48:01 +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:
@@ -634,15 +634,12 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use support::{assert_ok, impl_outer_origin, parameter_types};
|
||||
use runtime_io::with_externalities;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use primitives::H256;
|
||||
// The testing primitives are very useful for avoiding having to work with signatures
|
||||
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
|
||||
use sr_primitives::{
|
||||
Perbill,
|
||||
set_and_run_with_externalities, Perbill, weights::GetDispatchInfo, testing::Header,
|
||||
traits::{BlakeTwo256, OnInitialize, OnFinalize, IdentityLookup},
|
||||
weights::GetDispatchInfo,
|
||||
testing::Header
|
||||
};
|
||||
|
||||
impl_outer_origin! {
|
||||
@@ -707,7 +704,7 @@ mod tests {
|
||||
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
fn new_test_ext() -> runtime_io::TestExternalities<Blake2Hasher> {
|
||||
fn new_test_ext() -> runtime_io::TestExternalities {
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
balances::GenesisConfig::<Test>::default().assimilate_storage(&mut t).unwrap();
|
||||
@@ -722,7 +719,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn it_works_for_optional_value() {
|
||||
with_externalities(&mut new_test_ext(), || {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
// Check that GenesisBuilder works properly.
|
||||
assert_eq!(Example::dummy(), Some(42));
|
||||
|
||||
@@ -743,7 +740,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn it_works_for_default_value() {
|
||||
with_externalities(&mut new_test_ext(), || {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
assert_eq!(Example::foo(), 24);
|
||||
assert_ok!(Example::accumulate_foo(Origin::signed(1), 1));
|
||||
assert_eq!(Example::foo(), 25);
|
||||
@@ -752,7 +749,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn signed_ext_watch_dummy_works() {
|
||||
with_externalities(&mut new_test_ext(), || {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
let call = <Call<Test>>::set_dummy(10);
|
||||
let info = DispatchInfo::default();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user