From 26a8c48d45ca39a0acbebb6e45623c227d8d22cc Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Thu, 28 Nov 2024 14:27:56 -0600 Subject: [PATCH 1/9] feat: adds anvil-zksync to installation script --- foundryup-zksync/foundryup-zksync | 128 +++++++++++++++++------------- 1 file changed, 73 insertions(+), 55 deletions(-) diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index abc726a50..62c198e7c 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -89,7 +89,7 @@ main() { FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION:-nightly} FOUNDRYUP_TAG=$FOUNDRYUP_VERSION - # Normalize versions (handle channels, versions without v prefix + # Normalize versions (handle channels, versions without v prefix) if [[ "$FOUNDRYUP_VERSION" =~ ^nightly ]]; then FOUNDRYUP_VERSION="nightly" elif [[ "$FOUNDRYUP_VERSION" == [[:digit:]]* ]]; then @@ -101,52 +101,34 @@ main() { say "installing foundry (version ${FOUNDRYUP_VERSION}, tag ${FOUNDRYUP_TAG})" uname_s=$(uname -s) - PLATFORM=$(tolower "${FOUNDRYUP_PLATFORM:-$uname_s}") - EXT="tar.gz" - case $PLATFORM in - linux) ;; - darwin|mac*) - PLATFORM="darwin" - ;; - mingw*|win*) - EXT="zip" - PLATFORM="win32" - ;; - *) - err "unsupported platform: $PLATFORM" - ;; + uname_m=$(uname -m) + + # Map uname -s to platform + case "$uname_s" in + Linux*) PLATFORM="unknown-linux-gnu" ;; + Darwin*) PLATFORM="apple-darwin" ;; + *) err "unsupported platform: $uname_s" ;; esac - uname_m=$(uname -m) - ARCHITECTURE=$(tolower "${FOUNDRYUP_ARCH:-$uname_m}") - if [ "${ARCHITECTURE}" = "x86_64" ]; then - # Redirect stderr to /dev/null to avoid printing errors if non Rosetta. - if [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]; then - ARCHITECTURE="arm64" # Rosetta. - else - ARCHITECTURE="amd64" # Intel. - fi - elif [ "${ARCHITECTURE}" = "arm64" ] ||[ "${ARCHITECTURE}" = "aarch64" ] ; then - ARCHITECTURE="arm64" # Arm. - else - ARCHITECTURE="amd64" # Amd. - fi + # Map uname -m to architecture + case "$uname_m" in + x86_64) ARCHITECTURE="x86_64" ;; + arm64|aarch64) ARCHITECTURE="aarch64" ;; + *) err "unsupported architecture: $uname_m" ;; + esac + + # Construct the filenames + EXT="tar.gz" + FOUNDRY_BIN_NAME="${ARCHITECTURE}-${PLATFORM}.${EXT}" # Compute the URL of the release tarball in the Foundry repository. RELEASE_URL="https://github.com/${FOUNDRYUP_REPO}/releases/download/${FOUNDRYUP_TAG}/" - BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${PLATFORM}_${ARCHITECTURE}.$EXT" + BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${FOUNDRY_BIN_NAME}" MAN_TARBALL_URL="${RELEASE_URL}foundry_man_${FOUNDRYUP_VERSION}.tar.gz" # Download and extract the binaries archive - say "downloading latest forge, and cast" - if [ "$PLATFORM" = "win32" ]; then - tmp="$(mktemp -d 2>/dev/null || echo ".")/foundry-zksync.zip" - ensure download "$BIN_ARCHIVE_URL" "$tmp" - ensure unzip "$tmp" -d "$FOUNDRY_BIN_DIR" - rm -f "$tmp" - else - ensure download "$BIN_ARCHIVE_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" - fi + say "downloading latest forge and cast" + ensure download "$BIN_ARCHIVE_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" # Optionally download the manuals if check_cmd tar; then @@ -178,6 +160,49 @@ EOF fi done + # Begin anvil-zksync installation + say "downloading anvil-zksync" + + # Supported targets for anvil-zksync + SUPPORTED_TARGETS=( + "x86_64-apple-darwin" + "aarch64-apple-darwin" + "x86_64-unknown-linux-gnu" + "aarch64-unknown-linux-gnu" + ) + + TARGET="${ARCHITECTURE}-${PLATFORM}" + + if [[ " ${SUPPORTED_TARGETS[*]} " == *" $TARGET "* ]]; then + ANVIL_REPO="matter-labs/era-test-node" + + say "getting latest tag for anvil-zksync" + + ANVIL_TAG=$(curl -s https://api.github.com/repos/$ANVIL_REPO/releases/latest | grep -Po '"tag_name": "\K.*?(?=")') + + if [ -z "$ANVIL_TAG" ]; then + err "failed to get latest tag for anvil-zksync" + fi + + ANVIL_BIN_NAME="anvil-${ANVIL_TAG}-${ARCHITECTURE}-${PLATFORM}.${EXT}" + + ANVIL_BIN_URL="https://github.com/$ANVIL_REPO/releases/download/$ANVIL_TAG/$ANVIL_BIN_NAME" + + ANVIL_BIN_PATH="$FOUNDRY_BIN_DIR/anvil-zksync" + + say "downloading anvil-zksync from $ANVIL_BIN_URL" + + ensure download "$ANVIL_BIN_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" anvil + + mv "$FOUNDRY_BIN_DIR/anvil" "$ANVIL_BIN_PATH" + + chmod +x "$ANVIL_BIN_PATH" + + say "installed - $(ensure "$ANVIL_BIN_PATH" --version)" + else + warn "anvil-zksync is not supported on your platform ($TARGET). Skipping anvil-zksync installation." + fi + say "done!" # Install by cloning the repo with the provided branch/tag @@ -235,8 +260,6 @@ Update or revert to a specific Foundry-zksync version with ease. By default, the latest nightly version is installed from built binaries. -By default, the latest nightly version is installed from built binaries. - USAGE: foundryup-zksync @@ -249,8 +272,8 @@ OPTIONS: -r, --repo Build and install from a remote GitHub repo (uses default branch if no other options are set) -p, --path Build and install a local repository -j, --jobs Number of CPUs to use for building Foundry (default: all CPUs) - --arch Install a specific architecture (supports amd64 and arm64) - --platform Install a specific platform (supports win32, linux, and darwin) + --arch Install a specific architecture (supports x86_64 and aarch64) + --platform Install a specific platform (supports apple-darwin and unknown-linux-gnu) EOF } @@ -267,12 +290,8 @@ err() { exit 1 } -tolower() { - echo "$1" | awk '{print tolower($0)}' -} - need_cmd() { - if ! check_cmd "$1"; then + if ! command -v "$1" &>/dev/null; then err "need '$1' (command not found)" fi } @@ -292,16 +311,16 @@ download() { if [ -n "$2" ]; then # output into $2 if check_cmd curl; then - curl -#o "$2" -L "$1" + curl -sSfL -o "$2" "$1" else - wget --show-progress -qO "$2" "$1" + wget -qO "$2" "$1" fi else # output to stdout if check_cmd curl; then - curl -#L "$1" + curl -sSfL "$1" else - wget --show-progress -qO- "$1" + wget -qO- "$1" fi fi } @@ -313,19 +332,18 @@ banner() { .xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦ Portable and modular toolkit - ╠╣ ║ ║ ║ ║ ║║║ ║║ ╠╦╝ ╚╦╝ for Ethereum Application Development + ╠╣ ║ ║ ║ ║ ║║║ ║║ ╠╦╝ ╚╦╝ for ZKsync Application Development ╚ ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═ ╩ written in Rust. .xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx Fork of : https://github.com/foundry-rs/ Repo : https://github.com/matter-labs/foundry-zksync/ -Book : https://book.getfoundry.sh/ +Book : https://foundry-book.zksync.io/ .xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx ' } - main "$@" From 86d95e3262151c8fb5591fa296b5c644264a4e25 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Tue, 3 Dec 2024 14:28:47 -0600 Subject: [PATCH 2/9] fix: address target issue --- foundryup-zksync/foundryup-zksync | 82 +++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index 62c198e7c..d94b6a0ed 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -89,7 +89,7 @@ main() { FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION:-nightly} FOUNDRYUP_TAG=$FOUNDRYUP_VERSION - # Normalize versions (handle channels, versions without v prefix) + # Normalize versions (handle channels, versions without v prefix if [[ "$FOUNDRYUP_VERSION" =~ ^nightly ]]; then FOUNDRYUP_VERSION="nightly" elif [[ "$FOUNDRYUP_VERSION" == [[:digit:]]* ]]; then @@ -101,34 +101,52 @@ main() { say "installing foundry (version ${FOUNDRYUP_VERSION}, tag ${FOUNDRYUP_TAG})" uname_s=$(uname -s) - uname_m=$(uname -m) - - # Map uname -s to platform - case "$uname_s" in - Linux*) PLATFORM="unknown-linux-gnu" ;; - Darwin*) PLATFORM="apple-darwin" ;; - *) err "unsupported platform: $uname_s" ;; - esac - - # Map uname -m to architecture - case "$uname_m" in - x86_64) ARCHITECTURE="x86_64" ;; - arm64|aarch64) ARCHITECTURE="aarch64" ;; - *) err "unsupported architecture: $uname_m" ;; + PLATFORM=$(tolower "${FOUNDRYUP_PLATFORM:-$uname_s}") + EXT="tar.gz" + case $PLATFORM in + linux) ;; + darwin|mac*) + PLATFORM="darwin" + ;; + mingw*|win*) + EXT="zip" + PLATFORM="win32" + ;; + *) + err "unsupported platform: $PLATFORM" + ;; esac - # Construct the filenames - EXT="tar.gz" - FOUNDRY_BIN_NAME="${ARCHITECTURE}-${PLATFORM}.${EXT}" + uname_m=$(uname -m) + ARCHITECTURE=$(tolower "${FOUNDRYUP_ARCH:-$uname_m}") + if [ "${ARCHITECTURE}" = "x86_64" ]; then + # Redirect stderr to /dev/null to avoid printing errors if non Rosetta. + if [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]; then + ARCHITECTURE="arm64" # Rosetta. + else + ARCHITECTURE="amd64" # Intel. + fi + elif [ "${ARCHITECTURE}" = "arm64" ] ||[ "${ARCHITECTURE}" = "aarch64" ] ; then + ARCHITECTURE="arm64" # Arm. + else + ARCHITECTURE="amd64" # Amd. + fi # Compute the URL of the release tarball in the Foundry repository. RELEASE_URL="https://github.com/${FOUNDRYUP_REPO}/releases/download/${FOUNDRYUP_TAG}/" - BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${FOUNDRY_BIN_NAME}" + BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${PLATFORM}_${ARCHITECTURE}.$EXT" MAN_TARBALL_URL="${RELEASE_URL}foundry_man_${FOUNDRYUP_VERSION}.tar.gz" # Download and extract the binaries archive - say "downloading latest forge and cast" - ensure download "$BIN_ARCHIVE_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" + say "downloading latest forge, and cast" + if [ "$PLATFORM" = "win32" ]; then + tmp="$(mktemp -d 2>/dev/null || echo ".")/foundry-zksync.zip" + ensure download "$BIN_ARCHIVE_URL" "$tmp" + ensure unzip "$tmp" -d "$FOUNDRY_BIN_DIR" + rm -f "$tmp" + else + ensure download "$BIN_ARCHIVE_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" + fi # Optionally download the manuals if check_cmd tar; then @@ -171,20 +189,28 @@ EOF "aarch64-unknown-linux-gnu" ) - TARGET="${ARCHITECTURE}-${PLATFORM}" + if [ "$ARCHITECTURE" = "arm64" ]; then + ARCHITECTURE="aarch64" + fi + if [ "$PLATFORM" = "darwin" ]; then + TARGET="${ARCHITECTURE}-apple-${PLATFORM}" + else + TARGET="${ARCHITECTURE}-${PLATFORM}" + fi + if [[ " ${SUPPORTED_TARGETS[*]} " == *" $TARGET "* ]]; then ANVIL_REPO="matter-labs/era-test-node" say "getting latest tag for anvil-zksync" - ANVIL_TAG=$(curl -s https://api.github.com/repos/$ANVIL_REPO/releases/latest | grep -Po '"tag_name": "\K.*?(?=")') + ANVIL_TAG=$(curl -s https://api.github.com/repos/$ANVIL_REPO/releases/latest | sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p') if [ -z "$ANVIL_TAG" ]; then err "failed to get latest tag for anvil-zksync" fi - ANVIL_BIN_NAME="anvil-${ANVIL_TAG}-${ARCHITECTURE}-${PLATFORM}.${EXT}" + ANVIL_BIN_NAME="era_test_node-${ANVIL_TAG}-${TARGET}.${EXT}" ANVIL_BIN_URL="https://github.com/$ANVIL_REPO/releases/download/$ANVIL_TAG/$ANVIL_BIN_NAME" @@ -192,9 +218,9 @@ EOF say "downloading anvil-zksync from $ANVIL_BIN_URL" - ensure download "$ANVIL_BIN_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" anvil + ensure download "$ANVIL_BIN_URL" | ensure tar -xzC "$FOUNDRY_BIN_DIR" - mv "$FOUNDRY_BIN_DIR/anvil" "$ANVIL_BIN_PATH" + mv "$FOUNDRY_BIN_DIR/anvil-zksync" "$ANVIL_BIN_PATH" chmod +x "$ANVIL_BIN_PATH" @@ -290,6 +316,10 @@ err() { exit 1 } +tolower() { + echo "$1" | awk '{print tolower($0)}' +} + need_cmd() { if ! command -v "$1" &>/dev/null; then err "need '$1' (command not found)" From b098cc3c29a3acf24851064dc07970cb113fc518 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Tue, 3 Dec 2024 14:29:36 -0600 Subject: [PATCH 3/9] chore: lint --- foundryup-zksync/foundryup-zksync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index d94b6a0ed..7ec5eea1e 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -200,7 +200,7 @@ EOF fi if [[ " ${SUPPORTED_TARGETS[*]} " == *" $TARGET "* ]]; then - ANVIL_REPO="matter-labs/era-test-node" + ANVIL_REPO="matter-labs/anvil-zksync" say "getting latest tag for anvil-zksync" From 800633b087bfd910fe00b0a51ea933decf9f1d0f Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Tue, 3 Dec 2024 14:34:43 -0600 Subject: [PATCH 4/9] fix: revert unneeded changes --- foundryup-zksync/foundryup-zksync | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index 7ec5eea1e..9614b0546 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -210,7 +210,7 @@ EOF err "failed to get latest tag for anvil-zksync" fi - ANVIL_BIN_NAME="era_test_node-${ANVIL_TAG}-${TARGET}.${EXT}" + ANVIL_BIN_NAME="anvil-zksync-${ANVIL_TAG}-${TARGET}.${EXT}" ANVIL_BIN_URL="https://github.com/$ANVIL_REPO/releases/download/$ANVIL_TAG/$ANVIL_BIN_NAME" @@ -321,7 +321,7 @@ tolower() { } need_cmd() { - if ! command -v "$1" &>/dev/null; then + if ! check_cmd "$1"; then err "need '$1' (command not found)" fi } @@ -341,16 +341,16 @@ download() { if [ -n "$2" ]; then # output into $2 if check_cmd curl; then - curl -sSfL -o "$2" "$1" + curl -#o "$2" -L "$1" else - wget -qO "$2" "$1" + wget --show-progress -qO "$2" "$1" fi else # output to stdout if check_cmd curl; then - curl -sSfL "$1" + curl -#L "$1" else - wget -qO- "$1" + wget --show-progress -qO- "$1" fi fi } From e6cee1c0c3eea52e4f44ab0ae084133b227f64d7 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Tue, 3 Dec 2024 14:47:40 -0600 Subject: [PATCH 5/9] fix: linux install --- foundryup-zksync/foundryup-zksync | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index 9614b0546..14fe0ead8 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -195,6 +195,8 @@ EOF if [ "$PLATFORM" = "darwin" ]; then TARGET="${ARCHITECTURE}-apple-${PLATFORM}" + elif [ "$PLATFORM" = "linux" ]; then + TARGET="${ARCHITECTURE}-unknown-${PLATFORM}-gnu" else TARGET="${ARCHITECTURE}-${PLATFORM}" fi @@ -298,8 +300,8 @@ OPTIONS: -r, --repo Build and install from a remote GitHub repo (uses default branch if no other options are set) -p, --path Build and install a local repository -j, --jobs Number of CPUs to use for building Foundry (default: all CPUs) - --arch Install a specific architecture (supports x86_64 and aarch64) - --platform Install a specific platform (supports apple-darwin and unknown-linux-gnu) + --arch Install a specific architecture (supports amd64 and arm64) + --platform Install a specific platform (supports linux, and darwin) EOF } @@ -374,6 +376,7 @@ Book : https://foundry-book.zksync.io/ .xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx ' + } main "$@" From 4c59efecd574c1beae092c9237c5c89f5cc14518 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 4 Dec 2024 09:53:08 -0600 Subject: [PATCH 6/9] chore: update workflow action --- .github/workflows/test.yml | 265 ++++++++++++++++++------------------- 1 file changed, 132 insertions(+), 133 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e214bb025..3d152fef9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,142 +1,141 @@ name: test on: - push: - branches: - - main - pull_request: - branches: - - main + push: + branches: + - main + pull_request: + branches: + - main concurrency: - cancel-in-progress: true - group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + group: ${{github.workflow}}-${{github.ref}} env: - CARGO_TERM_COLOR: always - TARGET_RUST_VERSION: "nightly-2024-09-01" + CARGO_TERM_COLOR: always + TARGET_RUST_VERSION: "nightly-2024-09-01" jobs: - doctest: - runs-on: ubuntu-22.04-github-hosted-16core - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: cargo test - run: cargo test --doc -p forge - - clippy: - name: clippy - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@clippy - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - run: cargo clippy --workspace --all-targets --all-features - env: - RUSTFLAGS: -Dwarnings - - rustfmt: - runs-on: ubuntu-22.04-github-hosted-16core - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - components: rustfmt - - run: cargo fmt --all --check - - forge-fmt: - runs-on: ubuntu-22.04-github-hosted-16core - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: forge fmt - shell: bash - run: ./.github/scripts/format.sh --check - - codespell: - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - - uses: codespell-project/actions-codespell@v2 - with: - skip: "*.json" - - crate-checks: - runs-on: ubuntu-22.04-github-hosted-16core - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: taiki-e/install-action@cargo-hack - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: cargo hack - run: cargo hack check - - zk-cargo-test: - runs-on: ubuntu-22.04-github-hosted-16core - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{ github.event.pull_request.head.sha }} - - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - - name: Install cargo-nextest - uses: taiki-e/install-action@nextest - - - name: Run era-test-node - uses: dutterbutter/era-test-node-action@v1 - with: - mode: fork - network: mainnet - log: info - logFilePath: era_test_node.log - target: x86_64-unknown-linux-gnu - releaseTag: v0.1.0-alpha.29 - - - name: Run zk tests - env: - RUST_BACKTRACE: full - TEST_MAINNET_URL: http://localhost:8011 - run: | - git config --global user.name "test-runner" - ZK_DEBUG_HISTORICAL_BLOCK_HASHES=5 cargo nextest run --package '*' --lib --test '*' --filter-expr 'test(~zk)' - - check-ci-install: - name: CI install - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install foundry-zksync - run: cp ./install-foundry-zksync ./foundryup-zksync/* /tmp/ && cd /tmp && ./install-foundry-zksync - - name: Verify installation - run: forge --version + doctest: + runs-on: ubuntu-22.04-github-hosted-16core + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo test + run: cargo test --doc -p forge + + clippy: + name: clippy + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -Dwarnings + + rustfmt: + runs-on: ubuntu-22.04-github-hosted-16core + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + components: rustfmt + - run: cargo fmt --all --check + + forge-fmt: + runs-on: ubuntu-22.04-github-hosted-16core + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: forge fmt + shell: bash + run: ./.github/scripts/format.sh --check + + codespell: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: codespell-project/actions-codespell@v2 + with: + skip: "*.json" + + crate-checks: + runs-on: ubuntu-22.04-github-hosted-16core + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: taiki-e/install-action@cargo-hack + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo hack + run: cargo hack check + + zk-cargo-test: + runs-on: ubuntu-22.04-github-hosted-16core + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{ github.event.pull_request.head.sha }} + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Run era-test-node + uses: dutterbutter/anvil-zksync-action@v1.1.0 + with: + mode: fork + forkUrl: mainnet + log: info + logFilePath: anvil-zksync.log + target: x86_64-unknown-linux-gnu + + - name: Run zk tests + env: + RUST_BACKTRACE: full + TEST_MAINNET_URL: http://localhost:8011 + run: | + git config --global user.name "test-runner" + ZK_DEBUG_HISTORICAL_BLOCK_HASHES=5 cargo nextest run --package '*' --lib --test '*' --filter-expr 'test(~zk)' + + check-ci-install: + name: CI install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install foundry-zksync + run: cp ./install-foundry-zksync ./foundryup-zksync/* /tmp/ && cd /tmp && ./install-foundry-zksync + - name: Verify installation + run: forge --version From 9d91cc25d75d21fddd15a8632c56ef91236db975 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 4 Dec 2024 10:12:36 -0600 Subject: [PATCH 7/9] chore: make requested changes --- .github/workflows/test.yml | 2 +- foundryup-zksync/foundryup-zksync | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5b91357b..86dc3415a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,7 +119,7 @@ jobs: - name: Install cargo-nextest uses: taiki-e/install-action@nextest - - name: Run era-test-node + - name: Run anvil-zksync uses: dutterbutter/anvil-zksync-action@v1.1.0 with: mode: fork diff --git a/foundryup-zksync/foundryup-zksync b/foundryup-zksync/foundryup-zksync index 14fe0ead8..b61be118f 100755 --- a/foundryup-zksync/foundryup-zksync +++ b/foundryup-zksync/foundryup-zksync @@ -301,7 +301,7 @@ OPTIONS: -p, --path Build and install a local repository -j, --jobs Number of CPUs to use for building Foundry (default: all CPUs) --arch Install a specific architecture (supports amd64 and arm64) - --platform Install a specific platform (supports linux, and darwin) + --platform Install a specific platform (supports win32, linux, and darwin) EOF } From 332c3b50cad5ecf1d11c13e1ce4d8259d11b382c Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Mon, 9 Dec 2024 08:58:23 -0600 Subject: [PATCH 8/9] chore: resolve conflicts --- .github/workflows/test.yml | 221 ++++++++++++++++++++----------------- 1 file changed, 118 insertions(+), 103 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 233651d4b..57f27e3df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,14 @@ name: test on: - push: - branches: - - main - - "*upstream*" - pull_request: - branches: - - main - - "*upstream*" + push: + branches: + - main + - "*upstream*" + pull_request: + branches: + - main + - "*upstream*" concurrency: cancel-in-progress: true @@ -26,58 +26,58 @@ jobs: secrets: inherit doctest: - runs-on: ubuntu-22.04 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: cargo test - run: cargo test --doc -p forge + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo test + run: cargo test --doc -p forge clippy: - name: clippy - runs-on: ubuntu-22.04 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@clippy - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - run: cargo clippy --workspace --all-targets --all-features - env: - RUSTFLAGS: -Dwarnings + name: clippy + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -Dwarnings rustfmt: - runs-on: ubuntu-22.04 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - components: rustfmt - - run: cargo fmt --all --check + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + components: rustfmt + - run: cargo fmt --all --check forge-fmt: - runs-on: ubuntu-22.04 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: forge fmt - shell: bash - run: ./.github/scripts/format.sh --check + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: forge fmt + shell: bash + run: ./.github/scripts/format.sh --check codespell: runs-on: ubuntu-22.04 @@ -89,66 +89,81 @@ jobs: skip: "*.json" crate-checks: - # ubuntu-22.04 runs out of disk space - runs-on: ubuntu-22.04-github-hosted-16core - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ env.TARGET_RUST_VERSION }} - - uses: taiki-e/install-action@cargo-hack - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - name: cargo hack - run: cargo hack check - + # ubuntu-22.04 runs out of disk space + runs-on: ubuntu-22.04-github-hosted-16core + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + - uses: taiki-e/install-action@cargo-hack + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - name: cargo hack + run: cargo hack check + zk-cargo-test: - runs-on: ubuntu-22.04 - - steps: + runs-on: ubuntu-22.04 + + steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: recursive ref: ${{ github.event.pull_request.head.sha }} - + - name: Install Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: ${{ env.TARGET_RUST_VERSION }} zk-cargo-test: - runs-on: ubuntu-22.04-github-hosted-16core + runs-on: ubuntu-22.04 - - name: Run era-test-node - uses: dutterbutter/era-test-node-action@v1 - with: - mode: fork - network: mainnet - log: info - logFilePath: era_test_node.log - target: x86_64-unknown-linux-gnu - releaseTag: v0.1.0-alpha.29 - - name: Setup Git config - run: | - git config --global user.name "GitHub Actions Bot" - git config --global user.email "<>" - git config --global url."https://github.com/".insteadOf "git@github.com:" - - name: Run zk tests - env: - RUST_BACKTRACE: full - TEST_MAINNET_URL: http://localhost:8011 - run: | - ZK_DEBUG_HISTORICAL_BLOCK_HASHES=5 cargo nextest run --package '*' --lib --test '*' --filter-expr 'test(~zk)' + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{ github.event.pull_request.head.sha }} - check-ci-install: - name: CI install - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Install foundry-zksync - run: cp ./install-foundry-zksync ./foundryup-zksync/* /tmp/ && cd /tmp && ./install-foundry-zksync - - name: Verify installation - run: forge --version + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ env.TARGET_RUST_VERSION }} + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Run era-test-node + uses: dutterbutter/era-test-node-action@v1 + with: + mode: fork + network: mainnet + log: info + logFilePath: era_test_node.log + target: x86_64-unknown-linux-gnu + releaseTag: v0.1.0-alpha.29 + - name: Setup Git config + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "<>" + git config --global url."https://github.com/".insteadOf "git@github.com:" + - name: Run zk tests + env: + RUST_BACKTRACE: full + TEST_MAINNET_URL: http://localhost:8011 + run: | + ZK_DEBUG_HISTORICAL_BLOCK_HASHES=5 cargo nextest run --package '*' --lib --test '*' --filter-expr 'test(~zk)' + + check-ci-install: + name: CI install + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Install foundry-zksync + run: cp ./install-foundry-zksync ./foundryup-zksync/* /tmp/ && cd /tmp && ./install-foundry-zksync + - name: Verify installation + run: forge --version From 78ce3985678e67d4dee4c1980a35c5f039402214 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Mon, 9 Dec 2024 09:03:22 -0600 Subject: [PATCH 9/9] chore: update action --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57f27e3df..110fe7748 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -137,15 +137,15 @@ jobs: - name: Install cargo-nextest uses: taiki-e/install-action@nextest - - name: Run era-test-node - uses: dutterbutter/era-test-node-action@v1 + - name: Run anvil-zksync + uses: dutterbutter/anvil-zksync-action@v1.1.0 with: mode: fork - network: mainnet + forkUrl: mainnet log: info - logFilePath: era_test_node.log + logFilePath: anvil_zksync.log target: x86_64-unknown-linux-gnu - releaseTag: v0.1.0-alpha.29 + releaseTag: v0.2.1 - name: Setup Git config run: | git config --global user.name "GitHub Actions Bot"