From 67b457cec9a3e57032449154d6d96ce73af339e4 Mon Sep 17 00:00:00 2001 From: GreenBaneling | Supercolony Date: Sun, 13 Feb 2022 04:49:36 +0200 Subject: [PATCH 1/9] Explicitly specify the trait in the dispatching (#1131) * Explicitly specify the trait during execution * Added UI test to verify that traits which are using the same naming of messages doesn't conflict with each other --- crates/lang/codegen/src/generator/dispatch.rs | 2 +- .../pass/traits-messages-same-name.rs | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 crates/lang/tests/ui/contract/pass/traits-messages-same-name.rs diff --git a/crates/lang/codegen/src/generator/dispatch.rs b/crates/lang/codegen/src/generator/dispatch.rs index 45138d8d05f..8209f2ee0f0 100644 --- a/crates/lang/codegen/src/generator/dispatch.rs +++ b/crates/lang/codegen/src/generator/dispatch.rs @@ -385,7 +385,7 @@ impl Dispatch<'_> { const CALLABLE: fn(&mut Self::Storage, Self::Input) -> Self::Output = |storage, #input_tuple_bindings| { - #storage_ident::#message_ident( storage #( , #input_bindings )* ) + <#storage_ident as #trait_path>::#message_ident( storage #( , #input_bindings )* ) }; const SELECTOR: [::core::primitive::u8; 4usize] = #selector; const PAYABLE: ::core::primitive::bool = #payable; diff --git a/crates/lang/tests/ui/contract/pass/traits-messages-same-name.rs b/crates/lang/tests/ui/contract/pass/traits-messages-same-name.rs new file mode 100644 index 00000000000..1bc52d665bf --- /dev/null +++ b/crates/lang/tests/ui/contract/pass/traits-messages-same-name.rs @@ -0,0 +1,43 @@ +use ink_lang as ink; + +#[ink::trait_definition] +pub trait TraitDefinition1 { + #[ink(message)] + fn message(&self); +} + +#[ink::trait_definition] +pub trait TraitDefinition2 { + #[ink(message)] + fn message(&self); +} + +#[ink::contract] +mod contract { + use super::{ + TraitDefinition1, + TraitDefinition2, + }; + + #[ink(storage)] + pub struct Contract {} + + impl Contract { + #[ink(constructor)] + pub fn constructor() -> Self { + Self {} + } + } + + impl TraitDefinition1 for Contract { + #[ink(message)] + fn message(&self) {} + } + + impl TraitDefinition2 for Contract { + #[ink(message)] + fn message(&self) {} + } +} + +fn main() {} From d35b3d729eaedd685ca1343e7b4e2a53f787b804 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 16 Feb 2022 16:19:26 +0000 Subject: [PATCH 2/9] Update to parity-scale-codec `3` and scale-info `2` (#1132) * Update parity-scale-codec and scale-info dependencies * Add note to RELEASES.md * Fix UI tests --- RELEASES.md | 13 +++++++++++++ crates/engine/Cargo.toml | 2 +- crates/env/Cargo.toml | 4 ++-- crates/lang/Cargo.toml | 4 ++-- crates/lang/codegen/Cargo.toml | 2 +- crates/lang/macro/Cargo.toml | 4 ++-- .../contract/fail/message-returns-non-codec.stderr | 2 +- .../trait_def/fail/message_output_non_codec.stderr | 6 +++--- crates/metadata/Cargo.toml | 2 +- crates/primitives/Cargo.toml | 4 ++-- crates/storage/Cargo.toml | 4 ++-- crates/storage/derive/Cargo.toml | 2 +- examples/contract-terminate/Cargo.toml | 4 ++-- examples/contract-transfer/Cargo.toml | 4 ++-- examples/delegator/Cargo.toml | 4 ++-- examples/delegator/accumulator/Cargo.toml | 4 ++-- examples/delegator/adder/Cargo.toml | 4 ++-- examples/delegator/subber/Cargo.toml | 4 ++-- examples/dns/Cargo.toml | 4 ++-- examples/erc1155/Cargo.toml | 4 ++-- examples/erc20/Cargo.toml | 4 ++-- examples/erc721/Cargo.toml | 4 ++-- examples/flipper/Cargo.toml | 4 ++-- examples/incrementer/Cargo.toml | 4 ++-- examples/multisig/Cargo.toml | 4 ++-- examples/proxy/Cargo.toml | 4 ++-- examples/rand-extension/Cargo.toml | 4 ++-- examples/trait-erc20/Cargo.toml | 4 ++-- examples/trait-flipper/Cargo.toml | 4 ++-- examples/trait-incrementer/Cargo.toml | 4 ++-- 30 files changed, 67 insertions(+), 54 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index fd3fea234e6..2d37ec0c919 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,16 @@ +# Unreleased + +### Please upgrade `scale-info` and `parity-scale-codec` in your contract's dependencies + +In this release candidate we upgraded `scale-info` and `parity-scale-codec`. You have to use a compatible +version in your contract's `Cargo.toml` as well; `cargo-contract` will throw an error otherwise. + +The `Cargo.toml` should contain +``` +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } +``` + # Version 3.0-rc8 This is the 8th release candidate for ink! 3.0. diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 63428716e6e..089f7198c42 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -15,7 +15,7 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } sha2 = { version = "0.10" } diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 3b27e5db791..9c642607a4a 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -20,7 +20,7 @@ ink_allocator = { version = "3.0.0-rc8", path = "../allocator/", default-feature ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false } ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", 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" @@ -47,7 +47,7 @@ secp256k1 = { version = "0.21.2", features = ["recovery", "global-context"], opt # Sadly couldn't be marked as dev-dependency. # Never use this crate outside the off-chain environment! rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true } -scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [features] default = ["std"] diff --git a/crates/lang/Cargo.toml b/crates/lang/Cargo.toml index ec927257112..9f1e6edee36 100644 --- a/crates/lang/Cargo.toml +++ b/crates/lang/Cargo.toml @@ -23,7 +23,7 @@ ink_prelude = { version = "3.0.0-rc8", path = "../prelude", default-features = f ink_eth_compatibility = { version = "3.0.0-rc8", path = "../eth_compatibility", default-features = false } ink_lang_macro = { version = "3.0.0-rc8", path = "macro", default-features = false } -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from"] } [dev-dependencies] @@ -32,7 +32,7 @@ ink_metadata = { version = "3.0.0-rc8", default-features = false, path = "../met trybuild = { version = "1.0.52", features = ["diff"] } # Required for the doctest of `env_access::EnvAccess::instantiate_contract` -scale-info = { version = "1.0", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"] } [features] default = ["std"] diff --git a/crates/lang/codegen/Cargo.toml b/crates/lang/codegen/Cargo.toml index 156c37af01c..c0435a18c8c 100644 --- a/crates/lang/codegen/Cargo.toml +++ b/crates/lang/codegen/Cargo.toml @@ -27,7 +27,7 @@ itertools = "0.10" either = { version = "1.5", default-features = false } blake2 = "0.10" heck = "0.4.0" -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } impl-serde = "0.3.1" [features] diff --git a/crates/lang/macro/Cargo.toml b/crates/lang/macro/Cargo.toml index 8023e556b07..9b1e05271ff 100644 --- a/crates/lang/macro/Cargo.toml +++ b/crates/lang/macro/Cargo.toml @@ -19,7 +19,7 @@ ink_lang_ir = { version = "3.0.0-rc8", path = "../ir", default-features = false ink_lang_codegen = { version = "3.0.0-rc8", path = "../codegen", default-features = false } ink_primitives = { version = "3.0.0-rc8", path = "../../primitives/", default-features = false } -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } syn = "1" proc-macro2 = "1" @@ -28,7 +28,7 @@ ink_metadata = { version = "3.0.0-rc8", path = "../../metadata/" } ink_env = { version = "3.0.0-rc8", path = "../../env/" } ink_storage = { version = "3.0.0-rc8", path = "../../storage/" } ink_lang = { version = "3.0.0-rc8", path = ".." } -scale-info = { version = "1.0", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"] } [lib] name = "ink_lang_macro" diff --git a/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr b/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr index 44cf44c34bb..bbaedf2a244 100644 --- a/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr +++ b/crates/lang/tests/ui/contract/fail/message-returns-non-codec.stderr @@ -40,7 +40,7 @@ error[E0599]: the method `fire` exists for struct `ink_env::call::CallBuilder $CARGO/parity-scale-codec-2.3.1/src/codec.rs + --> $CARGO/parity-scale-codec-3.0.0/src/codec.rs | | / pub trait Decode: Sized { | | // !INTERNAL USE ONLY! diff --git a/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr b/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr index ffdb0343f25..102a12c5b8f 100644 --- a/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr +++ b/crates/lang/tests/ui/trait_def/fail/message_output_non_codec.stderr @@ -6,9 +6,9 @@ error[E0277]: the trait bound `NonCodec: WrapperTypeEncode` is not satisfied | = note: required because of the requirements on the impl of `Encode` for `NonCodec` note: required by a bound in `DispatchOutput` - --> src/codegen/dispatch/type_check.rs:69:8 + --> src/codegen/dispatch/type_check.rs | -69 | T: scale::Encode + 'static; + | T: scale::Encode + 'static; | ^^^^^^^^^^^^^ required by this bound in `DispatchOutput` error[E0599]: the method `fire` exists for struct `CallBuilder::AccountId>, Unset, Unset<::Balance>, Set>>, Set>>`, but its trait bounds were not satisfied @@ -24,7 +24,7 @@ error[E0599]: the method `fire` exists for struct `CallBuilder $CARGO/parity-scale-codec-2.3.1/src/codec.rs + --> $CARGO/parity-scale-codec-3.0.0/src/codec.rs | | / pub trait Decode: Sized { | | // !INTERNAL USE ONLY! diff --git a/crates/metadata/Cargo.toml b/crates/metadata/Cargo.toml index 875ad8dcea5..365a17c5c13 100644 --- a/crates/metadata/Cargo.toml +++ b/crates/metadata/Cargo.toml @@ -21,7 +21,7 @@ ink_primitives = { version = "3.0.0-rc8", 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 = "1.0", default-features = false, features = ["derive", "serde", "decode"] } +scale-info = { version = "2", default-features = false, features = ["derive", "serde", "decode"] } [dev-dependencies] pretty_assertions = "1" diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 4486d1fffa0..b80efa1f1ea 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -16,8 +16,8 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] [dependencies] ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } -scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } cfg-if = "1" [dev-dependencies] diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 097fbf9700e..063541348ef 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -21,9 +21,9 @@ ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-featu ink_storage_derive = { version = "3.0.0-rc8", path = "derive", default-features = false } ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } cfg-if = "1.0" array-init = { version = "2.0", default-features = false } diff --git a/crates/storage/derive/Cargo.toml b/crates/storage/derive/Cargo.toml index 921312a8d1f..9e5c49c308b 100644 --- a/crates/storage/derive/Cargo.toml +++ b/crates/storage/derive/Cargo.toml @@ -24,7 +24,7 @@ proc-macro2 = "1" synstructure = "0.12.4" [dev-dependencies] -scale = { package = "parity-scale-codec", version = "2.3", default-features = false, features = ["derive", "full"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } ink_env = { version = "3.0.0-rc8", path = "../../env" } ink_primitives = { version = "3.0.0-rc8", path = "../../primitives" } ink_metadata = { version = "3.0.0-rc8", path = "../../metadata" } diff --git a/examples/contract-terminate/Cargo.toml b/examples/contract-terminate/Cargo.toml index 3fda1cb347a..59802ca2f14 100644 --- a/examples/contract-terminate/Cargo.toml +++ b/examples/contract-terminate/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "contract_terminate" diff --git a/examples/contract-transfer/Cargo.toml b/examples/contract-transfer/Cargo.toml index dd3416d8bc4..a3eec338313 100644 --- a/examples/contract-transfer/Cargo.toml +++ b/examples/contract-transfer/Cargo.toml @@ -12,8 +12,8 @@ ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-fe ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "contract_transfer" diff --git a/examples/delegator/Cargo.toml b/examples/delegator/Cargo.toml index ff36839be84..0d9be78692d 100644 --- a/examples/delegator/Cargo.toml +++ b/examples/delegator/Cargo.toml @@ -11,12 +11,12 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } adder = { version = "3.0.0-rc8", path = "adder", default-features = false, features = ["ink-as-dependency"] } subber = { version = "3.0.0-rc8", path = "subber", default-features = false, features = ["ink-as-dependency"] } accumulator = { version = "3.0.0-rc8", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "2", 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 5b83b551473..aa44450cc1c 100644 --- a/examples/delegator/accumulator/Cargo.toml +++ b/examples/delegator/accumulator/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../../crates/env", default-feature ink_storage = { version = "3.0.0-rc8", path = "../../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "accumulator" diff --git a/examples/delegator/adder/Cargo.toml b/examples/delegator/adder/Cargo.toml index 0d9633573e1..d134bd212d2 100644 --- a/examples/delegator/adder/Cargo.toml +++ b/examples/delegator/adder/Cargo.toml @@ -13,8 +13,8 @@ ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-featu accumulator = { version = "3.0.0-rc8", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "adder" diff --git a/examples/delegator/subber/Cargo.toml b/examples/delegator/subber/Cargo.toml index 1af99693a92..9aba9e41d93 100644 --- a/examples/delegator/subber/Cargo.toml +++ b/examples/delegator/subber/Cargo.toml @@ -13,8 +13,8 @@ ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-featu accumulator = { version = "3.0.0-rc8", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "subber" diff --git a/examples/dns/Cargo.toml b/examples/dns/Cargo.toml index 6a3184cfff4..fb95fe716d5 100644 --- a/examples/dns/Cargo.toml +++ b/examples/dns/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "dns" diff --git a/examples/erc1155/Cargo.toml b/examples/erc1155/Cargo.toml index 5167cfe6a13..fb62b82db67 100644 --- a/examples/erc1155/Cargo.toml +++ b/examples/erc1155/Cargo.toml @@ -12,8 +12,8 @@ ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-fe ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "erc1155" diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index 450f86109c2..2c8443ce7ec 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "erc20" diff --git a/examples/erc721/Cargo.toml b/examples/erc721/Cargo.toml index ed49044cc5b..d966c8439ea 100644 --- a/examples/erc721/Cargo.toml +++ b/examples/erc721/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "erc721" diff --git a/examples/flipper/Cargo.toml b/examples/flipper/Cargo.toml index 5d0c74c156a..93d25cd6b13 100644 --- a/examples/flipper/Cargo.toml +++ b/examples/flipper/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "flipper" diff --git a/examples/incrementer/Cargo.toml b/examples/incrementer/Cargo.toml index 2ff5829cee5..2cc40f4e8cf 100644 --- a/examples/incrementer/Cargo.toml +++ b/examples/incrementer/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "incrementer" diff --git a/examples/multisig/Cargo.toml b/examples/multisig/Cargo.toml index 9ee13e36d4a..028107621d8 100755 --- a/examples/multisig/Cargo.toml +++ b/examples/multisig/Cargo.toml @@ -12,8 +12,8 @@ ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-fe ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "multisig" diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml index f308e045f33..062504b9c56 100644 --- a/examples/proxy/Cargo.toml +++ b/examples/proxy/Cargo.toml @@ -12,8 +12,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2.1", default-features = false, features = ["derive"] } -scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "proxy" diff --git a/examples/rand-extension/Cargo.toml b/examples/rand-extension/Cargo.toml index 4c33fda6121..0cbddbc0ef2 100755 --- a/examples/rand-extension/Cargo.toml +++ b/examples/rand-extension/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "rand_extension" diff --git a/examples/trait-erc20/Cargo.toml b/examples/trait-erc20/Cargo.toml index e00e5934ddb..2cfd63f5347 100644 --- a/examples/trait-erc20/Cargo.toml +++ b/examples/trait-erc20/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "trait_erc20" diff --git a/examples/trait-flipper/Cargo.toml b/examples/trait-flipper/Cargo.toml index a69b36598c3..4fc06ee3f9c 100644 --- a/examples/trait-flipper/Cargo.toml +++ b/examples/trait-flipper/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "trait_flipper" diff --git a/examples/trait-incrementer/Cargo.toml b/examples/trait-incrementer/Cargo.toml index 2db6dd29ed7..957ecb8b164 100644 --- a/examples/trait-incrementer/Cargo.toml +++ b/examples/trait-incrementer/Cargo.toml @@ -11,8 +11,8 @@ ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -scale = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive"] } -scale-info = { version = "1", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] name = "trait_incrementer" From e345679f4a6888bf253d430374c8db518d957d7d Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 17 Feb 2022 01:34:35 -0500 Subject: [PATCH 3/9] Re-export `initialize_contract` function (#1077) * Re-export the `initialize_contract` function * Use re-exported version in example contracts * Re-export `initialize_contract` from `utils` module * Change remaining usage of `ink_lang::codegen` to `ink_lang::utils` --- crates/lang/src/lib.rs | 7 +++++++ crates/lang/tests/ui/contract/pass/example-erc20-works.rs | 2 +- crates/lang/tests/ui/contract/pass/example-erc721-works.rs | 2 +- examples/dns/lib.rs | 4 +++- examples/erc1155/lib.rs | 2 +- examples/erc20/lib.rs | 4 +++- examples/erc721/lib.rs | 2 +- examples/multisig/lib.rs | 2 +- examples/trait-erc20/lib.rs | 2 +- 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/crates/lang/src/lib.rs b/crates/lang/src/lib.rs index bbc261dcc8e..b65981a7189 100644 --- a/crates/lang/src/lib.rs +++ b/crates/lang/src/lib.rs @@ -21,6 +21,13 @@ pub mod result_info; #[cfg_attr(not(feature = "show-codegen-docs"), doc(hidden))] pub mod codegen; +/// Utility functions for contract development. +pub mod utils { + // We want to expose this function without making users go through + // the `codgen` module + pub use super::codegen::initialize_contract; +} + pub mod reflect; mod chain_extension; diff --git a/crates/lang/tests/ui/contract/pass/example-erc20-works.rs b/crates/lang/tests/ui/contract/pass/example-erc20-works.rs index 2f5b96661e2..f1d50541ae6 100644 --- a/crates/lang/tests/ui/contract/pass/example-erc20-works.rs +++ b/crates/lang/tests/ui/contract/pass/example-erc20-works.rs @@ -58,7 +58,7 @@ mod erc20 { /// Creates a new ERC-20 contract with the specified initial supply. #[ink(constructor)] pub fn new(initial_supply: Balance) -> Self { - ink_lang::codegen::initialize_contract(|contract| { + ink_lang::utils::initialize_contract(|contract| { Self::new_init(contract, initial_supply) }) } diff --git a/crates/lang/tests/ui/contract/pass/example-erc721-works.rs b/crates/lang/tests/ui/contract/pass/example-erc721-works.rs index f97a7e564aa..3e4c4fc3a7f 100644 --- a/crates/lang/tests/ui/contract/pass/example-erc721-works.rs +++ b/crates/lang/tests/ui/contract/pass/example-erc721-works.rs @@ -79,7 +79,7 @@ mod erc721 { pub fn new() -> Self { // This call is required in order to correctly initialize the // `Mapping`s of our contract. - ink_lang::codegen::initialize_contract(|_| {}) + ink_lang::utils::initialize_contract(|_| {}) } /// Returns the balance of the owner. diff --git a/examples/dns/lib.rs b/examples/dns/lib.rs index 80342142ead..7dfe29cd1eb 100644 --- a/examples/dns/lib.rs +++ b/examples/dns/lib.rs @@ -85,7 +85,9 @@ mod dns { /// Creates a new domain name service contract. #[ink(constructor)] pub fn new() -> Self { - ink_lang::codegen::initialize_contract(|contract: &mut Self| { + // This call is required in order to correctly initialize the + // `Mapping`s of our contract. + ink_lang::utils::initialize_contract(|contract: &mut Self| { contract.default_address = Default::default(); }) } diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 7360d0ae654..4404ec4de15 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -272,7 +272,7 @@ mod erc1155 { // `Mapping`s of our contract. // // Not that `token_id_nonce` will be initialized to its `Default` value. - ink_lang::codegen::initialize_contract(|_| {}) + ink_lang::utils::initialize_contract(|_| {}) } /// Create the initial supply for a token. diff --git a/examples/erc20/lib.rs b/examples/erc20/lib.rs index a767914fdf9..088f8bfcc0b 100644 --- a/examples/erc20/lib.rs +++ b/examples/erc20/lib.rs @@ -60,7 +60,9 @@ mod erc20 { /// Creates a new ERC-20 contract with the specified initial supply. #[ink(constructor)] pub fn new(initial_supply: Balance) -> Self { - ink_lang::codegen::initialize_contract(|contract| { + // This call is required in order to correctly initialize the + // `Mapping`s of our contract. + ink_lang::utils::initialize_contract(|contract| { Self::new_init(contract, initial_supply) }) } diff --git a/examples/erc721/lib.rs b/examples/erc721/lib.rs index 919937d80f4..44a4a803729 100644 --- a/examples/erc721/lib.rs +++ b/examples/erc721/lib.rs @@ -131,7 +131,7 @@ mod erc721 { pub fn new() -> Self { // This call is required in order to correctly initialize the // `Mapping`s of our contract. - ink_lang::codegen::initialize_contract(|_| {}) + ink_lang::utils::initialize_contract(|_| {}) } /// Returns the balance of the owner. diff --git a/examples/multisig/lib.rs b/examples/multisig/lib.rs index cc2d4174733..abf63a5be54 100755 --- a/examples/multisig/lib.rs +++ b/examples/multisig/lib.rs @@ -281,7 +281,7 @@ mod multisig { /// If `requirement` violates our invariant. #[ink(constructor)] pub fn new(requirement: u32, mut owners: Vec) -> Self { - ink_lang::codegen::initialize_contract(|contract: &mut Self| { + ink_lang::utils::initialize_contract(|contract: &mut Self| { owners.sort_unstable(); owners.dedup(); ensure_requirement_is_valid(owners.len() as u32, requirement); diff --git a/examples/trait-erc20/lib.rs b/examples/trait-erc20/lib.rs index 66665fcf9d4..a3268c8a65f 100644 --- a/examples/trait-erc20/lib.rs +++ b/examples/trait-erc20/lib.rs @@ -97,7 +97,7 @@ mod erc20 { /// Creates a new ERC-20 contract with the specified initial supply. #[ink(constructor)] pub fn new(initial_supply: Balance) -> Self { - ink_lang::codegen::initialize_contract(|contract| { + ink_lang::utils::initialize_contract(|contract| { Self::new_init(contract, initial_supply) }) } From b68bed674e515ddb1a4add4409f2f503e1f67955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 17 Feb 2022 21:43:29 +0100 Subject: [PATCH 4/9] Remove `Memory` (#1137) --- crates/storage/src/lib.rs | 6 +- crates/storage/src/memory.rs | 323 ----------------------------------- 2 files changed, 1 insertion(+), 328 deletions(-) delete mode 100644 crates/storage/src/memory.rs diff --git a/crates/storage/src/lib.rs b/crates/storage/src/lib.rs index 17aeb9a4ed0..34755851c59 100644 --- a/crates/storage/src/lib.rs +++ b/crates/storage/src/lib.rs @@ -57,7 +57,6 @@ pub(crate) mod collections; #[allow(dead_code)] pub(crate) mod lazy; -mod memory; mod pack; #[cfg(test)] @@ -67,10 +66,7 @@ mod hashmap_entry_api_tests; mod test_utils; #[doc(inline)] -pub use self::{ - lazy::Mapping, - memory::Memory, -}; +pub use self::lazy::Mapping; #[doc(inline)] pub(crate) use self::{ diff --git a/crates/storage/src/memory.rs b/crates/storage/src/memory.rs deleted file mode 100644 index c43ca0d1b77..00000000000 --- a/crates/storage/src/memory.rs +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2018-2022 Parity Technologies (UK) Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use crate::traits::{ - KeyPtr, - SpreadAllocate, - SpreadLayout, -}; -use core::{ - convert::{ - self, - AsRef, - }, - fmt, - fmt::Display, - ops::{ - Deref, - DerefMut, - }, -}; -use ink_prelude::borrow::{ - Borrow, - BorrowMut, -}; - -/// An instance that is solely stored within the contract's memory. -/// -/// This will never be stored to or loaded from contract storage. -/// -/// # Note -/// -/// Use instances of this type in order to have some shared state between -/// contract messages and functions. -/// Its usage is comparable to the Solidity's `memory` instances. -/// Pulling an instance of this type from the contract storage will always -/// yield a default constructed value. -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Memory { - /// The inner value that will always be stored within contract memory. - inner: T, -} - -#[cfg(feature = "std")] -const _: () = { - use crate::traits::StorageLayout; - use ink_metadata::layout::{ - CellLayout, - Layout, - LayoutKey, - }; - - impl StorageLayout for Memory { - fn layout(key_ptr: &mut KeyPtr) -> Layout { - Layout::Cell(CellLayout::new::<()>(LayoutKey::from( - key_ptr.advance_by(0), - ))) - } - } -}; - -impl SpreadLayout for Memory -where - T: Default, -{ - const FOOTPRINT: u64 = 0; - - #[inline] - fn pull_spread(_ptr: &mut KeyPtr) -> Self { - Default::default() - } - - #[inline] - fn push_spread(&self, _ptr: &mut KeyPtr) {} - - #[inline] - fn clear_spread(&self, _ptr: &mut KeyPtr) {} -} - -impl SpreadAllocate for Memory -where - T: Default, -{ - #[inline] - fn allocate_spread(_ptr: &mut KeyPtr) -> Self { - Default::default() - } -} - -impl Memory { - /// Creates a new memory instance. - #[inline] - pub fn new(inner: T) -> Self { - Self { inner } - } - - /// Returns a shared reference to the inner `T`. - #[inline] - pub fn get(memory: &Self) -> &T { - &memory.inner - } - - /// Returns an exclusive reference to the inner `T`. - #[inline] - pub fn get_mut(memory: &mut Self) -> &mut T { - &mut memory.inner - } -} - -impl From for Memory { - #[inline] - fn from(inner: T) -> Self { - Self::new(inner) - } -} - -impl Default for Memory -where - T: Default, -{ - #[inline] - fn default() -> Self { - Self::new(::default()) - } -} - -impl Display for Memory -where - T: Display, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - core::fmt::Display::fmt(Self::get(self), f) - } -} - -impl Deref for Memory { - type Target = T; - - #[inline] - fn deref(&self) -> &Self::Target { - Self::get(self) - } -} - -impl DerefMut for Memory { - #[inline] - fn deref_mut(&mut self) -> &mut Self::Target { - Self::get_mut(self) - } -} - -impl AsRef for Memory -where - T: SpreadLayout, -{ - #[inline] - fn as_ref(&self) -> &T { - Self::get(self) - } -} - -impl convert::AsMut for Memory -where - T: SpreadLayout, -{ - #[inline] - fn as_mut(&mut self) -> &mut T { - Self::get_mut(self) - } -} - -impl Borrow for Memory -where - T: SpreadLayout, -{ - #[inline] - fn borrow(&self) -> &T { - Self::get(self) - } -} - -impl BorrowMut for Memory -where - T: SpreadLayout, -{ - #[inline] - fn borrow_mut(&mut self) -> &mut T { - Self::get_mut(self) - } -} - -#[cfg(test)] -mod tests { - use super::Memory; - use crate::traits::{ - KeyPtr, - SpreadLayout, - }; - use core::{ - convert::{ - AsMut, - AsRef, - }, - ops::{ - Deref, - DerefMut, - }, - }; - use ink_env::test::DefaultAccounts; - use ink_prelude::borrow::{ - Borrow, - BorrowMut, - }; - use ink_primitives::Key; - - type ComplexTuple = (u8, [i32; 4], (bool, i32)); - - fn complex_value() -> ComplexTuple { - (b'A', [0x00; 4], (true, 42)) - } - - #[test] - fn new_works() { - let mut expected = complex_value(); - let mut mem = Memory::new(expected); - assert_eq!( as Deref>::deref(&mem), &expected); - assert_eq!( as DerefMut>::deref_mut(&mut mem), &mut expected); - assert_eq!( as AsRef<_>>::as_ref(&mem), &expected); - assert_eq!( as AsMut<_>>::as_mut(&mut mem), &mut expected); - assert_eq!(Borrow::::borrow(&mem), &expected); - assert_eq!( - BorrowMut::::borrow_mut(&mut mem), - &mut expected - ); - assert_eq!(Memory::get(&mem), &expected); - assert_eq!(Memory::get_mut(&mut mem), &mut expected); - } - - #[test] - fn from_works() { - let mut expected = complex_value(); - let mut from = Memory::from(expected); - assert_eq!(from, Memory::new(expected)); - assert_eq!(Memory::get(&from), &expected); - assert_eq!(Memory::get_mut(&mut from), &mut expected); - } - - #[test] - fn default_works() { - use core::fmt::Debug; - fn assert_default() - where - T: Debug + Default + PartialEq, - { - let mut memory_default = as Default>::default(); - let mut default = ::default(); - assert_eq!(>::get(&memory_default), &default); - assert_eq!(>::get_mut(&mut memory_default), &mut default); - } - assert_default::(); - assert_default::(); - assert_default::>(); - assert_default::>(); - } - - #[test] - fn spread_layout_push_pull_works() { - let p1 = Memory::new((b'A', [0x00; 4], (true, 42))); - assert_eq!(*p1, (b'A', [0x00; 4], (true, 42))); - assert_ne!(p1, Default::default()); - let root_key = Key::from([0x42; 32]); - SpreadLayout::push_spread(&p1, &mut KeyPtr::from(root_key)); - // Now load another instance of a pack from the same key and check - // if both instances are equal: - let p2 = SpreadLayout::pull_spread(&mut KeyPtr::from(root_key)); - assert_ne!(p1, p2); - assert_eq!(p2, Default::default()); - } - - fn run_test(f: F) - where - F: FnOnce(DefaultAccounts), - { - ink_env::test::run_test::(|default_accounts| { - f(default_accounts); - Ok(()) - }) - .unwrap() - } - - #[test] - fn spread_layout_clear_works() { - run_test(|_| { - // Clearing a memory instance should have no effect on the underlying - // contract storage. We can test this by pushing and pulling a storage - // affecting entity in between on the same storage region: - let root_key = Key::from([0x42; 32]); - ::push_spread(&42, &mut KeyPtr::from(root_key)); - let loaded1 = ::pull_spread(&mut KeyPtr::from(root_key)); - assert_eq!(loaded1, 42); - let mem = Memory::new(77); - SpreadLayout::push_spread(&mem, &mut KeyPtr::from(root_key)); - let loaded2 = ::pull_spread(&mut KeyPtr::from(root_key)); - assert_eq!(loaded2, 42); - // Now we clear the `i32` from storage and check whether that works. - // We load as `Option` in order to expect `None`: - ::clear_spread(&loaded2, &mut KeyPtr::from(root_key)); - use crate::traits::pull_packed_root_opt; - let loaded3 = pull_packed_root_opt::>(&root_key); - assert_eq!(loaded3, None); - }) - } -} From be42524a23243c0ce497a54b9bf5405a04cc74b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 18 Feb 2022 00:02:50 +0100 Subject: [PATCH 5/9] Improve documentation of `ink_storage::Mapping` (#1138) --- crates/storage/Cargo.toml | 2 ++ crates/storage/src/lazy/mapping.rs | 48 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 063541348ef..fcdd85624e1 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -33,6 +33,8 @@ quickcheck_macros = "1.0" itertools = "0.10" paste = "1.0" +ink_lang = { version = "3.0.0-rc8", path = "../lang/", default-features = false } + [features] default = ["std"] std = [ diff --git a/crates/storage/src/lazy/mapping.rs b/crates/storage/src/lazy/mapping.rs index d84ee9b7ee8..3d8d12d29bd 100644 --- a/crates/storage/src/lazy/mapping.rs +++ b/crates/storage/src/lazy/mapping.rs @@ -37,6 +37,54 @@ use ink_env::hash::{ use ink_primitives::Key; /// A mapping of key-value pairs directly into contract storage. +/// +/// # Important +/// +/// If you use this data structure you must use the function +/// [`ink_lang::utils::initialize_contract`](https://paritytech.github.io/ink/ink_lang/utils/fn.initialize_contract.html) +/// in your contract's constructors! +/// +/// Note that in order to use this function your contract's storage struct must implement the +/// [`SpreadAllocate`](crate::traits::SpreadAllocate) trait. +/// +/// This is an example of how you can do this: +/// ```rust +/// # use ink_lang as ink; +/// # use ink_env::{ +/// # Environment, +/// # DefaultEnvironment, +/// # }; +/// # type AccountId = ::AccountId; +/// +/// # #[ink::contract] +/// # mod my_module { +/// use ink_storage::{traits::SpreadAllocate, Mapping}; +/// +/// #[ink(storage)] +/// #[derive(SpreadAllocate)] +/// pub struct MyContract { +/// balances: Mapping, +/// } +/// +/// impl MyContract { +/// #[ink(constructor)] +/// pub fn new() -> Self { +/// ink_lang::utils::initialize_contract(Self::new_init) +/// } +/// +/// /// Default initializes the contract. +/// fn new_init(&mut self) { +/// let caller = Self::env().caller(); +/// let value: Balance = Default::default(); +/// self.balances.insert(&caller, &value); +/// } +/// # #[ink(message)] +/// # pub fn my_message(&self) { } +/// } +/// # } +/// ``` +/// +/// More usage examples can be found [in the ink! examples](https://github.com/paritytech/ink/tree/master/examples). #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub struct Mapping { offset_key: Key, From 0869d333024bc5c5b4062862f62779a8765ae93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 18 Feb 2022 09:05:29 +0100 Subject: [PATCH 6/9] Fix test fixture for `nightly-2022-02-17` (#1139) --- .../contract/fail/event-too-many-topics-anonymous.stderr | 8 ++++---- .../tests/ui/contract/fail/event-too-many-topics.stderr | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/lang/tests/ui/contract/fail/event-too-many-topics-anonymous.stderr b/crates/lang/tests/ui/contract/fail/event-too-many-topics-anonymous.stderr index 57c4886dc17..4112ca28de5 100644 --- a/crates/lang/tests/ui/contract/fail/event-too-many-topics-anonymous.stderr +++ b/crates/lang/tests/ui/contract/fail/event-too-many-topics-anonymous.stderr @@ -11,10 +11,10 @@ error[E0277]: the trait bound `EventTopics<4_usize>: RespectTopicLimit<2_usize>` | |_____^ the trait `RespectTopicLimit<2_usize>` is not implemented for `EventTopics<4_usize>` | = help: the following implementations were found: - as RespectTopicLimit<0_usize>> - as RespectTopicLimit<10_usize>> - as RespectTopicLimit<11_usize>> - as RespectTopicLimit<12_usize>> + as RespectTopicLimit<10_usize>> + as RespectTopicLimit<11_usize>> + as RespectTopicLimit<12_usize>> + as RespectTopicLimit<4_usize>> and 87 others note: required by a bound in `EventRespectsTopicLimit` --> src/codegen/event/topics.rs diff --git a/crates/lang/tests/ui/contract/fail/event-too-many-topics.stderr b/crates/lang/tests/ui/contract/fail/event-too-many-topics.stderr index ad6aff43119..57b46ac1847 100644 --- a/crates/lang/tests/ui/contract/fail/event-too-many-topics.stderr +++ b/crates/lang/tests/ui/contract/fail/event-too-many-topics.stderr @@ -11,10 +11,10 @@ error[E0277]: the trait bound `EventTopics<3_usize>: RespectTopicLimit<2_usize>` | |_____^ the trait `RespectTopicLimit<2_usize>` is not implemented for `EventTopics<3_usize>` | = help: the following implementations were found: - as RespectTopicLimit<0_usize>> - as RespectTopicLimit<10_usize>> - as RespectTopicLimit<11_usize>> - as RespectTopicLimit<12_usize>> + as RespectTopicLimit<10_usize>> + as RespectTopicLimit<11_usize>> + as RespectTopicLimit<12_usize>> + as RespectTopicLimit<3_usize>> and 87 others note: required by a bound in `EventRespectsTopicLimit` --> src/codegen/event/topics.rs From 9fd0317a82445a1aaa30c1dcae6e9d5cc8f8dc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 18 Feb 2022 10:46:17 +0100 Subject: [PATCH 7/9] Remove redundant setting of `std` feature (#1140) --- crates/env/Cargo.toml | 3 --- crates/lang/Cargo.toml | 1 - crates/storage/Cargo.toml | 2 -- examples/contract-terminate/Cargo.toml | 2 -- examples/contract-transfer/Cargo.toml | 2 -- examples/delegator/Cargo.toml | 2 -- examples/delegator/accumulator/Cargo.toml | 2 -- examples/delegator/adder/Cargo.toml | 2 -- examples/delegator/subber/Cargo.toml | 2 -- examples/dns/Cargo.toml | 2 -- examples/erc1155/Cargo.toml | 2 -- examples/erc20/Cargo.toml | 2 -- examples/erc721/Cargo.toml | 2 -- examples/flipper/Cargo.toml | 2 -- examples/incrementer/Cargo.toml | 2 -- examples/multisig/Cargo.toml | 2 -- examples/proxy/Cargo.toml | 2 -- examples/rand-extension/Cargo.toml | 1 - examples/trait-erc20/Cargo.toml | 2 -- examples/trait-flipper/Cargo.toml | 2 -- examples/trait-incrementer/Cargo.toml | 2 -- 21 files changed, 41 deletions(-) diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 9c642607a4a..282ec29713a 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -52,16 +52,13 @@ scale-info = { version = "2", default-features = false, features = ["derive"], o [features] default = ["std"] std = [ - "ink_metadata", "ink_metadata/std", "ink_allocator/std", "ink_prelude/std", "ink_primitives/std", "scale/std", - "scale-info", "scale-info/std", "secp256k1", - "rand", "rand/std", "rand/std_rng", "num-traits/std", diff --git a/crates/lang/Cargo.toml b/crates/lang/Cargo.toml index 9f1e6edee36..bd732048f20 100644 --- a/crates/lang/Cargo.toml +++ b/crates/lang/Cargo.toml @@ -37,7 +37,6 @@ scale-info = { version = "2", default-features = false, features = ["derive"] } [features] default = ["std"] std = [ - "ink_metadata", "ink_metadata/std", "ink_prelude/std", "ink_primitives/std", diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index fcdd85624e1..57f72621510 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -38,13 +38,11 @@ ink_lang = { version = "3.0.0-rc8", path = "../lang/", default-features = false [features] default = ["std"] std = [ - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_prelude/std", "ink_primitives/std", "scale/std", - "scale-info", "scale-info/std", ] ink-fuzz-tests = ["std"] diff --git a/examples/contract-terminate/Cargo.toml b/examples/contract-terminate/Cargo.toml index 59802ca2f14..a6bd6cc2141 100644 --- a/examples/contract-terminate/Cargo.toml +++ b/examples/contract-terminate/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/contract-transfer/Cargo.toml b/examples/contract-transfer/Cargo.toml index a3eec338313..a6300dae372 100644 --- a/examples/contract-transfer/Cargo.toml +++ b/examples/contract-transfer/Cargo.toml @@ -24,13 +24,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/delegator/Cargo.toml b/examples/delegator/Cargo.toml index 0d9be78692d..235d18ec901 100644 --- a/examples/delegator/Cargo.toml +++ b/examples/delegator/Cargo.toml @@ -27,13 +27,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", "adder/std", diff --git a/examples/delegator/accumulator/Cargo.toml b/examples/delegator/accumulator/Cargo.toml index aa44450cc1c..6b3fa551d44 100644 --- a/examples/delegator/accumulator/Cargo.toml +++ b/examples/delegator/accumulator/Cargo.toml @@ -28,13 +28,11 @@ crate-type = [ default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/delegator/adder/Cargo.toml b/examples/delegator/adder/Cargo.toml index d134bd212d2..47b6e19c46c 100644 --- a/examples/delegator/adder/Cargo.toml +++ b/examples/delegator/adder/Cargo.toml @@ -30,13 +30,11 @@ crate-type = [ default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", "accumulator/std", diff --git a/examples/delegator/subber/Cargo.toml b/examples/delegator/subber/Cargo.toml index 9aba9e41d93..6cc7c8bbee0 100644 --- a/examples/delegator/subber/Cargo.toml +++ b/examples/delegator/subber/Cargo.toml @@ -30,13 +30,11 @@ crate-type = [ default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", "accumulator/std", diff --git a/examples/dns/Cargo.toml b/examples/dns/Cargo.toml index fb95fe716d5..e943712751f 100644 --- a/examples/dns/Cargo.toml +++ b/examples/dns/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/erc1155/Cargo.toml b/examples/erc1155/Cargo.toml index fb62b82db67..ec29904b510 100644 --- a/examples/erc1155/Cargo.toml +++ b/examples/erc1155/Cargo.toml @@ -24,14 +24,12 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "ink_prelude/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index 2c8443ce7ec..7234ac890e0 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/erc721/Cargo.toml b/examples/erc721/Cargo.toml index d966c8439ea..fc3c1a36dd9 100644 --- a/examples/erc721/Cargo.toml +++ b/examples/erc721/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/flipper/Cargo.toml b/examples/flipper/Cargo.toml index 93d25cd6b13..c46754b97d2 100644 --- a/examples/flipper/Cargo.toml +++ b/examples/flipper/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/incrementer/Cargo.toml b/examples/incrementer/Cargo.toml index 2cc40f4e8cf..30da41a6c62 100644 --- a/examples/incrementer/Cargo.toml +++ b/examples/incrementer/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/multisig/Cargo.toml b/examples/multisig/Cargo.toml index 028107621d8..b76c08a4779 100755 --- a/examples/multisig/Cargo.toml +++ b/examples/multisig/Cargo.toml @@ -23,7 +23,6 @@ crate-type = ["cdylib"] [features] default = ["std"] std = [ - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", @@ -31,7 +30,6 @@ std = [ "ink_primitives/std", "ink_prelude/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml index 062504b9c56..6df464f8db3 100644 --- a/examples/proxy/Cargo.toml +++ b/examples/proxy/Cargo.toml @@ -28,13 +28,11 @@ overflow-checks = false default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/rand-extension/Cargo.toml b/examples/rand-extension/Cargo.toml index 0cbddbc0ef2..4918b3067d1 100755 --- a/examples/rand-extension/Cargo.toml +++ b/examples/rand-extension/Cargo.toml @@ -27,7 +27,6 @@ std = [ "ink_storage/std", "ink_primitives/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/trait-erc20/Cargo.toml b/examples/trait-erc20/Cargo.toml index 2cfd63f5347..bc21f64c3e0 100644 --- a/examples/trait-erc20/Cargo.toml +++ b/examples/trait-erc20/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/trait-flipper/Cargo.toml b/examples/trait-flipper/Cargo.toml index 4fc06ee3f9c..aff46ca6917 100644 --- a/examples/trait-flipper/Cargo.toml +++ b/examples/trait-flipper/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] diff --git a/examples/trait-incrementer/Cargo.toml b/examples/trait-incrementer/Cargo.toml index 957ecb8b164..6ef71a3987b 100644 --- a/examples/trait-incrementer/Cargo.toml +++ b/examples/trait-incrementer/Cargo.toml @@ -23,13 +23,11 @@ crate-type = ["cdylib"] default = ["std"] std = [ "ink_primitives/std", - "ink_metadata", "ink_metadata/std", "ink_env/std", "ink_storage/std", "ink_lang/std", "scale/std", - "scale-info", "scale-info/std", ] ink-as-dependency = [] From 2f86746a1dec4fd8b43ba0e051133653668e969d Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 21 Feb 2022 09:49:01 +0000 Subject: [PATCH 8/9] Unique trait id as a parameter for `CallBuilder` trait impls (#1141) * Copy multiple foreign traits example from other PR * Rename to TraitInfo and add ID const * Use TraitInfo::ID to resolve CallBuilder impl * clean up todos and docs * clippy * Fix message selector overlap UI tests * Update examples/trait-incrementer/Cargo.toml Co-authored-by: Hernando Castano * Update examples/trait-incrementer/Cargo.toml Co-authored-by: Hernando Castano * Update examples/trait-incrementer/traits/lib.rs Co-authored-by: Hernando Castano * Update examples/trait-incrementer/traits/Cargo.toml Co-authored-by: Hernando Castano * Update examples/trait-incrementer/traits/Cargo.toml Co-authored-by: Hernando Castano Co-authored-by: Hernando Castano --- crates/lang/codegen/src/generator/arg_list.rs | 4 +- .../generator/as_dependency/call_builder.rs | 14 +++---- .../generator/as_dependency/contract_ref.rs | 4 +- .../src/generator/trait_def/trait_registry.rs | 24 +++++++++++- .../src/codegen/trait_def/call_builder.rs | 2 +- crates/lang/src/reflect/mod.rs | 2 +- crates/lang/src/reflect/trait_def/info.rs | 10 ++--- crates/lang/src/reflect/trait_def/mod.rs | 2 +- .../trait-message-selector-overlap-1.stderr | 9 +++++ .../trait-message-selector-overlap-2.stderr | 9 +++++ .../trait-message-selector-overlap-3.stderr | 9 +++++ examples/trait-incrementer/Cargo.toml | 2 + examples/trait-incrementer/lib.rs | 22 +---------- examples/trait-incrementer/traits/.gitignore | 9 +++++ examples/trait-incrementer/traits/Cargo.toml | 33 ++++++++++++++++ examples/trait-incrementer/traits/lib.rs | 39 +++++++++++++++++++ 16 files changed, 153 insertions(+), 41 deletions(-) create mode 100644 examples/trait-incrementer/traits/.gitignore create mode 100644 examples/trait-incrementer/traits/Cargo.toml create mode 100644 examples/trait-incrementer/traits/lib.rs diff --git a/crates/lang/codegen/src/generator/arg_list.rs b/crates/lang/codegen/src/generator/arg_list.rs index bcc771a46cb..913fbc64dc0 100644 --- a/crates/lang/codegen/src/generator/arg_list.rs +++ b/crates/lang/codegen/src/generator/arg_list.rs @@ -98,7 +98,7 @@ pub fn generate_reference_to_trait_info( trait_path: &syn::Path, ) -> TokenStream2 { quote_spanned!(span=> - <::ink_lang::reflect::TraitDefinitionRegistry - as #trait_path>::__ink_TraitInfo + <<::ink_lang::reflect::TraitDefinitionRegistry + as #trait_path>::__ink_TraitInfo as ::ink_lang::reflect::TraitInfo>::ID ) } diff --git a/crates/lang/codegen/src/generator/as_dependency/call_builder.rs b/crates/lang/codegen/src/generator/as_dependency/call_builder.rs index 17735a0ae05..bdd5a2fc1f3 100644 --- a/crates/lang/codegen/src/generator/as_dependency/call_builder.rs +++ b/crates/lang/codegen/src/generator/as_dependency/call_builder.rs @@ -182,10 +182,10 @@ impl CallBuilder<'_> { ) -> TokenStream2 { let span = impl_block.span(); let cb_ident = Self::call_builder_ident(); - let trait_info = generator::generate_reference_to_trait_info(span, trait_path); + let trait_info_id = generator::generate_reference_to_trait_info(span, trait_path); quote_spanned!(span=> #[doc(hidden)] - impl ::ink_lang::codegen::TraitCallForwarderFor<#trait_info> for #cb_ident { + impl ::ink_lang::codegen::TraitCallForwarderFor<{#trait_info_id}> for #cb_ident { type Forwarder = <::__ink_TraitInfo as ::ink_lang::codegen::TraitCallForwarder>::Forwarder; #[inline] @@ -217,7 +217,7 @@ impl CallBuilder<'_> { #[inline] fn build(&self) -> &::Builder { <_ as ::ink_lang::codegen::TraitCallBuilder>::call( - >::forward(self) + >::forward(self) ) } @@ -226,7 +226,7 @@ impl CallBuilder<'_> { -> &mut ::Builder { <_ as ::ink_lang::codegen::TraitCallBuilder>::call_mut( - >::forward_mut(self) + >::forward_mut(self) ) } } @@ -265,7 +265,7 @@ impl CallBuilder<'_> { let span = message.span(); let message_ident = message.ident(); let output_ident = generator::output_ident(message_ident); - let trait_info = generator::generate_reference_to_trait_info(span, trait_path); + let trait_info_id = generator::generate_reference_to_trait_info(span, trait_path); let (input_bindings, input_types): (Vec<_>, Vec<_>) = message .callable() .inputs() @@ -283,7 +283,7 @@ impl CallBuilder<'_> { quote_spanned!(span=> type #output_ident = <<< Self - as ::ink_lang::codegen::TraitCallForwarderFor<#trait_info>>::Forwarder + as ::ink_lang::codegen::TraitCallForwarderFor<{#trait_info_id}>>::Forwarder as ::ink_lang::codegen::TraitCallBuilder>::Builder as #trait_path>::#output_ident; @@ -294,7 +294,7 @@ impl CallBuilder<'_> { #( , #input_bindings: #input_types )* ) -> Self::#output_ident { <_ as #trait_path>::#message_ident( - >::#build_cmd(self) + >::#build_cmd(self) #( , #input_bindings )* ) } diff --git a/crates/lang/codegen/src/generator/as_dependency/contract_ref.rs b/crates/lang/codegen/src/generator/as_dependency/contract_ref.rs index 292ed7a009a..d1c4a8921d3 100644 --- a/crates/lang/codegen/src/generator/as_dependency/contract_ref.rs +++ b/crates/lang/codegen/src/generator/as_dependency/contract_ref.rs @@ -242,7 +242,7 @@ impl ContractRef<'_> { ) -> TokenStream2 { use ir::Callable as _; let span = message.span(); - let trait_info = generator::generate_reference_to_trait_info(span, trait_path); + let trait_info_id = generator::generate_reference_to_trait_info(span, trait_path); let message_ident = message.ident(); let output_ident = generator::output_ident(message_ident); let call_operator = match message.receiver() { @@ -266,7 +266,7 @@ impl ContractRef<'_> { #( , #input_bindings : #input_types )* ) -> Self::#output_ident { <_ as #trait_path>::#message_ident( - <_ as ::ink_lang::codegen::TraitCallForwarderFor<#trait_info>>::#forward_operator( + <_ as ::ink_lang::codegen::TraitCallForwarderFor<{#trait_info_id}>>::#forward_operator( ::#call_operator(self), ) #( , #input_bindings )* diff --git a/crates/lang/codegen/src/generator/trait_def/trait_registry.rs b/crates/lang/codegen/src/generator/trait_def/trait_registry.rs index a7b822e94c2..8b536d6708b 100644 --- a/crates/lang/codegen/src/generator/trait_def/trait_registry.rs +++ b/crates/lang/codegen/src/generator/trait_def/trait_registry.rs @@ -243,6 +243,7 @@ impl TraitRegistry<'_> { /// It is mainly used to access global information about the ink! trait. fn generate_trait_info_object(&self) -> TokenStream2 { let span = self.span(); + let trait_id = self.generate_trait_id(); let trait_ident = self.trait_ident(); let trait_info_ident = self.trait_def.trait_info_ident(); let trait_call_forwarder = self.trait_def.call_forwarder_ident(); @@ -256,10 +257,12 @@ impl TraitRegistry<'_> { #trait_message_info - impl ::ink_lang::reflect::TraitModulePath for #trait_info_ident + impl ::ink_lang::reflect::TraitInfo for #trait_info_ident where E: ::ink_env::Environment, { + const ID: u32 = #trait_id; + const PATH: &'static ::core::primitive::str = ::core::module_path!(); const NAME: &'static ::core::primitive::str = ::core::stringify!(#trait_ident); @@ -274,6 +277,25 @@ impl TraitRegistry<'_> { ) } + /// Generates a unique id for the trait, as an XOR of the set of selectors. + fn generate_trait_id(&self) -> syn::LitInt { + let span = self.span(); + let mut id = 0u32; + debug_assert!( + self.trait_def + .trait_def + .item() + .iter_items() + .next() + .is_some(), + "invalid empty ink! trait definition" + ); + for (_, selector) in self.trait_def.trait_def.item().iter_items() { + id ^= selector.into_be_u32() + } + syn::LitInt::new(&format!("{}", id), span) + } + /// Generates the [`::ink_lang::reflect::TraitMessageInfo`] implementations for all /// ink! messages defined by the ink! trait definition. fn generate_info_for_trait_messages(&self) -> TokenStream2 { diff --git a/crates/lang/src/codegen/trait_def/call_builder.rs b/crates/lang/src/codegen/trait_def/call_builder.rs index c1622b3c200..74ec7cd5876 100644 --- a/crates/lang/src/codegen/trait_def/call_builder.rs +++ b/crates/lang/src/codegen/trait_def/call_builder.rs @@ -48,7 +48,7 @@ pub trait TraitCallForwarder { /// While the trait is not necessary it encapsulates a lot of /// utility and auxiliary code required for the actual ink! trait /// implementations. -pub trait TraitCallForwarderFor { +pub trait TraitCallForwarderFor { type Forwarder: TraitCallBuilder; /// Forwards the `&self` call. diff --git a/crates/lang/src/reflect/mod.rs b/crates/lang/src/reflect/mod.rs index bca4f0aca01..3f59becff34 100644 --- a/crates/lang/src/reflect/mod.rs +++ b/crates/lang/src/reflect/mod.rs @@ -49,7 +49,7 @@ pub use self::{ event::ContractEventBase, trait_def::{ TraitDefinitionRegistry, + TraitInfo, TraitMessageInfo, - TraitModulePath, }, }; diff --git a/crates/lang/src/reflect/trait_def/info.rs b/crates/lang/src/reflect/trait_def/info.rs index 3b2734db150..5c561b09306 100644 --- a/crates/lang/src/reflect/trait_def/info.rs +++ b/crates/lang/src/reflect/trait_def/info.rs @@ -136,11 +136,11 @@ pub trait TraitMessageInfo { const SELECTOR: [u8; 4]; } -/// Captures the module path of the ink! trait definition. -/// -/// This can be used to differentiate between two equally named -/// ink! trait definitions and also for metadata. -pub trait TraitModulePath { +/// Captures info about an ink! trait definition. +pub trait TraitInfo { + /// The unique id of the ink! trait definition. + const ID: u32; + /// The module path of the ink! trait definition. /// /// This is equivalent to Rust's builtin `module_path!` macro diff --git a/crates/lang/src/reflect/trait_def/mod.rs b/crates/lang/src/reflect/trait_def/mod.rs index 54884f41026..9f9fdb64064 100644 --- a/crates/lang/src/reflect/trait_def/mod.rs +++ b/crates/lang/src/reflect/trait_def/mod.rs @@ -17,8 +17,8 @@ mod registry; pub use self::{ info::{ + TraitInfo, TraitMessageInfo, - TraitModulePath, }, registry::TraitDefinitionRegistry, }; diff --git a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-1.stderr b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-1.stderr index 8c550382817..6ea91ecc4eb 100644 --- a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-1.stderr +++ b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-1.stderr @@ -6,3 +6,12 @@ error[E0119]: conflicting implementations of trait `ink_lang::reflect::Dispatcha ... 47 | fn message(&self) {} | ^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::Contract` + +error[E0119]: conflicting implementations of trait `ink_lang::codegen::TraitCallForwarderFor<1083895717_u32>` for type `contract::_::CallBuilder` + --> tests/ui/contract/fail/trait-message-selector-overlap-1.rs:45:5 + | +40 | impl TraitDefinition1 for Contract { + | ---------------------------------- first implementation here +... +45 | impl TraitDefinition2 for Contract { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::_::CallBuilder` diff --git a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-2.stderr b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-2.stderr index ab83edd8e3d..9fd4346af04 100644 --- a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-2.stderr +++ b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-2.stderr @@ -6,3 +6,12 @@ error[E0119]: conflicting implementations of trait `ink_lang::reflect::Dispatcha ... 47 | fn message(&self) {} | ^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::Contract` + +error[E0119]: conflicting implementations of trait `ink_lang::codegen::TraitCallForwarderFor<1518209067_u32>` for type `contract::_::CallBuilder` + --> tests/ui/contract/fail/trait-message-selector-overlap-2.rs:45:5 + | +40 | impl TraitDefinition1 for Contract { + | ---------------------------------- first implementation here +... +45 | impl TraitDefinition2 for Contract { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::_::CallBuilder` diff --git a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-3.stderr b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-3.stderr index 3e99b03a02b..d8b948ebb4e 100644 --- a/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-3.stderr +++ b/crates/lang/tests/ui/contract/fail/trait-message-selector-overlap-3.stderr @@ -6,3 +6,12 @@ error[E0119]: conflicting implementations of trait `ink_lang::reflect::Dispatcha ... 47 | fn message2(&self) {} | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::Contract` + +error[E0119]: conflicting implementations of trait `ink_lang::codegen::TraitCallForwarderFor<42_u32>` for type `contract::_::CallBuilder` + --> tests/ui/contract/fail/trait-message-selector-overlap-3.rs:45:5 + | +40 | impl TraitDefinition1 for Contract { + | ---------------------------------- first implementation here +... +45 | impl TraitDefinition2 for Contract { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `contract::_::CallBuilder` diff --git a/examples/trait-incrementer/Cargo.toml b/examples/trait-incrementer/Cargo.toml index 6ef71a3987b..3741c05c65c 100644 --- a/examples/trait-incrementer/Cargo.toml +++ b/examples/trait-incrementer/Cargo.toml @@ -13,6 +13,7 @@ ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } +traits = { path = "./traits", default-features = false } [lib] name = "trait_incrementer" @@ -29,5 +30,6 @@ std = [ "ink_lang/std", "scale/std", "scale-info/std", + "traits/std", ] ink-as-dependency = [] diff --git a/examples/trait-incrementer/lib.rs b/examples/trait-incrementer/lib.rs index 8f3374d9141..af21de87f83 100644 --- a/examples/trait-incrementer/lib.rs +++ b/examples/trait-incrementer/lib.rs @@ -3,29 +3,9 @@ use ink_lang as ink; -/// Allows to increment and get the current value. -#[ink::trait_definition] -pub trait Increment { - /// Increments the current value of the implementer by one (1). - #[ink(message)] - fn inc(&mut self); - - /// Returns the current value of the implementer. - #[ink(message)] - fn get(&self) -> u64; -} - -/// Allows to reset the current value. -#[ink::trait_definition] -pub trait Reset { - /// Resets the current value to zero. - #[ink(message)] - fn reset(&mut self); -} - #[ink::contract] pub mod incrementer { - use super::{ + use traits::{ Increment, Reset, }; diff --git a/examples/trait-incrementer/traits/.gitignore b/examples/trait-incrementer/traits/.gitignore new file mode 100644 index 00000000000..bf910de10af --- /dev/null +++ b/examples/trait-incrementer/traits/.gitignore @@ -0,0 +1,9 @@ +# Ignore build artifacts from the local tests sub-crate. +/target/ + +# Ignore backup files creates by cargo fmt. +**/*.rs.bk + +# Remove Cargo.lock when creating an executable, leave it for libraries +# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock +Cargo.lock \ No newline at end of file diff --git a/examples/trait-incrementer/traits/Cargo.toml b/examples/trait-incrementer/traits/Cargo.toml new file mode 100644 index 00000000000..69a32d9f964 --- /dev/null +++ b/examples/trait-incrementer/traits/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "traits" +version = "3.0.0-rc8" +authors = ["Parity Technologies "] +edition = "2021" + +[dependencies] +ink_primitives = { version = "3.0.0-rc8", path = "../../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc8", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc8", path = "../../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc8", path = "../../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-features = false } + +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } +scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } + +[lib] +name = "traits" +path = "lib.rs" +crate-type = ["rlib"] + +[features] +default = ["std"] +std = [ + "ink_primitives/std", + "ink_metadata/std", + "ink_env/std", + "ink_storage/std", + "ink_lang/std", + "scale/std", + "scale-info/std", +] +ink-as-dependency = [] diff --git a/examples/trait-incrementer/traits/lib.rs b/examples/trait-incrementer/traits/lib.rs new file mode 100644 index 00000000000..ef7d844d4b7 --- /dev/null +++ b/examples/trait-incrementer/traits/lib.rs @@ -0,0 +1,39 @@ +// Copyright 2018-2022 Parity Technologies (UK) Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#![cfg_attr(not(feature = "std"), no_std)] + +//! Traits are extracted into a separate crate to show how the user can import +//! several foreign traits and implement those for the contract. + +use ink_lang as ink; + +/// Allows to increment and get the current value. +#[ink::trait_definition] +pub trait Increment { + /// Increments the current value of the implementer by one (1). + #[ink(message)] + fn inc(&mut self); + + /// Returns the current value of the implementer. + #[ink(message)] + fn get(&self) -> u64; +} + +/// Allows to reset the current value. +#[ink::trait_definition] +pub trait Reset { + /// Resets the current value to zero. + #[ink(message)] + fn reset(&mut self); +} From 07a8ed9b14a768b87f69dfcd6fedc580c7f36e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 23 Feb 2022 08:39:01 +0100 Subject: [PATCH 9/9] Release ink! 3.0.0-rc9 (#1135) * Bump crate versions to `3.0.0-rc9` * Improve documentation of `ink_storage::Mapping` * Hide `Memory` * Update release notes * Remove `Memory` * Remove `Memory` * Fix doc test * Add `Changed` section to release notes * Update release notes * Update release notes --- RELEASES.md | 42 +++++++++++++++++++++-- crates/allocator/Cargo.toml | 2 +- crates/engine/Cargo.toml | 2 +- crates/env/Cargo.toml | 12 +++---- crates/eth_compatibility/Cargo.toml | 4 +-- crates/lang/Cargo.toml | 20 +++++------ crates/lang/codegen/Cargo.toml | 4 +-- crates/lang/ir/Cargo.toml | 2 +- crates/lang/macro/Cargo.toml | 16 ++++----- crates/metadata/Cargo.toml | 6 ++-- crates/prelude/Cargo.toml | 2 +- crates/primitives/Cargo.toml | 4 +-- crates/storage/Cargo.toml | 14 ++++---- crates/storage/derive/Cargo.toml | 12 +++---- examples/contract-terminate/Cargo.toml | 12 +++---- examples/contract-transfer/Cargo.toml | 14 ++++---- examples/delegator/Cargo.toml | 18 +++++----- examples/delegator/accumulator/Cargo.toml | 12 +++---- examples/delegator/adder/Cargo.toml | 14 ++++---- examples/delegator/subber/Cargo.toml | 14 ++++---- examples/dns/Cargo.toml | 12 +++---- examples/erc1155/Cargo.toml | 14 ++++---- examples/erc20/Cargo.toml | 12 +++---- examples/erc721/Cargo.toml | 12 +++---- examples/flipper/Cargo.toml | 12 +++---- examples/incrementer/Cargo.toml | 12 +++---- examples/multisig/Cargo.toml | 12 +++---- examples/proxy/Cargo.toml | 14 ++++---- examples/rand-extension/Cargo.toml | 12 +++---- examples/trait-erc20/Cargo.toml | 12 +++---- examples/trait-flipper/Cargo.toml | 12 +++---- examples/trait-incrementer/Cargo.toml | 12 +++---- 32 files changed, 206 insertions(+), 168 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 2d37ec0c919..b1352d6fa87 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,4 +1,25 @@ -# Unreleased +# Version 3.0-rc9 + +This is the 9th release candidate for ink! 3.0. + +## Breaking Changes +### We removed all data structures other than `Mapping` from the public ink! API + +This is a drastic breaking change; it was no easy decision for us. +It affects `Lazy` and `Memory` as well. The rationale behind this change, +as well as some notes on migrating existing contracts, are explained +in [#1111](https://github.com/paritytech/ink/pull/1111) and +[#1137](https://github.com/paritytech/ink/pull/1137). + +If you used `Memory` in your contract, you can achieve the same functionality +by passing this data via arguments. If you think there's a case to be +made for bringing it back, please get in contact with us. + +If you use [`ink_storage::Mapping`](https://paritytech.github.io/ink/ink_storage/struct.Mapping.html) +in your contract, you need to initialize the data structure using the helper function +[`ink_lang::utils::initialize_contract(…)`](https://paritytech.github.io/ink/ink_lang/utils/fn.initialize_contract.html). +For more code examples you can take a look at our examples, e.g. +[`erc20`](https://github.com/paritytech/ink/blob/master/examples/erc20/lib.rs). ### Please upgrade `scale-info` and `parity-scale-codec` in your contract's dependencies @@ -11,6 +32,23 @@ scale-info = { version = "2", default-features = false, features = ["derive"], o scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } ``` +## Added +- Export `ink_lang::utils::initialize_contract(…)` - [#1077](https://github.com/paritytech/ink/pull/1077). +- Add `get_owner()` function to `dns` example contract - [#1118](https://github.com/paritytech/ink/pull/1118) (thanks [@agryaznov](https://github.com/agryaznov)). +- Improved usage documentation of `ink_storage::Mapping` - [#1138](https://github.com/paritytech/ink/pull/1138). + +## Changed +- Updated to `parity-scale-codec = "3"` and `scale-info = "2"` - [#1132](https://github.com/paritytech/ink/pull/1132). + +## Removed +- Remove `collection` and `lazy` modules from public ink! API - [#1111](https://github.com/paritytech/ink/pull/1111). +- Remove `Memory` from public ink! API - [#1137](https://github.com/paritytech/ink/pull/1137). + +## Fixed +- Fix bug with referencing two external trait definitions - [#1141](https://github.com/paritytech/ink/pull/1141). +- Explicitly specify trait in dispatching - [#1131](https://github.com/paritytech/ink/pull/1131) (thanks [@xgreenx](https://github.com/xgreenx)). +- Make `rust-analyzer` expand ink! macros without warning - [#1107](https://github.com/paritytech/ink/pull/1107). + # Version 3.0-rc8 This is the 8th release candidate for ink! 3.0. @@ -57,7 +95,7 @@ The ink! PR which implemented this is [#1065](https://github.com/paritytech/ink/ metadata to V3 is [#1100](https://github.com/paritytech/ink/pull/1100), and for the `polkadot-js/api` it was [polkadot-js/api#4432](https://github.com/polkadot-js/api/pull/4432). ## Changed -- Update metadate to support payable constructors - [#1100](https://github.com/paritytech/ink/pull/1100). +- Update metadata to support payable constructors - [#1100](https://github.com/paritytech/ink/pull/1100). - Make constructors non-payable by default, require specifying `payable` explicitly - [#1065](https://github.com/paritytech/ink/pull/1065). - Renamed the error code `EcdsaRecoverFailed` to `EcdsaRecoveryFailed` ‒ [#1064](https://github.com/paritytech/ink/pull/1064). - Renamed the `ink_env` function `transferred_balance()` to `transferred_value()` ‒ [#1063](https://github.com/paritytech/ink/pull/1063). diff --git a/crates/allocator/Cargo.toml b/crates/allocator/Cargo.toml index 3805fb45aa1..a074573a260 100644 --- a/crates/allocator/Cargo.toml +++ b/crates/allocator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_allocator" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 089f7198c42..f38d7e9fd31 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_engine" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Michael Müller "] edition = "2021" diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 282ec29713a..214df4c35b1 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_env" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,10 +15,10 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -ink_metadata = { version = "3.0.0-rc8", path = "../metadata/", default-features = false, features = ["derive"], optional = true } -ink_allocator = { version = "3.0.0-rc8", path = "../allocator/", default-features = false } -ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../metadata/", default-features = false, features = ["derive"], optional = true } +ink_allocator = { version = "3.0.0-rc9", path = "../allocator/", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } @@ -32,7 +32,7 @@ static_assertions = "1.1" rlibc = "1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -ink_engine = { version = "3.0.0-rc8", path = "../engine/", optional = true } +ink_engine = { version = "3.0.0-rc9", path = "../engine/", optional = true } # Hashes for the off-chain environment. sha2 = { version = "0.10", optional = true } diff --git a/crates/eth_compatibility/Cargo.toml b/crates/eth_compatibility/Cargo.toml index fab55128af8..a1723956517 100644 --- a/crates/eth_compatibility/Cargo.toml +++ b/crates/eth_compatibility/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_eth_compatibility" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" @@ -15,7 +15,7 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] [dependencies] -ink_env = { version = "3.0.0-rc8", path = "../env", default-features = false } +ink_env = { version = "3.0.0-rc9", path = "../env", default-features = false } [target.'cfg(not(target_os = "windows"))'.dependencies] # We do not include `libsecp256k1` on Windows, since it's incompatible. diff --git a/crates/lang/Cargo.toml b/crates/lang/Cargo.toml index bd732048f20..73f7061334d 100644 --- a/crates/lang/Cargo.toml +++ b/crates/lang/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_lang" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,20 +15,20 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -ink_env = { version = "3.0.0-rc8", path = "../env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../storage", default-features = false } -ink_primitives = { version = "3.0.0-rc8", path = "../primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../metadata", default-features = false, optional = true } -ink_prelude = { version = "3.0.0-rc8", path = "../prelude", default-features = false } -ink_eth_compatibility = { version = "3.0.0-rc8", path = "../eth_compatibility", default-features = false } -ink_lang_macro = { version = "3.0.0-rc8", path = "macro", default-features = false } +ink_env = { version = "3.0.0-rc9", path = "../env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../storage", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../metadata", default-features = false, optional = true } +ink_prelude = { version = "3.0.0-rc9", path = "../prelude", default-features = false } +ink_eth_compatibility = { version = "3.0.0-rc9", path = "../eth_compatibility", default-features = false } +ink_lang_macro = { version = "3.0.0-rc9", path = "macro", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from"] } [dev-dependencies] -ink_lang_ir = { version = "3.0.0-rc8", path = "ir" } -ink_metadata = { version = "3.0.0-rc8", default-features = false, path = "../metadata" } +ink_lang_ir = { version = "3.0.0-rc9", path = "ir" } +ink_metadata = { version = "3.0.0-rc9", default-features = false, path = "../metadata" } trybuild = { version = "1.0.52", features = ["diff"] } # Required for the doctest of `env_access::EnvAccess::instantiate_contract` diff --git a/crates/lang/codegen/Cargo.toml b/crates/lang/codegen/Cargo.toml index c0435a18c8c..68966595013 100644 --- a/crates/lang/codegen/Cargo.toml +++ b/crates/lang/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_lang_codegen" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -18,7 +18,7 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] name = "ink_lang_codegen" [dependencies] -ir = { version = "3.0.0-rc8", package = "ink_lang_ir", path = "../ir", default-features = false } +ir = { version = "3.0.0-rc9", package = "ink_lang_ir", path = "../ir", default-features = false } quote = "1" syn = { version = "1.0", features = ["parsing", "full", "extra-traits"] } proc-macro2 = "1.0" diff --git a/crates/lang/ir/Cargo.toml b/crates/lang/ir/Cargo.toml index 9e6a30f83d8..a399f0c7ce4 100644 --- a/crates/lang/ir/Cargo.toml +++ b/crates/lang/ir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_lang_ir" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" diff --git a/crates/lang/macro/Cargo.toml b/crates/lang/macro/Cargo.toml index 9b1e05271ff..83926a6b88c 100644 --- a/crates/lang/macro/Cargo.toml +++ b/crates/lang/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_lang_macro" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,19 +15,19 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -ink_lang_ir = { version = "3.0.0-rc8", path = "../ir", default-features = false } -ink_lang_codegen = { version = "3.0.0-rc8", path = "../codegen", default-features = false } -ink_primitives = { version = "3.0.0-rc8", path = "../../primitives/", default-features = false } +ink_lang_ir = { version = "3.0.0-rc9", path = "../ir", default-features = false } +ink_lang_codegen = { version = "3.0.0-rc9", path = "../codegen", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../primitives/", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } syn = "1" proc-macro2 = "1" [dev-dependencies] -ink_metadata = { version = "3.0.0-rc8", path = "../../metadata/" } -ink_env = { version = "3.0.0-rc8", path = "../../env/" } -ink_storage = { version = "3.0.0-rc8", path = "../../storage/" } -ink_lang = { version = "3.0.0-rc8", path = ".." } +ink_metadata = { version = "3.0.0-rc9", path = "../../metadata/" } +ink_env = { version = "3.0.0-rc9", path = "../../env/" } +ink_storage = { version = "3.0.0-rc9", path = "../../storage/" } +ink_lang = { version = "3.0.0-rc9", path = ".." } scale-info = { version = "2", default-features = false, features = ["derive"] } [lib] diff --git a/crates/metadata/Cargo.toml b/crates/metadata/Cargo.toml index 365a17c5c13..c00b4b4acfd 100644 --- a/crates/metadata/Cargo.toml +++ b/crates/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_metadata" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,8 +15,8 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } -ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false } serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] } impl-serde = "0.3.1" diff --git a/crates/prelude/Cargo.toml b/crates/prelude/Cargo.toml index 3de500a0dfe..bcda9c3a579 100644 --- a/crates/prelude/Cargo.toml +++ b/crates/prelude/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_prelude" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index b80efa1f1ea..8d3fc10c6ee 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_primitives" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,7 +15,7 @@ categories = ["no-std", "embedded"] include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"] [dependencies] -ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } cfg-if = "1" diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 57f72621510..102206f4d06 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_storage" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -15,11 +15,11 @@ categories = ["no-std", "embedded"] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"] [dependencies] -ink_env = { version = "3.0.0-rc8", path = "../env/", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../metadata/", default-features = false, features = ["derive"], optional = true } -ink_primitives = { version = "3.0.0-rc8", path = "../primitives/", default-features = false } -ink_storage_derive = { version = "3.0.0-rc8", path = "derive", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../prelude/", default-features = false } +ink_env = { version = "3.0.0-rc9", path = "../env/", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../metadata/", default-features = false, features = ["derive"], optional = true } +ink_primitives = { version = "3.0.0-rc9", path = "../primitives/", default-features = false } +ink_storage_derive = { version = "3.0.0-rc9", path = "derive", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../prelude/", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } @@ -33,7 +33,7 @@ quickcheck_macros = "1.0" itertools = "0.10" paste = "1.0" -ink_lang = { version = "3.0.0-rc8", path = "../lang/", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../lang/", default-features = false } [features] default = ["std"] diff --git a/crates/storage/derive/Cargo.toml b/crates/storage/derive/Cargo.toml index 9e5c49c308b..945d422535e 100644 --- a/crates/storage/derive/Cargo.toml +++ b/crates/storage/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ink_storage_derive" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies ", "Robin Freyler "] edition = "2021" @@ -25,8 +25,8 @@ synstructure = "0.12.4" [dev-dependencies] scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } -ink_env = { version = "3.0.0-rc8", path = "../../env" } -ink_primitives = { version = "3.0.0-rc8", path = "../../primitives" } -ink_metadata = { version = "3.0.0-rc8", path = "../../metadata" } -ink_prelude = { version = "3.0.0-rc8", path = "../../prelude/" } -ink_storage = { version = "3.0.0-rc8", path = ".." } +ink_env = { version = "3.0.0-rc9", path = "../../env" } +ink_primitives = { version = "3.0.0-rc9", path = "../../primitives" } +ink_metadata = { version = "3.0.0-rc9", path = "../../metadata" } +ink_prelude = { version = "3.0.0-rc9", path = "../../prelude/" } +ink_storage = { version = "3.0.0-rc9", path = ".." } diff --git a/examples/contract-terminate/Cargo.toml b/examples/contract-terminate/Cargo.toml index a6bd6cc2141..6340cc8d2f6 100644 --- a/examples/contract-terminate/Cargo.toml +++ b/examples/contract-terminate/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "contract_terminate" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/contract-transfer/Cargo.toml b/examples/contract-transfer/Cargo.toml index a6300dae372..6505fb542b5 100644 --- a/examples/contract-transfer/Cargo.toml +++ b/examples/contract-transfer/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "contract_transfer" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false, features = [ "ink-debug" ] } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false, features = [ "ink-debug" ] } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../../crates/prelude", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/delegator/Cargo.toml b/examples/delegator/Cargo.toml index 235d18ec901..b24d76962bc 100644 --- a/examples/delegator/Cargo.toml +++ b/examples/delegator/Cargo.toml @@ -1,21 +1,21 @@ [package] name = "delegator" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -adder = { version = "3.0.0-rc8", path = "adder", default-features = false, features = ["ink-as-dependency"] } -subber = { version = "3.0.0-rc8", path = "subber", default-features = false, features = ["ink-as-dependency"] } -accumulator = { version = "3.0.0-rc8", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } +adder = { version = "3.0.0-rc9", path = "adder", default-features = false, features = ["ink-as-dependency"] } +subber = { version = "3.0.0-rc9", path = "subber", default-features = false, features = ["ink-as-dependency"] } +accumulator = { version = "3.0.0-rc9", path = "accumulator", default-features = false, features = ["ink-as-dependency"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } [lib] diff --git a/examples/delegator/accumulator/Cargo.toml b/examples/delegator/accumulator/Cargo.toml index 6b3fa551d44..63c3e3e0318 100644 --- a/examples/delegator/accumulator/Cargo.toml +++ b/examples/delegator/accumulator/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "accumulator" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/delegator/adder/Cargo.toml b/examples/delegator/adder/Cargo.toml index 47b6e19c46c..ee596ba08b2 100644 --- a/examples/delegator/adder/Cargo.toml +++ b/examples/delegator/adder/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "adder" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../../crates/lang", default-features = false } -accumulator = { version = "3.0.0-rc8", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } +accumulator = { version = "3.0.0-rc9", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/delegator/subber/Cargo.toml b/examples/delegator/subber/Cargo.toml index 6cc7c8bbee0..7f507a2d25c 100644 --- a/examples/delegator/subber/Cargo.toml +++ b/examples/delegator/subber/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "subber" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../../crates/lang", default-features = false } -accumulator = { version = "3.0.0-rc8", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } +accumulator = { version = "3.0.0-rc9", path = "../accumulator", default-features = false, features = ["ink-as-dependency"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/dns/Cargo.toml b/examples/dns/Cargo.toml index e943712751f..31a0c760a3b 100644 --- a/examples/dns/Cargo.toml +++ b/examples/dns/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "dns" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/erc1155/Cargo.toml b/examples/erc1155/Cargo.toml index ec29904b510..bb784162485 100644 --- a/examples/erc1155/Cargo.toml +++ b/examples/erc1155/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "erc1155" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false, features = ["ink-debug"] } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false, features = ["ink-debug"] } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../../crates/prelude", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index 7234ac890e0..e2c10d5e7f8 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "erc20" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/erc721/Cargo.toml b/examples/erc721/Cargo.toml index fc3c1a36dd9..1a85471f586 100644 --- a/examples/erc721/Cargo.toml +++ b/examples/erc721/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "erc721" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/flipper/Cargo.toml b/examples/flipper/Cargo.toml index c46754b97d2..74257a3675c 100644 --- a/examples/flipper/Cargo.toml +++ b/examples/flipper/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "flipper" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/incrementer/Cargo.toml b/examples/incrementer/Cargo.toml index 30da41a6c62..3ee378f4e96 100644 --- a/examples/incrementer/Cargo.toml +++ b/examples/incrementer/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "incrementer" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/multisig/Cargo.toml b/examples/multisig/Cargo.toml index b76c08a4779..92dfc28abb0 100755 --- a/examples/multisig/Cargo.toml +++ b/examples/multisig/Cargo.toml @@ -5,12 +5,12 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../../crates/prelude", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml index 6df464f8db3..a58be40a976 100644 --- a/examples/proxy/Cargo.toml +++ b/examples/proxy/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "proxy" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_prelude = { version = "3.0.0-rc8", path = "../../crates/prelude", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_prelude = { version = "3.0.0-rc9", path = "../../crates/prelude", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/rand-extension/Cargo.toml b/examples/rand-extension/Cargo.toml index 4918b3067d1..fb87b6569be 100755 --- a/examples/rand-extension/Cargo.toml +++ b/examples/rand-extension/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "rand_extension" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/trait-erc20/Cargo.toml b/examples/trait-erc20/Cargo.toml index bc21f64c3e0..1ce383e2f6a 100644 --- a/examples/trait-erc20/Cargo.toml +++ b/examples/trait-erc20/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "trait_erc20" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/trait-flipper/Cargo.toml b/examples/trait-flipper/Cargo.toml index aff46ca6917..60ab4325cf1 100644 --- a/examples/trait-flipper/Cargo.toml +++ b/examples/trait-flipper/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "trait_flipper" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } diff --git a/examples/trait-incrementer/Cargo.toml b/examples/trait-incrementer/Cargo.toml index 3741c05c65c..47861afa54f 100644 --- a/examples/trait-incrementer/Cargo.toml +++ b/examples/trait-incrementer/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "trait-incrementer" -version = "3.0.0-rc8" +version = "3.0.0-rc9" authors = ["Parity Technologies "] edition = "2021" [dependencies] -ink_primitives = { version = "3.0.0-rc8", path = "../../crates/primitives", default-features = false } -ink_metadata = { version = "3.0.0-rc8", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } -ink_env = { version = "3.0.0-rc8", path = "../../crates/env", default-features = false } -ink_storage = { version = "3.0.0-rc8", path = "../../crates/storage", default-features = false } -ink_lang = { version = "3.0.0-rc8", path = "../../crates/lang", default-features = false } +ink_primitives = { version = "3.0.0-rc9", path = "../../crates/primitives", default-features = false } +ink_metadata = { version = "3.0.0-rc9", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true } +ink_env = { version = "3.0.0-rc9", path = "../../crates/env", default-features = false } +ink_storage = { version = "3.0.0-rc9", path = "../../crates/storage", default-features = false } +ink_lang = { version = "3.0.0-rc9", path = "../../crates/lang", default-features = false } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }