Skip to content

Commit c080745

Browse files
committed
chore: run tests with zksyncos server
1 parent 08f15c5 commit c080745

File tree

47 files changed

+2349
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2349
-410
lines changed

.github/workflows/ci-rust.yml

Lines changed: 104 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,110 @@ jobs:
8787
run: forge build
8888
working-directory: packages/erc4337-contracts
8989

90-
- name: Verify ERC-4337 contract ABIs exist
90+
- name: Run clippy
91+
run: |
92+
rustup component add clippy --toolchain stable
93+
rustup component add --toolchain 1.91.0-x86_64-unknown-linux-gnu clippy
94+
cargo clippy --all-targets -- -D warnings
95+
working-directory: packages/sdk-platforms/rust/zksync-sso-erc4337
96+
97+
- name: Install cargo-nextest
98+
uses: taiki-e/install-action@nextest
99+
100+
- name: Run rust tests with nextest
101+
run: cargo nextest run --profile ci --all-features
102+
working-directory: packages/sdk-platforms/rust/zksync-sso-erc4337
103+
104+
rust-sdk-erc4337-zksync-os:
105+
name: Rust 4337 SDK (zksync-os)
106+
runs-on: ubuntu-latest
107+
strategy:
108+
matrix:
109+
config:
110+
- debug
111+
steps:
112+
- uses: actions/checkout@v4
113+
with:
114+
submodules: recursive
115+
116+
- name: Run sccache-cache
117+
uses: mozilla-actions/sccache-action@v0.0.4
118+
119+
- name: Install Rust
120+
run: |
121+
rustup update stable && rustup default stable
122+
rustup toolchain install nightly
123+
124+
- name: Run rustfmt
125+
run: |
126+
rustup component add rustfmt --toolchain nightly
127+
cargo +nightly fmt --all -- --check
128+
working-directory: packages/sdk-platforms/rust/zksync-sso-erc4337
129+
130+
- name: Install Foundry
131+
uses: foundry-rs/foundry-toolchain@v1.4.0
132+
with:
133+
# zksync-os-server's zkos-l1-state.json doesn't work on latest version of anvil
134+
version: v1.5.1
135+
136+
- name: Install dependencies
137+
run: forge soldeer install
138+
working-directory: packages/erc4337-contracts
139+
140+
- name: Install Node.js 22 via nvm
141+
run: |
142+
export NVM_DIR="$HOME/.nvm"
143+
mkdir -p "$NVM_DIR"
144+
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
145+
. "$NVM_DIR/nvm.sh"
146+
nvm install 22
147+
nvm use 22
148+
node -v
149+
npm install -g yarn
150+
# Expose Node.js bin dir to subsequent steps
151+
echo "$(dirname $(nvm which 22))" >> $GITHUB_PATH
152+
153+
- name: Configure pnpm store dir
154+
run: echo "PNPM_STORE_DIR=$HOME/.pnpm-store" >> $GITHUB_ENV
155+
156+
- name: Cache pnpm store
157+
uses: actions/cache@v4
158+
with:
159+
path: ~/.pnpm-store
160+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('packages/erc4337-contracts/pnpm-lock.yaml') }}
161+
restore-keys: |
162+
${{ runner.os }}-pnpm-store-
163+
164+
- name: Enable corepack and activate pnpm from contracts package.json
165+
run: |
166+
corepack enable
167+
corepack prepare "$(node -p "require('./package.json').packageManager")" --activate
168+
pnpm -v
169+
working-directory: packages/erc4337-contracts
170+
171+
- name: Install dependencies
172+
run: pnpm install --frozen-lockfile
173+
working-directory: packages/erc4337-contracts
174+
175+
- name: Build ERC-4337 contracts
176+
run: forge build
177+
working-directory: packages/erc4337-contracts
178+
179+
- name: Clone zksync-os dependencies
91180
run: |
92181
set -euo pipefail
93-
missing=()
94-
files=(
95-
"out/IERC7579Account.sol/IERC7579Account.json"
96-
"out/EntryPoint.sol/EntryPoint.json"
97-
)
98-
for f in "${files[@]}"; do
99-
if [ ! -f "$f" ]; then
100-
missing+=("$f")
101-
fi
102-
done
103-
if [ ${#missing[@]} -gt 0 ]; then
104-
echo "Missing expected ABI JSON files:" >&2
105-
for m in "${missing[@]}"; do echo " - $m" >&2; done
106-
echo "\nAvailable JSON files under out/:" >&2
107-
find out -maxdepth 2 -type f -name '*.json' | sort || true
108-
exit 1
182+
cd packages/sdk-platforms/rust/zksync-sso-erc4337
183+
if [ ! -d account-abstraction ]; then
184+
git clone https://github.com/eth-infinitism/account-abstraction
109185
fi
110-
working-directory: packages/erc4337-contracts
186+
if [ ! -d zksync-os-server ]; then
187+
git clone https://github.com/matter-labs/zksync-os-server
188+
fi
189+
190+
- name: Build zksync-os-server
191+
run: |
192+
cd packages/sdk-platforms/rust/zksync-sso-erc4337/zksync-os-server
193+
cargo build --release --bin zksync-os-server
111194
112195
- name: Run clippy
113196
run: |
@@ -119,7 +202,9 @@ jobs:
119202
- name: Install cargo-nextest
120203
uses: taiki-e/install-action@nextest
121204

122-
- name: Run rust tests with nextest
205+
- name: Run rust tests with nextest (zksync-os)
206+
env:
207+
SSO_TEST_NODE_BACKEND: zksyncos
123208
run: cargo nextest run --profile ci --all-features
124209
working-directory: packages/sdk-platforms/rust/zksync-sso-erc4337
125210

@@ -153,28 +238,6 @@ jobs:
153238
run: forge build
154239
working-directory: packages/erc4337-contracts
155240

156-
- name: Verify ERC-4337 contract ABIs exist
157-
run: |
158-
set -euo pipefail
159-
missing=()
160-
files=(
161-
"out/IERC7579Account.sol/IERC7579Account.json"
162-
"out/EntryPoint.sol/EntryPoint.json"
163-
)
164-
for f in "${files[@]}"; do
165-
if [ ! -f "$f" ]; then
166-
missing+=("$f")
167-
fi
168-
done
169-
if [ ${#missing[@]} -gt 0 ]; then
170-
echo "Missing expected ABI JSON files:" >&2
171-
for m in "${missing[@]}"; do echo " - $m" >&2; done
172-
echo "\nAvailable JSON files under out/:" >&2
173-
find out -maxdepth 2 -type f -name '*.json' | sort || true
174-
exit 1
175-
fi
176-
working-directory: packages/erc4337-contracts
177-
178241
- name: Build WASM module (web target)
179242
run: wasm-pack build --target web
180243
working-directory: packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-ffi-web

.github/workflows/ci-swift.yml

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ permissions:
55
on:
66
push:
77
paths:
8-
- 'packages/contracts/**'
9-
- 'packages/sdk-platforms/rust/**'
10-
- 'packages/sdk-platforms/swift/**'
11-
- '.github/workflows/ci-swift.yml'
8+
- "packages/contracts/**"
9+
- "packages/sdk-platforms/rust/**"
10+
- "packages/sdk-platforms/swift/**"
11+
- ".github/workflows/ci-swift.yml"
1212
pull_request:
1313
paths:
14-
- 'packages/contracts/**'
15-
- 'packages/sdk-platforms/rust/**'
16-
- 'packages/sdk-platforms/swift/**'
17-
- '.github/workflows/ci-swift.yml'
14+
- "packages/contracts/**"
15+
- "packages/sdk-platforms/rust/**"
16+
- "packages/sdk-platforms/swift/**"
17+
- ".github/workflows/ci-swift.yml"
1818

1919
jobs:
2020
swift-sdk:
@@ -28,7 +28,7 @@ jobs:
2828
- uses: actions/checkout@v4
2929
with:
3030
submodules: recursive
31-
31+
3232
- name: Run sccache-cache
3333
uses: mozilla-actions/sccache-action@v0.0.4
3434

@@ -83,22 +83,60 @@ jobs:
8383
- name: Select Xcode 16.3
8484
run: sudo xcode-select -s /Applications/Xcode_16.3.app
8585

86-
- name: Select Simulator
86+
- name: Create and Select Simulator
8787
run: |
88-
UDID=$(xcrun simctl list devices | awk '/-- iOS 18.4 --/{flag=1; next} /--/{flag=0} flag' | grep "iPhone 16 Pro" | awk -F '[()]' '{print $2}' | head -1)
89-
if [ -z "$UDID" ]; then
90-
echo "Simulator not found!" >&2
88+
# List available runtimes before installation
89+
echo "Available runtimes before installation:"
90+
xcrun simctl list runtimes
91+
92+
# Download iOS platform
93+
echo "Downloading iOS platform..."
94+
xcodebuild -downloadPlatform iOS
95+
96+
# Wait for download to complete
97+
sleep 10
98+
99+
# List available runtimes after installation
100+
echo "Available runtimes after installation:"
101+
xcrun simctl list runtimes
102+
103+
# Get the latest iOS runtime
104+
IOS_RUNTIME=$(xcrun simctl list runtimes | grep "iOS" | tail -1 | awk '{for(i=1;i<=NF;i++) if($i ~ /^com\.apple\.CoreSimulator\.SimRuntime/) print $i}' | tr -d ')')
105+
106+
if [ -z "$IOS_RUNTIME" ]; then
107+
echo "ERROR: No iOS runtime found"
108+
xcrun simctl list runtimes
91109
exit 1
92110
fi
93-
echo "Simulator UDID: $UDID"
111+
112+
echo "Using iOS runtime: $IOS_RUNTIME"
113+
114+
# List available device types
115+
echo "Available device types:"
116+
xcrun simctl list devicetypes | grep iPhone
117+
118+
# Create a new iPhone simulator
119+
UDID=$(xcrun simctl create "iPhone-CI" "com.apple.CoreSimulator.SimDeviceType.iPhone-15" "$IOS_RUNTIME")
120+
echo "Created simulator with UDID: $UDID"
121+
122+
# Boot the simulator
123+
xcrun simctl boot "$UDID"
124+
echo "Booted simulator"
125+
126+
# Verify simulator is booted
127+
xcrun simctl list devices | grep "$UDID"
128+
129+
# Wait for simulator to be ready
130+
sleep 5
131+
94132
echo "SIMULATOR_UDID=$UDID" >> $GITHUB_ENV
95-
133+
96134
- name: Install swiftformat
97135
run: brew install swiftformat
98136

99137
- name: Build bindings
100138
run: sh packages/sdk-platforms/rust/zksync-sso/crates/ffi/build-swift-framework-ios-ci.sh
101-
139+
102140
- name: Build & test Swift SDK
103141
run: |
104142
xcodebuild test \
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
#Cargo.lock
1+
zksync-os-server
2+
account-abstraction

0 commit comments

Comments
 (0)