Skip to content

Commit aaa7f03

Browse files
ci: finalize ci for sync layer stable (#3451)
## What ❔ <!-- What are the changes this PR brings about? --> <!-- Example: This PR adds a PR template to the repo. --> <!-- (For bigger PRs adding more context is appreciated) --> ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. --------- Co-authored-by: perekopskiy <[email protected]>
1 parent 9aa8412 commit aaa7f03

File tree

7 files changed

+103
-28
lines changed

7 files changed

+103
-28
lines changed

.github/workflows/ci-core-reusable.yml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,22 @@ jobs:
171171
172172
integration-tests:
173173
runs-on: [ matterlabs-ci-runner-ultra-performance ]
174+
strategy:
175+
# ----------------------------------------------
176+
# Note, that while the contracts do support gateway chain
177+
# in reality it won't exist for quite some time and so
178+
# we will test both cases here
179+
# ----------------------------------------------
180+
matrix:
181+
use_gateway_chain: [ "WITH_GATEWAY", "WITHOUT_GATEWAY" ]
182+
# In some cases it's useful to continue one job even if another fails.
183+
fail-fast: false
174184
steps:
175185
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
176186
with:
177187
submodules: "recursive"
178188
fetch-depth: 0
179189

180-
181190
- name: Setup environment
182191
run: |
183192
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV
@@ -357,7 +366,11 @@ jobs:
357366
CHAINS="era,validium,custom_token,consensus"
358367
echo "CHAINS=$CHAINS" >> $GITHUB_ENV
359368
369+
# ----------------------------------------------------------------
370+
# Only create/initialize the gateway chain *if* use_gateway_chain=WITH_GATEWAY
371+
# ----------------------------------------------------------------
360372
- name: Initialize gateway chain
373+
if: matrix.use_gateway_chain == 'WITH_GATEWAY'
361374
run: |
362375
ci_run zkstack chain create \
363376
--chain-name gateway \
@@ -383,22 +396,26 @@ jobs:
383396
ci_run zkstack chain convert-to-gateway --chain gateway --ignore-prerequisites
384397
385398
- name: Run gateway
399+
if: matrix.use_gateway_chain == 'WITH_GATEWAY'
386400
run: |
387401
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
388402
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
389403
390404
- name: Migrate chains to gateway
405+
if: matrix.use_gateway_chain == 'WITH_GATEWAY'
391406
run: |
392407
ci_run zkstack chain migrate-to-gateway --chain era --gateway-chain-name gateway
393408
ci_run zkstack chain migrate-to-gateway --chain validium --gateway-chain-name gateway
394409
ci_run zkstack chain migrate-to-gateway --chain custom_token --gateway-chain-name gateway
395410
ci_run zkstack chain migrate-to-gateway --chain consensus --gateway-chain-name gateway
396411
397412
- name: Migrate back era
413+
if: matrix.use_gateway_chain == 'WITH_GATEWAY'
398414
run: |
399415
ci_run zkstack chain migrate-from-gateway --chain era --gateway-chain-name gateway
400416
401417
- name: Migrate to gateway again
418+
if: matrix.use_gateway_chain == 'WITH_GATEWAY'
402419
run: |
403420
ci_run zkstack chain migrate-to-gateway --chain era --gateway-chain-name gateway
404421
@@ -447,20 +464,22 @@ jobs:
447464
448465
- name: Init external nodes
449466
run: |
467+
GATEWAY_RPC_URL="${{ matrix.use_gateway_chain == 'WITH_GATEWAY' && '--gateway-rpc-url=http://localhost:3550' || '' }}"
468+
450469
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
451-
--db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain era
470+
--db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain era
452471
ci_run zkstack external-node init --ignore-prerequisites --chain era
453472
454473
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
455-
--db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain validium
474+
--db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain validium
456475
ci_run zkstack external-node init --ignore-prerequisites --chain validium
457476
458477
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
459-
--db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain custom_token
478+
--db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain custom_token
460479
ci_run zkstack external-node init --ignore-prerequisites --chain custom_token
461480
462481
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
463-
--db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain consensus
482+
--db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain consensus
464483
ci_run zkstack external-node init --ignore-prerequisites --chain consensus
465484
466485
- name: Run recovery tests (from snapshot)
@@ -490,17 +509,28 @@ jobs:
490509
- name: Fee projection tests
491510
run: |
492511
ci_run killall -INT zksync_server || true
493-
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
494-
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
512+
513+
# Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
514+
if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
515+
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
516+
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
517+
fi
518+
519+
# Always run the chain-specific fee tests
495520
ci_run ./bin/run_on_all_chains.sh "zkstack dev test fees --no-deps --no-kill" ${{ env.CHAINS }} ${{ env.FEES_LOGS_DIR }}
496521
497522
- name: Run revert tests
498523
run: |
499524
ci_run killall -INT zksync_server || true
500525
ci_run killall -INT zksync_external_node || true
501-
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
502-
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
503526
527+
# Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
528+
if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
529+
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
530+
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
531+
fi
532+
533+
# Always run the chain-specific revert tests
504534
ci_run ./bin/run_on_all_chains.sh "zkstack dev test revert --no-deps --external-node --no-kill --ignore-prerequisites" ${{ env.CHAINS }} ${{ env.INTEGRATION_TESTS_LOGS_DIR }}
505535
506536
# Upgrade tests should run last, because as soon as they
@@ -509,13 +539,19 @@ jobs:
509539
- name: Run upgrade test
510540
run: |
511541
ci_run killall -INT zksync_server || true
512-
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
513-
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
542+
543+
# Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
544+
if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
545+
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
546+
ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
547+
fi
548+
549+
# Always run the upgrade test against era
514550
ci_run zkstack dev test upgrade --no-deps --chain era
515551
516552
- name: Upload logs
517553
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
518554
if: always()
519555
with:
520-
name: logs
556+
name: logs_${{matrix.use_gateway_chain}}
521557
path: logs

.github/workflows/ci-prover-e2e.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ jobs:
4343
run: |
4444
git fetch
4545
# Checkout the commit with the DualVerifier contract to test FFLONK interface
46-
git checkout b4d5b984
46+
git checkout b68a01afa494fbb2fe85c954f0afe0d36ef589ca
4747
git submodule update --init --recursive
4848
git rev-parse HEAD
4949
50+
- name: Set new genesis for fflonk
51+
# Note, that while `Verifier` is not explicitly a part of the genensis state,
52+
# it affects it indirectly as it is a part of the repo.
53+
working-directory: ./etc/env/file_based
54+
if: matrix.compressor-mode == 'fflonk'
55+
run: |
56+
sudo sed -i 's/^genesis_root: .*/genesis_root: 0x596bdde3d20c57b7e1bc63dfa094c0824a82a7f11eba1658d2399c9b29216c97/' genesis.yaml
57+
sudo sed -i "s/^genesis_batch_commitment: .*/genesis_batch_commitment: 0xa3ceee53a25ae7438d7144d3cf151d25638b866cdacc51226b04380ed8aa8bbe/" genesis.yaml
58+
5059
- name: Init
5160
run: |
5261
ci_run chmod -R +x ./bin

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ jobs:
9696
name: CI for Prover Components
9797
uses: ./.github/workflows/ci-prover-reusable.yml
9898

99-
# e2e-for-prover:
100-
# name: E2E Test for Prover Components
101-
# needs: changed_files
102-
# if: ${{(needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true') && !contains(github.ref_name, 'release-please--branches') }}
103-
# uses: ./.github/workflows/ci-prover-e2e.yml
99+
e2e-for-prover:
100+
name: E2E Test for Prover Components
101+
needs: changed_files
102+
if: ${{(needs.changed_files.outputs.prover == 'true' || needs.changed_files.outputs.all == 'true') && !contains(github.ref_name, 'release-please--branches') }}
103+
uses: ./.github/workflows/ci-prover-e2e.yml
104104

105105
ci-for-docs:
106106
needs: changed_files
@@ -184,7 +184,7 @@ jobs:
184184
name: Github Status Check
185185
runs-on: ubuntu-latest
186186
if: always() && !cancelled()
187-
needs: [ ci-for-core-lint, ci-for-common, ci-for-core, ci-for-prover, ci-for-docs, build-core-images, build-contract-verifier, build-prover-images ]
187+
needs: [ ci-for-core-lint, ci-for-common, ci-for-core, ci-for-prover, ci-for-docs, build-core-images, build-contract-verifier, build-prover-images, e2e-for-prover ]
188188
steps:
189189
- name: Status
190190
run: |

core/lib/l1_contract_interface/src/i_executor/methods/prove_batches.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ impl ProveBatches {
5858
}
5959
};
6060

61+
let should_use_fflonk = !is_verifier_pre_fflonk || !protocol_version.is_pre_fflonk();
62+
6163
if protocol_version.is_pre_gateway() {
62-
let proof_input = if !is_verifier_pre_fflonk || !protocol_version.is_pre_fflonk() {
64+
let proof_input = if should_use_fflonk {
6365
Token::Tuple(vec![
6466
Token::Array(vec![verifier_type.into_token()]),
6567
Token::Array(proof.into_iter().map(Token::Uint).collect()),
@@ -73,7 +75,17 @@ impl ProveBatches {
7375

7476
vec![prev_l1_batch_info, batches_arg, proof_input]
7577
} else {
76-
let proof_input = Token::Array(proof.into_iter().map(Token::Uint).collect());
78+
let proof_input = if should_use_fflonk {
79+
Token::Array(
80+
vec![verifier_type]
81+
.into_iter()
82+
.chain(proof)
83+
.map(Token::Uint)
84+
.collect(),
85+
)
86+
} else {
87+
Token::Array(proof.into_iter().map(Token::Uint).collect())
88+
};
7789

7890
let encoded_data = encode(&[prev_l1_batch_info, batches_arg, proof_input]);
7991
let prove_data = [[SUPPORTED_ENCODING_VERSION].to_vec(), encoded_data]

core/tests/ts-integration/tests/base-token.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('base ERC20 contract checks', () => {
7878
// TODO: should all the following tests use strict equality?
7979

8080
const finalEthBalance = await alice.getBalanceL1();
81-
expect(initialEthBalance).toBeGreaterThan(finalEthBalance + fee); // Fee should be taken from the ETH balance on L1.
81+
expect(initialEthBalance).toBeGreaterThanOrEqual(finalEthBalance + fee); // Fee should be taken from the ETH balance on L1.
8282

8383
const finalL1Balance = await alice.getBalanceL1(baseTokenDetails.l1Address);
8484
expect(initialL1Balance).toBeGreaterThanOrEqual(finalL1Balance + amount);

core/tests/upgrade-test/tests/upgrade.test.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,18 @@ describe('Upgrade test', function () {
349349
);
350350

351351
console.log('Sending chain admin operation');
352-
await sendChainAdminOperation({
353-
target: await slChainAdminContract.getAddress(),
354-
data: setTimestampCalldata,
355-
value: 0
356-
});
352+
// Different chain admin impls are used depending on whether gateway is used.
353+
if (gatewayInfo) {
354+
// ChainAdmin.sol: `setUpgradeTimestamp` has onlySelf so we do multicall.
355+
await sendChainAdminOperation({
356+
target: await slChainAdminContract.getAddress(),
357+
data: setTimestampCalldata,
358+
value: 0
359+
});
360+
} else {
361+
// ChainAdminOwnable.sol: `setUpgradeTimestamp` has onlyOwner so we call it directly.
362+
await chainAdminSetTimestamp(setTimestampCalldata);
363+
}
357364

358365
// Wait for server to process L1 event.
359366
await utils.sleep(2);
@@ -458,6 +465,17 @@ describe('Upgrade test', function () {
458465
console.log('Transaction complete!');
459466
}
460467

468+
async function chainAdminSetTimestamp(data: string) {
469+
const transaction = await slAdminGovWallet.sendTransaction({
470+
to: await slChainAdminContract.getAddress(),
471+
data,
472+
type: 0
473+
});
474+
console.log(`Sent chain admin operation, tx_hash=${transaction.hash}, nonce=${transaction.nonce}`);
475+
await transaction.wait();
476+
console.log(`Chain admin operation succeeded, tx_hash=${transaction.hash}`);
477+
}
478+
461479
async function sendChainAdminOperation(call: Call) {
462480
const executeMulticallData = slChainAdminContract.interface.encodeFunctionData('multicall', [[call], true]);
463481

0 commit comments

Comments
 (0)