Skip to content

Commit 5407621

Browse files
Co-authored-by: Marcin M <[email protected]>
1 parent 43c2dd5 commit 5407621

File tree

11 files changed

+68
-58
lines changed

11 files changed

+68
-58
lines changed

.github/workflows/dead-links.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Find and check markdown files
2020
run: |
2121
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
22-
find . -type f -name "*.md" ! -path "*/node_modules/*" ! -path "*/openzeppelin*" ! -path "*/murky/*" -exec lychee --max-concurrency 1 --cache --retry-wait-time 10 --github-token $GITHUB_TOKEN {} +
22+
find . -type f -name "*.md" ! -path "*/node_modules/*" ! -path "*/openzeppelin*" ! -path "*/murky/*" -exec lychee --max-concurrency 1 --cache --retry-wait-time 10 --exclude-path .lycheeignore --github-token $GITHUB_TOKEN {} +

.lycheeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://zksync.mirror.xyz/
2+

.solhint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"avoid-call-value": "error",
55
"avoid-low-level-calls": "off",
66
"avoid-sha3": "error",
7+
"avoid-tx-origin": "off",
78
"check-send-result": "error",
89
"compiler-version": ["error", "^0.8.0"],
910
"const-name-snakecase": "off",

AllContractsHashes.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -985,11 +985,11 @@
985985
},
986986
{
987987
"contractName": "l1-contracts/GatewayCTMDeployer",
988-
"zkBytecodeHash": "0x010003c16917108b4c68b889f841af139429fd2f226a89a33d1f68667fd11653",
988+
"zkBytecodeHash": "0x010003c1b7a9c48d1447fc3de28a036856509d22f172e249311ce63b23eea3f7",
989989
"zkBytecodePath": "/l1-contracts/zkout/GatewayCTMDeployer.sol/GatewayCTMDeployer.json",
990-
"evmBytecodeHash": "0x7e25f86cb3b2538b7a34158bc855a15293a334545d41cc8dd9e633a1d6941a92",
990+
"evmBytecodeHash": "0xaf629cd72a06fae9eed1b80278be0524edd5e7fbdbc236aaec680ce2701ecdc9",
991991
"evmBytecodePath": "/l1-contracts/out/GatewayCTMDeployer.sol/GatewayCTMDeployer.json",
992-
"evmDeployedBytecodeHash": "0x1d44717c44de5bcb6e84380922619c9169c3983b3182c21f3f67da8d80bff05f"
992+
"evmDeployedBytecodeHash": "0xe57ef24fae2cc16fdfa7ffdfa1f9b93b8728bbe7b1efb315bb776b4898b5e68a"
993993
},
994994
{
995995
"contractName": "l1-contracts/GatewayTransactionFilterer",
@@ -1073,19 +1073,19 @@
10731073
},
10741074
{
10751075
"contractName": "l1-contracts/L1VerifierFflonk",
1076-
"zkBytecodeHash": "0x010009bb366c91dbb0ee7a657e354cd158fab39efaa187ce25527e1520ecc234",
1076+
"zkBytecodeHash": "0x010009bbd00e4b4a07aec3b1206c685f0aaece45e844189463e5e49e21358735",
10771077
"zkBytecodePath": "/l1-contracts/zkout/L1VerifierFflonk.sol/L1VerifierFflonk.json",
1078-
"evmBytecodeHash": "0x535bf75f33136495f1ee7d6c43e4703c47e5a4b9b1249efd621f7061363efe77",
1078+
"evmBytecodeHash": "0xf8158fa3b47429e29702a4c9ff479ead9402e1ab3a5b1974421ec36faba834df",
10791079
"evmBytecodePath": "/l1-contracts/out/L1VerifierFflonk.sol/L1VerifierFflonk.json",
1080-
"evmDeployedBytecodeHash": "0x53b362c5cfdf8a222b75b7f261fd43ac5cef75d62ae4964c5dabe260bfd2f268"
1080+
"evmDeployedBytecodeHash": "0x2a76b627f1526fb519289a1fb1a7dd7840c7fb1b032f94c46461d379cd961ee2"
10811081
},
10821082
{
10831083
"contractName": "l1-contracts/L1VerifierPlonk",
1084-
"zkBytecodeHash": "0x01000dbbcf7703d7db99c4007645f2761f7a9d65bff63fedc98ab48ebf49ec68",
1084+
"zkBytecodeHash": "0x01000dbb61c136b35bff0dd894dd43a7547ac94b0304abdf5e6aefaec2b622da",
10851085
"zkBytecodePath": "/l1-contracts/zkout/L1VerifierPlonk.sol/L1VerifierPlonk.json",
1086-
"evmBytecodeHash": "0xe5bc313c647e4e09df97fc65ab976c8269978ee3006b490ea4e17c88fee4053a",
1086+
"evmBytecodeHash": "0x80826e81704eb941083a822e582366225f3ad64c7fcd692712cbcaf885453414",
10871087
"evmBytecodePath": "/l1-contracts/out/L1VerifierPlonk.sol/L1VerifierPlonk.json",
1088-
"evmDeployedBytecodeHash": "0x9e2d982d812614e9315c854d9bf7b13a28d71f43609ac5af9cb79c8485ee5b43"
1088+
"evmDeployedBytecodeHash": "0x64ecf77b416fbf7f7b697ed313ba3d9c4bc68c123cb2c65c54224486b9377778"
10891089
},
10901090
{
10911091
"contractName": "l1-contracts/L2AdminFactory",
@@ -1137,19 +1137,19 @@
11371137
},
11381138
{
11391139
"contractName": "l1-contracts/L2VerifierFflonk",
1140-
"zkBytecodeHash": "0x010009e7a67e5d38dcf3a6d46c8932b7ac7a8c59820900c2c42e94f919cfe303",
1140+
"zkBytecodeHash": "0x010009e78abd7e1cb6bb03f522aa29c03b2662a442728f404d6cf0c515b2e94d",
11411141
"zkBytecodePath": "/l1-contracts/zkout/L2VerifierFflonk.sol/L2VerifierFflonk.json",
1142-
"evmBytecodeHash": "0x58e440a309c2efee98eaf3e4dbfff23eea0c7daedf6504cb2193f8ba065f50e5",
1142+
"evmBytecodeHash": "0xd21688a2fbe3b7ecae624e07ea7bd5ef30fd4f8730a3d0bb3e67f9740e7e36f4",
11431143
"evmBytecodePath": "/l1-contracts/out/L2VerifierFflonk.sol/L2VerifierFflonk.json",
1144-
"evmDeployedBytecodeHash": "0x3de906fdd3f497f691faf3b174ee4a52fcf940248f6cb2f1f8eb7e8beee0079b"
1144+
"evmDeployedBytecodeHash": "0x4e79f4cbbbf271f103472c647759bcccc2c66266d78e62e7428e174569c84607"
11451145
},
11461146
{
11471147
"contractName": "l1-contracts/L2VerifierPlonk",
1148-
"zkBytecodeHash": "0x01000e176f9efebfe1b3a193ba398eb2b09e2290768e2bea53201177f2cc45b4",
1148+
"zkBytecodeHash": "0x01000e17ae0bd6b5a89490a640cfb332e8b11edc9023d5649998c15dbcf9bc83",
11491149
"zkBytecodePath": "/l1-contracts/zkout/L2VerifierPlonk.sol/L2VerifierPlonk.json",
1150-
"evmBytecodeHash": "0x17c988ee73be6b005565c350724354a42cec2e398a5eae022d9e92a9712d4409",
1150+
"evmBytecodeHash": "0x5374754e6276da0f8ebef6e2f6ef0b0d13949788595e13d31e84316313749213",
11511151
"evmBytecodePath": "/l1-contracts/out/L2VerifierPlonk.sol/L2VerifierPlonk.json",
1152-
"evmDeployedBytecodeHash": "0x5e7c84743330846d1d3142aea3bfea483a186e7df20c4c192f4b2035499da965"
1152+
"evmDeployedBytecodeHash": "0x4aef7addf976b0465d283c365eb0d53f86b47a12534df2d855bf3eac40226c86"
11531153
},
11541154
{
11551155
"contractName": "l1-contracts/L2WrappedBaseToken",

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 0x17e8d7931f1314431359233e65c22657a32c335205e3c24ce292c5819becfaa7
12+
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
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 = 0x19bd7a8cb4cb56772e1a67453c37c9657164a60b05a2d5dbe48de94b80a8563e;
28-
uint256 internal constant VK_C0_G1_Y = 0x1891e1b2512fd626bdd1e82d967ef7f327610799c6548e71283c5b932eaf5370;
27+
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
28+
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;
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 0xd90459c5b727b9ceeb2b6192d2953dbf05970edf090333b3ad3bcac1a1442b78
12+
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
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, 0x24e3eb5ec8decc0a0cc9d7652eb0e88d4ef64f59ffc6be78d7279e83d67713c1)
288-
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0ecf4eb9866a9bd12e080dca7aaac2735fa016b40d055a8417294e1ffab49383)
287+
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
288+
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
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, 0x1b695865b5bb8e5bf2456d3cc4ef085ba8f85e588a50bcdc98dd04efc8f09e59)
300-
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x2c31aa6561f35253c2adf8bf3eb1d0a1e74bd6eaeef3db6be78651c74bb1b127)
299+
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
300+
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
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 0x17e8d7931f1314431359233e65c22657a32c335205e3c24ce292c5819becfaa7
12+
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
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 = 0x19bd7a8cb4cb56772e1a67453c37c9657164a60b05a2d5dbe48de94b80a8563e;
28-
uint256 internal constant VK_C0_G1_Y = 0x1891e1b2512fd626bdd1e82d967ef7f327610799c6548e71283c5b932eaf5370;
27+
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
28+
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;
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 0xd90459c5b727b9ceeb2b6192d2953dbf05970edf090333b3ad3bcac1a1442b78
12+
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
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, 0x24e3eb5ec8decc0a0cc9d7652eb0e88d4ef64f59ffc6be78d7279e83d67713c1)
288-
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0ecf4eb9866a9bd12e080dca7aaac2735fa016b40d055a8417294e1ffab49383)
287+
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
288+
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
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, 0x1b695865b5bb8e5bf2456d3cc4ef085ba8f85e588a50bcdc98dd04efc8f09e59)
300-
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x2c31aa6561f35253c2adf8bf3eb1d0a1e74bd6eaeef3db6be78651c74bb1b127)
299+
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
300+
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
301301
mstore(VK_GATE_SETUP_7_X_SLOT, 0x283344a1ab3e55ecfd904d0b8e9f4faea338df5a4ead2fa9a42f0e103da40abc)
302302
mstore(VK_GATE_SETUP_7_Y_SLOT, 0x223b37b83b9687512d322993edd70e508dd80adb10bcf7321a3cc8a44c269521)
303303

tools/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
`cargo run --bin zksync_verifier_contract_generator --release -- --plonk_input_path /path/to/plonk_scheduler_verification_key.json --fflonk_input_path /path/to/fflonk_scheduler_verification_key.json --plonk_output_path /path/to/VerifierPlonk.sol --fflonk_output_path /path/to/VerifierFflonk.sol`
44

5+
First, copy the keys into data directory:
6+
7+
```shell
8+
cp ../../prover/data/keys/fflonk_verification_snark_key.json data/fflonk_scheduler_key.json
9+
cp ../../prover/data/keys/verification_snark_key.json data/plonk_scheduler_key.json
10+
```
11+
512
To generate the verifier from the scheduler key in 'data' directory, just run:
613

714
```shell

tools/data/fflonk_scheduler_key.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
"n": 8388607,
33
"c0": {
44
"x": [
5-
16469075922854106686,
6-
8170838190226331099,
7-
3322081222199855461,
8-
1854773366293747319
5+
9878536302458040129,
6+
7072944109966006247,
7+
5735025731440953759,
8+
1745957900286229622
99
],
1010
"y": [
11-
2899292947821319024,
12-
2837557597258944113,
13-
13677968825796982771,
14-
1770444284515833382
11+
8109620634627525174,
12+
12271611730423466405,
13+
18183968510115880526,
14+
616284296044257947
1515
],
1616
"infinity": false
1717
},
@@ -97,4 +97,4 @@
9797
"infinity": false
9898
}
9999
]
100-
}
100+
}

0 commit comments

Comments
 (0)