diff --git a/CHANGELOG.md b/CHANGELOG.md index d2082b820c7..b9571f37470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Linter] Add links to detailed lint description ‒ [#2170](https://github.com/use-ink/ink/pull/2170) - Add `xcm_execute` and `xcm_send` support - [#1912](https://github.com/use-ink/ink/pull/1912) - Environment agnostic contract invocation API ‒ [#219](https://github.com/use-ink/ink/pull/2219) +- [E2E] Add ability to take and restore snapshots - [#2261](https://github.com/paritytech/ink/pull/2261) (thanks [@0xLucca](https://github.com/0xLucca)!) ### Changed - [E2E] Update `subxt` and `polkadot-sdk` dependencies ‒ [#2174](https://github.com/use-ink/ink/pull/2174) @@ -19,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix outdated docs for `[ink_e2e::test]` ‒ [#2162](https://github.com/use-ink/ink/pull/2162) - [E2E] build contracts before initializing node rpc ‒ [#2168](https://github.com/use-ink/ink/pull/2162) +- [E2E] `set_account_balance` now can't set balance below existential deposit - [#1983](https://github.com/paritytech/ink/pull/1983) (thanks [@0xLucca](https://github.com/0xLucca)!) ## Version 5.0.0 @@ -200,7 +202,6 @@ See [the compatibility section](https://use.ink/faq/migrating-from-ink-4-to-5/#c - Split up `ink_linting` to mandatory and extra libraries - [#2032](https://github.com/use-ink/ink/pull/2032) - [E2E] resolve DispatchError error details for dry-runs - [#1994](https://github.com/use-ink/ink/pull/1994) - [E2E] update to new `drink` API - [#2005](https://github.com/use-ink/ink/pull/2005) -- [E2E] `set_account_balance` now can't set balance below existential deposit - [#1983](https://github.com/paritytech/ink/pull/1983) ## Version 5.0.0-alpha diff --git a/crates/e2e/macro/Cargo.toml b/crates/e2e/macro/Cargo.toml index 356cc44653c..d9e5a03f2c1 100644 --- a/crates/e2e/macro/Cargo.toml +++ b/crates/e2e/macro/Cargo.toml @@ -21,7 +21,7 @@ proc-macro = true [dependencies] darling = { workspace = true } ink_ir = { workspace = true, default-features = true } -derive_more = { workspace = true, default-features = true } +derive_more = { workspace = true, features = ["from"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } serde_json = { workspace = true } syn = { workspace = true } @@ -34,5 +34,5 @@ ink_e2e = { path = "../", features = ["sandbox"] } temp-env = "0.3.6" [features] -std = [] +std = ["derive_more/std"] sandbox = [] diff --git a/crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.stderr b/crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.stderr index 28b6186d90c..61f3715be90 100644 --- a/crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.stderr +++ b/crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.stderr @@ -130,6 +130,9 @@ note: required because it appears within the type `Contract` | ^^^^^^^^ note: required by an implicit `Sized` bound in `Result` --> $RUST/core/src/result.rs + | + | pub enum Result { + | ^ required by the implicit `Sized` requirement on this type parameter in `Result` = note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `[NonPacked]: Encode` is not satisfied @@ -152,6 +155,9 @@ note: required because it appears within the type `Contract` | ^^^^^^^^ note: required by an implicit `Sized` bound in `Result` --> $RUST/core/src/result.rs + | + | pub enum Result { + | ^ required by the implicit `Sized` requirement on this type parameter in `Result` = note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Vec: Packed` is not satisfied diff --git a/crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.stderr b/crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.stderr index a371d959ba9..b0f4df3a1ce 100644 --- a/crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.stderr +++ b/crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.stderr @@ -121,6 +121,9 @@ note: required because it appears within the type `Contract` | ^^^^^^^^ note: required by an implicit `Sized` bound in `Result` --> $RUST/core/src/result.rs + | + | pub enum Result { + | ^ required by the implicit `Sized` requirement on this type parameter in `Result` = note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `BTreeMap: Encode` is not satisfied @@ -140,6 +143,9 @@ note: required because it appears within the type `Contract` | ^^^^^^^^ note: required by an implicit `Sized` bound in `Result` --> $RUST/core/src/result.rs + | + | pub enum Result { + | ^ required by the implicit `Sized` requirement on this type parameter in `Result` = note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `BTreeMap: Packed` is not satisfied diff --git a/integration-tests/internal/storage-types/Cargo.toml b/integration-tests/internal/storage-types/Cargo.toml new file mode 100755 index 00000000000..5e0e082a6bc --- /dev/null +++ b/integration-tests/internal/storage-types/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "storage-types" +version = "5.0.0" +authors = ["Use Ink "] +edition = "2021" +publish = false + +[dependencies] +ink = { path = "../../../crates/ink", default-features = false } + +[dev-dependencies] +ink_e2e = { path = "../../../crates/e2e" } + +[lib] +path = "lib.rs" + +[features] +default = ["std"] +std = [ + "ink/std", +] +ink-as-dependency = [] diff --git a/integration-tests/storage-types/lib.rs b/integration-tests/internal/storage-types/lib.rs similarity index 83% rename from integration-tests/storage-types/lib.rs rename to integration-tests/internal/storage-types/lib.rs index 6cb5b960356..fe405e533fa 100755 --- a/integration-tests/storage-types/lib.rs +++ b/integration-tests/internal/storage-types/lib.rs @@ -7,11 +7,16 @@ #[ink::contract] mod storage_types { - use ink::prelude::{string::String, vec, vec::Vec}; - use scale::{Decode, Encode}; + use ink::prelude::{ + string::String, + vec, + vec::Vec, + }; - #[derive(Debug, Decode, Encode)] - #[cfg_attr(feature = "std", derive(::scale_info::TypeInfo))] + #[derive(Debug)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] + #[allow(clippy::enum_variant_names)] pub enum CustomError { EmptyError, StringError(String), @@ -19,11 +24,9 @@ mod storage_types { StringUnsignedError(String, u32), } - #[derive(Clone, Debug, Decode, Default, Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, PartialEq, Eq, Clone, Default)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub enum EnumWithoutValues { #[default] A, @@ -31,22 +34,18 @@ mod storage_types { C, } - #[derive(Clone, Debug, Decode, Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub enum EnumWithValues { OneValue(u32), TwoValues(u32, u32), ThreeValues(u32, u32, u32), } - #[derive(Clone, Debug, Decode, Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub struct PrimitiveTypes { bool_value: bool, enum_without_values: EnumWithoutValues, @@ -56,11 +55,9 @@ mod storage_types { tuple_triplet_value: (i32, i32, i32), } - #[derive(Clone, Debug, Decode, Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub struct SignedIntegers { i128_value_max: i128, i128_value_min: i128, @@ -74,11 +71,9 @@ mod storage_types { i8_value_min: i8, } - #[derive(Clone, Debug, Decode, Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub struct SubstrateTypes { account_id_value: AccountId, balance_value_max: Balance, @@ -86,22 +81,18 @@ mod storage_types { hash_value: Hash, } - #[derive(Clone, Debug, Decode, scale::Encode)] - #[cfg_attr( - feature = "std", - derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub struct InkPreludeTypes { string_value: String, vec_string_value: Vec, vec_vec_string_value: Vec>, } - #[derive(Clone, Decode, Encode)] - #[cfg_attr( - feature = "std", - derive(Debug, scale_info::TypeInfo, ink::storage::traits::StorageLayout) - )] + #[derive(Debug, Clone)] + #[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))] + #[ink::scale_derive(Encode, Decode, TypeInfo)] pub struct UnsignedIntegers { u128_value_max: u128, u128_value_min: u128, diff --git a/integration-tests/storage-types/Cargo.toml b/integration-tests/storage-types/Cargo.toml deleted file mode 100755 index e6ebaa316d1..00000000000 --- a/integration-tests/storage-types/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "storage-types" -version = "4.2.0" -authors = ["Parity Technologies "] -edition = "2021" -publish = false - -[dependencies] -ink = { path = "../../crates/ink", default-features = false } - -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } - -[dev-dependencies] -ink_e2e = { path = "../../crates/e2e" } - -[lib] -path = "lib.rs" - -[features] -default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = []