From 773d3116e01ce0b230a6d8dedd11c92300fff372 Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Tue, 4 Oct 2022 09:55:17 +0200 Subject: [PATCH 1/6] Sacrifice build time for execution speed --- Cargo.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 3bfbfd9c75..36b4491e69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,12 @@ exclude = [ "benches/payout-stakers", "bin/cliain", ] + +[profile.release] +# Substrate runtime requires unwinding. +panic = "unwind" + +[profile.production] +inherits = "release" +lto = true +codegen-units = 1 From 69a57e364776af1c63cbb5d851a73f0daa3801cc Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Tue, 4 Oct 2022 11:29:55 +0200 Subject: [PATCH 2/6] Change build in workflows --- .github/workflows/build-node-and-runtime.yml | 4 ++-- .github/workflows/e2e-tests-main-devnet.yml | 8 +++---- .github/workflows/nightly-pipeline.yaml | 22 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-node-and-runtime.yml b/.github/workflows/build-node-and-runtime.yml index dc3b1fe8e1..ae3062bb87 100644 --- a/.github/workflows/build-node-and-runtime.yml +++ b/.github/workflows/build-node-and-runtime.yml @@ -38,7 +38,7 @@ jobs: cache-version: v1 - name: Build binary and runtime - run: cargo build --release -p aleph-node + run: cargo build --profile production -p aleph-node - name: Upload release binary uses: actions/upload-artifact@v2 @@ -57,7 +57,7 @@ jobs: retention-days: 7 - name: Build test binary - run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals" + run: cargo build --profile production -p aleph-node --features "short_session enable_treasury_proposals" - name: Upload test binary uses: actions/upload-artifact@v2 diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index 1701afbf99..a724d1b2aa 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -84,7 +84,7 @@ jobs: mv "$ARTIFACT" "$TARGET_DIR" sha256sum "$TARGET_DIR/$ARTIFACT" > checksum.sha256 cargo clean - cargo build --release -p aleph-runtime + cargo build --profile production -p aleph-runtime sha256sum -c checksum.sha256 @@ -554,7 +554,7 @@ jobs: then echo "::set-output name=diff::0" else - echo "::set-output name=diff::1" + echo "::set-output name=diff::1" fi build-new-runtime-and-try_runtime: @@ -578,10 +578,10 @@ jobs: target-key: try-runtime - name: Build try-runtime - run: cargo build --release -p aleph-node --features "try-runtime" + run: cargo build --profile production -p aleph-node --features "try-runtime" - name: Build runtime - run: cargo build --release -p aleph-runtime --features "try-runtime" + run: cargo build --profile production -p aleph-runtime --features "try-runtime" - name: Upload try-runtime uses: actions/upload-artifact@v3 diff --git a/.github/workflows/nightly-pipeline.yaml b/.github/workflows/nightly-pipeline.yaml index af2f1ab1b4..c40e6ac7cf 100644 --- a/.github/workflows/nightly-pipeline.yaml +++ b/.github/workflows/nightly-pipeline.yaml @@ -26,14 +26,14 @@ jobs: with: name: aleph-test-node path: target/release - + - name: Build test docker image id: build-image run: | chmod +x target/release/aleph-node docker build --tag aleph-node:latest -f ./docker/Dockerfile . docker save -o aleph-node.tar aleph-node:latest - + - name: Upload test docker image uses: actions/upload-artifact@v2 with: @@ -51,7 +51,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v2 - + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 @@ -62,7 +62,7 @@ jobs: uses: actions/download-artifact@v2 with: name: aleph-release-runtime - + - name: Build runtime and compare checksum with artifact env: ARTIFACT: aleph_runtime.compact.wasm @@ -72,7 +72,7 @@ jobs: mv "$ARTIFACT" "$TARGET_DIR" sha256sum "$TARGET_DIR/$ARTIFACT" > checksum.sha256 cargo clean - cargo build --release -p aleph-runtime + cargo build --profile production -p aleph-runtime sha256sum -c checksum.sha256 build-test-client: @@ -83,10 +83,10 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v2 - + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 - + - name: Restore cache uses: ./.github/actions/restore-cache with: @@ -94,17 +94,17 @@ jobs: cargo-key: e2e cache-version: v1 cargo-targets: e2e-tests/target/ - + - name: Build binary and docker image run: | cd e2e-tests/ - cargo build --release + cargo build --profile production docker build --tag aleph-e2e-client:latest -f Dockerfile . docker save -o aleph-e2e-client.tar aleph-e2e-client:latest - + - name: Stop cache uses: ./.github/actions/post-cache - + - name: Upload artifact uses: actions/upload-artifact@v2 with: From 5ef35240cb3f3faa1a1afc23bf7a05cad5b19dc5 Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Fri, 21 Oct 2022 14:28:12 +0200 Subject: [PATCH 3/6] review --- .github/workflows/e2e-tests-main-devnet.yml | 6 +++--- .github/workflows/nightly-pipeline.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index a724d1b2aa..e7f5751466 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -84,7 +84,7 @@ jobs: mv "$ARTIFACT" "$TARGET_DIR" sha256sum "$TARGET_DIR/$ARTIFACT" > checksum.sha256 cargo clean - cargo build --profile production -p aleph-runtime + cargo build --release -p aleph-runtime sha256sum -c checksum.sha256 @@ -578,10 +578,10 @@ jobs: target-key: try-runtime - name: Build try-runtime - run: cargo build --profile production -p aleph-node --features "try-runtime" + run: cargo build --release -p aleph-node --features "try-runtime" - name: Build runtime - run: cargo build --profile production -p aleph-runtime --features "try-runtime" + run: cargo build --release -p aleph-runtime --features "try-runtime" - name: Upload try-runtime uses: actions/upload-artifact@v3 diff --git a/.github/workflows/nightly-pipeline.yaml b/.github/workflows/nightly-pipeline.yaml index c40e6ac7cf..5e86c89038 100644 --- a/.github/workflows/nightly-pipeline.yaml +++ b/.github/workflows/nightly-pipeline.yaml @@ -98,7 +98,7 @@ jobs: - name: Build binary and docker image run: | cd e2e-tests/ - cargo build --profile production + cargo build docker build --tag aleph-e2e-client:latest -f Dockerfile . docker save -o aleph-e2e-client.tar aleph-e2e-client:latest From 83e24949dcaabbe8f7e97715aece50ad8e3cb401 Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Fri, 21 Oct 2022 17:35:45 +0200 Subject: [PATCH 4/6] fix upload paths --- .github/workflows/build-node-and-runtime.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-node-and-runtime.yml b/.github/workflows/build-node-and-runtime.yml index ae3062bb87..380afd44e0 100644 --- a/.github/workflows/build-node-and-runtime.yml +++ b/.github/workflows/build-node-and-runtime.yml @@ -44,7 +44,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: ${{ inputs.artifact-prefix }}aleph-release-node - path: target/release/aleph-node + path: target/production/aleph-node if-no-files-found: error retention-days: 7 @@ -52,12 +52,12 @@ jobs: uses: actions/upload-artifact@v2 with: name: ${{ inputs.artifact-prefix }}aleph-release-runtime - path: target/release/wbuild/aleph-runtime/aleph_runtime.compact.wasm + path: target/production/wbuild/aleph-runtime/aleph_runtime.compact.wasm if-no-files-found: error retention-days: 7 - name: Build test binary - run: cargo build --profile production -p aleph-node --features "short_session enable_treasury_proposals" + run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals" - name: Upload test binary uses: actions/upload-artifact@v2 From 83414dfc012254a04ed0d4c38f9ec5ebe2fd4ab8 Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Mon, 24 Oct 2022 11:23:17 +0200 Subject: [PATCH 5/6] fix paths for chsum --- .github/workflows/e2e-tests-main-devnet.yml | 2 +- .github/workflows/nightly-pipeline.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index e7f5751466..15d27b466e 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -78,7 +78,7 @@ jobs: - name: Build runtime and compare checksum with artifact env: ARTIFACT: aleph_runtime.compact.wasm - TARGET_DIR: target/release/wbuild/aleph-runtime + TARGET_DIR: target/production/wbuild/aleph-runtime run: | mkdir -p "$TARGET_DIR" mv "$ARTIFACT" "$TARGET_DIR" diff --git a/.github/workflows/nightly-pipeline.yaml b/.github/workflows/nightly-pipeline.yaml index 5e86c89038..08cb2e2a14 100644 --- a/.github/workflows/nightly-pipeline.yaml +++ b/.github/workflows/nightly-pipeline.yaml @@ -66,7 +66,7 @@ jobs: - name: Build runtime and compare checksum with artifact env: ARTIFACT: aleph_runtime.compact.wasm - TARGET_DIR: target/release/wbuild/aleph-runtime + TARGET_DIR: target/production/wbuild/aleph-runtime run: | mkdir -p "$TARGET_DIR" mv "$ARTIFACT" "$TARGET_DIR" From db3dae395c5170eeffaa1d9561a383a1bb0d950c Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Mon, 24 Oct 2022 12:17:25 +0200 Subject: [PATCH 6/6] fix determinism check --- .github/workflows/e2e-tests-main-devnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index 15d27b466e..084e3d675e 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -84,7 +84,7 @@ jobs: mv "$ARTIFACT" "$TARGET_DIR" sha256sum "$TARGET_DIR/$ARTIFACT" > checksum.sha256 cargo clean - cargo build --release -p aleph-runtime + cargo build --profile production -p aleph-runtime sha256sum -c checksum.sha256