Split off TypeId so as not to pull in sr-io (#3740)

* Add type-id

* Builds with std now.

* Fix for cargo

* Remove unneeded stuff

* Move TypeId.
This commit is contained in:
Gavin Wood
2019-10-03 12:37:37 +02:00
committed by GitHub
parent 18fa1d15ce
commit 251d33cb74
3 changed files with 8 additions and 9 deletions
+1 -7
View File
@@ -23,7 +23,7 @@ use runtime_io;
use std::fmt::{Debug, Display};
#[cfg(feature = "std")]
use serde::{Serialize, Deserialize, de::DeserializeOwned};
use primitives::{self, Hasher, Blake2Hasher};
use primitives::{self, Hasher, Blake2Hasher, TypeId};
use crate::codec::{Codec, Encode, Decode, HasCompact};
use crate::transaction_validity::{
ValidTransaction, TransactionValidity, TransactionValidityError, UnknownTransaction,
@@ -1123,12 +1123,6 @@ pub trait AccountIdConversion<AccountId>: Sized {
fn try_from_sub_account<S: Decode>(x: &AccountId) -> Option<(Self, S)>;
}
/// Provide a simple 4 byte identifier for a type.
pub trait TypeId {
/// Simple 4 byte identifier.
const TYPE_ID: [u8; 4];
}
/// Format is TYPE_ID ++ encode(parachain ID) ++ 00.... where 00... is indefinite trailing zeroes to
/// fill AccountId.
impl<T: Encode + Decode + Default, Id: Encode + Decode + TypeId> AccountIdConversion<T> for Id {