Skip to content

Commit 3e3df91

Browse files
authored
Misc fixes to directory structure, changelog, CI (#2309)
* Fix feature activation for `derive_more` 1.0 * Fix changelog * Propagate `std` feature to `derive_more` * Move `storage-types` example to `internal` * Update derives to ink! 5.0 * Apply `cargo fmt` * Remove unnecessary import * Update derives to ink! 5.0 * Make `clippy` happy * Update test fixtures * Update test fixtures * Update test fixtures
1 parent 7b4ef6d commit 3e3df91

File tree

7 files changed

+68
-70
lines changed

7 files changed

+68
-70
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- [Linter] Add links to detailed lint description ‒ [#2170](https://github.com/use-ink/ink/pull/2170)
1111
- Add `xcm_execute` and `xcm_send` support - [#1912](https://github.com/use-ink/ink/pull/1912)
1212
- Environment agnostic contract invocation API ‒ [#219](https://github.com/use-ink/ink/pull/2219)
13+
- [E2E] Add ability to take and restore snapshots - [#2261](https://github.com/paritytech/ink/pull/2261) (thanks [@0xLucca](https://github.com/0xLucca)!)
1314

1415
### Changed
1516
- [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
1920
### Fixed
2021
- Fix outdated docs for `[ink_e2e::test]`[#2162](https://github.com/use-ink/ink/pull/2162)
2122
- [E2E] build contracts before initializing node rpc ‒ [#2168](https://github.com/use-ink/ink/pull/2162)
23+
- [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)!)
2224

2325
## Version 5.0.0
2426

@@ -200,7 +202,6 @@ See [the compatibility section](https://use.ink/faq/migrating-from-ink-4-to-5/#c
200202
- Split up `ink_linting` to mandatory and extra libraries - [#2032](https://github.com/use-ink/ink/pull/2032)
201203
- [E2E] resolve DispatchError error details for dry-runs - [#1994](https://github.com/use-ink/ink/pull/1994)
202204
- [E2E] update to new `drink` API - [#2005](https://github.com/use-ink/ink/pull/2005)
203-
- [E2E] `set_account_balance` now can't set balance below existential deposit - [#1983](https://github.com/paritytech/ink/pull/1983)
204205

205206

206207
## Version 5.0.0-alpha

crates/e2e/macro/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ proc-macro = true
2121
[dependencies]
2222
darling = { workspace = true }
2323
ink_ir = { workspace = true, default-features = true }
24-
derive_more = { workspace = true, default-features = true }
24+
derive_more = { workspace = true, features = ["from"] }
2525
tracing-subscriber = { workspace = true, features = ["env-filter"] }
2626
serde_json = { workspace = true }
2727
syn = { workspace = true }
@@ -34,5 +34,5 @@ ink_e2e = { path = "../", features = ["sandbox"] }
3434
temp-env = "0.3.6"
3535

3636
[features]
37-
std = []
37+
std = ["derive_more/std"]
3838
sandbox = []

crates/ink/tests/ui/storage_item/fail/collections_only_packed_1.stderr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ note: required because it appears within the type `Contract`
130130
| ^^^^^^^^
131131
note: required by an implicit `Sized` bound in `Result`
132132
--> $RUST/core/src/result.rs
133+
|
134+
| pub enum Result<T, E> {
135+
| ^ required by the implicit `Sized` requirement on this type parameter in `Result`
133136
= note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info)
134137

135138
error[E0277]: the trait bound `[NonPacked]: Encode` is not satisfied
@@ -152,6 +155,9 @@ note: required because it appears within the type `Contract`
152155
| ^^^^^^^^
153156
note: required by an implicit `Sized` bound in `Result`
154157
--> $RUST/core/src/result.rs
158+
|
159+
| pub enum Result<T, E> {
160+
| ^ required by the implicit `Sized` requirement on this type parameter in `Result`
155161
= note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info)
156162

157163
error[E0277]: the trait bound `Vec<NonPacked>: Packed` is not satisfied

crates/ink/tests/ui/storage_item/fail/collections_only_packed_2.stderr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ note: required because it appears within the type `Contract`
121121
| ^^^^^^^^
122122
note: required by an implicit `Sized` bound in `Result`
123123
--> $RUST/core/src/result.rs
124+
|
125+
| pub enum Result<T, E> {
126+
| ^ required by the implicit `Sized` requirement on this type parameter in `Result`
124127
= note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info)
125128

126129
error[E0277]: the trait bound `BTreeMap<u128, NonPacked>: Encode` is not satisfied
@@ -140,6 +143,9 @@ note: required because it appears within the type `Contract`
140143
| ^^^^^^^^
141144
note: required by an implicit `Sized` bound in `Result`
142145
--> $RUST/core/src/result.rs
146+
|
147+
| pub enum Result<T, E> {
148+
| ^ required by the implicit `Sized` requirement on this type parameter in `Result`
143149
= note: this error originates in the derive macro `::ink::storage::traits::Storable` (in Nightly builds, run with -Z macro-backtrace for more info)
144150

145151
error[E0277]: the trait bound `BTreeMap<u128, NonPacked>: Packed` is not satisfied
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "storage-types"
3+
version = "5.0.0"
4+
authors = ["Use Ink <ink@use.ink>"]
5+
edition = "2021"
6+
publish = false
7+
8+
[dependencies]
9+
ink = { path = "../../../crates/ink", default-features = false }
10+
11+
[dev-dependencies]
12+
ink_e2e = { path = "../../../crates/e2e" }
13+
14+
[lib]
15+
path = "lib.rs"
16+
17+
[features]
18+
default = ["std"]
19+
std = [
20+
"ink/std",
21+
]
22+
ink-as-dependency = []

integration-tests/storage-types/lib.rs renamed to integration-tests/internal/storage-types/lib.rs

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,45 @@
77

88
#[ink::contract]
99
mod storage_types {
10-
use ink::prelude::{string::String, vec, vec::Vec};
11-
use scale::{Decode, Encode};
10+
use ink::prelude::{
11+
string::String,
12+
vec,
13+
vec::Vec,
14+
};
1215

13-
#[derive(Debug, Decode, Encode)]
14-
#[cfg_attr(feature = "std", derive(::scale_info::TypeInfo))]
16+
#[derive(Debug)]
17+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
18+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
19+
#[allow(clippy::enum_variant_names)]
1520
pub enum CustomError {
1621
EmptyError,
1722
StringError(String),
1823
StringStringError(String, String),
1924
StringUnsignedError(String, u32),
2025
}
2126

22-
#[derive(Clone, Debug, Decode, Default, Encode)]
23-
#[cfg_attr(
24-
feature = "std",
25-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
26-
)]
27+
#[derive(Debug, PartialEq, Eq, Clone, Default)]
28+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
29+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
2730
pub enum EnumWithoutValues {
2831
#[default]
2932
A,
3033
B,
3134
C,
3235
}
3336

34-
#[derive(Clone, Debug, Decode, Encode)]
35-
#[cfg_attr(
36-
feature = "std",
37-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
38-
)]
37+
#[derive(Debug, Clone)]
38+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
39+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
3940
pub enum EnumWithValues {
4041
OneValue(u32),
4142
TwoValues(u32, u32),
4243
ThreeValues(u32, u32, u32),
4344
}
4445

45-
#[derive(Clone, Debug, Decode, Encode)]
46-
#[cfg_attr(
47-
feature = "std",
48-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
49-
)]
46+
#[derive(Debug, Clone)]
47+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
48+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
5049
pub struct PrimitiveTypes {
5150
bool_value: bool,
5251
enum_without_values: EnumWithoutValues,
@@ -56,11 +55,9 @@ mod storage_types {
5655
tuple_triplet_value: (i32, i32, i32),
5756
}
5857

59-
#[derive(Clone, Debug, Decode, Encode)]
60-
#[cfg_attr(
61-
feature = "std",
62-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
63-
)]
58+
#[derive(Debug, Clone)]
59+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
60+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
6461
pub struct SignedIntegers {
6562
i128_value_max: i128,
6663
i128_value_min: i128,
@@ -74,34 +71,28 @@ mod storage_types {
7471
i8_value_min: i8,
7572
}
7673

77-
#[derive(Clone, Debug, Decode, Encode)]
78-
#[cfg_attr(
79-
feature = "std",
80-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
81-
)]
74+
#[derive(Debug, Clone)]
75+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
76+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
8277
pub struct SubstrateTypes {
8378
account_id_value: AccountId,
8479
balance_value_max: Balance,
8580
balance_value_min: Balance,
8681
hash_value: Hash,
8782
}
8883

89-
#[derive(Clone, Debug, Decode, scale::Encode)]
90-
#[cfg_attr(
91-
feature = "std",
92-
derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
93-
)]
84+
#[derive(Debug, Clone)]
85+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
86+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
9487
pub struct InkPreludeTypes {
9588
string_value: String,
9689
vec_string_value: Vec<String>,
9790
vec_vec_string_value: Vec<Vec<String>>,
9891
}
9992

100-
#[derive(Clone, Decode, Encode)]
101-
#[cfg_attr(
102-
feature = "std",
103-
derive(Debug, scale_info::TypeInfo, ink::storage::traits::StorageLayout)
104-
)]
93+
#[derive(Debug, Clone)]
94+
#[cfg_attr(feature = "std", derive(ink::storage::traits::StorageLayout))]
95+
#[ink::scale_derive(Encode, Decode, TypeInfo)]
10596
pub struct UnsignedIntegers {
10697
u128_value_max: u128,
10798
u128_value_min: u128,

integration-tests/storage-types/Cargo.toml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)