From 81d2de984feac12d995c3f6525abcd2d97629560 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Tue, 23 May 2023 00:06:01 +0200 Subject: [PATCH 1/4] fix(gh-workflows): compatible nightly toolchain version is provided --- .github/workflows/build-and-push.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 47eda7ac..0acd6794 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -6,25 +6,25 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Install latest nightly + - name: Install compatible nightly toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2023-02-07 target: x86_64-unknown-linux-gnu components: rustfmt, clippy - name: Install dependencies run: | - rustup target add wasm32-unknown-unknown --toolchain nightly - rustup component add rust-src --toolchain nightly-unknown-linux-gnu + rustup target add wasm32-unknown-unknown --toolchain nightly-2023-02-07 + rustup component add rust-src --toolchain nightly-2023-02-07-unknown-linux-gnu sudo apt-get install binaryen - cargo install cargo-contract --version ^0.14 --force --locked + cargo install cargo-contract --version 1.5.0 --force --locked - name: Run tests run: | - RUSTFLAGS=-Awarnings cargo test + RUSTFLAGS=-Awarnings cargo +nightly-2023-02-07 test - name: Build contract run: | - cargo contract build --release --manifest-path bucket/Cargo.toml + cargo +nightly-2023-02-07 contract build --release --manifest-path bucket/Cargo.toml - name: Create names linked to commit run: | ddc_contract_name=ddc.${GITHUB_SHA:0:7}.contract From 742cddda328b5746914863395fd9608ea7cf1ae3 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Tue, 23 May 2023 00:24:12 +0200 Subject: [PATCH 2/4] fix(gh-workflows): installing cargo-dylint package --- .github/workflows/build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 0acd6794..cb219452 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -18,6 +18,7 @@ jobs: rustup target add wasm32-unknown-unknown --toolchain nightly-2023-02-07 rustup component add rust-src --toolchain nightly-2023-02-07-unknown-linux-gnu sudo apt-get install binaryen + cargo install cargo-dylint cargo install cargo-contract --version 1.5.0 --force --locked - name: Run tests run: | From 6daf80cbd96b7b80366273d49b5492bf25e7be48 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Tue, 23 May 2023 00:39:50 +0200 Subject: [PATCH 3/4] fix(gh-workflows): installing dylint-link package --- .github/workflows/build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index cb219452..fb9be897 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -19,6 +19,7 @@ jobs: rustup component add rust-src --toolchain nightly-2023-02-07-unknown-linux-gnu sudo apt-get install binaryen cargo install cargo-dylint + cargo install dylint-link cargo install cargo-contract --version 1.5.0 --force --locked - name: Run tests run: | From d362ba0967be601e47f8f839b0aa83318bda34da Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Tue, 23 May 2023 01:26:37 +0200 Subject: [PATCH 4/4] fix(gh-workflows): 'unconditional_recursion' is allowed according to ink! 3.x official docs example --- bucket/ddc_bucket/bucket/entity.rs | 2 ++ bucket/ddc_bucket/cdn_cluster/entity.rs | 2 ++ bucket/ddc_bucket/cdn_node/entity.rs | 2 ++ bucket/ddc_bucket/cluster/entity.rs | 2 ++ bucket/ddc_bucket/node/entity.rs | 2 ++ 5 files changed, 10 insertions(+) diff --git a/bucket/ddc_bucket/bucket/entity.rs b/bucket/ddc_bucket/bucket/entity.rs index f8bdc589..00335ac9 100644 --- a/bucket/ddc_bucket/bucket/entity.rs +++ b/bucket/ddc_bucket/bucket/entity.rs @@ -26,6 +26,8 @@ pub struct Bucket { pub resource_consumption_cap: Resource, } +// https://use.ink/3.x/ink-vs-solidity#nested-mappings--custom--advanced-structures +#[allow(unconditional_recursion)] impl ink_storage::traits::PackedAllocate for Bucket { fn allocate_packed(&mut self, at: &Key) { PackedAllocate::allocate_packed(&mut *self, at) diff --git a/bucket/ddc_bucket/cdn_cluster/entity.rs b/bucket/ddc_bucket/cdn_cluster/entity.rs index a1d23dab..8b12f810 100644 --- a/bucket/ddc_bucket/cdn_cluster/entity.rs +++ b/bucket/ddc_bucket/cdn_cluster/entity.rs @@ -25,6 +25,8 @@ pub struct CdnCluster { pub usd_per_gb: Balance, } +// https://use.ink/3.x/ink-vs-solidity#nested-mappings--custom--advanced-structures +#[allow(unconditional_recursion)] impl ink_storage::traits::PackedAllocate for CdnCluster { fn allocate_packed(&mut self, at: &Key) { PackedAllocate::allocate_packed(&mut *self, at) diff --git a/bucket/ddc_bucket/cdn_node/entity.rs b/bucket/ddc_bucket/cdn_node/entity.rs index 578e2ac9..32584cb7 100644 --- a/bucket/ddc_bucket/cdn_node/entity.rs +++ b/bucket/ddc_bucket/cdn_node/entity.rs @@ -17,6 +17,8 @@ pub struct CdnNode { pub undistributed_payment: Balance, } +// https://use.ink/3.x/ink-vs-solidity#nested-mappings--custom--advanced-structures +#[allow(unconditional_recursion)] impl ink_storage::traits::PackedAllocate for CdnNode { fn allocate_packed(&mut self, at: &Key) { PackedAllocate::allocate_packed(&mut *self, at) diff --git a/bucket/ddc_bucket/cluster/entity.rs b/bucket/ddc_bucket/cluster/entity.rs index 84cd6d3b..35e435d9 100644 --- a/bucket/ddc_bucket/cluster/entity.rs +++ b/bucket/ddc_bucket/cluster/entity.rs @@ -29,6 +29,8 @@ pub struct Cluster { pub total_rent: Balance, } +// https://use.ink/3.x/ink-vs-solidity#nested-mappings--custom--advanced-structures +#[allow(unconditional_recursion)] impl ink_storage::traits::PackedAllocate for Cluster { fn allocate_packed(&mut self, at: &Key) { PackedAllocate::allocate_packed(&mut *self, at) diff --git a/bucket/ddc_bucket/node/entity.rs b/bucket/ddc_bucket/node/entity.rs index 75efa26d..b7f5a8a8 100644 --- a/bucket/ddc_bucket/node/entity.rs +++ b/bucket/ddc_bucket/node/entity.rs @@ -22,6 +22,8 @@ pub struct Node { pub node_tag: NodeTag, } +// https://use.ink/3.x/ink-vs-solidity#nested-mappings--custom--advanced-structures +#[allow(unconditional_recursion)] impl ink_storage::traits::PackedAllocate for Node { fn allocate_packed(&mut self, at: &Key) { PackedAllocate::allocate_packed(&mut *self, at)