mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Clean up sr-io (#3609)
* Move trait `Printable` into `sr-primitives` * Cleanup runtime io trie_root interfaces * Remove last generic bits from sr-io interface * Fix srml-sudo after master merge * Fix benchmarks * Runtime bump
This commit is contained in:
@@ -822,7 +822,7 @@ define_env!(Env, <E: Ext>,
|
||||
ext_println(ctx, str_ptr: u32, str_len: u32) => {
|
||||
let data = read_sandbox_memory(ctx, str_ptr, str_len)?;
|
||||
if let Ok(utf8) = core::str::from_utf8(&data) {
|
||||
runtime_io::print(utf8);
|
||||
sr_primitives::print(utf8);
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
|
||||
@@ -562,7 +562,7 @@ decl_module! {
|
||||
|
||||
fn on_initialize(n: T::BlockNumber) {
|
||||
if let Err(e) = Self::end_block(n) {
|
||||
runtime_io::print(e);
|
||||
sr_primitives::print(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#![recursion_limit="128"]
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sr_primitives::traits::{Zero, One, StaticLookup, Bounded, Saturating};
|
||||
use sr_primitives::weights::SimpleDispatchInfo;
|
||||
use runtime_io::print;
|
||||
use sr_primitives::{
|
||||
print, traits::{Zero, One, StaticLookup, Bounded, Saturating}, weights::SimpleDispatchInfo,
|
||||
};
|
||||
use support::{
|
||||
StorageValue, StorageMap,
|
||||
dispatch::Result, decl_storage, decl_event, ensure, decl_module,
|
||||
|
||||
@@ -579,7 +579,7 @@ impl<T: Trait + Send + Sync> SignedExtension for WatchDummy<T> {
|
||||
// check for `set_dummy`
|
||||
match call {
|
||||
Call::set_dummy(..) => {
|
||||
runtime_io::print("set_dummy was received.");
|
||||
sr_primitives::print("set_dummy was received.");
|
||||
|
||||
let mut valid_tx = ValidTransaction::default();
|
||||
valid_tx.priority = Bounded::max_value();
|
||||
|
||||
@@ -217,7 +217,7 @@ where
|
||||
let l = uxt.encode().len();
|
||||
match Self::apply_extrinsic_with_len(uxt, l, None) {
|
||||
Ok(Ok(())) => (),
|
||||
Ok(Err(e)) => runtime_io::print(e),
|
||||
Ok(Err(e)) => sr_primitives::print(e),
|
||||
Err(e) => { let err: &'static str = e.into(); panic!(err) },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,8 @@ use codec::{Encode, Decode};
|
||||
use primitives::offchain::{OpaqueNetworkState, StorageKind};
|
||||
use rstd::prelude::*;
|
||||
use session::historical::IdentificationTuple;
|
||||
use runtime_io::Printable;
|
||||
use sr_primitives::{
|
||||
traits::{Convert, Member}, Perbill,
|
||||
traits::{Convert, Member, Printable}, Perbill,
|
||||
transaction_validity::{
|
||||
TransactionValidity, TransactionLongevity, ValidTransaction, InvalidTransaction,
|
||||
},
|
||||
|
||||
@@ -126,7 +126,7 @@ decl_module! {
|
||||
Ok(_) => true,
|
||||
Err(e) => {
|
||||
let e: DispatchError = e.into();
|
||||
runtime_io::print(e);
|
||||
sr_primitives::print(e);
|
||||
false
|
||||
}
|
||||
};
|
||||
@@ -176,7 +176,7 @@ decl_module! {
|
||||
Ok(_) => true,
|
||||
Err(e) => {
|
||||
let e: DispatchError = e.into();
|
||||
runtime_io::print(e);
|
||||
sr_primitives::print(e);
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,8 +67,8 @@ pub use self::storage::{StorageValue, StorageMap, StorageLinkedMap, StorageDoubl
|
||||
pub use self::hashable::Hashable;
|
||||
pub use self::dispatch::{Parameter, Callable, IsSubType};
|
||||
pub use self::double_map::StorageDoubleMapWithHasher;
|
||||
pub use runtime_io::{print, storage_root, Printable};
|
||||
pub use sr_primitives::{self, ConsensusEngineId};
|
||||
pub use runtime_io::storage_root;
|
||||
pub use sr_primitives::{self, ConsensusEngineId, print, traits::Printable};
|
||||
|
||||
/// Macro for easily creating a new implementation of the `Get` trait. Use similarly to
|
||||
/// how you would declare a `const`:
|
||||
@@ -270,7 +270,8 @@ pub use serde::{Serialize, Deserialize};
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codec::Codec;
|
||||
use runtime_io::{with_externalities, Blake2Hasher};
|
||||
use runtime_io::with_externalities;
|
||||
use primitives::Blake2Hasher;
|
||||
pub use srml_metadata::{
|
||||
DecodeDifferent, StorageEntryMetadata, StorageMetadata, StorageEntryType,
|
||||
StorageEntryModifier, DefaultByte, DefaultByteGetter, StorageHasher
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use runtime_io::{with_externalities, Blake2Hasher};
|
||||
use runtime_io::with_externalities;
|
||||
use primitives::Blake2Hasher;
|
||||
use support::{StorageValue, StorageMap, StorageLinkedMap, StorageDoubleMap};
|
||||
use support::storage::unhashed;
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
#![recursion_limit="128"]
|
||||
|
||||
use runtime_io::{with_externalities, Blake2Hasher};
|
||||
use runtime_io::with_externalities;
|
||||
use support::{
|
||||
Parameter, traits::Get, parameter_types,
|
||||
sr_primitives::{generic, BuildStorage, traits::{BlakeTwo256, Block as _, Verify}},
|
||||
@@ -28,7 +28,7 @@ use support::{
|
||||
use inherents::{
|
||||
ProvideInherent, InherentData, InherentIdentifier, RuntimeString, MakeFatalError
|
||||
};
|
||||
use primitives::{H256, sr25519};
|
||||
use primitives::{H256, sr25519, Blake2Hasher};
|
||||
|
||||
mod system;
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
use criterion::{Criterion, criterion_group, criterion_main, black_box};
|
||||
use srml_system as system;
|
||||
use support::{decl_module, decl_event, impl_outer_origin, impl_outer_event};
|
||||
use runtime_io::{with_externalities, Blake2Hasher};
|
||||
use primitives::H256;
|
||||
use runtime_io::with_externalities;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
|
||||
|
||||
mod module {
|
||||
|
||||
@@ -118,10 +118,10 @@ use safe_mix::TripletMix;
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use runtime_io::{TestExternalities, Blake2Hasher};
|
||||
use runtime_io::TestExternalities;
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use primitives::ChangesTrieConfiguration;
|
||||
use primitives::{ChangesTrieConfiguration, Blake2Hasher};
|
||||
|
||||
pub mod offchain;
|
||||
|
||||
@@ -151,8 +151,7 @@ pub fn extrinsics_root<H: Hash, E: codec::Encode>(extrinsics: &[E]) -> H::Output
|
||||
|
||||
/// Compute the trie root of a list of extrinsics.
|
||||
pub fn extrinsics_data_root<H: Hash>(xts: Vec<Vec<u8>>) -> H::Output {
|
||||
let xts = xts.iter().map(Vec::as_slice).collect::<Vec<_>>();
|
||||
H::ordered_trie_root(&xts)
|
||||
H::ordered_trie_root(xts)
|
||||
}
|
||||
|
||||
pub trait Trait: 'static + Eq + Clone {
|
||||
|
||||
Reference in New Issue
Block a user