Skip to content

Commit e06c313

Browse files
committed
fix: resolve merge conflict with main and add repo links
Resolve merge conflict in SUMMARY.md keeping the renamed integration-guide.md from main and the Auctions section from this branch. Add Hardhat template and OZ confidential contracts repo links to erc7984.md as requested in PR review.
2 parents 2eb82ba + a4e85ae commit e06c313

File tree

163 files changed

+16245
-5087
lines changed

Some content is hidden

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

163 files changed

+16245
-5087
lines changed

.github/workflows/contracts-upgrade-version-check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
# This avoids unnecessary reinitializer bumps when multiple PRs modify
1010
# the same contract between deployments. Keep in sync with *-upgrade-tests.yml.
1111
env:
12-
UPGRADE_FROM_TAG: v0.11.0
12+
UPGRADE_FROM_TAG: v0.11.1
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
@@ -36,11 +36,13 @@ jobs:
3636
- .github/workflows/contracts-upgrade-version-check.yml
3737
- ci/check-upgrade-versions.ts
3838
- ci/merge-address-constants.ts
39+
- ci/upgrade-version-check-lib.ts
3940
- host-contracts/**
4041
gateway-contracts:
4142
- .github/workflows/contracts-upgrade-version-check.yml
4243
- ci/check-upgrade-versions.ts
4344
- ci/merge-address-constants.ts
45+
- ci/upgrade-version-check-lib.ts
4446
- gateway-contracts/**
4547
4648
check:

.github/workflows/coprocessor-benchmark-cpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172

173173
- name: Start localstack
174174
run: |
175-
docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:latest
175+
docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:4.14.0
176176
177177
- name: Run benchmarks on CPU
178178
run: |

.github/workflows/coprocessor-cargo-tests.yml

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
4141
packages: 'read' # Required to read GitHub packages/container registry
4242
pull-requests: 'write' # Required to post coverage comment on PR
4343
runs-on: large_ubuntu_16
44+
env:
45+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang
46+
RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
4447
steps:
4548
- name: Checkout code
4649
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -51,6 +54,25 @@ jobs:
5154
- name: Checkout LFS objects
5255
run: git lfs checkout
5356

57+
- name: Login to GitHub Container Registry
58+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
59+
with:
60+
registry: ghcr.io
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
64+
- name: Login to GitHub Chainguard Registry
65+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
66+
with:
67+
registry: cgr.dev
68+
username: ${{ secrets.CGR_USERNAME }}
69+
password: ${{ secrets.CGR_PASSWORD }}
70+
71+
- name: Start database services (background)
72+
run: |
73+
nohup docker compose up -d --build db-migration > /tmp/db-init.log 2>&1 &
74+
working-directory: coprocessor/fhevm-engine/tfhe-worker
75+
5476
- name: Setup Rust toolchain file
5577
run: cp coprocessor/fhevm-engine/rust-toolchain.toml .
5678

@@ -65,7 +87,7 @@ jobs:
6587
- name: Install cargo dependencies
6688
run: |
6789
sudo apt-get update
68-
sudo apt-get install -y protobuf-compiler && \
90+
sudo apt-get install -y protobuf-compiler mold clang && \
6991
cargo install sqlx-cli --version 0.7.2 --no-default-features --features postgres --locked
7092
7193
- name: Install foundry
@@ -81,42 +103,55 @@ jobs:
81103
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
82104
restore-keys: ${{ runner.os }}-cargo-coverage-
83105

84-
- name: Login to GitHub Container Registry
85-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
86-
with:
87-
registry: ghcr.io
88-
username: ${{ github.actor }}
89-
password: ${{ secrets.GITHUB_TOKEN }}
90-
91-
- name: Login to GitHub Chainguard Registry
92-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
93-
with:
94-
registry: cgr.dev
95-
username: ${{ secrets.CGR_USERNAME }}
96-
password: ${{ secrets.CGR_PASSWORD }}
97-
98-
- name: Init database
99-
run: make init_db
100-
working-directory: coprocessor/fhevm-engine/tfhe-worker
101-
102106
- name: Use Node.js
103107
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
104108
with:
105109
node-version: 20.x
106110

107111
- name: Start localstack
108-
run: |
109-
docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:latest
112+
run: docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:4.14.0
110113

111114
- name: Clean previous coverage data
112115
run: cargo llvm-cov clean --workspace --profile coverage
113116
working-directory: coprocessor/fhevm-engine
114117

118+
- name: Compile tests with coverage instrumentation
119+
run: |
120+
cargo llvm-cov show-env --sh > /tmp/llvm-cov-env.sh
121+
source /tmp/llvm-cov-env.sh
122+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
123+
SQLX_OFFLINE=true \
124+
cargo test --no-run --workspace --profile coverage
125+
working-directory: coprocessor/fhevm-engine
126+
127+
- name: Wait for database migration
128+
run: |
129+
SECONDS=0
130+
while ! docker container inspect db-migration > /dev/null 2>&1; do
131+
if [ "$SECONDS" -ge 900 ]; then
132+
echo "Timed out waiting for db-migration container after 15 minutes"
133+
cat /tmp/db-init.log
134+
exit 1
135+
fi
136+
echo "Waiting for db-migration container to be created..."
137+
sleep 2
138+
done
139+
EXIT_CODE=$(docker wait db-migration)
140+
if [ "$EXIT_CODE" != "0" ]; then
141+
echo "Database migration failed with exit code $EXIT_CODE"
142+
docker logs db-migration
143+
cat /tmp/db-init.log
144+
exit 1
145+
fi
146+
echo "Database migration completed"
147+
115148
- name: Run tests with coverage
116149
run: |
150+
source /tmp/llvm-cov-env.sh
117151
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
118152
TEST_GLOBAL_LOCALSTACK=1 \
119-
cargo llvm-cov --no-report --workspace --profile coverage
153+
SQLX_OFFLINE=true \
154+
cargo test --workspace --profile coverage
120155
working-directory: coprocessor/fhevm-engine
121156

122157
- name: Generate coverage report

.github/workflows/coprocessor-gpu-tests.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ jobs:
167167
username: ${{ secrets.CGR_USERNAME }}
168168
password: ${{ secrets.CGR_PASSWORD }}
169169

170-
- name: Init database
171-
run: make init_db
170+
- name: Start database services (background)
171+
run: |
172+
nohup docker compose up -d --build db-migration > /tmp/db-init.log 2>&1 &
172173
working-directory: coprocessor/fhevm-engine/tfhe-worker
173174

174175
- name: Use Node.js
@@ -182,6 +183,37 @@ jobs:
182183
env:
183184
HARDHAT_NETWORK: hardhat
184185

186+
- name: Compile GPU test artifacts
187+
run: |
188+
SQLX_OFFLINE=true cargo test --no-run \
189+
-p tfhe-worker \
190+
-p sns-worker \
191+
-p zkproof-worker \
192+
--release \
193+
--features=gpu
194+
working-directory: coprocessor/fhevm-engine
195+
196+
- name: Wait for database migration
197+
run: |
198+
SECONDS=0
199+
while ! docker container inspect db-migration > /dev/null 2>&1; do
200+
if [ "$SECONDS" -ge 900 ]; then
201+
echo "Timed out waiting for db-migration container after 15 minutes"
202+
cat /tmp/db-init.log
203+
exit 1
204+
fi
205+
echo "Waiting for db-migration container to be created..."
206+
sleep 2
207+
done
208+
EXIT_CODE=$(docker wait db-migration)
209+
if [ "$EXIT_CODE" != "0" ]; then
210+
echo "Database migration failed with exit code $EXIT_CODE"
211+
docker logs db-migration
212+
cat /tmp/db-init.log
213+
exit 1
214+
fi
215+
echo "Database migration completed"
216+
185217
- name: Run GPU tests for the worker services.
186218
run: |
187219
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor

.github/workflows/gateway-contracts-upgrade-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616
# - RPC_URL: The port should match the one used in the anvil node in the docker-compose.yml file
1717
env:
1818
# Bump this tag each release cycle to test upgrades from the previous version
19-
UPGRADE_FROM_TAG: v0.11.0
19+
UPGRADE_FROM_TAG: v0.11.1
2020
DOTENV_CONFIG_PATH: .env.example
2121
HARDHAT_NETWORK: staging
2222
CHAIN_ID_GATEWAY: 54321

.github/workflows/host-contracts-upgrade-tests.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
# - CHAIN_ID_GATEWAY: The chain ID of the gateway network, used by deployment tasks
1616
# - RPC_URL: The port should match the one used in the anvil node in the docker-compose.yml file
1717
env:
18-
UPGRADE_FROM_TAG: v0.11.0
18+
UPGRADE_FROM_TAG: v0.11.1
1919
DOTENV_CONFIG_PATH: .env.example
2020
HARDHAT_NETWORK: staging
2121
CHAIN_ID_GATEWAY: 54321
@@ -120,6 +120,28 @@ jobs:
120120
cp -r ../../previous-fhevm/host-contracts/contracts ./previous-contracts
121121
docker cp fhevm-sc-deploy:/app/addresses ./
122122
123+
# The regular upgrade loop below only exercises task:upgrade<Contract>, which upgrades the proxy in place.
124+
# We also rely on task:prepareUpgradeFHEVMExecutor operationally to deploy a new implementation without
125+
# mutating the proxy. This smoke step covers that prepare-only path and guards against regressions where
126+
# the task stops deploying correctly or accidentally upgrades the proxy instead of just preparing it.
127+
- name: Smoke test prepare-only FHEVMExecutor deployment
128+
working-directory: current-fhevm/host-contracts
129+
run: |
130+
set -euo pipefail
131+
git fetch --depth=1 origin "refs/tags/${UPGRADE_FROM_TAG}:refs/tags/${UPGRADE_FROM_TAG}"
132+
source addresses/.env.host
133+
134+
before_impl=$(cast implementation "$FHEVM_EXECUTOR_CONTRACT_ADDRESS" --rpc-url "$RPC_URL")
135+
136+
npx hardhat task:prepareUpgradeFHEVMExecutor \
137+
--upgrade-from-ref "$UPGRADE_FROM_TAG" \
138+
--new-implementation contracts/FHEVMExecutor.sol:FHEVMExecutor \
139+
--use-internal-proxy-address true \
140+
--verify-contract false
141+
142+
after_impl=$(cast implementation "$FHEVM_EXECUTOR_CONTRACT_ADDRESS" --rpc-url "$RPC_URL")
143+
test "$before_impl" = "$after_impl"
144+
123145
- name: Run contract upgrades
124146
working-directory: current-fhevm/host-contracts
125147
run: |

.github/workflows/kms-connector-docker-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
- kms-connector/crates/gw-listener/**
102102
- kms-connector/crates/utils/**
103103
- kms-connector/Cargo.*
104-
- gateway-contracts/rust-bindings/**
104+
- gateway-contracts/rust_bindings/**
105105
106106
check-changes-kms-worker:
107107
uses: ./.github/workflows/check-changes-for-docker-build.yml
@@ -118,8 +118,8 @@ jobs:
118118
- kms-connector/crates/kms-worker/**
119119
- kms-connector/crates/utils/**
120120
- kms-connector/Cargo.*
121-
- gateway-contracts/rust-bindings/**
122-
- host-contracts/rust-bindings/**
121+
- gateway-contracts/rust_bindings/**
122+
- host-contracts/rust_bindings/**
123123
124124
check-changes-tx-sender:
125125
uses: ./.github/workflows/check-changes-for-docker-build.yml
@@ -136,7 +136,7 @@ jobs:
136136
- kms-connector/crates/tx-sender/**
137137
- kms-connector/crates/utils/**
138138
- kms-connector/Cargo.*
139-
- gateway-contracts/rust-bindings/**
139+
- gateway-contracts/rust_bindings/**
140140
141141
########################################################################
142142
# BUILD DECISIONS #

.github/workflows/kms-connector-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- kms-connector/connector-db/**
4040
- kms-connector/crates/**
4141
- kms-connector/Cargo.*
42-
- gateway-contracts/rust-bindings/**
43-
- host-contracts/rust-bindings/**
42+
- gateway-contracts/rust_bindings/**
43+
- host-contracts/rust_bindings/**
4444
4545
start-runner:
4646
name: kms-connector-tests/start-runner

.github/workflows/test-suite-e2e-operators-tests.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: test-suite-e2e-operators-tests
22

3-
# Github does not support more than 10 inputs for workflow_dispatch:
4-
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#providing-inputs
53
# Core, relayer and test-suite will use the default versions defined in the `fhevm-cli` script
64
on:
75
workflow_dispatch:
@@ -47,6 +45,14 @@ on:
4745
description: "ZKProof Worker Image Version"
4846
default: ""
4947
type: string
48+
deploy-build:
49+
description: "Build local Docker images from the checked out repository before deploy"
50+
default: false
51+
type: boolean
52+
grep:
53+
description: "Optional grep pattern to narrow operators tests"
54+
default: ""
55+
type: string
5056

5157
permissions: {}
5258

@@ -127,22 +133,34 @@ jobs:
127133
TFHE_WORKER_VERSION: ${{ inputs.tfhe_worker_version }}
128134
SNS_WORKER_VERSION: ${{ inputs.sns_worker_version }}
129135
ZKPROOF_WORKER_VERSION: ${{ inputs.zkproof_worker_version }}
136+
DEPLOY_BUILD: ${{ inputs.deploy-build }}
130137
run: |
131-
./fhevm-cli deploy --coprocessors 2 --coprocessor-threshold 2
138+
if [[ "$DEPLOY_BUILD" == 'true' ]]; then
139+
./fhevm-cli deploy --build --coprocessors 2 --coprocessor-threshold 2
140+
else
141+
./fhevm-cli deploy --coprocessors 2 --coprocessor-threshold 2
142+
fi
132143
133144
- name: All operators tests
134145
working-directory: test-suite/fhevm
146+
env:
147+
GREP: ${{ inputs.grep }}
135148
run: |
136-
./fhevm-cli test operators
149+
if [ -n "$GREP" ]; then
150+
./fhevm-cli test operators -g "$GREP"
151+
else
152+
./fhevm-cli test operators
153+
fi
137154
138155
- name: Random operators tests
156+
if: ${{ inputs.grep == '' }}
139157
working-directory: test-suite/fhevm
140158
run: |
141159
./fhevm-cli test random
142160
143161
- name: Show logs on test failure
144162
working-directory: test-suite/fhevm
145-
if: always()
163+
if: failure()
146164
run: |
147165
echo "::group::Relayer Logs"
148166
./fhevm-cli logs relayer

.github/workflows/test-suite-e2e-tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,17 @@ jobs:
187187
run: |
188188
./fhevm-cli unpause gateway
189189
190-
# E2E tests after unpausing the Host and Gateway contracts
190+
# E2E tests after unpausing the Host and Gateway contracts.
191+
192+
# The revert test runs first: it populates the DB, reverts to a midpoint,
193+
# and waits for the coprocessor to recover. All subsequent tests then run
194+
# against a post-revert DB, providing a stronger guarantee that the
195+
# coprocessor works correctly after a state revert.
196+
- name: Coprocessor DB state revert test
197+
working-directory: test-suite/fhevm
198+
run: |
199+
./fhevm-cli test coprocessor-db-state-revert
200+
191201
- name: Input proof test (uint64)
192202
working-directory: test-suite/fhevm
193203
run: |

0 commit comments

Comments
 (0)