Skip to content

Commit

Permalink
Merge pull request #2291 from subspace/fix-aes-ni-by-default
Browse files Browse the repository at this point in the history
Fix AES-NI enablement by default, including when building container images
  • Loading branch information
nazar-pc authored Dec 6, 2023
2 parents 9ca7a15 + dfd8eff commit b7b01c1
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[target.'cfg(target_arch = "x64_64")']
[target.'cfg(target_arch = "x86_64")']
# Require AES-NI on x86-64 by default
rustflags = "-C target-feature=+aes"
rustflags = ["-C", "target-feature=+aes"]

[target.'cfg(target_arch = "aarch64")']
# TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved
# TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least
# 1.61: https://github.com/RustCrypto/block-ciphers/issues/373
rustflags = "--cfg aes_armv8"
rustflags = ["--cfg", "aes_armv8"]
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!/.cargo
!/crates
!/domains
!/orml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snapshot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- os: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-20.04') }}
target: x86_64-unknown-linux-gnu
suffix: ubuntu-x86_64-v2-${{ github.ref_name }}
rustflags: "-C target-cpu=x86-64-v2"
rustflags: "-C target-cpu=x86-64-v2 -C target-feature=+aes"
- os: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-20.04') }}
target: aarch64-unknown-linux-gnu
suffix: ubuntu-aarch64-${{ github.ref_name }}
Expand All @@ -115,7 +115,7 @@ jobs:
- os: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "windows-server-2022-x86-64"]' || 'windows-2022') }}
target: x86_64-pc-windows-msvc
suffix: windows-x86_64-v2-${{ github.ref_name }}
rustflags: "-C target-cpu=x86-64-v2"
rustflags: "-C target-cpu=x86-64-v2 -C target-feature=+aes"
runs-on: ${{ matrix.build.os }}
env:
PRODUCTION_TARGET: target/${{ matrix.build.target }}/production
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-bootstrap-node
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-bootstrap-node.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-farmer
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-farmer.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-node
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-node.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN \

RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown

COPY .cargo /code/.cargo
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
Expand Down

0 comments on commit b7b01c1

Please sign in to comment.