mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Retire storage_items! (#3950)
* Retire storage_items * Add storage_items! tests to srml/support/tests * Assimilate genesis config
This commit is contained in:
@@ -20,12 +20,13 @@
|
||||
use rstd::prelude::*;
|
||||
use runtime_io::{storage_root, storage_changes_root, blake2_256};
|
||||
use runtime_support::storage::{self, StorageValue, StorageMap};
|
||||
use runtime_support::storage_items;
|
||||
use runtime_support::{decl_storage, decl_module};
|
||||
use sr_primitives::{
|
||||
traits::{Hash as HashT, BlakeTwo256, Header as _}, generic, ApplyError, ApplyResult,
|
||||
transaction_validity::{TransactionValidity, ValidTransaction, InvalidTransaction},
|
||||
};
|
||||
use codec::{KeyedVec, Encode};
|
||||
use srml_system::Trait;
|
||||
use crate::{
|
||||
AccountId, BlockNumber, Extrinsic, Transfer, H256 as Hash, Block, Header, Digest, AuthorityId
|
||||
};
|
||||
@@ -34,14 +35,20 @@ use primitives::storage::well_known_keys;
|
||||
const NONCE_OF: &[u8] = b"nonce:";
|
||||
const BALANCE_OF: &[u8] = b"balance:";
|
||||
|
||||
storage_items! {
|
||||
ExtrinsicData: b"sys:xtd" => required map [ u32 => Vec<u8> ];
|
||||
// The current block number being processed. Set by `execute_block`.
|
||||
Number: b"sys:num" => BlockNumber;
|
||||
ParentHash: b"sys:pha" => required Hash;
|
||||
NewAuthorities: b"sys:new_auth" => Vec<AuthorityId>;
|
||||
StorageDigest: b"sys:digest" => Digest;
|
||||
Authorities get(authorities): b"sys:auth" => default Vec<AuthorityId>;
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as TestRuntime {
|
||||
ExtrinsicData: map u32 => Vec<u8>;
|
||||
// The current block number being processed. Set by `execute_block`.
|
||||
Number get(fn number): Option<BlockNumber>;
|
||||
ParentHash get(fn parent_hash): Hash;
|
||||
NewAuthorities get(fn new_authorities): Option<Vec<AuthorityId>>;
|
||||
StorageDigest get(fn storage_digest): Option<Digest>;
|
||||
Authorities get(fn authorities) config(): Vec<AuthorityId>;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn balance_of_key(who: AccountId) -> Vec<u8> {
|
||||
@@ -70,6 +77,10 @@ pub fn initialize_block(header: &Header) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn authorities() -> Vec<AuthorityId> {
|
||||
Authorities::get()
|
||||
}
|
||||
|
||||
pub fn get_block_number() -> Option<BlockNumber> {
|
||||
Number::get()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user