Skip to content

Commit

Permalink
Misc fixes to directory structure, changelog, CI (#2309)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cmichi authored Nov 14, 2024
1 parent 7b4ef6d commit 3e3df91
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 70 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/e2e/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -34,5 +34,5 @@ ink_e2e = { path = "../", features = ["sandbox"] }
temp-env = "0.3.6"

[features]
std = []
std = ["derive_more/std"]
sandbox = []
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, E> {
| ^ 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
Expand All @@ -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<T, E> {
| ^ 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<NonPacked>: Packed` is not satisfied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, E> {
| ^ 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<u128, NonPacked>: Encode` is not satisfied
Expand All @@ -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<T, E> {
| ^ 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<u128, NonPacked>: Packed` is not satisfied
Expand Down
22 changes: 22 additions & 0 deletions integration-tests/internal/storage-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "storage-types"
version = "5.0.0"
authors = ["Use Ink <[email protected]>"]
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 = []
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,45 @@

#[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),
StringStringError(String, String),
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,
B,
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,
Expand All @@ -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,
Expand All @@ -74,34 +71,28 @@ 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,
balance_value_min: Balance,
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<String>,
vec_vec_string_value: Vec<Vec<String>>,
}

#[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,
Expand Down
28 changes: 0 additions & 28 deletions integration-tests/storage-types/Cargo.toml

This file was deleted.

0 comments on commit 3e3df91

Please sign in to comment.