Unverified Commit a526d732 authored by Andrew Jones's avatar Andrew Jones Committed by GitHub
Browse files

[metadata] update scale-info, remove string parameterization (#672)

* Temporarily use new scale-info branch until release

* [metadata] update scale-info, remove string parameterization

* Revert "Temporarily use new scale-info branch until release"

This reverts commit 08a9c2ac

* Upgrade scale-info to 0.6

* Add missing version update
parent 2c085ad1
Pipeline #123654 failed with stages
in 7 minutes and 6 seconds
...@@ -38,7 +38,7 @@ blake2 = { version = "0.9", optional = true } ...@@ -38,7 +38,7 @@ blake2 = { version = "0.9", optional = true }
# Sadly couldn't be marked as dev-dependency. # Sadly couldn't be marked as dev-dependency.
# Never use this crate outside of the off-chain environment! # Never use this crate outside of the off-chain environment!
rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true } rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[features] [features]
default = ["std"] default = ["std"]
......
...@@ -30,7 +30,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../storage/" } ...@@ -30,7 +30,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../storage/" }
ink_lang = { version = "3.0.0-rc2", path = ".." } ink_lang = { version = "3.0.0-rc2", path = ".." }
trybuild = "1.0.24" trybuild = "1.0.24"
scale-info = { version = "0.5", default-features = false, features = ["derive"] } scale-info = { version = "0.6", default-features = false, features = ["derive"] }
[lib] [lib]
name = "ink_lang_macro" name = "ink_lang_macro"
......
...@@ -21,7 +21,7 @@ ink_primitives = { version = "3.0.0-rc2", path = "../primitives/", default-featu ...@@ -21,7 +21,7 @@ ink_primitives = { version = "3.0.0-rc2", path = "../primitives/", default-featu
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] } serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
impl-serde = "0.3.1" impl-serde = "0.3.1"
derive_more = { version = "0.99", default-features = false, features = ["from"] } derive_more = { version = "0.99", default-features = false, features = ["from"] }
scale-info = { version = "0.5", default-features = false, features = ["derive", "serde"] } scale-info = { version = "0.6", default-features = false, features = ["derive", "serde"] }
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6.1" pretty_assertions = "0.6.1"
......
...@@ -47,30 +47,25 @@ use impl_serde::serialize as serde_hex; ...@@ -47,30 +47,25 @@ use impl_serde::serialize as serde_hex;
#[cfg(feature = "derive")] #[cfg(feature = "derive")]
use scale_info::{ use scale_info::{
form::{ form::PortableForm,
FormString,
PortableForm,
},
IntoPortable as _, IntoPortable as _,
PortableRegistry, PortableRegistry,
Registry, Registry,
}; };
use serde::{ use serde::{
de::DeserializeOwned,
Deserialize, Deserialize,
Serialize, Serialize,
}; };
/// An entire ink! project for metadata file generation purposes. /// An entire ink! project for metadata file generation purposes.
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(bound(deserialize = "S: DeserializeOwned"))] pub struct InkProject {
pub struct InkProject<S: FormString = &'static str> {
#[serde(flatten)] #[serde(flatten)]
registry: PortableRegistry<S>, registry: PortableRegistry,
#[serde(rename = "storage")] #[serde(rename = "storage")]
/// The layout of the storage data structure /// The layout of the storage data structure
layout: layout::Layout<PortableForm<S>>, layout: layout::Layout<PortableForm>,
spec: ContractSpec<PortableForm<S>>, spec: ContractSpec<PortableForm>,
} }
impl InkProject { impl InkProject {
...@@ -89,22 +84,19 @@ impl InkProject { ...@@ -89,22 +84,19 @@ impl InkProject {
} }
} }
impl<S> InkProject<S> impl InkProject {
where
S: FormString,
{
/// Returns a read-only registry of types in the contract. /// Returns a read-only registry of types in the contract.
pub fn registry(&self) -> &PortableRegistry<S> { pub fn registry(&self) -> &PortableRegistry {
&self.registry &self.registry
} }
/// Returns the storage layout of the contract. /// Returns the storage layout of the contract.
pub fn layout(&self) -> &layout::Layout<PortableForm<S>> { pub fn layout(&self) -> &layout::Layout<PortableForm> {
&self.layout &self.layout
} }
/// Returns the specification of the contract. /// Returns the specification of the contract.
pub fn spec(&self) -> &ContractSpec<PortableForm<S>> { pub fn spec(&self) -> &ContractSpec<PortableForm> {
&self.spec &self.spec
} }
} }
...@@ -32,7 +32,7 @@ fn spec_constructor_selector_must_serialize_to_hex() { ...@@ -32,7 +32,7 @@ fn spec_constructor_selector_must_serialize_to_hex() {
// when // when
let json = serde_json::to_value(&portable_spec).unwrap(); let json = serde_json::to_value(&portable_spec).unwrap();
let deserialized: ConstructorSpec<PortableForm<String>> = let deserialized: ConstructorSpec<PortableForm> =
serde_json::from_value(json.clone()).unwrap(); serde_json::from_value(json.clone()).unwrap();
// then // then
...@@ -183,7 +183,7 @@ fn trim_docs() { ...@@ -183,7 +183,7 @@ fn trim_docs() {
// when // when
let json = serde_json::to_value(&compact_spec).unwrap(); let json = serde_json::to_value(&compact_spec).unwrap();
let deserialized: ConstructorSpec<PortableForm<String>> = let deserialized: ConstructorSpec<PortableForm> =
serde_json::from_value(json.clone()).unwrap(); serde_json::from_value(json.clone()).unwrap();
// then // then
......
...@@ -17,7 +17,7 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] ...@@ -17,7 +17,7 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
[dependencies] [dependencies]
ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = false } ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[dev-dependencies] [dev-dependencies]
criterion = "0.3.1" criterion = "0.3.1"
......
...@@ -23,7 +23,7 @@ ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = ...@@ -23,7 +23,7 @@ ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features =
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
cfg-if = "1.0" cfg-if = "1.0"
array-init = { version = "1.0", default-features = false, features = ["const-generics"] } array-init = { version = "1.0", default-features = false, features = ["const-generics"] }
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -16,7 +16,7 @@ scale = { package = "parity-scale-codec", version = "2.0", default-features = fa ...@@ -16,7 +16,7 @@ scale = { package = "parity-scale-codec", version = "2.0", default-features = fa
adder = { version = "3.0.0-rc2", path = "adder", default-features = false, features = ["ink-as-dependency"] } adder = { version = "3.0.0-rc2", path = "adder", default-features = false, features = ["ink-as-dependency"] }
subber = { version = "3.0.0-rc2", path = "subber", default-features = false, features = ["ink-as-dependency"] } subber = { version = "3.0.0-rc2", path = "subber", default-features = false, features = ["ink-as-dependency"] }
accumulator = { version = "3.0.0-rc2", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "3.0.0-rc2", path = "accumulator", default-features = false, features = ["ink-as-dependency"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "delegator" name = "delegator"
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../../crates/storage", default ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../../crates/storage", default
ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -14,7 +14,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-featu ...@@ -14,7 +14,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-featu
accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -14,7 +14,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-featu ...@@ -14,7 +14,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-featu
accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe ...@@ -12,7 +12,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-fe
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -13,7 +13,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features ...@@ -13,7 +13,7 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features
ink_prelude = { version = "3.0.0-rc2", path = "../../crates/prelude", default-features = false } ink_prelude = { version = "3.0.0-rc2", path = "../../crates/prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
......
...@@ -12,7 +12,7 @@ ink_storage = { path = "../../crates/storage", default-features = false } ...@@ -12,7 +12,7 @@ ink_storage = { path = "../../crates/storage", default-features = false }
ink_lang = { path = "../../crates/lang", default-features = false } ink_lang = { path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
[lib] [lib]
name = "rand_extension" name = "rand_extension"
......
Supports Markdown
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