Open
Description
When integrating the latest scale-info
master
into substrate (see https://github.com/paritytech/substrate/compare/aj-metadata-vnext) I receive the following error:
It appears to have been introduced in #53.
Removing the TypeInfo
derive on MultiAddress
makes it compile:
diff --git a/primitives/runtime/src/multiaddress.rs b/primitives/runtime/src/multiaddress.rs
index a47201008..d09cd7aca 100644
--- a/primitives/runtime/src/multiaddress.rs
+++ b/primitives/runtime/src/multiaddress.rs
@@ -21,7 +21,7 @@ use codec::{Encode, Decode};
use sp_std::vec::Vec;
/// A multi-format address wrapper for on-chain accounts.
-#[derive(Encode, Decode, PartialEq, Eq, Clone, crate::RuntimeDebug, scale_info::TypeInfo)]
+#[derive(Encode, Decode, PartialEq, Eq, Clone, crate::RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Hash))]
pub enum MultiAddress<AccountId, AccountIndex> {
/// It's an account ID (pubkey).
diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs
index 00fae6fe6..0fdf6d55b 100644
--- a/primitives/runtime/src/traits.rs
+++ b/primitives/runtime/src/traits.rs
@@ -203,7 +203,7 @@ pub trait Lookup {
/// context.
pub trait StaticLookup {
/// Type to lookup from.
- type Source: Codec + Clone + PartialEq + Debug + scale_info::TypeInfo;
+ type Source: Codec + Clone + PartialEq + Debug;
/// Type to lookup into.
type Target;
/// Attempt a lookup.
Here is the expanded derived TypeInfo impl for MultiAddress
:
impl<AccountId, AccountIndex> ::scale_info::TypeInfo for MultiAddress<AccountId, AccountIndex>
where
AccountId: ::scale_info::TypeInfo + 'static,
AccountIndex: ::codec::HasCompact,
<AccountIndex as ::codec::HasCompact>::Type: ::scale_info::TypeInfo + 'static,
AccountId: ::scale_info::TypeInfo + 'static,
AccountIndex: ::scale_info::TypeInfo + 'static,
{
type Identity = Self;
fn type_info() -> ::scale_info::Type {
::scale_info::Type::builder()
.path(::scale_info::Path::new(
"MultiAddress",
"sp_runtime::multiaddress",
))
.type_params(<[_]>::into_vec(box [
::scale_info::meta_type::<AccountId>(),
::scale_info::meta_type::<AccountIndex>(),
]))
.variant(
::scale_info::build::Variants::with_fields()
.variant(
"Id",
::scale_info::build::Fields::unnamed()
.field_of::<AccountId>("AccountId"),
)
.variant(
"Index",
::scale_info::build::Fields::unnamed()
.compact_of::<AccountIndex>("AccountIndex"),
)
.variant(
"Raw",
::scale_info::build::Fields::unnamed()
.field_of::<Vec<u8>>("Vec<u8>"),
)
.variant(
"Address32",
::scale_info::build::Fields::unnamed()
.field_of::<[u8; 32]>("[u8; 32]"),
)
.variant(
"Address20",
::scale_info::build::Fields::unnamed()
.field_of::<[u8; 20]>("[u8; 20]"),
),
)
}
};
Metadata
Assignees
Labels
No labels