Skip to content

Commit 4776fed

Browse files
authored
Merge branch 'matter-labs:main' into main
2 parents 0e01624 + dbfc9b5 commit 4776fed

File tree

62 files changed

+4064
-819
lines changed

Some content is hidden

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

62 files changed

+4064
-819
lines changed

.github/workflows/system-contracts-ci.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ jobs:
123123
cache: yarn
124124

125125
- name: Run anvil-zksync
126-
uses: dutterbutter/anvil-zksync-action@v1.1.0
126+
uses: dutterbutter/anvil-zksync-action@v1.3.0
127127
with:
128128
mode: run
129-
releaseTag: v0.6.1
130-
protocolVersion: 28
131-
emulateEvm: true
129+
protocolVersion: 29
130+
evmInterpreter: true
131+
logFilePath: "anvil_zksync.log"
132+
offline: true
132133

133134
- name: Install dependencies
134135
run: yarn

AllContractsHashes.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,11 @@
10171017
},
10181018
{
10191019
"contractName": "l1-contracts/GatewayCTMDeployer",
1020-
"zkBytecodeHash": "0x010003edbfd4a073221c92c63a48ab3da34ec32ffeb017e698912129585d13e6",
1020+
"zkBytecodeHash": "0x010003edc52326e2a5fde49aa80b0b95e4763574f6b8ca2e1bd4b059e6e8deec",
10211021
"zkBytecodePath": "/l1-contracts/zkout/GatewayCTMDeployer.sol/GatewayCTMDeployer.json",
1022-
"evmBytecodeHash": "0x55e1eada2542b962ea321a860ffb6af1cde31d3a4b946da836bf971dc99b3f12",
1022+
"evmBytecodeHash": "0x04774c5c64c44616cedd442f13182acba12c4b7f8446de4b816a2830404c875b",
10231023
"evmBytecodePath": "/l1-contracts/out/GatewayCTMDeployer.sol/GatewayCTMDeployer.json",
1024-
"evmDeployedBytecodeHash": "0x784bb3b59427f02d0c719fbb910884ba28c158feb1bbec486664bba4059004ce"
1024+
"evmDeployedBytecodeHash": "0x11195b22a73d4b4276b5ee34376cdd61b7513fa3e45256deee08c6b2ad881788"
10251025
},
10261026
{
10271027
"contractName": "l1-contracts/GatewayTransactionFilterer",
@@ -1113,19 +1113,19 @@
11131113
},
11141114
{
11151115
"contractName": "l1-contracts/L1VerifierFflonk",
1116-
"zkBytecodeHash": "0x010009bf68f8b5fb7ddf225ab004155517aed2822e27fe6039e574f62a4a96e2",
1116+
"zkBytecodeHash": "0x010009bfe7dc4c879153fb09adcc4b70d62326b1a08400808d70f85b71aa5a3f",
11171117
"zkBytecodePath": "/l1-contracts/zkout/L1VerifierFflonk.sol/L1VerifierFflonk.json",
1118-
"evmBytecodeHash": "0x6288e9af14d7d2899832c37eb5fd231261116c3d6e58ce2532b10e110640cf3c",
1118+
"evmBytecodeHash": "0x949f81e2620f553bdc9c1c508e49cff31e0e396b82375d22a5a12a8453b384cf",
11191119
"evmBytecodePath": "/l1-contracts/out/L1VerifierFflonk.sol/L1VerifierFflonk.json",
1120-
"evmDeployedBytecodeHash": "0xc1209209da6af03183afe41df0fdf3c5a21207c3fb50d527a92dd4f1b5f6257d"
1120+
"evmDeployedBytecodeHash": "0x128280533432f226fa726e2871928432c091a561df838c3f5cdb94de57b431b9"
11211121
},
11221122
{
11231123
"contractName": "l1-contracts/L1VerifierPlonk",
1124-
"zkBytecodeHash": "0x01000dbb61c136b35bff0dd894dd43a7547ac94b0304abdf5e6aefaec2b622da",
1124+
"zkBytecodeHash": "0x01000dbbfd0d0bd6676b2602f7d788f1e25059a237ae1d12b17cde0d30106e01",
11251125
"zkBytecodePath": "/l1-contracts/zkout/L1VerifierPlonk.sol/L1VerifierPlonk.json",
1126-
"evmBytecodeHash": "0x80826e81704eb941083a822e582366225f3ad64c7fcd692712cbcaf885453414",
1126+
"evmBytecodeHash": "0xdb69906628a7438f698fac4d6f69fe2260028a7bb3aa2a989a4970e13a880152",
11271127
"evmBytecodePath": "/l1-contracts/out/L1VerifierPlonk.sol/L1VerifierPlonk.json",
1128-
"evmDeployedBytecodeHash": "0x64ecf77b416fbf7f7b697ed313ba3d9c4bc68c123cb2c65c54224486b9377778"
1128+
"evmDeployedBytecodeHash": "0x4c27e5b06f0e2b6563d2a3331d4bb27bbc3da8f479ff1d3b887e22367bd9a049"
11291129
},
11301130
{
11311131
"contractName": "l1-contracts/L2AdminFactory",
@@ -1185,19 +1185,19 @@
11851185
},
11861186
{
11871187
"contractName": "l1-contracts/L2VerifierFflonk",
1188-
"zkBytecodeHash": "0x010009ed49b08976342fdf5d09e4bd7a7c66c76b6f6312666732669ad8a2cdc2",
1188+
"zkBytecodeHash": "0x010009ed5daafeb4aae604049ce9ab7eb61e4d05659227abdde776e919210d76",
11891189
"zkBytecodePath": "/l1-contracts/zkout/L2VerifierFflonk.sol/L2VerifierFflonk.json",
1190-
"evmBytecodeHash": "0x5df2248136838b7835f6d7d7b8794fc0a601bfabe2eecdbe4913f5ed8a0b15ea",
1190+
"evmBytecodeHash": "0xdeed467b947f8372c63014d1fe86a2b35a21cf9592a8392c93f919d01884600f",
11911191
"evmBytecodePath": "/l1-contracts/out/L2VerifierFflonk.sol/L2VerifierFflonk.json",
1192-
"evmDeployedBytecodeHash": "0x2ca1f2bd3ed2c703518eb33542861cd167ac5c73e51385f94a7b8069d316045f"
1192+
"evmDeployedBytecodeHash": "0xd36c222eb93c12f90deac8afce1c51e6d206ecae2a87ec40dad969c1e0895fb6"
11931193
},
11941194
{
11951195
"contractName": "l1-contracts/L2VerifierPlonk",
1196-
"zkBytecodeHash": "0x01000e17ae0bd6b5a89490a640cfb332e8b11edc9023d5649998c15dbcf9bc83",
1196+
"zkBytecodeHash": "0x01000e17a6180a6030aa9bc104dba94746553b97262b0f6be5c1edb16751443e",
11971197
"zkBytecodePath": "/l1-contracts/zkout/L2VerifierPlonk.sol/L2VerifierPlonk.json",
1198-
"evmBytecodeHash": "0x5374754e6276da0f8ebef6e2f6ef0b0d13949788595e13d31e84316313749213",
1198+
"evmBytecodeHash": "0x5295e4d866fb816151251d3049950d53e794f576e1254f4c0da85b36dd6eea38",
11991199
"evmBytecodePath": "/l1-contracts/out/L2VerifierPlonk.sol/L2VerifierPlonk.json",
1200-
"evmDeployedBytecodeHash": "0x4aef7addf976b0465d283c365eb0d53f86b47a12534df2d855bf3eac40226c86"
1200+
"evmDeployedBytecodeHash": "0xa6baea6e676548e94c1c62f91e93bdf1f4575602d1ebc4acbdac8301bffb3267"
12011201
},
12021202
{
12031203
"contractName": "l1-contracts/L2WrappedBaseToken",

l1-contracts/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,59 @@ For example, for ZKsync Era testnet environment it would look the following way:
6666
```
6767
VERIFICATION_URL=https://explorer.sepolia.era.zksync.dev/contract_verification yarn verify-on-l2-explorer
6868
```
69+
70+
### Verifying Contracts from Deployment Logs
71+
72+
We provide a script [`verify-contracts.ts`](./scripts/verify-contracts.ts) that automates contract verification from deployment logs.
73+
74+
#### Usage
75+
76+
```bash
77+
yarn verify-contracts <log_file> --chain [stage|testnet|mainnet]
78+
```
79+
80+
log_file — path to a deployment log containing forge verify-contract commands
81+
82+
chain — one of stage, testnet, or mainnet (default: stage)
83+
84+
#### Behavior
85+
86+
- Parses all forge verify-contract commands in the log
87+
88+
- Locates matching .sol sources inside l1-contracts or da-contracts
89+
90+
- Supports fallback mappings (e.g. VerifierFflonk → L1VerifierFflonk)
91+
92+
- Executes forge verify-contract from the correct project root
93+
94+
- If verification fails, retries with:
95+
96+
- the original contract name (in case of fallback)
97+
98+
- TransparentUpgradeableProxy (useful for proxy deployments)
99+
100+
- Redacts ETHERSCAN_API_KEY in printed commands to avoid leaking secrets
101+
102+
#### ZKsync Support
103+
104+
If a log line includes --verifier zksync, the script automatically appends the correct ZKsync verifier URL (no ETHERSCAN_API_KEY required).
105+
106+
For non-ZKsync logs, the script uses Etherscan-style verification and requires ETHERSCAN_API_KEY.
107+
108+
#### Examples
109+
110+
_Etherscan-style (Ethereum):_
111+
112+
```bash
113+
export ETHERSCAN_API_KEY=$API_KEY
114+
yarn verify-contracts ./deployment-logs.txt --chain mainnet
115+
```
116+
117+
_ZKsync logs (no API key needed):_
118+
119+
```bash
120+
yarn verify-contracts ./deployment-logs.txt --chain stage
121+
```
122+
123+
If the file contains both Ethereum and ZKsync logs, it will process both successfully.
124+
At the end of execution, the script prints a summary of verified and skipped contracts.

l1-contracts/contracts/state-transition/verifiers/L1VerifierFflonk.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {IVerifierV2} from "../chain-interfaces/IVerifierV2.sol";
99
/// @notice FFT inspired version of PlonK to optimize on-chain gas cost
1010
/// @dev For better understanding of the protocol follow the below papers:
1111
/// * Fflonk Paper: https://eprint.iacr.org/2021/1167
12-
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
12+
/// @dev Contract was generated from a verification key with a hash of 0x49eae0bf5c7ea580f4979b366e52b386adc5f42e2ce50fc1d3c4de9a86052bff
1313
/// @custom:security-contact [email protected]
1414
contract L1VerifierFflonk is IVerifierV2 {
1515
// ================Constants================
@@ -24,8 +24,8 @@ contract L1VerifierFflonk is IVerifierV2 {
2424
// ================Verification Key================
2525
uint256 internal constant VK_NUM_INPUTS = 1;
2626
// [C0]1 = qL(X^8)+ X*qR(X^8)+ X^2*qO(X^8)+ X^3*qM(X^8)+ X^4*qC(X^8)+ X^5*Sσ1(X^8)+ X^6*Sσ2(X^8)+ X^7*Sσ3(X^8)
27-
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
28-
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;
27+
uint256 internal constant VK_C0_G1_X = 0x196013309322dc5ce901c20b2d8079da2a3d68cd8b98c943785298ead0b2ba4d;
28+
uint256 internal constant VK_C0_G1_Y = 0x1d08f60c613bfe68af690cecb6f2232c28b7eaa8fc582f76cd7112a164211890;
2929

3030
// k1 = 5, k2 = 7
3131
uint256 internal constant VK_NON_RESIDUES_0 = 0x05;

l1-contracts/contracts/state-transition/verifiers/L1VerifierPlonk.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {IVerifier} from "../chain-interfaces/IVerifier.sol";
99
/// @notice Modified version of the Permutations over Lagrange-bases for Oecumenical Noninteractive arguments of
1010
/// Knowledge (PLONK) verifier.
1111
/// Modifications have been made to optimize the proof system for ZK chain circuits.
12-
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
12+
/// @dev Contract was generated from a verification key with a hash of 0x1ffc56111a5cfaf5db387f6a31408ad20217e9bc1f31f2f5c1bd38b0d6d7968b
1313
/// @dev It uses a custom memory layout inside the inline assembly block. Each reserved memory cell is declared in the
1414
/// constants below.
1515
/// @dev For a better understanding of the verifier algorithm please refer to the following papers:
@@ -284,8 +284,8 @@ contract L1VerifierPlonk is IVerifier {
284284
function _loadVerificationKey() internal pure virtual {
285285
assembly {
286286
// gate setup commitments
287-
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
288-
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
287+
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0a04da14b87f44a2b1e8c3b4f4e39a14c0dd2e8bdb38d05b068800fca24be3ed)
288+
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0bc51e8894d9270da4079ae6c6acd0502bd5c173a8b3f8ac76fe528560862f2b)
289289
mstore(VK_GATE_SETUP_1_X_SLOT, 0x04659caf7b05471ba5ba85b1ab62267aa6c456836e625f169f7119d55b9462d2)
290290
mstore(VK_GATE_SETUP_1_Y_SLOT, 0x0ea63403692148d2ad22189a1e5420076312f4d46e62036a043a6b0b84d5b410)
291291
mstore(VK_GATE_SETUP_2_X_SLOT, 0x0e6696d09d65fce1e42805be03fca1f14aea247281f688981f925e77d4ce2291)
@@ -296,8 +296,8 @@ contract L1VerifierPlonk is IVerifier {
296296
mstore(VK_GATE_SETUP_4_Y_SLOT, 0x22e404bc91350f3bc7daad1d1025113742436983c85eac5ab7b42221a181b81e)
297297
mstore(VK_GATE_SETUP_5_X_SLOT, 0x0d9b29613037a5025655c82b143d2b7449c98f3aea358307c8529249cc54f3b9)
298298
mstore(VK_GATE_SETUP_5_Y_SLOT, 0x15b3c4c946ad1babfc4c03ff7c2423fd354af3a9305c499b7fb3aaebe2fee746)
299-
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
300-
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
299+
mstore(VK_GATE_SETUP_6_X_SLOT, 0x08532fa83bfdb26399b55fddeec4b35aa83ab1bd79b095d8732613712daae577)
300+
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x1b92521d7adf52f1f808927ae7a18648cd33d0abb85c2fa0282c25df76595688)
301301
mstore(VK_GATE_SETUP_7_X_SLOT, 0x283344a1ab3e55ecfd904d0b8e9f4faea338df5a4ead2fa9a42f0e103da40abc)
302302
mstore(VK_GATE_SETUP_7_Y_SLOT, 0x223b37b83b9687512d322993edd70e508dd80adb10bcf7321a3cc8a44c269521)
303303

l1-contracts/contracts/state-transition/verifiers/L2VerifierFflonk.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {IVerifierV2} from "../chain-interfaces/IVerifierV2.sol";
99
/// @notice FFT inspired version of PlonK to optimize on-chain gas cost
1010
/// @dev For better understanding of the protocol follow the below papers:
1111
/// * Fflonk Paper: https://eprint.iacr.org/2021/1167
12-
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
12+
/// @dev Contract was generated from a verification key with a hash of 0x49eae0bf5c7ea580f4979b366e52b386adc5f42e2ce50fc1d3c4de9a86052bff
1313
/// @custom:security-contact [email protected]
1414
contract L2VerifierFflonk is IVerifierV2 {
1515
// ================Constants================
@@ -24,8 +24,8 @@ contract L2VerifierFflonk is IVerifierV2 {
2424
// ================Verification Key================
2525
uint256 internal constant VK_NUM_INPUTS = 1;
2626
// [C0]1 = qL(X^8)+ X*qR(X^8)+ X^2*qO(X^8)+ X^3*qM(X^8)+ X^4*qC(X^8)+ X^5*Sσ1(X^8)+ X^6*Sσ2(X^8)+ X^7*Sσ3(X^8)
27-
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
28-
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;
27+
uint256 internal constant VK_C0_G1_X = 0x196013309322dc5ce901c20b2d8079da2a3d68cd8b98c943785298ead0b2ba4d;
28+
uint256 internal constant VK_C0_G1_Y = 0x1d08f60c613bfe68af690cecb6f2232c28b7eaa8fc582f76cd7112a164211890;
2929

3030
// k1 = 5, k2 = 7
3131
uint256 internal constant VK_NON_RESIDUES_0 = 0x05;

l1-contracts/contracts/state-transition/verifiers/L2VerifierPlonk.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {IVerifier} from "../chain-interfaces/IVerifier.sol";
99
/// @notice Modified version of the Permutations over Lagrange-bases for Oecumenical Noninteractive arguments of
1010
/// Knowledge (PLONK) verifier.
1111
/// Modifications have been made to optimize the proof system for ZK chain circuits.
12-
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
12+
/// @dev Contract was generated from a verification key with a hash of 0x1ffc56111a5cfaf5db387f6a31408ad20217e9bc1f31f2f5c1bd38b0d6d7968b
1313
/// @dev It uses a custom memory layout inside the inline assembly block. Each reserved memory cell is declared in the
1414
/// constants below.
1515
/// @dev For a better understanding of the verifier algorithm please refer to the following papers:
@@ -284,8 +284,8 @@ contract L2VerifierPlonk is IVerifier {
284284
function _loadVerificationKey() internal pure virtual {
285285
assembly {
286286
// gate setup commitments
287-
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
288-
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
287+
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0a04da14b87f44a2b1e8c3b4f4e39a14c0dd2e8bdb38d05b068800fca24be3ed)
288+
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0bc51e8894d9270da4079ae6c6acd0502bd5c173a8b3f8ac76fe528560862f2b)
289289
mstore(VK_GATE_SETUP_1_X_SLOT, 0x04659caf7b05471ba5ba85b1ab62267aa6c456836e625f169f7119d55b9462d2)
290290
mstore(VK_GATE_SETUP_1_Y_SLOT, 0x0ea63403692148d2ad22189a1e5420076312f4d46e62036a043a6b0b84d5b410)
291291
mstore(VK_GATE_SETUP_2_X_SLOT, 0x0e6696d09d65fce1e42805be03fca1f14aea247281f688981f925e77d4ce2291)
@@ -296,8 +296,8 @@ contract L2VerifierPlonk is IVerifier {
296296
mstore(VK_GATE_SETUP_4_Y_SLOT, 0x22e404bc91350f3bc7daad1d1025113742436983c85eac5ab7b42221a181b81e)
297297
mstore(VK_GATE_SETUP_5_X_SLOT, 0x0d9b29613037a5025655c82b143d2b7449c98f3aea358307c8529249cc54f3b9)
298298
mstore(VK_GATE_SETUP_5_Y_SLOT, 0x15b3c4c946ad1babfc4c03ff7c2423fd354af3a9305c499b7fb3aaebe2fee746)
299-
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
300-
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
299+
mstore(VK_GATE_SETUP_6_X_SLOT, 0x08532fa83bfdb26399b55fddeec4b35aa83ab1bd79b095d8732613712daae577)
300+
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x1b92521d7adf52f1f808927ae7a18648cd33d0abb85c2fa0282c25df76595688)
301301
mstore(VK_GATE_SETUP_7_X_SLOT, 0x283344a1ab3e55ecfd904d0b8e9f4faea338df5a4ead2fa9a42f0e103da40abc)
302302
mstore(VK_GATE_SETUP_7_Y_SLOT, 0x223b37b83b9687512d322993edd70e508dd80adb10bcf7321a3cc8a44c269521)
303303

l1-contracts/deploy-script-config-template/config-deploy-l1.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ diamond_init_max_pubdata_per_batch = 120000
2727
diamond_init_max_l2_gas_per_batch = 80000000
2828
diamond_init_priority_tx_max_pubdata = 99000
2929
diamond_init_minimal_l2_gas_price = 250000000
30-
bootloader_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
31-
default_aa_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
32-
evm_emulator_hash = "0x0000000000000000000000000000000000000000000000000000000000000000"
30+
bootloader_hash = "0x0100000000000000000000000000000000000000000000000000000000000000"
31+
default_aa_hash = "0x0100000000000000000000000000000000000000000000000000000000000000"
32+
evm_emulator_hash = "0x0100000000000000000000000000000000000000000000000000000000000000"
3333
force_deployments_data = "0x"
3434

3535
[tokens]

0 commit comments

Comments
 (0)