Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dead-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: Find and check markdown files
run: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
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 {} +
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 {} +
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://zksync.mirror.xyz/

1 change: 1 addition & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"avoid-call-value": "error",
"avoid-low-level-calls": "off",
"avoid-sha3": "error",
"avoid-tx-origin": "off",
"check-send-result": "error",
"compiler-version": ["error", "^0.8.0"],
"const-name-snakecase": "off",
Expand Down
296 changes: 164 additions & 132 deletions AllContractsHashes.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// SPDX-License-Identifier: MIT
// We use a floating point pragma here so it can be used within other projects that interact with the ZKsync ecosystem without using our exact pragma version.
pragma solidity ^0.8.21;

// import {IL2ToL1Messenger} from "./IL2ToL1Messenger.sol";
// import {IL2InteropRootStorage} from "../interfaces/IL2InteropRootStorage.sol";
// import {IMessageVerification} from "../../state-transition/chain-interfaces/IMessageVerification.sol";

/// @dev the offset for the system contracts
uint160 constant SYSTEM_CONTRACTS_OFFSET = 0x8000; // 2^15

/// @dev The offset from which the built-in, but user space contracts are located.
uint160 constant USER_CONTRACTS_OFFSET = 0x10000; // 2^16

/// @dev The formal address of the initial program of the system: the bootloader
address constant L2_BOOTLOADER_ADDRESS = address(SYSTEM_CONTRACTS_OFFSET + 0x01);

/// @dev The address of the known code storage system contract
address constant L2_KNOWN_CODE_STORAGE_SYSTEM_CONTRACT_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x04);

/// @dev The address of the L2 deployer system contract.
address constant L2_DEPLOYER_SYSTEM_CONTRACT_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x06);

/// @dev The special reserved L2 address. It is located in the system contracts space but doesn't have deployed
/// bytecode.
/// @dev The L2 deployer system contract allows changing bytecodes on any address if the `msg.sender` is this address.
/// @dev So, whenever the governor wants to redeploy system contracts, it just initiates the L1 upgrade call deployer
/// system contract
/// via the L1 -> L2 transaction with `sender == L2_FORCE_DEPLOYER_ADDR`. For more details see the
/// `diamond-initializers` contracts.
address constant L2_FORCE_DEPLOYER_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x07);

/// @dev The address of the L2ToL1Messenger system contract
address constant L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x08);
/// @dev The address of the special smart contract that can send arbitrary length message as an L2 log
// IL2ToL1Messenger constant L2_TO_L1_MESSENGER_SYSTEM_CONTRACT = IL2ToL1Messenger(
// L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR
// );

/// @dev The address of the eth token system contract
address constant L2_BASE_TOKEN_SYSTEM_CONTRACT_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x0a);

/// @dev The address of the context system contract
address constant L2_SYSTEM_CONTEXT_SYSTEM_CONTRACT_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x0b);

/// @dev The address of the pubdata chunk publisher contract
address constant L2_PUBDATA_CHUNK_PUBLISHER_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x11);

/// @dev The address used to execute complex upgragedes, also used for the genesis upgrade
address constant L2_COMPLEX_UPGRADER_ADDR = address(SYSTEM_CONTRACTS_OFFSET + 0x0f);

/// @dev the address of the msg value system contract
address constant MSG_VALUE_SYSTEM_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x09);

/// @dev The address of the create2 factory contract
address constant L2_CREATE2_FACTORY_ADDR = address(USER_CONTRACTS_OFFSET + 0x00);

/// @dev The address used to execute the genesis upgrade
address constant L2_GENESIS_UPGRADE_ADDR = address(USER_CONTRACTS_OFFSET + 0x01);

/// @dev The genesis upgrade address is reused for all version specific upgrades
address constant L2_VERSION_SPECIFIC_UPGRADER_ADDR = L2_GENESIS_UPGRADE_ADDR;

/// @dev The address of the L2 bridge hub system contract, used to start L1->L2 transactions
address constant L2_BRIDGEHUB_ADDR = address(USER_CONTRACTS_OFFSET + 0x02);

/// @dev the address of the l2 asset router.
address constant L2_ASSET_ROUTER_ADDR = address(USER_CONTRACTS_OFFSET + 0x03);

/// @dev An l2 system contract address, used in the assetId calculation for native assets.
/// This is needed for automatic bridging, i.e. without deploying the AssetHandler contract,
/// if the assetId can be calculated with this address then it is in fact an NTV asset
address constant L2_NATIVE_TOKEN_VAULT_ADDR = address(USER_CONTRACTS_OFFSET + 0x04);

/// @dev the address of the l2 asset router.
address constant L2_MESSAGE_ROOT_ADDR = address(USER_CONTRACTS_OFFSET + 0x05);

/// @dev The address of the SloadContract system contract, which provides a method to read values from arbitrary storage slots
address constant SLOAD_CONTRACT_ADDR = address(USER_CONTRACTS_OFFSET + 0x06);

/// @dev The address of the WETH implementation contract
address constant L2_WETH_IMPL_ADDR = address(USER_CONTRACTS_OFFSET + 0x07);

/// @dev The address of the L2 interop root storage system contract
// IL2InteropRootStorage constant L2_INTEROP_ROOT_STORAGE = IL2InteropRootStorage(address(USER_CONTRACTS_OFFSET + 0x08));

/// @dev The address of the L2 message verification system contract
// IMessageVerification constant L2_MESSAGE_VERIFICATION = IMessageVerification(address(USER_CONTRACTS_OFFSET + 0x09));

/// @dev The address of the L2 chain handler system contract
address constant L2_CHAIN_ASSET_HANDLER_ADDR = address(USER_CONTRACTS_OFFSET + 0x0a);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IVerifierV2} from "../chain-interfaces/IVerifierV2.sol";
/// @notice FFT inspired version of PlonK to optimize on-chain gas cost
/// @dev For better understanding of the protocol follow the below papers:
/// * Fflonk Paper: https://eprint.iacr.org/2021/1167
/// @dev Contract was generated from a verification key with a hash of 0x17e8d7931f1314431359233e65c22657a32c335205e3c24ce292c5819becfaa7
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
/// @custom:security-contact [email protected]
contract L1VerifierFflonk is IVerifierV2 {
// ================Constants================
Expand All @@ -24,8 +24,8 @@ contract L1VerifierFflonk is IVerifierV2 {
// ================Verification Key================
uint256 internal constant VK_NUM_INPUTS = 1;
// [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)
uint256 internal constant VK_C0_G1_X = 0x19bd7a8cb4cb56772e1a67453c37c9657164a60b05a2d5dbe48de94b80a8563e;
uint256 internal constant VK_C0_G1_Y = 0x1891e1b2512fd626bdd1e82d967ef7f327610799c6548e71283c5b932eaf5370;
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;

// k1 = 5, k2 = 7
uint256 internal constant VK_NON_RESIDUES_0 = 0x05;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IVerifier} from "../chain-interfaces/IVerifier.sol";
/// @notice Modified version of the Permutations over Lagrange-bases for Oecumenical Noninteractive arguments of
/// Knowledge (PLONK) verifier.
/// Modifications have been made to optimize the proof system for ZK chain circuits.
/// @dev Contract was generated from a verification key with a hash of 0xd90459c5b727b9ceeb2b6192d2953dbf05970edf090333b3ad3bcac1a1442b78
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
/// @dev It uses a custom memory layout inside the inline assembly block. Each reserved memory cell is declared in the
/// constants below.
/// @dev For a better understanding of the verifier algorithm please refer to the following papers:
Expand Down Expand Up @@ -284,8 +284,8 @@ contract L1VerifierPlonk is IVerifier {
function _loadVerificationKey() internal pure virtual {
assembly {
// gate setup commitments
mstore(VK_GATE_SETUP_0_X_SLOT, 0x24e3eb5ec8decc0a0cc9d7652eb0e88d4ef64f59ffc6be78d7279e83d67713c1)
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0ecf4eb9866a9bd12e080dca7aaac2735fa016b40d055a8417294e1ffab49383)
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
mstore(VK_GATE_SETUP_1_X_SLOT, 0x04659caf7b05471ba5ba85b1ab62267aa6c456836e625f169f7119d55b9462d2)
mstore(VK_GATE_SETUP_1_Y_SLOT, 0x0ea63403692148d2ad22189a1e5420076312f4d46e62036a043a6b0b84d5b410)
mstore(VK_GATE_SETUP_2_X_SLOT, 0x0e6696d09d65fce1e42805be03fca1f14aea247281f688981f925e77d4ce2291)
Expand All @@ -296,8 +296,8 @@ contract L1VerifierPlonk is IVerifier {
mstore(VK_GATE_SETUP_4_Y_SLOT, 0x22e404bc91350f3bc7daad1d1025113742436983c85eac5ab7b42221a181b81e)
mstore(VK_GATE_SETUP_5_X_SLOT, 0x0d9b29613037a5025655c82b143d2b7449c98f3aea358307c8529249cc54f3b9)
mstore(VK_GATE_SETUP_5_Y_SLOT, 0x15b3c4c946ad1babfc4c03ff7c2423fd354af3a9305c499b7fb3aaebe2fee746)
mstore(VK_GATE_SETUP_6_X_SLOT, 0x1b695865b5bb8e5bf2456d3cc4ef085ba8f85e588a50bcdc98dd04efc8f09e59)
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x2c31aa6561f35253c2adf8bf3eb1d0a1e74bd6eaeef3db6be78651c74bb1b127)
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
mstore(VK_GATE_SETUP_7_X_SLOT, 0x283344a1ab3e55ecfd904d0b8e9f4faea338df5a4ead2fa9a42f0e103da40abc)
mstore(VK_GATE_SETUP_7_Y_SLOT, 0x223b37b83b9687512d322993edd70e508dd80adb10bcf7321a3cc8a44c269521)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IVerifierV2} from "../chain-interfaces/IVerifierV2.sol";
/// @notice FFT inspired version of PlonK to optimize on-chain gas cost
/// @dev For better understanding of the protocol follow the below papers:
/// * Fflonk Paper: https://eprint.iacr.org/2021/1167
/// @dev Contract was generated from a verification key with a hash of 0x17e8d7931f1314431359233e65c22657a32c335205e3c24ce292c5819becfaa7
/// @dev Contract was generated from a verification key with a hash of 0x6f36a08c517b060fa97308cdb3e23b04842ff839d451a753ec8fae1a5408304a
/// @custom:security-contact [email protected]
contract L2VerifierFflonk is IVerifierV2 {
// ================Constants================
Expand All @@ -24,8 +24,8 @@ contract L2VerifierFflonk is IVerifierV2 {
// ================Verification Key================
uint256 internal constant VK_NUM_INPUTS = 1;
// [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)
uint256 internal constant VK_C0_G1_X = 0x19bd7a8cb4cb56772e1a67453c37c9657164a60b05a2d5dbe48de94b80a8563e;
uint256 internal constant VK_C0_G1_Y = 0x1891e1b2512fd626bdd1e82d967ef7f327610799c6548e71283c5b932eaf5370;
uint256 internal constant VK_C0_G1_X = 0x183ae375b758fc764f96e7846c43499f62282531a6b717e789179c6da8cfef41;
uint256 internal constant VK_C0_G1_Y = 0x088d7b4d525ea29bfc5a6f0464589e4eaa4d85d9dd6849a5708b29002626ca36;

// k1 = 5, k2 = 7
uint256 internal constant VK_NON_RESIDUES_0 = 0x05;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IVerifier} from "../chain-interfaces/IVerifier.sol";
/// @notice Modified version of the Permutations over Lagrange-bases for Oecumenical Noninteractive arguments of
/// Knowledge (PLONK) verifier.
/// Modifications have been made to optimize the proof system for ZK chain circuits.
/// @dev Contract was generated from a verification key with a hash of 0xd90459c5b727b9ceeb2b6192d2953dbf05970edf090333b3ad3bcac1a1442b78
/// @dev Contract was generated from a verification key with a hash of 0x64b347c642ea60114c98b3976124ea8a7e0bb778bd7e479aedc02f994486c8a1
/// @dev It uses a custom memory layout inside the inline assembly block. Each reserved memory cell is declared in the
/// constants below.
/// @dev For a better understanding of the verifier algorithm please refer to the following papers:
Expand Down Expand Up @@ -284,8 +284,8 @@ contract L2VerifierPlonk is IVerifier {
function _loadVerificationKey() internal pure virtual {
assembly {
// gate setup commitments
mstore(VK_GATE_SETUP_0_X_SLOT, 0x24e3eb5ec8decc0a0cc9d7652eb0e88d4ef64f59ffc6be78d7279e83d67713c1)
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x0ecf4eb9866a9bd12e080dca7aaac2735fa016b40d055a8417294e1ffab49383)
mstore(VK_GATE_SETUP_0_X_SLOT, 0x0d66d491183c1da0596ff2f1ead5fb08117e947eba0bc018214464d5157dc84d)
mstore(VK_GATE_SETUP_0_Y_SLOT, 0x005ae6dd3b955bdee772718f85d3011bd3eec6695dfeaef524a9ea89af4a4398)
mstore(VK_GATE_SETUP_1_X_SLOT, 0x04659caf7b05471ba5ba85b1ab62267aa6c456836e625f169f7119d55b9462d2)
mstore(VK_GATE_SETUP_1_Y_SLOT, 0x0ea63403692148d2ad22189a1e5420076312f4d46e62036a043a6b0b84d5b410)
mstore(VK_GATE_SETUP_2_X_SLOT, 0x0e6696d09d65fce1e42805be03fca1f14aea247281f688981f925e77d4ce2291)
Expand All @@ -296,8 +296,8 @@ contract L2VerifierPlonk is IVerifier {
mstore(VK_GATE_SETUP_4_Y_SLOT, 0x22e404bc91350f3bc7daad1d1025113742436983c85eac5ab7b42221a181b81e)
mstore(VK_GATE_SETUP_5_X_SLOT, 0x0d9b29613037a5025655c82b143d2b7449c98f3aea358307c8529249cc54f3b9)
mstore(VK_GATE_SETUP_5_Y_SLOT, 0x15b3c4c946ad1babfc4c03ff7c2423fd354af3a9305c499b7fb3aaebe2fee746)
mstore(VK_GATE_SETUP_6_X_SLOT, 0x1b695865b5bb8e5bf2456d3cc4ef085ba8f85e588a50bcdc98dd04efc8f09e59)
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x2c31aa6561f35253c2adf8bf3eb1d0a1e74bd6eaeef3db6be78651c74bb1b127)
mstore(VK_GATE_SETUP_6_X_SLOT, 0x0f2f98f08f99edc5e1131b38feb32649d59783b5f3e9ce49bf76c4e94fc45e7a)
mstore(VK_GATE_SETUP_6_Y_SLOT, 0x072f6cb8958d63e349e9863a227203bca4158f8e8907bb67f99286c1c930ce05)
mstore(VK_GATE_SETUP_7_X_SLOT, 0x283344a1ab3e55ecfd904d0b8e9f4faea338df5a4ead2fa9a42f0e103da40abc)
mstore(VK_GATE_SETUP_7_Y_SLOT, 0x223b37b83b9687512d322993edd70e508dd80adb10bcf7321a3cc8a44c269521)

Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/deploy-scripts/Create2FactoryUtils.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ abstract contract Create2FactoryUtils is Script {
/// @param a The first string.
/// @param b The second string.
/// @return True if the strings are identical, false otherwise.
function compareStrings(string memory a, string memory b) internal pure returns (bool) {
function compareStrings(string memory a, string memory b) internal virtual pure returns (bool) {
return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b));
}
}
Loading