Commit 6274048c authored by Andrew Jones's avatar Andrew Jones

Update to latest scale-info

parent 921d3c62
......@@ -20,7 +20,7 @@ ink_primitives = { version = "2.1.0", path = "../primitives/", default-features
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
derive_more = { version = "0.99", default-features = false, features = ["from"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"] }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"] }
[dev-dependencies]
serde_json = "1.0"
......
......@@ -20,13 +20,14 @@ use derive_more::From;
use ink_prelude::collections::btree_map::BTreeMap;
use ink_primitives::Key;
use scale_info::{
meta_type,
form::{
CompactForm,
Form,
MetaForm,
},
IntoCompact,
Metadata,
TypeInfo,
Registry,
};
......@@ -85,11 +86,11 @@ impl CellLayout {
/// Creates a new cell layout.
pub fn new<T>(key: LayoutKey) -> Self
where
T: Metadata,
T: TypeInfo + 'static,
{
Self {
key,
ty: <T as Metadata>::meta_type(),
ty: meta_type::<T>(),
}
}
}
......
......@@ -23,13 +23,14 @@ use alloc::{
};
use core::marker::PhantomData;
use scale_info::{
meta_type,
form::{
CompactForm,
Form,
MetaForm,
},
IntoCompact,
Metadata,
TypeInfo,
Registry,
};
use serde::Serialize;
......@@ -602,7 +603,7 @@ impl TypeSpec {
/// Panics if the given display name is invalid.
pub fn with_name_str<T>(display_name: &'static str) -> Self
where
T: Metadata,
T: TypeInfo + 'static,
{
Self::with_name_segs::<T, _>(display_name.split("::"))
}
......@@ -621,11 +622,11 @@ impl TypeSpec {
/// Panics if the given display name is invalid.
pub fn with_name_segs<T, S>(segments: S) -> Self
where
T: Metadata,
T: TypeInfo + 'static,
S: IntoIterator<Item = <MetaForm as Form>::String>,
{
Self {
id: T::meta_type(),
id: meta_type::<T>(),
display_name: DisplayName::from_segments(segments)
.expect("display name is invalid"),
}
......@@ -634,10 +635,10 @@ impl TypeSpec {
/// Creates a new type specification without a display name.
pub fn new<T>() -> Self
where
T: Metadata,
T: TypeInfo + 'static,
{
Self {
id: T::meta_type(),
id: meta_type::<T>(),
display_name: DisplayName::default(),
}
}
......
......@@ -39,7 +39,7 @@ blake2 = { version = "0.9", optional = true }
# Sadly couldn't be marked as dev-dependency.
# Never use this crate outside of the off-chain environment!
rand = { version = "0.7", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[dev-dependencies]
itertools = "0.9"
......
......@@ -46,7 +46,7 @@ use scale::{
Encode,
};
#[cfg(feature = "std")]
use scale_info::Metadata;
use scale_info::TypeInfo;
/// Types that allow for simple arithmetic operations.
///
......@@ -178,7 +178,7 @@ where
/// The fundamental types of the default configuration.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Metadata))]
#[cfg_attr(feature = "std", derive(TypeInfo))]
pub enum DefaultEnvTypes {}
impl EnvTypes for DefaultEnvTypes {
......@@ -252,7 +252,7 @@ impl scale::Decode for Call {
From,
Default,
)]
#[cfg_attr(feature = "std", derive(Metadata))]
#[cfg_attr(feature = "std", derive(TypeInfo))]
pub struct AccountId([u8; 32]);
impl<'a> TryFrom<&'a [u8]> for AccountId {
......@@ -284,7 +284,7 @@ impl<'a> TryFrom<&'a [u8]> for AccountId {
From,
Default,
)]
#[cfg_attr(feature = "std", derive(Metadata))]
#[cfg_attr(feature = "std", derive(TypeInfo))]
pub struct Hash([u8; 32]);
impl<'a> TryFrom<&'a [u8]> for Hash {
......
......@@ -33,7 +33,7 @@ use ink_primitives::Key;
#[derive(
Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, scale::Encode, scale::Decode,
)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct DynamicAllocation(pub(super) u32);
impl DynamicAllocation {
......
......@@ -19,7 +19,7 @@ use core::ops::{
/// Stores the number of set bits for each 256-bits block in a compact `u8`.
#[derive(Debug, Default, PartialEq, Eq, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct CountFree {
/// Set bits per 256-bit chunk.
counts: [u8; 32],
......@@ -44,7 +44,7 @@ impl IndexMut<u8> for CountFree {
}
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct FullMask(u32);
impl FullMask {
......
......@@ -22,7 +22,7 @@ use super::{
/// A chunk of 256 bits.
#[derive(Debug, Copy, Clone, PartialEq, Eq, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct Bits256 {
bits: [Bits64; 4],
}
......
......@@ -90,7 +90,7 @@ where
///
/// Stores the value as well as the index to its associated key.
#[derive(Debug, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
struct ValueEntry<V> {
/// The value stored in this entry.
value: V,
......
......@@ -48,12 +48,12 @@ const _: () = {
Layout,
StructLayout,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<K, V, H> StorageLayout for StorageHashMap<K, V, H>
where
K: Metadata + Ord + Clone + PackedLayout + 'static,
V: Metadata + PackedLayout + 'static,
K: TypeInfo + Ord + Clone + PackedLayout + 'static,
V: TypeInfo + PackedLayout + 'static,
H: LayoutCryptoHasher + Hasher,
Key: From<<H as Hasher>::Output>,
{
......
......@@ -34,11 +34,11 @@ const _: () = {
Layout,
StructLayout,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<T, N> StorageLayout for SmallVec<T, N>
where
T: PackedLayout + Metadata,
T: PackedLayout + TypeInfo + 'static,
N: LazyArrayLength<T>,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
......
......@@ -54,7 +54,7 @@ where
/// Stores general commonly required information about the storage stash.
#[derive(Debug, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
struct Header {
/// The latest vacant index.
///
......@@ -76,7 +76,7 @@ struct Header {
/// A vacant entry with previous and next vacant indices.
#[derive(Debug, Copy, Clone, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct VacantEntry {
/// The next vacant index.
next: Index,
......@@ -89,7 +89,7 @@ pub struct VacantEntry {
/// The vacant entries within a storage stash form a doubly linked list of
/// vacant entries that is used to quickly re-use their vacant storage.
#[derive(Debug, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub enum Entry<T> {
/// A vacant entry that holds the index to the next and previous vacant entry.
Vacant(VacantEntry),
......
......@@ -45,7 +45,7 @@ const _: () = {
LayoutKey,
StructLayout,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl StorageLayout for Header {
fn layout(key_ptr: &mut KeyPtr) -> Layout {
......@@ -57,7 +57,7 @@ const _: () = {
impl<T> StorageLayout for StorageStash<T>
where
T: PackedLayout + Metadata + 'static,
T: PackedLayout + TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
Layout::Struct(StructLayout::new(vec![
......
......@@ -35,11 +35,11 @@ const _: () = {
Layout,
StructLayout,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<T> StorageLayout for StorageVec<T>
where
T: PackedLayout + Metadata,
T: PackedLayout + TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
Layout::Struct(StructLayout::new(vec![
......
......@@ -96,11 +96,11 @@ const _: () = {
Layout,
LayoutKey,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<T, N> StorageLayout for LazyArray<T, N>
where
T: Metadata,
T: TypeInfo + 'static,
N: LazyArrayLength<T>,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
......
......@@ -160,12 +160,12 @@ const _: () = {
Layout,
LayoutKey,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<K, V, H> StorageLayout for LazyHashMap<K, V, H>
where
K: Ord + scale::Encode,
V: Metadata,
V: TypeInfo + 'static,
H: Hasher + LayoutCryptoHasher,
Key: From<<H as Hasher>::Output>,
{
......
......@@ -206,11 +206,11 @@ const _: () = {
Layout,
LayoutKey,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<T> StorageLayout for LazyIndexMap<T>
where
T: Metadata,
T: TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
let capacity = u32::MAX;
......
......@@ -89,11 +89,11 @@ const _: () = {
Layout,
LayoutKey,
};
use scale_info::Metadata;
use scale_info::TypeInfo;
impl<T> StorageLayout for Pack<T>
where
T: Metadata,
T: TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
Layout::Cell(CellLayout::new::<T>(LayoutKey::from(key_ptr.advance_by(1))))
......
......@@ -41,7 +41,7 @@ use ink_prelude::{
vec::Vec,
};
use ink_primitives::Key;
use scale_info::Metadata;
use scale_info::TypeInfo;
macro_rules! impl_storage_layout_for_primitives {
( $($name:ty),* $(,)? ) => {
......@@ -184,7 +184,7 @@ where
impl<T> StorageLayout for Vec<T>
where
T: Metadata + 'static,
T: TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(
......@@ -195,8 +195,8 @@ where
impl<K, V> StorageLayout for BTreeMap<K, V>
where
K: Metadata + 'static,
V: Metadata + 'static,
K: TypeInfo + 'static,
V: TypeInfo + 'static,
{
fn layout(key_ptr: &mut KeyPtr) -> Layout {
Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(
......@@ -207,7 +207,7 @@ where
// impl<T> StorageLayout for BinaryHeap<T>
// where
// T: Metadata + 'static,
// T: TypeInfo + 'static,
// {
// fn layout(key_ptr: &mut KeyPtr) -> Layout {
// Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(key_ptr.advance_by(1))))
......@@ -216,7 +216,7 @@ where
// impl<T> StorageLayout for BTreeSet<T>
// where
// T: Metadata + 'static,
// T: TypeInfo + 'static,
// {
// fn layout(key_ptr: &mut KeyPtr) -> Layout {
// Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(key_ptr.advance_by(1))))
......@@ -225,7 +225,7 @@ where
// impl<T> StorageLayout for VecDeque<T>
// where
// T: Metadata + 'static,
// T: TypeInfo + 'static,
// {
// fn layout(key_ptr: &mut KeyPtr) -> Layout {
// Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(key_ptr.advance_by(1))))
......@@ -234,7 +234,7 @@ where
// impl<T> StorageLayout for LinkedList<T>
// where
// T: Metadata + 'static,
// T: TypeInfo + 'static,
// {
// fn layout(key_ptr: &mut KeyPtr) -> Layout {
// Layout::Cell(CellLayout::new::<Self>(LayoutKey::from(key_ptr.advance_by(1))))
......
......@@ -15,7 +15,7 @@ scale = { package = "parity-scale-codec", version = "1.3", default-features = fa
adder = { version = "2.1.0", path = "adder", default-features = false, features = ["ink-as-dependency"] }
subber = { version = "2.1.0", path = "subber", default-features = false, features = ["ink-as-dependency"] }
accumulator = { version = "2.1.0", path = "accumulator", default-features = false, features = ["ink-as-dependency"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "delegator"
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../../core", default-features = false
ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "accumulator"
......
......@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false
accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "adder"
......
......@@ -49,7 +49,7 @@ mod delegator {
)]
#[cfg_attr(
feature = "std",
derive(::scale_info::Metadata, ::ink_core::storage2::traits::StorageLayout)
derive(::scale_info::TypeInfo, ::ink_core::storage2::traits::StorageLayout)
)]
pub enum Which {
Adder,
......
......@@ -13,7 +13,7 @@ ink_lang = { version = "2.1.0", path = "../../../lang", default-features = false
accumulator = { version = "2.1.0", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "subber"
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "dns"
......
......@@ -86,7 +86,7 @@ mod dns {
/// Errors that can occur upon calling this contract.
#[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(::scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(::scale_info::TypeInfo))]
pub enum Error {
/// Returned if the name already exists upon registration.
NameAlreadyExists,
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "erc20"
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "erc721"
......
......@@ -93,7 +93,7 @@ mod erc721 {
}
#[derive(Encode, Decode, Debug, PartialEq, Eq, Copy, Clone)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub enum Error {
NotOwner,
NotApproved,
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "flipper"
......
......@@ -11,7 +11,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "incrementer"
......
......@@ -12,7 +12,7 @@ ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
ink_prelude = { version = "2.1.0", path = "../../prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "multisig_plain"
......
......@@ -121,7 +121,7 @@ mod multisig_plain {
#[derive(scale::Encode, scale::Decode, Clone, Copy, SpreadLayout, PackedLayout)]
#[cfg_attr(
feature = "std",
derive(scale_info::Metadata, ink_core::storage2::traits::StorageLayout)
derive(scale_info::TypeInfo, ink_core::storage2::traits::StorageLayout)
)]
pub enum ConfirmationStatus {
/// The transaction is already confirmed.
......@@ -139,7 +139,7 @@ mod multisig_plain {
Debug,
PartialEq,
Eq,
scale_info::Metadata,
scale_info::TypeInfo,
ink_core::storage2::traits::StorageLayout
)
)]
......
......@@ -12,7 +12,7 @@ ink_core = { version = "2.1.0", path = "../../core", default-features = false }
ink_lang = { version = "2.1.0", path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[lib]
name = "runtime_storage"
......
......@@ -36,7 +36,7 @@ ink_lang = { version = "2.1.0", path = ".." }
trybuild = "1.0.24"
pretty_assertions = "0.6.1"
scale-info = { version = "0.1", default-features = false, features = ["derive"] }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"] }
[lib]
name = "ink_lang_macro"
......
......@@ -148,7 +148,7 @@ impl CrossCalling<'_> {
#[cfg_attr(
feature = "std",
derive(
::scale_info::Metadata,
::scale_info::TypeInfo,
::ink_core::storage2::traits::StorageLayout,
)
)]
......
......@@ -8,7 +8,7 @@ mod erc721 {
pub type TokenId = u32;
#[derive(scale::Encode, scale::Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub enum Error {
SpecifiedTokenHasNoOwner,
ApprovalToCurrentOwner,
......
......@@ -21,7 +21,7 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
ink_prelude = { version = "2.1.0", path = "../prelude/", default-features = false }
tiny-keccak = { version = "2.0", features = ["keccak"] }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive", "full"] }
scale-info = { version = "0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { git = "https://github.com/paritytech/scale-info", default-features = false, features = ["derive"], optional = true }
[dev-dependencies]
criterion = "0.3.1"
......
......@@ -35,7 +35,7 @@ use scale::{
///
/// Prefer using types found in `collections` or `Synced` type.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)]
#[cfg_attr(feature = "std", derive(scale_info::Metadata))]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
pub struct Key(pub [u8; 32]);
impl From<[u8; 32]> for Key {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment