zksync-era integration docs #1036
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
merge_group: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: 1.78.0 | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
compile: | |
name: Compile | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Rustup toolchain install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Run cargo check | |
run: cargo check --workspace --all-features --all-targets | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --workspace --all-features --benches --examples --tests -- -D warnings | |
build-compiler-tester: | |
name: Build Compiler Tester Bundle | |
runs-on: ubuntu-latest | |
env: | |
ROCKSDB_LIB_DIR: /usr/lib | |
SNAPPY_LIB_DIR: /usr/lib | |
LLVM_SYS_170_PREFIX: ${{ github.workspace }}/zksync-llvm/target-llvm/target-final | |
steps: | |
- name: Checkout vm sources | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/era_vm | |
- name: System Dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: llvm clang clang-tools build-essential lld ninja-build librocksdb-dev libsnappy-dev | |
version: 1.0 | |
- uses: dtolnay/[email protected] | |
with: | |
components: clippy | |
- name: Setup compiler-tester submodule | |
working-directory: ${{ github.workspace }}/era_vm | |
run: make submodules | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
era_vm | |
era_vm/era-compiler-tester | |
- name: Fetch zksync-llvm | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
workflow: build-binaries.yml | |
repo: matter-labs/era-compiler-llvm | |
if_no_artifact_found: fail | |
path: ${{ github.workspace }}/zksync-llvm | |
workflow_conclusion: success | |
name: llvm-bins-Linux-X64 | |
search_artifacts: true | |
- name: Download zksolc compiler | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: | | |
curl -L https://github.com/matter-labs/zksolc-bin/releases/download/v1.5.1/zksolc-linux-amd64-musl-v1.5.1 --output zksolc | |
chmod +x zksolc | |
sudo cp zksolc /usr/bin/zksolc | |
# We use zkvyper v1.5.1 since v1.5.3 breaks with these tests | |
- name: Download zkvyper compiler | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: | | |
curl -L https://github.com/matter-labs/zkvyper-bin/releases/download/v1.5.1/zkvyper-linux-amd64-musl-v1.5.1 --output zkvyper | |
chmod +x zkvyper | |
sudo cp zkvyper /usr/bin/zkvyper | |
- name: Download solc compiler | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: | | |
curl -L https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux --output solc | |
chmod +x solc | |
sudo cp solc /usr/bin/solc | |
- name: Install zkLLVM | |
working-directory: ${{ github.workspace }}/zksync-llvm | |
run: | | |
rm -rfv llvm | |
tar -xvf Linux-X64-target-final.tar.gz | |
- name: Build compiler tester with Lambdaclass VM | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: cargo build --features lambda_vm --release --bin compiler-tester | |
- name: Compile system contracts | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: | | |
./target/release/compiler-tester --path tests/none --save-system-contracts system-contracts-prod.o | |
./target/release/compiler-tester --path tests/none --save-system-contracts system-contracts-test.o --use-test-encoding | |
- name: Upload Bundle | |
uses: actions/cache/save@v3 | |
with: | |
# Use github.sha in the key because this is valid only for this commit | |
key: compiler-tester-bundle-${{ github.sha }} | |
path: | | |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-prod.o | |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-test.o | |
${{ github.workspace }}/era_vm/era-compiler-tester/target/release/compiler-tester | |
${{ github.workspace }}/era_vm/era-compiler-tester/solc-bin | |
${{ github.workspace }}/era_vm/era-compiler-tester/vyper-bin | |
${{ github.workspace }}/era_vm/era-compiler-tester/solc | |
${{ github.workspace }}/era_vm/era-compiler-tester/zksolc | |
${{ github.workspace }}/era_vm/era-compiler-tester/zkvyper | |
test-with-compiler-tester: | |
needs: build-compiler-tester | |
strategy: | |
fail-fast: false | |
matrix: | |
testgroup: [ | |
tests/solidity/complex/interpreter, | |
tests/llvm, | |
"tests/solidity/complex/array_one_element,balance,call_by_signature,call_chain,create,default,default_single_file,evaluation_order,forwarding,immutable_delegate_call,import_library_inline,indirect_recursion_fact,interface_casting,internal_function_pointers,invalid_signature,library_call_tuple,many_arguments,nested_calls,solidity_by_example}", | |
"tests/solidity/complex/{storage,sum_of_squares,try_catch,value,voting}", | |
"tests/solidity/complex/yul_instructions/{calldatasize,extcodehash,extcodesize}", | |
tests/solidity/complex/yul_instructions/call/, | |
tests/solidity/complex/yul_instructions/calldatacopy, | |
tests/solidity/complex/yul_instructions/calldataload, | |
tests/solidity/complex/yul_instructions/create, | |
tests/solidity/complex/yul_instructions/create2, | |
tests/solidity/complex/yul_instructions/codecopy, | |
tests/solidity/complex/yul_instructions/delegatecall, | |
tests/solidity/complex/yul_instructions/staticcall, | |
tests/solidity/ethereum/*.sol, | |
"tests/solidity/ethereum/{abiEncoderV[12],abiencodedecode}", | |
"tests/solidity/ethereum/{accessor,arithmetics,asmForLoop,builtinFunctions,c99_scoping_activation.sol,cleanup,constantEvaluator}", | |
"tests/solidity/ethereum/array/{*.sol,inline_*.sol,array_memory_allocation,concat,push,slices}", | |
tests/solidity/ethereum/array/copying, | |
"tests/solidity/ethereum/array/{delete,indexAccess,pop}", | |
"tests/solidity/ethereum/{calldata,constants,constructor,conversions,deployedCodeExclusion,ecrecover,enums,errors}", | |
"tests/solidity/ethereum/{events,experimental,exponentiation,expressions,externalContracts,externalSource}", | |
"tests/solidity/ethereum/{fallback,freeFunctions,functionCall,functionSelector,functionTypes}", | |
"tests/solidity/ethereum/{getters,immutable,inheritance,inlineAssembly,integer,interfaceID,isoltestTesting}", | |
"tests/solidity/ethereum/{libraries,literals,memoryManagement,metaTypes,modifiers,multiSource}", | |
"tests/solidity/ethereum/{operators,optimizer,payable,receive}", | |
"tests/solidity/ethereum/{reverts,revertStrings,salted_create,shanghai,smoke,specialFunctions,state}", | |
"tests/solidity/ethereum/{statements,storage,strings,structs}", | |
"tests/solidity/ethereum/{tryCatch,types,underscore,uninitializedFunctionPointer}", | |
"tests/solidity/ethereum/{userDefinedValueType,using,variables,various,virtualFunctions}", | |
"tests/solidity/simple/{algorithm,array,block,call_chain,conditional,constant_expressions,constants,constructor,context}", | |
"tests/solidity/simple/{destructuring,error,events,expression,fallback,fat_ptr,function,gas_value,immutable,interface,internal_function_pointers}", | |
"tests/solidity/simple/{linearity,loop,match,modular,order,overflow,pointer,recursion,return}", | |
tests/solidity/simple/operator/arithmetic, | |
tests/solidity/simple/operator/assignment, | |
"tests/solidity/simple/operator/{bitwise,casting,logical}", | |
tests/solidity/simple/operator/comparison, | |
"tests/solidity/simple/{solidity_by_example,storage,structure,system,try_catch,unused}", | |
"tests/solidity/simple/yul_instructions/{[a-j]*,lt}.sol", | |
"tests/solidity/simple/yul_instructions/m*.sol", | |
"tests/solidity/simple/yul_instructions/[n-p]*.sol", | |
"tests/solidity/simple/yul_instructions/s[a-h]*.sol", | |
"tests/solidity/simple/yul_instructions/s[i-z]*.sol", | |
"tests/solidity/simple/yul_instructions/[t-z]*.sol", | |
tests/solidity/simple/yul_instructions/returndatacopy.sol, | |
tests/solidity/simple/yul_instructions/returndatasize.sol, | |
tests/solidity/simple/yul_semantic, | |
"tests/vyper/complex/{array_one_element,call_by_signature,call_chain,create_from_blueprint}", | |
"tests/vyper/complex/{create_minimal_proxy_to,default,defi}", | |
"tests/vyper/complex/ethereum/[a-e]*", | |
"tests/vyper/complex/ethereum/[f-i]*", | |
"tests/vyper/complex/ethereum/[j-z]", | |
tests/vyper/complex/interface_casting, | |
tests/vyper/complex/nested_calls, | |
"tests/vyper/complex/{indirect_recursion_fact,invalid_signature,many_arguments}", | |
"tests/vyper/complex/{solidity_by_example,storage,sum_of_squares,value,voting}", | |
tests/vyper/ethereum/*.vy, | |
tests/vyper/ethereum/abiEncoderV1, | |
tests/vyper/ethereum/abiEncoderV2, | |
tests/vyper/ethereum/abiencodedecode, | |
tests/vyper/ethereum/accessor, | |
tests/vyper/ethereum/arithmetics, | |
tests/vyper/ethereum/array, | |
tests/vyper/ethereum/builtinFunctions, | |
tests/vyper/ethereum/calldata, | |
tests/vyper/ethereum/cleanup, | |
tests/vyper/ethereum/constantEvaluator, | |
tests/vyper/ethereum/constants, | |
tests/vyper/ethereum/constructor, | |
tests/vyper/ethereum/conversions, | |
tests/vyper/ethereum/ecrecover, | |
tests/vyper/ethereum/events, | |
tests/vyper/ethereum/expressions, | |
tests/vyper/ethereum/fallback, | |
tests/vyper/ethereum/functionCall, | |
tests/vyper/ethereum/getters, | |
tests/vyper/ethereum/immutable, | |
tests/vyper/ethereum/integer, | |
tests/vyper/ethereum/interfaceID, | |
tests/vyper/ethereum/isoltestTesting, | |
tests/vyper/ethereum/literals, | |
tests/vyper/ethereum/memoryManagement, | |
tests/vyper/ethereum/operators, | |
tests/vyper/ethereum/optimizer, | |
tests/vyper/ethereum/revertStrings, | |
tests/vyper/ethereum/reverts, | |
tests/vyper/ethereum/smoke, | |
tests/vyper/ethereum/specialFunctions, | |
tests/vyper/ethereum/state, | |
tests/vyper/ethereum/storage, | |
tests/vyper/ethereum/strings, | |
tests/vyper/ethereum/structs, | |
tests/vyper/ethereum/types, | |
tests/vyper/ethereum/underscore, | |
tests/vyper/ethereum/variables, | |
tests/vyper/ethereum/various, | |
tests/vyper/ethereum/viaYul, | |
tests/vyper/simple/*.vy, | |
tests/vyper/simple/algorithm, | |
tests/vyper/simple/array, | |
tests/vyper/simple/block, | |
tests/vyper/simple/built_in_functions, | |
tests/vyper/simple/conditional, | |
tests/vyper/simple/constructor, | |
tests/vyper/simple/destructuring, | |
tests/vyper/simple/error, | |
tests/vyper/simple/events, | |
tests/vyper/simple/expression, | |
tests/vyper/simple/fallback, | |
tests/vyper/simple/function, | |
tests/vyper/simple/immutable, | |
tests/vyper/simple/interface, | |
tests/vyper/simple/loop, | |
tests/vyper/simple/modular, | |
tests/vyper/simple/operator, | |
tests/vyper/simple/order, | |
tests/vyper/simple/overflow, | |
tests/vyper/simple/return, | |
tests/vyper/simple/revert_on_failure, | |
tests/vyper/simple/solidity_by_example, | |
tests/vyper/simple/storage, | |
tests/vyper/simple/structure, | |
tests/vyper/simple/unchecked_math, | |
tests/vyper/simple/unused, | |
"tests/yul/{*}", | |
] | |
mode: [''] | |
# Special case the slowest tests to parallelize on execution mode as well | |
include: | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/log0.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/log1.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/log2.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/log3.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/log4.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/operator | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/return.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode M0' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode M1' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode M2' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode M3' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode Ms' | |
- testgroup: tests/solidity/simple/yul_instructions/revert.sol | |
mode: '--mode Mz' | |
- testgroup: tests/solidity/complex/parser | |
encoding: 'test' | |
- testgroup: tests/solidity/complex/defi | |
encoding: 'test' | |
name: Run Compiler Tester | |
runs-on: ubuntu-latest | |
steps: | |
- name: System Dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: llvm clang clang-tools build-essential lld ninja-build librocksdb-dev libsnappy-dev | |
version: 1.0 | |
- name: Checkout vm sources | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/era_vm | |
- name: Setup compiler-tester submodule | |
working-directory: ${{ github.workspace }}/era_vm | |
run: make submodules | |
- name: Download Bundle | |
uses: actions/cache/restore@v3 | |
with: | |
# Use github.sha in the key because this is valid only for this commit | |
key: compiler-tester-bundle-${{ github.sha }} | |
# This should be guaranteed to hit | |
fail-on-cache-miss: true | |
path: | | |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-prod.o | |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-test.o | |
${{ github.workspace }}/era_vm/era-compiler-tester/target/release/compiler-tester | |
${{ github.workspace }}/era_vm/era-compiler-tester/solc-bin | |
${{ github.workspace }}/era_vm/era-compiler-tester/vyper-bin | |
${{ github.workspace }}/era_vm/era-compiler-tester/solc | |
${{ github.workspace }}/era_vm/era-compiler-tester/zksolc | |
${{ github.workspace }}/era_vm/era-compiler-tester/zkvyper | |
- name: Install Bundle | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
run: sudo cp zksolc zkvyper solc /usr/bin/ | |
- name: Run compiler-tester tests | |
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester | |
env: | |
system-contracts: system-contracts-${{ matrix.encoding == 'test' && 'test' || 'prod' }}.o | |
encoding: ${{ matrix.encoding == 'test' && '--use-test-encoding' || '' }} | |
run: ./target/release/compiler-tester --load-system-contracts ${{ env.system-contracts}} ${{ env.encoding }} --target EraVM ${{ matrix.mode }} --path ${{ matrix.testgroup }} | |
zksync_era_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout vm sources | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/era_vm | |
- name: Setup compiler-tester submodule | |
working-directory: ${{ github.workspace }}/era_vm | |
run: make submodules | |
- name: Setup nodejs + yarn | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.20.2 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ${{ github.workspace }} | |
- name: Rustup toolchain install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Setup zksync-era | |
working-directory: ${{ github.workspace }}/era_vm/zksync-era | |
run: | | |
cargo install sqlx-cli --version 0.8.0 | |
mkdir -p ./volumes/reth/data | |
mkdir -p ./volumes/postgres | |
docker compose -v up -d | |
sleep 15 | |
export ZKSYNC_HOME=$(pwd) | |
export PATH=$PATH:./bin | |
zk | |
zk init | |
- name: Run tests | |
working-directory: ${{ github.workspace }}/era_vm | |
run: make era-test |