Skip to content

Commit

Permalink
Merge branch 'nish-fix-fork-reset' into upstream-5e72c69-fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MBerguer committed Jan 22, 2025
2 parents 041cfb0 + 8504a67 commit 889c181
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 36 deletions.
17 changes: 17 additions & 0 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"include-component-in-tag": true,
"release-type": "simple",
"packages": {
".": {
"component": "foundry-zksync",
"extra-files": [
{
"type": "generic",
"path": "Cargo.toml"
}
]
}
}
}
3 changes: 3 additions & 0 deletions .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.2"
}
41 changes: 41 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release-please

# Give permissions to the release-please bot to open and update PRs
# and commit to PRs the repository to update Cargo.lock
permissions:
contents: write
pull-requests: write
id-token: write
attestations: write

# Run the workflow on push to the main branch and manually
on:
push:
branches:
- main
workflow_dispatch:

jobs:

# Prepare the release PR with changelog updates and create github releases
# Do not publish to crates.io or upgrade dependencies
release-please:
uses: matter-labs/zksync-ci-common/.github/workflows/release-please.yaml@v1
secrets:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
config: '.github/release-please/config.json' # Specify the path to the configuration file
manifest: '.github/release-please/manifest.json' # Specify the path to the manifest file
update-cargo-lock: true # Update Cargo.lock file
publish-to-crates-io: false # Enable publishing to crates.io
upgrade-dependencies: false # Upgrade workspace dependencies

# Trigger workflow to generate artifacts
release:
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
needs: release-please
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.release-please.outputs.tag_name }}
secrets: inherit
15 changes: 0 additions & 15 deletions .github/workflows/release-plz.yaml

This file was deleted.

52 changes: 39 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
name: release
name: Release

on:
push:
tags:
- "*-zksync.*"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
# Workflow call trigger for stable releases generation
workflow_call:
inputs:
tag:
description: "Tag to use for the release."
type: string
required: true
default: ""

env:
CARGO_TERM_COLOR: always
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
IS_NIGHTLY: ${{ github.event_name == 'schedule' || inputs.tag == '' }}

jobs:
prepare:
Expand All @@ -20,21 +25,25 @@ jobs:
outputs:
tag_name: ${{ steps.release_info.outputs.tag_name }}
release_name: ${{ steps.release_info.outputs.release_name }}
changelog: ${{ steps.build_changelog.outputs.changelog }}
prerelease: ${{ steps.release_info.outputs.prerelease }}
changelog: ${{ steps.build_changelog.outputs.changelog || '' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.tag || '' }}

- name: Compute release name and tag
id: release_info
run: |
if [[ ${IS_NIGHTLY} == 'true' ]]; then
echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "release_name=foundry-zksync Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "release_name=foundry-zksync@${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
# Creates a `nightly-SHA` tag for this specific nightly
Expand All @@ -52,11 +61,13 @@ jobs:
await createTag({ github, context }, process.env.TAG_NAME)
- name: Build changelog
if: ${{ env.IS_NIGHTLY == 'true' }}
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: "./.github/changelog.json"
fromTag: ${{ env.IS_NIGHTLY == 'true' && 'nightly' || '' }}
fromTag: 'nightly'
toTag: ${{ steps.release_info.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -78,12 +89,12 @@ jobs:
# `target`: Rust build target triple
# `platform` and `arch`: Used in tarball names
# `svm`: target platform to use for the Solc binary: https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24
- runner: ubuntu-22.04-github-hosted-16core
- runner: ubuntu-24.04-github-hosted-16core
target: x86_64-unknown-linux-gnu
svm_target_platform: linux-amd64
platform: linux
arch: amd64
- runner: ubuntu-22.04-github-hosted-16core
- runner: ubuntu-24.04-github-hosted-16core
target: aarch64-unknown-linux-gnu
svm_target_platform: linux-aarch64
platform: linux
Expand All @@ -100,9 +111,13 @@ jobs:
arch: arm64
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || '' }}

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install required Rust targets
run: rustup target add ${{ matrix.target }}

Expand All @@ -118,6 +133,7 @@ jobs:
echo "PATH=/usr/local/opt/make/libexec/gnubin:$PATH" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Apple Darwin
if: matrix.target == 'x86_64-apple-darwin'
run: |
Expand Down Expand Up @@ -184,7 +200,7 @@ jobs:
env:
PLATFORM_NAME: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
VERSION_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }}
shell: bash
run: |
sudo apt-get -y install help2man
Expand All @@ -197,16 +213,26 @@ jobs:
# Creates the release for this specific version
- name: Create release
uses: softprops/action-gh-release@v1
if: ${{ inputs.tag == '' }}
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.prepare.outputs.release_name }}
tag_name: ${{ needs.prepare.outputs.tag_name }}
prerelease: true
prerelease: ${{ needs.prepare.outputs.prerelease }}
body: ${{ needs.prepare.outputs.changelog }}
files: |
${{ steps.artifacts.outputs.file_name }}
${{ steps.man.outputs.foundry_man }}
- name: Update release-please release artifacts
if: ${{ inputs.tag != '' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
files: |
${{ steps.artifacts.outputs.file_name }}
${{ steps.man.outputs.foundry_man }}
- name: Binaries attestation
uses: actions/attest-build-provenance@v2
with:
Expand All @@ -217,8 +243,8 @@ jobs:
# If this is a nightly release, it also updates the release
# tagged `nightly` for compatibility with `foundryup`
- name: Update nightly release
if: ${{ env.IS_NIGHTLY }}
uses: softprops/action-gh-release@v1
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: softprops/action-gh-release@v2
with:
name: "Nightly foundry-zksync"
tag_name: "nightly"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:

crate-checks:
# ubuntu-22.04 runs out of disk space
runs-on: ubuntu-22.04-github-hosted-16core
runs-on: ubuntu-24.04-github-hosted-16core
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -103,7 +103,7 @@ jobs:
run: cargo hack check

zk-cargo-test:
runs-on: ubuntu-22.04-github-hosted-16core
runs-on: ubuntu-24.04-github-hosted-16core
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -165,12 +165,12 @@ jobs:
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 anvil-zksync installation
run: anvil-zksync --version
4 changes: 2 additions & 2 deletions .github/workflows/zk-aave-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
zk-aave-test:
runs-on: ubuntu-22.04-github-hosted-16core
runs-on: ubuntu-24.04-github-hosted-16core

steps:
- name: Checkout code
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
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(~test_zk_aave_di)'
ZK_DEBUG_HISTORICAL_BLOCK_HASHES=5 cargo nextest run --package '*' --lib --test '*' --filter-expr 'test(~test_zk_aave_di)'
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.0.2"
version = "0.0.2" # x-release-please-version
edition = "2021"
# Remember to update clippy.toml as well
rust-version = "1.83"
Expand Down
39 changes: 39 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Release Process

This document outlines the automated release process for `foundry-zksync` project.
The release process ensures that every change is systematically analyzed, documented, and packaged for distribution.

## Release Process Overview

1. **Triggering the Release Workflow**
- Every merge to the `main` branch activates a special workflow.
- This workflow uses the [`release-please` tool](https://github.com/googleapis/release-please) to analyze the commits.

2. **Commit Analysis and Release Candidate Creation**
- The `release-please` tool scans for new conventional commits that meet the criteria for triggering a release.
- If qualifying commits are found, the tool automatically creates a **Release Pull Request (PR)**. This PR includes:
- An updated changelog detailing the new changes.
- Updated `Cargo.toml` and `Cargo.lock` files with the next release version.

3. **Review and Approval**
- The Release PR must be reviewed and approved by the designated Release Manager.
- Once approved, the PR is merged when the release is planned.

4. **Creating a New Release**
- Upon merging the Release PR:
- The workflow automatically creates a new GitHub tag and release corresponding to the new version.
- The Release PR is marked as "released" and linked to the newly created release.
- Merged PRs included in the release are also labeled with `released in version...`.

5. **Generating and Publishing Artifacts**
- The `release-please` workflow also triggers the `release.yaml` workflow.
- This workflow generates binary artifacts for the release and attaches them to the GitHub release generated by `release-please`.

6. **Release Completion**
- With the binary artifacts added, the release is complete and available for distribution.

## Release Versioning

The `foundry-zksync` project follows [Semantic Versioning](https://semver.org/).

Tags are created in the format `foundry-zksync-vX.Y.Z`.
20 changes: 20 additions & 0 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,26 @@ impl Backend {
*self.fork.write() = Some(fork);
*self.env.write() = env;
} else {
// Set cache path on correct block
{
let maybe_fork_url = { self.node_config.read().await.eth_rpc_url.clone() };
if let Some(fork_url) = maybe_fork_url {
// Set the fork block number
let mut node_config = self.node_config.write().await;
node_config.fork_choice = Some(ForkChoice::Block(fork_block_number));

let mut env = self.env.read().clone();
let (forked_db, client_fork_config) = node_config
.setup_fork_db_config(fork_url, &mut env, &self.fees)
.await?;

*self.db.write().await = Box::new(forked_db);
let fork = ClientFork::new(client_fork_config, Arc::clone(&self.db));
*self.fork.write() = Some(fork);
*self.env.write() = env;
}
}

let gas_limit = self.node_config.read().await.fork_gas_limit(&fork_block);
let mut env = self.env.write();

Expand Down
2 changes: 1 addition & 1 deletion crates/zksync/core/src/vm/farcall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl FarCallHandler {
PrimitiveValue { value: return_fat_ptr.to_u256(), is_pointer: false };

// Just rewriting `code_page` is very error-prone, since the same memory page would be
// re-used for decommitments. We'll use a different approach:
// reused for decommitments. We'll use a different approach:
// - Set `previous_code_word` to the value that we want
// - Set `previous_code_memory_page` to the current code page + `previous_super_pc` to 0
// (as it corresponds
Expand Down

0 comments on commit 889c181

Please sign in to comment.