Skip to content
Merged
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
30 changes: 15 additions & 15 deletions AllContractsHashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1121,23 +1121,23 @@
},
{
"contractName": "l1-contracts/EraVerifierFflonk",
"zkBytecodeHash": "0x010009bf1a2a70c1f95d09eef43e5987235d235f762458ed1ce488497cb5dcd8",
"zkBytecodeHash": "0x010009bf3eec5109d71bbcfb172427bf154b3d7d7cf7658de47a1f30accca029",
"zkBytecodePath": "/l1-contracts/zkout/EraVerifierFflonk.sol/EraVerifierFflonk.json",
"evmBytecodeHash": "0x89b8657ec5c09924d9263f240ac47ff7f4c70920f8f31b25697feb29b733f247",
"evmBytecodeHash": "0x83956ff613e2e47d7839699d9b40b00a965bf387ce65dac032ea01efa8adcecc",
"evmBytecodePath": "/l1-contracts/out/EraVerifierFflonk.sol/EraVerifierFflonk.json",
"evmDeployedBytecodeHash": "0xe667284b7ac8069bacd0de5ea5a5d112287897ed531bfb676b3df9ff91b08956",
"evmDeployedBytecodeBlakeHash": "0x7ab617cfb9fb627dbb65a74e8a9a69ac7564c8211f04edc0d1b3ca5c25180d26",
"evmDeployedBytecodeHash": "0x8f25f56f9ab945ff80d2baae4317caa5cc44c9977dcb080a626c8aa7243c8dc3",
"evmDeployedBytecodeBlakeHash": "0xd28d4d70d0843417371350d5f537788f3b660f329ea530f0110c3f26f0e0defc",
"evmDeployedBytecodeLength": 14703
},
{
"contractName": "l1-contracts/EraVerifierPlonk",
"zkBytecodeHash": "0x01000dbbe1f44e0700602e4a3876c1f10c6e80b214633879653607485870ebf2",
"zkBytecodeHash": "0x01000dbbd8b7a51e31a86baedeebff06d9620b6b387138c16fa0c0e937474e2e",
"zkBytecodePath": "/l1-contracts/zkout/EraVerifierPlonk.sol/EraVerifierPlonk.json",
"evmBytecodeHash": "0x620222ada31c2b1941ac42a0503b07d055e149c79779151df5ef58d9fbac8fbd",
"evmBytecodeHash": "0xb9b1c454adf0c8164df1ec693818edb9218aefb2e34400b22ff554f9dc4e8e3b",
"evmBytecodePath": "/l1-contracts/out/EraVerifierPlonk.sol/EraVerifierPlonk.json",
"evmDeployedBytecodeHash": "0x40274fb988c3dead26d594ce66f193c74dc9f0fc3c0edc4e25a5c774b58f5c95",
"evmDeployedBytecodeBlakeHash": "0x19913bf603f4fa147c6d1fed8e8e4232efa2fa5eb753c3f7fa3d974c74c09743",
"evmDeployedBytecodeLength": 17228
"evmDeployedBytecodeHash": "0x0cbec817c0b91e8c644059beace800e42960de8dbe2238094adccec4ed8e3ad4",
"evmDeployedBytecodeBlakeHash": "0x047ae67462c77961199bffe974845c920a46e006f1935a0e7c9d1365a64fcfba",
"evmDeployedBytecodeLength": 17226
},
{
"contractName": "l1-contracts/ExecutorFacet",
Expand Down Expand Up @@ -1231,12 +1231,12 @@
},
{
"contractName": "l1-contracts/GatewayCTMDeployerVerifiers",
"zkBytecodeHash": "0x01000085995731416be7ae0a14af1d6edf150d3899007e124489aebcaff0330a",
"zkBytecodeHash": "0x01000085426a7a0700448a722cc65f48230400afcaa83bd16eca6802266fb276",
"zkBytecodePath": "/l1-contracts/zkout/GatewayCTMDeployerVerifiers.sol/GatewayCTMDeployerVerifiers.json",
"evmBytecodeHash": "0xdef1a3e9e86097101c2057eaf3199b3a0b52e19e845d37ad08ac9ea8cce999d9",
"evmBytecodeHash": "0x63097630b4e44e418daeb7485dea019bfa3629225a395b46664add80e77a67ad",
"evmBytecodePath": "/l1-contracts/out/GatewayCTMDeployerVerifiers.sol/GatewayCTMDeployerVerifiers.json",
"evmDeployedBytecodeHash": "0x321d4da09c4145e81c51a6c7fde08e77f2ab59511dfe5c1d44ed0ac074c15c45",
"evmDeployedBytecodeBlakeHash": "0x6508a0e31e2ee735e5293789577bc1fd1d88c76a0aa7c7957a09ee6337676f91",
"evmDeployedBytecodeHash": "0xff7ea340f34c3aa1cdc2875a23f538b8925b17b3748fa043e6ce9f08ff2a43d3",
"evmDeployedBytecodeBlakeHash": "0x04161c904ce1311b5f7a73a039e1f0a8c343e9d585da5d315c0fc22dc1f3951c",
"evmDeployedBytecodeLength": 256
},
{
Expand Down Expand Up @@ -2672,7 +2672,7 @@
{
"contractName": "Bootloader",
"zkBytecodePath": "/system-contracts/zkout/fee_estimate.yul/Bootloader.json",
"zkBytecodeHash": "0x01000a1fb576943665f4460fa24b2e52f25850abb8dac0d004b6bdf90ef3c615",
"zkBytecodeHash": "0x01000a87b05d2e820b3124888ab0e6a4260aa4b510760b170b2ebb7f52b6b84e",
"evmBytecodePath": null,
"evmBytecodeHash": null,
"evmDeployedBytecodeHash": null,
Expand All @@ -2692,7 +2692,7 @@
{
"contractName": "Bootloader",
"zkBytecodePath": "/system-contracts/zkout/playground_batch.yul/Bootloader.json",
"zkBytecodeHash": "0x01000a259c438fe41738298f3fc3e193f8e12d78522a5c608c700c05f3f4acea",
"zkBytecodeHash": "0x01000a8d11b6d3302e03c801946d80e694dbb9c3c8ab21f1d0f06c66a193b0f4",
"evmBytecodePath": null,
"evmBytecodeHash": null,
"evmDeployedBytecodeHash": null,
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* @vladbochok @StanislavBreadless
* @vladbochok @StanislavBreadless @kelemeno
l1-contracts/deploy-scripts @Deniallugo
l1-contracts/deploy-script-config-template @Deniallugo
.solhint.json @nikitastupin-matterlabs
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ license.
We aim to make it as easy as possible to contribute to the mission. This is still WIP, and we're happy for contributions
and suggestions here too. Some resources to help:

1. [In-repo docs aimed at developers](docs)
2. [ZKsync Era docs!](https://docs.zksync.io/zk-stack)
1. [In-repo docs aimed at developers are stored in zksync-era repository.](https://github.com/matter-labs/zksync-era/blob/main/docs)
2. [ZK Stack docs!](https://docs.zksync.io/zk-stack)
3. Company links can be found in the [repo's readme](README.md)

## Code of Conduct
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum pr
or re-auditing a single line of code. ZKsync Era also uses an LLVM-based compiler that will eventually let developers
write smart contracts in C++, Rust and other popular languages.

This repository contains both L1 and L2 ZKsync smart contracts. For their description see the
[system overview](docs/overview.md).
This repository contains both L1 and L2 ZKsync smart contracts.

## Documentation

Documentation for these contracts is maintained in the [zksync-era repository](https://github.com/matter-labs/zksync-era/blob/main/docs/src/specs/contracts).

## Disclaimer

Expand Down
6 changes: 3 additions & 3 deletions configs/genesis/era/latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"minor": 31,
"patch": 0
},
"genesis_root": "0xd587b49f995a73535cf8f2ba63ea420cbd34fbda8c26b3b94102f5069b00c52b",
"genesis_root": "0x29b737d0c805488d22037961612c913cdd1916563d4d0ffdc9bcd1bc90a3bc7c",
"genesis_rollup_leaf_index": 104,
"genesis_batch_commitment": "0xef771e98edab2758a64c8930512dcb1b80fc08e3e6fec048d7e5d703603c28e4",
"genesis_batch_commitment": "0x69e3619d4d81b4ca62b92a0d92f0aecb6e1521c4695de3fa76f43b38f88043f9",
"bootloader_hash": "0x0100099b799188da75411d9c2815a792e60e031bc5f89c2938b6deced048ad83",
"default_aa_hash": "0x010005f9ffcf2471de535c03a1ac9da1ff92fedd96b40895aaf27a961400d403",
"evm_emulator_hash": "0x01000d8bae37b82f311186426184866498b357f41d7a02ced11f3e3fbfbacd63",
"prover": {
"recursion_scheduler_level_vk_hash": "0x1ffc56111a5cfaf5db387f6a31408ad20217e9bc1f31f2f5c1bd38b0d6d7968b",
"recursion_scheduler_level_vk_hash": "0xb2f50340e0edbe49dc657d4eb298e07f13860c1be0fe2e438e44ef8fad133d84",
"fflonk_snark_wrapper_vk_hash": "0x49eae0bf5c7ea580f4979b366e52b386adc5f42e2ce50fc1d3c4de9a86052bff"
}
}
6 changes: 3 additions & 3 deletions configs/genesis/era/latest.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
protocol_semantic_version = 133143986176
genesis_root = "0xd587b49f995a73535cf8f2ba63ea420cbd34fbda8c26b3b94102f5069b00c52b"
genesis_root = "0x29b737d0c805488d22037961612c913cdd1916563d4d0ffdc9bcd1bc90a3bc7c"
genesis_rollup_leaf_index = 104
genesis_batch_commitment = "0xef771e98edab2758a64c8930512dcb1b80fc08e3e6fec048d7e5d703603c28e4"
genesis_batch_commitment = "0x69e3619d4d81b4ca62b92a0d92f0aecb6e1521c4695de3fa76f43b38f88043f9"
bootloader_hash = "0x0100099b799188da75411d9c2815a792e60e031bc5f89c2938b6deced048ad83"
default_aa_hash = "0x010005f9ffcf2471de535c03a1ac9da1ff92fedd96b40895aaf27a961400d403"
evm_emulator_hash = "0x01000d8bae37b82f311186426184866498b357f41d7a02ced11f3e3fbfbacd63"

[prover]
recursion_scheduler_level_vk_hash = "0x1ffc56111a5cfaf5db387f6a31408ad20217e9bc1f31f2f5c1bd38b0d6d7968b"
recursion_scheduler_level_vk_hash = "0xb2f50340e0edbe49dc657d4eb298e07f13860c1be0fe2e438e44ef8fad133d84"
fflonk_snark_wrapper_vk_hash = "0x49eae0bf5c7ea580f4979b366e52b386adc5f42e2ce50fc1d3c4de9a86052bff"
73 changes: 2 additions & 71 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,3 @@
# ZK Stack contracts specs
# Documentation

The order of the files here only roughly represents the order of reading. A lot of topics are intertwined, so it is recommended to read everything first to have a complete picture and then refer to specific documents for more details.

- [Glossary](./glossary.md)
- [Overview](./overview.md)
- Contracts of an individual chain
- [ZK Chain basics](./settlement_contracts/zkchain_basics.md)
- Data availability
- [Custom DA support](./settlement_contracts/data_availability/custom_da.md)
- [Rollup DA support](./settlement_contracts/data_availability/rollup_da.md)
- [Standard pubdata format](./settlement_contracts/data_availability/standard_pubdata_format.md)
- [State diff compression v1 spec](./settlement_contracts/data_availability/state_diff_compression_v1_spec.md)
- L1->L2 transaction handling
- [Processing of L1->L2 transactions](./settlement_contracts/priority_queue/processing_of_l1-l2_txs.md)
- [Priority queue](./settlement_contracts/priority_queue/priority-queue.md)
- Consensus
- [Consensus Registry](./consensus/consensus-registry.md)
- Chain Management
- [Chain type manager](./chain_management/chain_type_manager.md)
- [Admin role](./chain_management/admin_role.md)
- [Chain genesis](./chain_management/chain_genesis.md)
- [Standard Upgrade process](./chain_management/upgrade_process.md)
- Bridging
- Bridgehub
- [Overview of the bridgehub functionality](./bridging/bridgehub/overview.md)
- [Asset Router](./bridging/asset_router/overview.md)
- L2 System Contracts
- [System contracts bootloader description](./l2_system_contracts/system_contracts_bootloader_description.md)
- [Batches and blocks on ZKsync](./l2_system_contracts/batches_and_blocks_on_zksync.md)
- [Elliptic curve precompiles](./l2_system_contracts/elliptic_curve_precompiles.md)
- [ZKsync fee model](./l2_system_contracts/zksync_fee_model.md)
- Gateway
- [General overview](./gateway/overview.md)
- [Chain migration](./gateway/chain_migration.md)
- [L1->L2 messaging via gateway](./gateway/messaging_via_gateway.md)
- [L2->L1 messaging via gateway](./gateway/l2_gw_l1_messaging.md)
- [Gateway protocol versioning](./gateway/gateway_protocol_upgrades.md)
- [DA handling on Gateway](./gateway/gateway_da.md)
- EVM emulation
- [Technical overview](./evm_emulation/technical_overview.md)
- [Gas emulation](./evm_emulation/evm_gas_emulation.md)
- [Differences from EVM (Cancun)](./evm_emulation/differences_from_cancun_evm.md)
- [EVM predeploys list](./evm_emulation/evm_predeploys_list.md)
- Upgrade history
- Gateway
- [Gateway upgrade diff](./upgrade_history/gateway_preparation_upgrade/gateway_diff_review.md)
- [Gateway upgrade process](<./upgrade_history/gateway_preparation_upgrade/upgrade_process_(no_gateway_chain).md>)
- EVM emulator
- [Upgrade process and changes](./upgrade_history/v27_evm_emulation/v27-evm-emulation.md)

![Reading order](./img/reading_order.png)

## Repo structure

The repository contains the following sections:

- [gas-bound-caller](../gas-bound-caller) that contains `GasBoundCaller` utility contract implementation. You can read more about it in its README.
- [da-contracts](../da-contracts/). There are implementations for [DA validation](./settlement_contracts/data_availability/custom_da.md) contracts that should be deployed on L1 only.
- [l1-contracts](../l1-contracts/). Despite the legacy name, it contains contracts that are deployed both on L1 and on L2. This folder encompasses bridging, ZK chain contracts, the contracts for chain admin, etc. The name is historical due to the fact that these contracts were usually deployed on L1 only. However with Gateway, settlement and bridging-related contracts will be deployed on both EVM and eraVM environment. Also, bridging has been unified between L1 and L2 in many places and so keeping everything in one project allows to avoid code duplication.
- [l2-contracts](../l2-contracts/). Contains contracts that are deployed only on L2.
- [system-contracts](../system-contracts/). Contains system contracts or predeployed L2 contracts.

## For auditors: Invariants/tricky places to look out for

This section is for auditors of the codebase. It includes some of the important invariants that the system relies on and which if broken could have bad consequences.

- Assuming that the accepting CTM is correct & efficient, the L1→GW part of the L1→GW→L2 transaction never fails. It is assumed that the provided max amount for gas is always enough for any transaction that can realistically come from L1.
- GW → L1 migration never fails. If it is possible to get into a state where the migration is not possible to finish, then the chain is basically lost. There are some exceptions where for now it is the expected behavior. (check out the “Migration invariants & protocol upgradability” section)
- The general consistency of chains when migration between different settlement layers is done. Including the feasibility of emergency upgrades, etc. I.e. whether the whole system is thought-through.
- Preimage attacks in the L2→GW→L1 tree, we apply special prefixes to ensure that the tree structure is fixed, i.e. all logs are 88 bytes long (this is for backwards compatibility reasons). For batch leaves and chain id leaves we use special prefixes.
- Data availability guarantees. Whether rollup users can always restore all their storage slots, etc. An example of a potential tricky issue can be found in “Security notes for Gateway-based rollups” [in this document](./gateway/gateway_da.md).
The documentation for ZKsync Era smart contracts is maintained in the [zksync-era repository](https://github.com/matter-labs/zksync-era/blob/main/docs/src/specs/contracts).
47 changes: 0 additions & 47 deletions docs/bridging/asset_router/asset_router.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading
Loading