mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-05 19:07:23 +00:00
integrate new primitives with native-runtime
This commit is contained in:
@@ -21,7 +21,7 @@ use runtime_std::mem;
|
||||
use runtime_std::cell::RefCell;
|
||||
use runtime_std::rc::Rc;
|
||||
|
||||
use primitives::{BlockNumber, Digest};
|
||||
use primitives::block::{Number as BlockNumber, Digest};
|
||||
|
||||
#[derive(Default)]
|
||||
/// The information that can be accessed globally.
|
||||
|
||||
@@ -24,9 +24,8 @@ use codec::{Slicable, KeyedVec};
|
||||
|
||||
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
|
||||
pub fn get<T: Slicable + Sized>(key: &[u8]) -> Option<T> {
|
||||
Slicable::set_as_slice(|out, offset|
|
||||
runtime_std::read_storage(&twox_128(key)[..], out, offset) >= out.len()
|
||||
)
|
||||
let raw = runtime_std::storage(&twox_128(key)[..]);
|
||||
Slicable::from_slice(&mut &raw[..])
|
||||
}
|
||||
|
||||
/// Return the value of the item in storage under `key`, or the type's default if there is no
|
||||
@@ -216,10 +215,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn proposals_can_be_stored() {
|
||||
use primitives::{Proposal, InternalFunction};
|
||||
use primitives::proposal::{Proposal, InternalFunction};
|
||||
let mut t = TestExternalities { storage: HashMap::new(), };
|
||||
with_externalities(&mut t, || {
|
||||
let x = Proposal { function: InternalFunction::StakingSetSessionsPerEra, input_data: b"Hello world".to_vec() };
|
||||
let x = Proposal {
|
||||
function: InternalFunction::StakingSetSessionsPerEra(25519),
|
||||
};
|
||||
put(b":test", &x);
|
||||
let y: Proposal = get(b":test").unwrap();
|
||||
assert_eq!(x, y);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Testing helpers.
|
||||
|
||||
use primitives::AccountID;
|
||||
use primitives::AccountId;
|
||||
use super::statichex::StaticHexInto;
|
||||
|
||||
#[macro_export]
|
||||
@@ -27,11 +27,11 @@ macro_rules! map {
|
||||
}
|
||||
|
||||
/// One account (to which we know the secret key).
|
||||
pub fn one() -> AccountID {
|
||||
pub fn one() -> AccountId {
|
||||
"2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee".convert()
|
||||
}
|
||||
/// Another account (secret key known).
|
||||
pub fn two() -> AccountID {
|
||||
pub fn two() -> AccountId {
|
||||
"d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a".convert()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user