From c512e4ffc2741351e8960192c44a6f8878d7262e Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 9 Jan 2025 13:34:02 -0600 Subject: [PATCH 1/6] fix: fix builds for releases --- .github/workflows/release.yml | 6 +++++- Cross.toml | 12 ++++++------ Makefile | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7a55cbc..ce0e855c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,11 @@ jobs: - name: Build anvil-zksync for ${{ matrix.arch }} run: | - make build-${{ matrix.arch }} + if [[ "${{ matrix.arch }}" == *"linux"* ]]; then + make build-static-${{ matrix.arch }} + else + make build-${{ matrix.arch }} + fi - name: Rename and move binary run: | diff --git a/Cross.toml b/Cross.toml index cb732fa5..63cb9f29 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,14 +1,14 @@ -# Cross.toml - [target.x86_64-unknown-linux-gnu] +image = "ubuntu:22.04" pre-build = [ "export DEBIAN_FRONTEND=noninteractive", "export TZ=Etc/UTC", "dpkg --add-architecture $CROSS_DEB_ARCH", - "apt update -q && apt upgrade -yq && apt install --assume-yes --no-install-recommends libclang-10-dev clang-10 cmake build-essential pkg-config libssl-dev:$CROSS_DEB_ARCH libsasl2-dev llvm-dev gnutls-bin", - "apt install -y gcc-10 g++-10", - "update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10", - "update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10" + "apt update -q && apt upgrade -yq", + "apt install --assume-yes --no-install-recommends libclang-14-dev clang-14 cmake build-essential pkg-config libssl-dev:$CROSS_DEB_ARCH libsasl2-dev llvm-14-dev gnutls-bin", + "apt install -y gcc-11 g++-11", + "update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11", + "update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11" ] [target.aarch64-unknown-linux-gnu] diff --git a/Makefile b/Makefile index 40a11209..630f32d9 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ run: all build-%: cross build --bin anvil-zksync --target $* --release +# Build the Rust project for a specific target (static build). +build-static-%: + RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --bin anvil-zksync --target $* --release + # Build the Rust documentation rust-doc: cargo doc --no-deps --open From dc0ec4d47816d8b26d8c458a0cbf370298058705 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 9 Jan 2025 13:36:29 -0600 Subject: [PATCH 2/6] chore: bump base image --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce0e855c..ea9dc2ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,9 +41,9 @@ jobs: ] include: - arch: x86_64-unknown-linux-gnu - platform: ubuntu-20.04 + platform: ubuntu-latest - arch: aarch64-unknown-linux-gnu - platform: ubuntu-20.04 + platform: ubuntu-latest - arch: x86_64-apple-darwin platform: macos-latest - arch: aarch64-apple-darwin From f6bcd454d44698c417102c7aae898a47b06f4dae Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 10 Jan 2025 09:51:45 -0600 Subject: [PATCH 3/6] chore: update to 22:04 explicitly --- .github/workflows/release.yml | 4 ++-- Cross.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea9dc2ce..3f74d1e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,9 +41,9 @@ jobs: ] include: - arch: x86_64-unknown-linux-gnu - platform: ubuntu-latest + platform: ubuntu-24.04 - arch: aarch64-unknown-linux-gnu - platform: ubuntu-latest + platform: ubuntu-24.04 - arch: x86_64-apple-darwin platform: macos-latest - arch: aarch64-apple-darwin diff --git a/Cross.toml b/Cross.toml index 63cb9f29..93b229ef 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,5 +1,5 @@ [target.x86_64-unknown-linux-gnu] -image = "ubuntu:22.04" +image = "ubuntu:24.04" pre-build = [ "export DEBIAN_FRONTEND=noninteractive", "export TZ=Etc/UTC", From 26f2fadb61491a5c0978a6f64323a6de313be587 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 10 Jan 2025 09:56:43 -0600 Subject: [PATCH 4/6] chore: fix lint --- crates/core/src/fork.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/core/src/fork.rs b/crates/core/src/fork.rs index 9f98be2d..1eb92029 100644 --- a/crates/core/src/fork.rs +++ b/crates/core/src/fork.rs @@ -551,8 +551,7 @@ impl ForkDetails { block.l1_batch_number = Some(l1_batch_number.0.into()); if !block_details - .protocol_version - .map_or(false, supported_protocol_versions) + .protocol_version.is_some_and(supported_protocol_versions) { return Err(eyre!("This block is using the unsupported protocol version: {:?}. This binary supports versions {}.", block_details.protocol_version, From d1f98636d8593b26fec117f690a1ee24ec4cce22 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 10 Jan 2025 10:48:00 -0600 Subject: [PATCH 5/6] chore: fix lint issue --- crates/core/src/fork.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/core/src/fork.rs b/crates/core/src/fork.rs index 1eb92029..83f9907e 100644 --- a/crates/core/src/fork.rs +++ b/crates/core/src/fork.rs @@ -551,7 +551,8 @@ impl ForkDetails { block.l1_batch_number = Some(l1_batch_number.0.into()); if !block_details - .protocol_version.is_some_and(supported_protocol_versions) + .protocol_version + .is_some_and(supported_protocol_versions) { return Err(eyre!("This block is using the unsupported protocol version: {:?}. This binary supports versions {}.", block_details.protocol_version, From 34b7ebab896aa90180841e885966d8e4238ff974 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 10 Jan 2025 11:10:29 -0600 Subject: [PATCH 6/6] fix lint errors --- e2e-tests-rust/src/utils.rs | 3 +-- spec-tests/src/utils.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/e2e-tests-rust/src/utils.rs b/e2e-tests-rust/src/utils.rs index 64bf62e6..71de3b50 100644 --- a/e2e-tests-rust/src/utils.rs +++ b/e2e-tests-rust/src/utils.rs @@ -66,8 +66,7 @@ impl LockedPort { /// or is not needed anymore. impl Drop for LockedPort { fn drop(&mut self) { - self.lockfile - .unlock() + fs2::FileExt::unlock(&self.lockfile) .with_context(|| format!("failed to unlock lockfile for port={}", self.port)) .unwrap(); } diff --git a/spec-tests/src/utils.rs b/spec-tests/src/utils.rs index 8ba96c20..f5cadbc0 100644 --- a/spec-tests/src/utils.rs +++ b/spec-tests/src/utils.rs @@ -64,8 +64,7 @@ impl LockedPort { /// or is not needed anymore. impl Drop for LockedPort { fn drop(&mut self) { - self.lockfile - .unlock() + fs2::FileExt::unlock(&self.lockfile) .with_context(|| format!("failed to unlock lockfile for port={}", self.port)) .unwrap(); }