diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 04b54a7b4f2..0b353d459a4 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -20,7 +20,7 @@ ink_allocator = { version = "3.0.0-rc2", path = "../allocator/", default-feature ink_primitives = { version = "3.0.0-rc2", path = "../primitives/", default-features = false } ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", 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"] } num-traits = { version = "0.2", default-features = false, features = ["i128"] } cfg-if = "1.0" @@ -38,7 +38,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.8", default-features = false, features = ["alloc"], optional = true } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } [features] default = ["std"] diff --git a/crates/env/src/call/execution_input.rs b/crates/env/src/call/execution_input.rs index 180f8baa821..148dda60b95 100644 --- a/crates/env/src/call/execution_input.rs +++ b/crates/env/src/call/execution_input.rs @@ -152,7 +152,7 @@ where } #[inline] - fn encode_to(&self, output: &mut O) { + fn encode_to(&self, output: &mut O) { ::encode_to(&self.arg, output) } } @@ -164,7 +164,7 @@ impl scale::Encode for EmptyArgumentList { } #[inline] - fn encode_to(&self, _output: &mut O) {} + fn encode_to(&self, _output: &mut O) {} } impl<'a, Head, Rest> scale::Encode for ArgumentList, Rest> @@ -178,7 +178,7 @@ where } #[inline] - fn encode_to(&self, output: &mut O) { + fn encode_to(&self, output: &mut O) { // We reverse the order of encoding because we build up the list of // arguments in reverse order, too. This way we encode the arguments // in the same order in which they have been pushed to the argument list @@ -198,7 +198,7 @@ where } #[inline] - fn encode_to(&self, output: &mut O) { + fn encode_to(&self, output: &mut O) { scale::Encode::encode_to(&self.selector, output); scale::Encode::encode_to(&self.args, output); } diff --git a/crates/env/src/engine/off_chain/call_data.rs b/crates/env/src/engine/off_chain/call_data.rs index 156cea43908..b6b4dbf88a7 100644 --- a/crates/env/src/engine/off_chain/call_data.rs +++ b/crates/env/src/engine/off_chain/call_data.rs @@ -74,7 +74,7 @@ impl scale::Encode for CallData { self.bytes.len() } - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { dest.write(self.bytes.as_slice()); } } diff --git a/crates/env/src/topics.rs b/crates/env/src/topics.rs index d2d82499264..54afc37ce66 100644 --- a/crates/env/src/topics.rs +++ b/crates/env/src/topics.rs @@ -229,7 +229,7 @@ where } #[inline] - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { self.prefix.encode_to(dest); self.value.encode_to(dest); } diff --git a/crates/lang/Cargo.toml b/crates/lang/Cargo.toml index 178458125a9..72d34d16533 100644 --- a/crates/lang/Cargo.toml +++ b/crates/lang/Cargo.toml @@ -22,7 +22,7 @@ ink_metadata = { version = "3.0.0-rc2", path = "../metadata", default-features = ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = false } ink_lang_macro = { version = "3.0.0-rc2", path = "macro", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", 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"] } static_assertions = "1.1" diff --git a/crates/lang/macro/Cargo.toml b/crates/lang/macro/Cargo.toml index aef78cb43e9..1339b483536 100644 --- a/crates/lang/macro/Cargo.toml +++ b/crates/lang/macro/Cargo.toml @@ -19,7 +19,7 @@ ink_lang_ir = { version = "3.0.0-rc2", path = "../ir", default-features = false ink_lang_codegen = { version = "3.0.0-rc2", path = "../codegen", default-features = false } ink_primitives = { version = "3.0.0-rc2", path = "../../primitives/", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } +scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } syn = "1" proc-macro2 = "1" @@ -30,7 +30,7 @@ ink_storage = { version = "3.0.0-rc2", path = "../../storage/" } ink_lang = { version = "3.0.0-rc2", path = ".." } trybuild = "1.0.24" -scale-info = { version = "0.4", default-features = false, features = ["derive"] } +scale-info = { version = "0.5", default-features = false, features = ["derive"] } [lib] name = "ink_lang_macro" diff --git a/crates/metadata/Cargo.toml b/crates/metadata/Cargo.toml index 3d016eb7b8c..74558b97ef0 100644 --- a/crates/metadata/Cargo.toml +++ b/crates/metadata/Cargo.toml @@ -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"] } impl-serde = "0.3.1" derive_more = { version = "0.99", default-features = false, features = ["from"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"] } +scale-info = { version = "0.5", default-features = false, features = ["derive", "serde"] } [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/crates/metadata/src/layout/mod.rs b/crates/metadata/src/layout/mod.rs index 12f62587215..e7caea60708 100644 --- a/crates/metadata/src/layout/mod.rs +++ b/crates/metadata/src/layout/mod.rs @@ -27,12 +27,12 @@ use ink_prelude::collections::btree_map::BTreeMap; use ink_primitives::Key; use scale_info::{ form::{ - CompactForm, Form, MetaForm, + PortableForm, }, meta_type, - IntoCompact, + IntoPortable, Registry, TypeInfo, }; @@ -146,10 +146,10 @@ impl CellLayout { } } -impl IntoCompact for CellLayout { - type Output = CellLayout; +impl IntoPortable for CellLayout { + type Output = CellLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { CellLayout { key: self.key, ty: registry.register_type(&self.ty), @@ -157,22 +157,26 @@ impl IntoCompact for CellLayout { } } -impl IntoCompact for Layout { - type Output = Layout; +impl IntoPortable for Layout { + type Output = Layout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { match self { Layout::Cell(encoded_cell) => { - Layout::Cell(encoded_cell.into_compact(registry)) + Layout::Cell(encoded_cell.into_portable(registry)) + } + Layout::Hash(hash_layout) => { + Layout::Hash(hash_layout.into_portable(registry)) } - Layout::Hash(hash_layout) => Layout::Hash(hash_layout.into_compact(registry)), Layout::Array(array_layout) => { - Layout::Array(array_layout.into_compact(registry)) + Layout::Array(array_layout.into_portable(registry)) } Layout::Struct(struct_layout) => { - Layout::Struct(struct_layout.into_compact(registry)) + Layout::Struct(struct_layout.into_portable(registry)) + } + Layout::Enum(enum_layout) => { + Layout::Enum(enum_layout.into_portable(registry)) } - Layout::Enum(enum_layout) => Layout::Enum(enum_layout.into_compact(registry)), } } } @@ -209,14 +213,14 @@ pub struct HashLayout { layout: Box>, } -impl IntoCompact for HashLayout { - type Output = HashLayout; +impl IntoPortable for HashLayout { + type Output = HashLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { HashLayout { offset: self.offset, strategy: self.strategy, - layout: Box::new(self.layout.into_compact(registry)), + layout: Box::new(self.layout.into_portable(registry)), } } } @@ -380,15 +384,15 @@ where } } -impl IntoCompact for ArrayLayout { - type Output = ArrayLayout; +impl IntoPortable for ArrayLayout { + type Output = ArrayLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { ArrayLayout { offset: self.offset, len: self.len, cells_per_elem: self.cells_per_elem, - layout: Box::new(self.layout.into_compact(registry)), + layout: Box::new(self.layout.into_portable(registry)), } } } @@ -426,15 +430,15 @@ where } } -impl IntoCompact for StructLayout { - type Output = StructLayout; +impl IntoPortable for StructLayout { + type Output = StructLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { StructLayout { fields: self .fields .into_iter() - .map(|field| field.into_compact(registry)) + .map(|field| field.into_portable(registry)) .collect::>(), } } @@ -492,13 +496,13 @@ where } } -impl IntoCompact for FieldLayout { - type Output = FieldLayout; +impl IntoPortable for FieldLayout { + type Output = FieldLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { FieldLayout { - name: self.name.map(|name| name.into_compact(registry)), - layout: self.layout.into_compact(registry), + name: self.name.map(|name| name.into_portable(registry)), + layout: self.layout.into_portable(registry), } } } @@ -563,17 +567,17 @@ where } } -impl IntoCompact for EnumLayout { - type Output = EnumLayout; +impl IntoPortable for EnumLayout { + type Output = EnumLayout; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { EnumLayout { dispatch_key: self.dispatch_key, variants: self .variants .into_iter() .map(|(discriminant, layout)| { - (discriminant, layout.into_compact(registry)) + (discriminant, layout.into_portable(registry)) }) .collect(), } diff --git a/crates/metadata/src/layout/tests.rs b/crates/metadata/src/layout/tests.rs index 741f2aa5085..11d18786332 100644 --- a/crates/metadata/src/layout/tests.rs +++ b/crates/metadata/src/layout/tests.rs @@ -44,7 +44,7 @@ fn named_fields_struct_layout(key_ptr: &mut KeyPtr) -> Layout { fn named_fields_work() { let layout = named_fields_struct_layout(&mut KeyPtr::from(Key::from([0x00; 32]))); let mut registry = Registry::new(); - let compacted = layout.into_compact(&mut registry); + let compacted = layout.into_portable(&mut registry); let json = serde_json::to_value(&compacted).unwrap(); let expected = serde_json::json! { { @@ -101,7 +101,7 @@ fn tuple_struct_layout(key_ptr: &mut KeyPtr) -> Layout { fn tuple_struct_work() { let layout = tuple_struct_layout(&mut KeyPtr::from(Key::from([0x00; 32]))); let mut registry = Registry::new(); - let compacted = layout.into_compact(&mut registry); + let compacted = layout.into_portable(&mut registry); let json = serde_json::to_value(&compacted).unwrap(); let expected = serde_json::json! { { @@ -156,7 +156,7 @@ fn clike_enum_layout(key_ptr: &mut KeyPtr) -> Layout { fn clike_enum_work() { let layout = clike_enum_layout(&mut KeyPtr::from(Key::from([0x00; 32]))); let mut registry = Registry::new(); - let compacted = layout.into_compact(&mut registry); + let compacted = layout.into_portable(&mut registry); let json = serde_json::to_value(&compacted).unwrap(); let expected = serde_json::json! { { @@ -237,7 +237,7 @@ fn mixed_enum_layout(key_ptr: &mut KeyPtr) -> Layout { fn mixed_enum_work() { let layout = mixed_enum_layout(&mut KeyPtr::from(Key::from([0x00; 32]))); let mut registry = Registry::new(); - let compacted = layout.into_compact(&mut registry); + let compacted = layout.into_portable(&mut registry); let json = serde_json::to_value(&compacted).unwrap(); let expected = serde_json::json! { { @@ -336,7 +336,7 @@ fn unbounded_hashing_layout(key_ptr: &mut KeyPtr) -> Layout { fn unbounded_layout_works() { let layout = unbounded_hashing_layout(&mut KeyPtr::from(Key::from([0x00; 32]))); let mut registry = Registry::new(); - let compacted = layout.into_compact(&mut registry); + let compacted = layout.into_portable(&mut registry); let json = serde_json::to_value(&compacted).unwrap(); let expected = serde_json::json! { { diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index 181b0bfd796..ad39c6de12b 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -47,25 +47,30 @@ use impl_serde::serialize as serde_hex; #[cfg(feature = "derive")] use scale_info::{ - form::CompactForm, - IntoCompact as _, + form::{ + FormString, + PortableForm, + }, + IntoPortable as _, + PortableRegistry, Registry, - RegistryReadOnly, }; use serde::{ + de::DeserializeOwned, Deserialize, Serialize, }; /// An entire ink! project for metadata file generation purposes. #[derive(Debug, Serialize, Deserialize)] -pub struct InkProject { +#[serde(bound(deserialize = "S: DeserializeOwned"))] +pub struct InkProject { #[serde(flatten)] - registry: RegistryReadOnly, + registry: PortableRegistry, #[serde(rename = "storage")] /// The layout of the storage data structure - layout: layout::Layout, - spec: ContractSpec, + layout: layout::Layout>, + spec: ContractSpec>, } impl InkProject { @@ -77,26 +82,29 @@ impl InkProject { let mut registry = Registry::new(); Self { - layout: layout.into().into_compact(&mut registry), - spec: spec.into().into_compact(&mut registry), + layout: layout.into().into_portable(&mut registry), + spec: spec.into().into_portable(&mut registry), registry: registry.into(), } } } -impl InkProject { +impl InkProject +where + S: FormString, +{ /// Returns a read-only registry of types in the contract. - pub fn registry(&self) -> &RegistryReadOnly { + pub fn registry(&self) -> &PortableRegistry { &self.registry } /// Returns the storage layout of the contract. - pub fn layout(&self) -> &layout::Layout { + pub fn layout(&self) -> &layout::Layout> { &self.layout } /// Returns the specification of the contract. - pub fn spec(&self) -> &ContractSpec { + pub fn spec(&self) -> &ContractSpec> { &self.spec } } diff --git a/crates/metadata/src/specs.rs b/crates/metadata/src/specs.rs index e9b42304650..9c8c2f6561a 100644 --- a/crates/metadata/src/specs.rs +++ b/crates/metadata/src/specs.rs @@ -24,12 +24,12 @@ use alloc::{ use core::marker::PhantomData; use scale_info::{ form::{ - CompactForm, Form, MetaForm, + PortableForm, }, meta_type, - IntoCompact, + IntoPortable, Registry, TypeInfo, }; @@ -56,27 +56,27 @@ pub struct ContractSpec { docs: Vec, } -impl IntoCompact for ContractSpec { - type Output = ContractSpec; +impl IntoPortable for ContractSpec { + type Output = ContractSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { ContractSpec { constructors: self .constructors .into_iter() - .map(|constructor| constructor.into_compact(registry)) + .map(|constructor| constructor.into_portable(registry)) .collect::>(), messages: self .messages .into_iter() - .map(|msg| msg.into_compact(registry)) + .map(|msg| msg.into_portable(registry)) .collect::>(), events: self .events .into_iter() - .map(|event| event.into_compact(registry)) + .map(|event| event.into_portable(registry)) .collect::>(), - docs: registry.map_into_compact(self.docs), + docs: registry.map_into_portable(self.docs), } } } @@ -232,19 +232,19 @@ pub struct ConstructorSpec { pub docs: Vec, } -impl IntoCompact for ConstructorSpec { - type Output = ConstructorSpec; +impl IntoPortable for ConstructorSpec { + type Output = ConstructorSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { ConstructorSpec { - name: registry.map_into_compact(self.name), + name: registry.map_into_portable(self.name), selector: self.selector, args: self .args .into_iter() - .map(|arg| arg.into_compact(registry)) + .map(|arg| arg.into_portable(registry)) .collect::>(), - docs: registry.map_into_compact(self.docs), + docs: registry.map_into_portable(self.docs), } } } @@ -609,22 +609,22 @@ impl } } -impl IntoCompact for MessageSpec { - type Output = MessageSpec; +impl IntoPortable for MessageSpec { + type Output = MessageSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { MessageSpec { - name: registry.map_into_compact(self.name), + name: registry.map_into_portable(self.name), selector: self.selector, mutates: self.mutates, payable: self.payable, args: self .args .into_iter() - .map(|arg| arg.into_compact(registry)) + .map(|arg| arg.into_portable(registry)) .collect::>(), - return_type: self.return_type.into_compact(registry), - docs: registry.map_into_compact(self.docs), + return_type: self.return_type.into_portable(registry), + docs: registry.map_into_portable(self.docs), } } } @@ -678,18 +678,18 @@ impl EventSpecBuilder { } } -impl IntoCompact for EventSpec { - type Output = EventSpec; +impl IntoPortable for EventSpec { + type Output = EventSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { EventSpec { - name: self.name.into_compact(registry), + name: self.name.into_portable(registry), args: self .args .into_iter() - .map(|arg| arg.into_compact(registry)) + .map(|arg| arg.into_portable(registry)) .collect::>(), - docs: registry.map_into_compact(self.docs), + docs: registry.map_into_portable(self.docs), } } } @@ -808,13 +808,13 @@ pub struct TypeSpec { display_name: DisplayName, } -impl IntoCompact for TypeSpec { - type Output = TypeSpec; +impl IntoPortable for TypeSpec { + type Output = TypeSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { TypeSpec { ty: registry.register_type(&self.ty), - display_name: self.display_name.into_compact(registry), + display_name: self.display_name.into_portable(registry), } } } @@ -907,15 +907,15 @@ pub struct EventParamSpec { docs: Vec, } -impl IntoCompact for EventParamSpec { - type Output = EventParamSpec; +impl IntoPortable for EventParamSpec { + type Output = EventParamSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { EventParamSpec { - name: self.name.into_compact(registry), + name: self.name.into_portable(registry), indexed: self.indexed, - ty: self.ty.into_compact(registry), - docs: registry.map_into_compact(self.docs), + ty: self.ty.into_portable(registry), + docs: registry.map_into_portable(self.docs), } } } @@ -1015,14 +1015,14 @@ pub struct ReturnTypeSpec { opt_type: Option>, } -impl IntoCompact for ReturnTypeSpec { - type Output = ReturnTypeSpec; +impl IntoPortable for ReturnTypeSpec { + type Output = ReturnTypeSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { ReturnTypeSpec { opt_type: self .opt_type - .map(|opt_type| opt_type.into_compact(registry)), + .map(|opt_type| opt_type.into_portable(registry)), } } } @@ -1071,13 +1071,13 @@ pub struct MessageParamSpec { ty: TypeSpec, } -impl IntoCompact for MessageParamSpec { - type Output = MessageParamSpec; +impl IntoPortable for MessageParamSpec { + type Output = MessageParamSpec; - fn into_compact(self, registry: &mut Registry) -> Self::Output { + fn into_portable(self, registry: &mut Registry) -> Self::Output { MessageParamSpec { - name: self.name.into_compact(registry), - ty: self.ty.into_compact(registry), + name: self.name.into_portable(registry), + ty: self.ty.into_portable(registry), } } } diff --git a/crates/metadata/src/tests.rs b/crates/metadata/src/tests.rs index 644c52847dc..0ae170b81a0 100644 --- a/crates/metadata/src/tests.rs +++ b/crates/metadata/src/tests.rs @@ -15,7 +15,7 @@ use super::*; use pretty_assertions::assert_eq; use scale_info::{ - IntoCompact, + IntoPortable, Registry, }; use serde_json::json; @@ -28,11 +28,11 @@ fn spec_constructor_selector_must_serialize_to_hex() { .selector(123_456_789u32.to_be_bytes()) .done(); let mut registry = Registry::new(); - let compact_spec = cs.into_compact(&mut registry); + let portable_spec = cs.into_portable(&mut registry); // when - let json = serde_json::to_value(&compact_spec).unwrap(); - let deserialized: ConstructorSpec = + let json = serde_json::to_value(&portable_spec).unwrap(); + let deserialized: ConstructorSpec> = serde_json::from_value(json.clone()).unwrap(); // then @@ -45,7 +45,7 @@ fn spec_constructor_selector_must_serialize_to_hex() { "docs": [] }) ); - assert_eq!(deserialized, compact_spec); + assert_eq!(deserialized.selector, portable_spec.selector); } #[test] @@ -99,7 +99,7 @@ fn spec_contract_json() { let mut registry = Registry::new(); // when - let json = serde_json::to_value(&contract.into_compact(&mut registry)).unwrap(); + let json = serde_json::to_value(&contract.into_portable(&mut registry)).unwrap(); // then assert_eq!( @@ -179,11 +179,11 @@ fn trim_docs() { .docs(vec![" foobar "]) .done(); let mut registry = Registry::new(); - let compact_spec = cs.into_compact(&mut registry); + let compact_spec = cs.into_portable(&mut registry); // when let json = serde_json::to_value(&compact_spec).unwrap(); - let deserialized: ConstructorSpec = + let deserialized: ConstructorSpec> = serde_json::from_value(json.clone()).unwrap(); // then @@ -196,5 +196,5 @@ fn trim_docs() { "docs": ["foobar"] }) ); - assert_eq!(deserialized, compact_spec); + assert_eq!(deserialized.docs, compact_spec.docs); } diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 2a2475761ab..51826dd47dc 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -17,8 +17,8 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] [dependencies] ink_prelude = { version = "3.0.0-rc2", 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.4", default-features = false, features = ["derive"], optional = true } +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 } [dev-dependencies] diff --git a/crates/primitives/src/key.rs b/crates/primitives/src/key.rs index f218b2791d3..4dacd56d77d 100644 --- a/crates/primitives/src/key.rs +++ b/crates/primitives/src/key.rs @@ -149,7 +149,7 @@ impl scale::Encode for Key { } #[inline] - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { if cfg!(target_endian = "little") { dest.write(self.try_as_bytes().expect("little endian is asserted")) } else { @@ -236,10 +236,12 @@ const _: () = { }; impl TypeInfo for Key { + type Identity = Self; + fn type_info() -> Type { Type::builder() .path(Path::new("Key", "ink_primitives")) - .composite(Fields::unnamed().field_of::<[u8; 32]>()) + .composite(Fields::unnamed().field_of::<[u8; 32]>("[u8; 32]")) } } }; diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 6f2228db425..77ddef3a564 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -21,9 +21,9 @@ ink_primitives = { version = "3.0.0-rc2", path = "../primitives/", default-featu ink_storage_derive = { version = "3.0.0-rc2", path = "derive", default-features = false } ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", 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"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } cfg-if = "1.0" array-init = "1.0" generic-array = "0.14.1" diff --git a/crates/storage/src/alloc/allocation.rs b/crates/storage/src/alloc/allocation.rs index 227ad47f6a2..0f8e6c10780 100644 --- a/crates/storage/src/alloc/allocation.rs +++ b/crates/storage/src/alloc/allocation.rs @@ -124,7 +124,7 @@ impl DynamicAllocation { #[rustfmt::skip] fn encode_to(&self, output: &mut O) where - O: scale::Output, + O: scale::Output + ?Sized, { <[u8; 21] as scale::Encode>::encode_to(&[ b'D', b'Y', b'N', b'A', b'M', b'I', b'C', b'A', b'L', b'L', b'Y', diff --git a/crates/storage/src/alloc/boxed/storage.rs b/crates/storage/src/alloc/boxed/storage.rs index 91e54d40ff6..0624bdedabc 100644 --- a/crates/storage/src/alloc/boxed/storage.rs +++ b/crates/storage/src/alloc/boxed/storage.rs @@ -49,8 +49,10 @@ const _: () = { impl scale_info::TypeInfo for StorageBox where - T: SpreadLayout, + T: SpreadLayout + 'static, { + type Identity = Self; + fn type_info() -> scale_info::Type { scale_info::Type::builder() .path( @@ -66,7 +68,7 @@ const _: () = { // .type_params(vec![scale_info::MetaType::new::()]) .composite( scale_info::build::Fields::named() - .field_of::("allocation"), + .field_of::("allocation", "DynamicAllocation"), ) } } @@ -99,7 +101,7 @@ where ::size_hint(&self.allocation) } - fn encode_to(&self, dest: &mut O) { + fn encode_to(&self, dest: &mut O) { ::encode_to(&self.allocation, dest) } diff --git a/crates/storage/src/collections/binary_heap/reverse.rs b/crates/storage/src/collections/binary_heap/reverse.rs index a3649e765c7..1ae64edbe61 100644 --- a/crates/storage/src/collections/binary_heap/reverse.rs +++ b/crates/storage/src/collections/binary_heap/reverse.rs @@ -94,7 +94,7 @@ where } #[inline] - fn encode_to(&self, dest: &mut O) { + fn encode_to(&self, dest: &mut O) { ::encode_to(self.value(), dest) } diff --git a/crates/storage/src/lazy/entry.rs b/crates/storage/src/lazy/entry.rs index fb6da768d22..3c73db03ee4 100644 --- a/crates/storage/src/lazy/entry.rs +++ b/crates/storage/src/lazy/entry.rs @@ -131,7 +131,7 @@ where } #[inline] - fn encode_to(&self, dest: &mut O) { + fn encode_to(&self, dest: &mut O) { as scale::Encode>::encode_to(&self.value, dest) } diff --git a/crates/storage/src/pack.rs b/crates/storage/src/pack.rs index c5efdf177d5..dce6b7e586c 100644 --- a/crates/storage/src/pack.rs +++ b/crates/storage/src/pack.rs @@ -81,7 +81,7 @@ where } #[inline] - fn encode_to(&self, dest: &mut O) { + fn encode_to(&self, dest: &mut O) { ::encode_to(&self.inner, dest) } diff --git a/examples/contract-terminate/Cargo.toml b/examples/contract-terminate/Cargo.toml index 05b208706b3..11900736389 100644 --- a/examples/contract-terminate/Cargo.toml +++ b/examples/contract-terminate/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc1", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/contract-transfer/Cargo.toml b/examples/contract-transfer/Cargo.toml index 7f5dffdc71b..f05ad122929 100644 --- a/examples/contract-transfer/Cargo.toml +++ b/examples/contract-transfer/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc1", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc1", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/delegator/Cargo.toml b/examples/delegator/Cargo.toml index 8d85f6464ab..001dc99c8ae 100644 --- a/examples/delegator/Cargo.toml +++ b/examples/delegator/Cargo.toml @@ -11,12 +11,12 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } +scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] } 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"] } accumulator = { version = "3.0.0-rc2", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "0.5", default-features = false, features = ["derive"], optional = true } [lib] name = "delegator" diff --git a/examples/delegator/accumulator/Cargo.toml b/examples/delegator/accumulator/Cargo.toml index 5c271ffbe38..b1679f8b9b5 100644 --- a/examples/delegator/accumulator/Cargo.toml +++ b/examples/delegator/accumulator/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../../crates/env", default-feature ink_storage = { version = "3.0.0-rc2", path = "../../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/delegator/adder/Cargo.toml b/examples/delegator/adder/Cargo.toml index 0614bbbf918..1211b2e1e44 100644 --- a/examples/delegator/adder/Cargo.toml +++ b/examples/delegator/adder/Cargo.toml @@ -13,8 +13,8 @@ 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"] } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/delegator/subber/Cargo.toml b/examples/delegator/subber/Cargo.toml index 2ca9b664f58..c16b184ea6c 100644 --- a/examples/delegator/subber/Cargo.toml +++ b/examples/delegator/subber/Cargo.toml @@ -13,8 +13,8 @@ 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"] } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/dns/Cargo.toml b/examples/dns/Cargo.toml index 780bba12287..c7d6adc8d26 100644 --- a/examples/dns/Cargo.toml +++ b/examples/dns/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index ba0b8f9a43b..f168e47c9a5 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/erc20/lib.rs b/examples/erc20/lib.rs index 992441aba68..40bf294d48a 100644 --- a/examples/erc20/lib.rs +++ b/examples/erc20/lib.rs @@ -548,7 +548,7 @@ mod erc20 { } #[inline] - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { self.prefix.encode_to(dest); self.value.encode_to(dest); } diff --git a/examples/erc721/Cargo.toml b/examples/erc721/Cargo.toml index a455795066a..185abbb428e 100644 --- a/examples/erc721/Cargo.toml +++ b/examples/erc721/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/flipper/Cargo.toml b/examples/flipper/Cargo.toml index fc056ade09a..67495220541 100644 --- a/examples/flipper/Cargo.toml +++ b/examples/flipper/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/incrementer/Cargo.toml b/examples/incrementer/Cargo.toml index e754cd05542..e1408fefb56 100644 --- a/examples/incrementer/Cargo.toml +++ b/examples/incrementer/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/multisig_plain/Cargo.toml b/examples/multisig_plain/Cargo.toml index c20687e57dd..80393b2fbd5 100755 --- a/examples/multisig_plain/Cargo.toml +++ b/examples/multisig_plain/Cargo.toml @@ -12,8 +12,8 @@ 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_prelude = { version = "3.0.0-rc2", path = "../../crates/prelude", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/multisig_plain/lib.rs b/examples/multisig_plain/lib.rs index 20956752969..4f1057b5174 100755 --- a/examples/multisig_plain/lib.rs +++ b/examples/multisig_plain/lib.rs @@ -111,7 +111,7 @@ mod multisig_plain { struct CallInput<'a>(&'a [u8]); impl<'a> scale::Encode for CallInput<'a> { - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { dest.write(self.0); } } diff --git a/examples/trait-erc20/Cargo.toml b/examples/trait-erc20/Cargo.toml index ba0b8f9a43b..f168e47c9a5 100644 --- a/examples/trait-erc20/Cargo.toml +++ b/examples/trait-erc20/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] diff --git a/examples/trait-erc20/lib.rs b/examples/trait-erc20/lib.rs index 21e304d56ff..1b3b350ebce 100644 --- a/examples/trait-erc20/lib.rs +++ b/examples/trait-erc20/lib.rs @@ -600,7 +600,7 @@ mod erc20 { } #[inline] - fn encode_to(&self, dest: &mut T) { + fn encode_to(&self, dest: &mut T) { self.prefix.encode_to(dest); self.value.encode_to(dest); } diff --git a/examples/trait-flipper/Cargo.toml b/examples/trait-flipper/Cargo.toml index e189710f934..a5d69926a74 100644 --- a/examples/trait-flipper/Cargo.toml +++ b/examples/trait-flipper/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } +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 } [lib] name = "flipper"