Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
d26e845
Boojum OS initial draft version
AntonD3 May 17, 2025
7b1536d
Some fixes
AntonD3 May 17, 2025
6b56f03
Some fixes
AntonD3 May 28, 2025
17e3fd1
One more fix
AntonD3 May 28, 2025
28b7570
reintroduce method
StanislavBreadless Apr 30, 2025
e644ea6
Add upgrade tx hash to public input
AntonD3 May 28, 2025
d9f5a86
Enable boojum os flag by default
AntonD3 May 28, 2025
faebd92
Use 20 bytes for l2 da validator in PI
AntonD3 May 28, 2025
58b6e83
Save batch output hash in the commitment
AntonD3 May 29, 2025
42be22c
Update plonk verifier
AntonD3 May 29, 2025
b45691c
comment out some assertions that don't apply to zkos
RomanBrodetski May 29, 2025
f14043f
change commitment in storedBatchInfo to use non-packed preimage
RomanBrodetski May 29, 2025
7393112
revert to packed version of commitment
RomanBrodetski Jun 2, 2025
512b7e6
Update plonk verifier
AntonD3 Jun 4, 2025
b70c165
Update plonk verifier
AntonD3 Jun 4, 2025
e91d9f3
Update verifier
AntonD3 Jun 5, 2025
ded5f76
wip
StanislavBreadless Jun 10, 2025
7bf163c
wip
StanislavBreadless Jun 15, 2025
2ff2394
delete constructors
StanislavBreadless Jun 18, 2025
8c26f7b
tmp fix scripts
StanislavBreadless Jun 18, 2025
eeba00a
fast compilation + make compiler work
StanislavBreadless Jun 19, 2025
434cda9
fmt
StanislavBreadless Jun 19, 2025
9f2aa30
updated VK for 0.2.0
mm-zk Jun 24, 2025
dad38d7
wip
StanislavBreadless Jun 26, 2025
7ce8c7c
port d8d0d3e52082987b35d28b40a5b3c89ff2683f48
Raid5594 Jun 18, 2025
3bb2d79
add a small test for hashing
Raid5594 Jun 19, 2025
916280d
include force deployment info
StanislavBreadless Jun 26, 2025
17a0ad6
fix lock files
StanislavBreadless Jun 26, 2025
a221e7f
use force deploy
StanislavBreadless Jun 27, 2025
af6aa77
remove unneeded methods
StanislavBreadless Jun 27, 2025
e6c2f63
fix
StanislavBreadless Jun 27, 2025
f0037e4
cleanup
StanislavBreadless Jun 27, 2025
b73d200
keep the old fix
StanislavBreadless Jun 27, 2025
696d967
updated key to 0.3.1 airbender
mm-zk Jun 27, 2025
ec72efd
updated key again
mm-zk Jun 27, 2025
00b64d6
some refactor
StanislavBreadless Jun 30, 2025
69f5a77
some more cleanup
StanislavBreadless Jun 30, 2025
90a4521
fmt
StanislavBreadless Jun 30, 2025
23f7860
more fixes
StanislavBreadless Jun 30, 2025
12c5407
upd commands
StanislavBreadless Jun 30, 2025
c5f10cb
Merge branch 'release-v28' into sb-adapting-contracts-for-zksync-os
StanislavBreadless Jun 30, 2025
3659e7f
sync with draft-v29
StanislavBreadless Jul 1, 2025
ee75bb9
split chain asset handler
StanislavBreadless Jul 1, 2025
49b8c3f
adapt scripts
StanislavBreadless Jul 2, 2025
53d4146
minor cleanups
StanislavBreadless Jul 2, 2025
875e418
lint
StanislavBreadless Jul 2, 2025
59a9978
Update Verification keys
zksync-dev-robot Jul 2, 2025
c02c128
added support for ohBender and updated keys. (#1543)
mm-zk Jul 2, 2025
1bbef40
Updated keys to 0.3.3 (fix)
mm-zk Jul 2, 2025
d1d9516
partial lint resolve
StanislavBreadless Jul 3, 2025
d211870
fmt
StanislavBreadless Jul 3, 2025
492e870
fmt
StanislavBreadless Jul 3, 2025
910d5e6
feat: Kl/zkos default upgrades (#1554)
kelemeno Jul 10, 2025
9b250aa
interop
koloz193 Jul 16, 2025
d681d16
Merge remote-tracking branch 'origin/zksync-os-stable' into zk-zksync…
koloz193 Jul 16, 2025
49c3156
i
koloz193 Jul 17, 2025
466d705
feat: Mock verifier (#1581)
mm-zk Jul 28, 2025
eec56fb
sync with base
StanislavBreadless Jul 29, 2025
da6aa66
allow mock verifier on sepolia testnet
RomanBrodetski Jul 30, 2025
2149c82
Merge pull request #1584 from matter-labs/RomanBrodetski-patch-1
RomanBrodetski Aug 5, 2025
e89f6f1
merge sb-adapting-contracts-for-zksync-os
perekopskiy Aug 14, 2025
a848804
pass correct factory deps
perekopskiy Aug 14, 2025
e621116
fix
perekopskiy Aug 14, 2025
20c97ba
Merge branch 'draft-v30' into sb-adapting-contracts-for-zksync-os-v30
StanislavBreadless Aug 14, 2025
63ccbbc
support upgrade tx in zkos executor
perekopskiy Aug 15, 2025
28aa62a
Merge remote-tracking branch 'origin/zk-zksync-os-interop' into merge…
koloz193 Aug 15, 2025
0547d2f
fix compile
StanislavBreadless Aug 18, 2025
71f032f
Update PLONK Verifier based on new VK from multiblock
EmilLuta Aug 19, 2025
6f62197
feta(zksync-os): merge sb-adapting-contracts-for-zksync-os to zksync-…
perekopskiy Aug 19, 2025
6227840
Merge pull request #1601 from matter-labs/evl-update-plonk-vk-v0-3-3-…
EmilLuta Aug 19, 2025
758b628
add interop root to batch PI and lint
koloz193 Aug 19, 2025
31d946d
Merge branch 'zksync-os-stable' into zk/zksync-os-stable-v29
koloz193 Aug 20, 2025
12ed1ee
recompute hashes
koloz193 Aug 20, 2025
55ffec8
add v29 stage patch script
zkzoomer Aug 21, 2025
2138cd9
lint
zkzoomer Aug 21, 2025
b72ec75
rm old MailboxFacet
zkzoomer Aug 21, 2025
526d210
fixes
zkzoomer Aug 21, 2025
f998d83
specify facet cuts
zkzoomer Aug 21, 2025
3835f25
rm unused
zkzoomer Aug 21, 2025
d63f122
Merge branch 'draft-v29' into zk/zksync-os-stable-v29
koloz193 Aug 21, 2025
59a0a30
renaming
zkzoomer Aug 22, 2025
5144ad0
Revert "specify facet cuts"
zkzoomer Aug 22, 2025
17e93b0
minor fix
zkzoomer Aug 22, 2025
35212a6
rm unused
zkzoomer Aug 22, 2025
d9b9da8
Revert "rm unused"
zkzoomer Aug 22, 2025
00bf6a6
rm unused
zkzoomer Aug 22, 2025
c40ece4
Revert "rm unused"
zkzoomer Aug 22, 2025
592e1ac
read previous verifiers
zkzoomer Aug 22, 2025
6c1067a
rm unused
zkzoomer Aug 22, 2025
a7caac6
lint
zkzoomer Aug 22, 2025
0a1a307
modify check
zkzoomer Aug 22, 2025
ab5c11c
lint
zkzoomer Aug 22, 2025
4ce1435
fix hashes
zkzoomer Aug 22, 2025
682a5e8
bump hashes
koloz193 Aug 22, 2025
1d3efb6
update genesis
zkzoomer Aug 22, 2025
19cd015
fix force deployment
zkzoomer Aug 23, 2025
0205bd3
fix hashes
zkzoomer Aug 23, 2025
4bb12c7
update genesis
zkzoomer Aug 24, 2025
edbb95a
save to file
zkzoomer Aug 25, 2025
f4a6ede
add run
zkzoomer Aug 25, 2025
61c63fb
lint
zkzoomer Aug 25, 2025
6388439
rm unused
zkzoomer Aug 25, 2025
183b87a
add genesis upgrade addr
zkzoomer Aug 25, 2025
cc1f536
update run
zkzoomer Aug 25, 2025
e2721f4
add diamond init addr
zkzoomer Aug 25, 2025
e7ef3d8
add set new version call
zkzoomer Aug 26, 2025
9017426
add existing facets
zkzoomer Aug 26, 2025
c1a9ca6
add stage0, stage2
zkzoomer Aug 26, 2025
ba43fca
update run
zkzoomer Aug 26, 2025
1213742
bump new protocol version
zkzoomer Aug 26, 2025
c856d26
sync with base
StanislavBreadless Aug 26, 2025
0b7f57e
Merge remote-tracking branch 'origin/sma/v29.1-patch-scripts' into zk…
koloz193 Aug 26, 2025
ac0e310
bump hashes
koloz193 Aug 26, 2025
0da2020
fix getFactoryDeps
perekopskiy Aug 27, 2025
f79c9fd
feat: update Plonk verifier
dimazhornyk Aug 27, 2025
c796928
Merge pull request #1608 from matter-labs/dz-update-plonk-vk
RomanBrodetski Aug 27, 2025
c0c232f
keep old vk
perekopskiy Aug 28, 2025
9495316
Merge pull request #1596 from matter-labs/zk/zksync-os-stable-v29
perekopskiy Aug 28, 2025
ee3fcdc
remove zkos specific changes
koloz193 Aug 28, 2025
a7d4380
remove more zkos references
koloz193 Aug 28, 2025
8a79a33
feat: Elastic verifier, that allows owner to set multiple VKs (#1599)
mm-zk Aug 28, 2025
c029b98
Update vk from script (zkos wrapper v0.4.3 and zkos v0.0.20) (#1612)
mm-zk Aug 29, 2025
74a9dda
fix: merge conflicts
Raid5594 Aug 29, 2025
7a53c65
make compile
StanislavBreadless Aug 29, 2025
69396ab
add back onlyL2 modifier
koloz193 Sep 2, 2025
620276e
Merge branch 'draft-v29' into draft-v29.5
koloz193 Sep 2, 2025
23beee0
change L1->L2/upgrade tx type ids
itegulov Sep 3, 2025
139fac5
Merge remote-tracking branch 'origin/draft-v29' into draft-v29.5
zkzoomer Sep 3, 2025
ccbe998
support both era and zksync-os
itegulov Sep 3, 2025
704a591
address comments
itegulov Sep 3, 2025
d114f24
use correct tx type during deploy
itegulov Sep 3, 2025
fe1d560
change type id to 0x7d/0x7f
itegulov Sep 3, 2025
6699157
pure->view
itegulov Sep 3, 2025
5358b14
remove redundant force data deployment generation
Deniallugo Sep 3, 2025
339c9c2
refactor into methods
itegulov Sep 3, 2025
76aa2c4
Merge pull request #1620 from matter-labs/di/zksync-os-stable
itegulov Sep 3, 2025
3899ae0
Update era contracts - server: d62892c, wrapper: v0.4.3
itegulov Sep 4, 2025
9cbc849
Merge pull request #1622 from matter-labs/update-vk-from-script-20250…
itegulov Sep 4, 2025
481a57d
fix: small fixes/improvements (#1627)
AntonD3 Sep 4, 2025
1f8053e
Some fixes. Comments, constructor removal, lint
0xValera Sep 5, 2025
c285bbd
comment
0xValera Sep 5, 2025
0931202
Merge remote-tracking branch 'origin/draft-v29.5' into sb-adapting-co…
0xValera Sep 5, 2025
3c1cb06
lint
0xValera Sep 5, 2025
ce06092
Merge remote-tracking branch 'origin/zksync-os-stable' into sb-adapti…
0xValera Sep 5, 2025
377f9c9
some fixes on the way to compilation
0xValera Sep 7, 2025
9c4373c
make compilable
0xValera Sep 8, 2025
5302b60
some fixes, lint
0xValera Sep 8, 2025
255bf3e
more fixes
0xValera Sep 8, 2025
7efa454
fix build
0xValera Sep 8, 2025
039f531
fix links
0xValera Sep 8, 2025
83e50a6
fix deploy script
0xValera Sep 8, 2025
8c29a0a
move ComplexUpgrader and L2GenesisUpgrader tests to l1-contracts
0xValera Sep 8, 2025
e6dbffb
TO REVERT: not require lint for tests and coverage in l1-contracts
0xValera Sep 8, 2025
7d6c89c
various ci fixes (#1621)
zkzoomer Sep 8, 2025
e0def62
bump ComplexUpgrader, L2GenesisUpgrade locations
0xValera Sep 8, 2025
e6b6f4c
skip assembly in L1 slither due to slither issue
0xValera Sep 8, 2025
de359e0
slither fixes
0xValera Sep 8, 2025
760c108
slither fix
0xValera Sep 8, 2025
72a2b62
fix errors lint
0xValera Sep 8, 2025
75d0514
Revert "TO REVERT: not require lint for tests and coverage in l1-cont…
0xValera Sep 8, 2025
2530839
lint
0xValera Sep 8, 2025
2c9e6d9
fix scripts
0xValera Sep 8, 2025
5c999b3
fix link
0xValera Sep 8, 2025
a5dc308
upd links (#1632)
StanislavBreadless Sep 8, 2025
3c2e89e
Merge remote-tracking branch 'origin/zksync-os-stable' into sb-adapti…
0xValera Sep 9, 2025
9577337
restore CI elements, make build
0xValera Sep 9, 2025
4ec853e
ignore L2GenesisUpgrade+L2ComplexUpgrader tests in l1 CI
0xValera Sep 9, 2025
5c9c5f4
fix test
0xValera Sep 9, 2025
bdad82f
fix foundry-zksync tests
0xValera Sep 9, 2025
6f97428
Merge remote-tracking branch 'origin/zksync-os-stable' into ra/zksync…
Raid5594 Sep 9, 2025
6e00490
feat: update scripts to enable saving calldata (#1631)
Raid5594 Sep 9, 2025
08f14a6
remove unnecessary deploy
Raid5594 Sep 9, 2025
c81ea82
resolve a few comments
Raid5594 Sep 9, 2025
a11c31d
fix: add comments
Raid5594 Sep 9, 2025
4ef514c
Merge branch 'draft-v30' of https://github.com/matter-labs/era-contra…
0xValera Sep 10, 2025
1380818
fix: refactoring
Raid5594 Sep 10, 2025
1eaa26f
add back deploy gov/admin
Raid5594 Sep 10, 2025
8192316
typo
0xValera Sep 10, 2025
6547bdc
Delete L2VerifierPlonk.sol
0xValera Sep 10, 2025
54cbc4d
Merge branch 'draft-v30' of https://github.com/matter-labs/era-contra…
0xValera Sep 10, 2025
89d8d84
fix build
0xValera Sep 10, 2025
b6de41e
Merge branch 'draft-v30' into sb-adapting-contracts-for-zksync-os-v30
0xValera Sep 10, 2025
a70efd5
lint
0xValera Sep 10, 2025
5f35f09
Update AllContractsHashes.json
0xValera Sep 10, 2025
f808d2d
fix bootloader testing (bump zksync-era commit)
0xValera Sep 10, 2025
4684b45
feat(scripts): Added wallets for prove & execute (#1640)
mm-zk Sep 10, 2025
cd00919
Merge remote-tracking branch 'origin/draft-v29' into ra/zksync-os-sta…
Raid5594 Sep 12, 2025
f644f88
fix: consturctor args to message root
Raid5594 Sep 12, 2025
48d2216
fix: hashes
Raid5594 Sep 12, 2025
da4f761
feat: add helper script
Raid5594 Sep 12, 2025
dbcce37
update factorydeps
0xValera Sep 12, 2025
46fe7e6
fix: lint
Raid5594 Sep 12, 2025
fca9d97
wip
Raid5594 Sep 12, 2025
1e9580c
fix: typo + lint
Raid5594 Sep 12, 2025
c280745
Update RegisterZKChain.s.sol
0xValera Sep 12, 2025
8333778
chore: refactoring
Raid5594 Sep 12, 2025
e6b8531
Merge remote-tracking branch 'origin/draft-v29' into ra/zksync-os-sta…
Raid5594 Sep 12, 2025
2f3f756
Ra/zksync os stable split scripts for zkstack cli (#1613)
Raid5594 Sep 12, 2025
5014886
Revert "Ra/zksync os stable split scripts for zkstack cli" (#1647)
Raid5594 Sep 12, 2025
8591ff3
Merge pull request #1648 from matter-labs/ra/zksync-os-stable-split-s…
Raid5594 Sep 12, 2025
bea8f12
Update GatewayVotePreparation.s.sol
0xValera Sep 15, 2025
ef6ab9c
Update era contracts - zkos: v0.0.25, wrapper: v0.4.6 (#1672)
mm-zk Sep 24, 2025
8289273
Merge branch 'draft-v30' of https://github.com/matter-labs/era-contra…
0xValera Sep 25, 2025
7aa66e8
build fixes after merge, lint, hashes
0xValera Sep 25, 2025
15a7917
Update VerifierPlonk.sol
0xValera Sep 25, 2025
c4100fe
regenerate verifier
0xValera Sep 25, 2025
ce1b113
some fixes
0xValera Sep 25, 2025
6cc9111
L2_NTV_BEACON_DEPLOYER_ADDR -> L2ContractAddresses
0xValera Sep 29, 2025
d88e9c3
OhBender -> ZKsync OS
0xValera Sep 29, 2025
834d8d6
foundry optimizer settings
0xValera Sep 29, 2025
a9f04bf
fix passing of parameters in L2NativeTokenVaultL1Test
0xValera Sep 29, 2025
af13f72
return vm.snapshotGasLastCall
0xValera Sep 29, 2025
362365e
set ZKsyncOS flag to false
0xValera Sep 29, 2025
34643da
fix typo
0xValera Sep 29, 2025
177b776
uncomment test_startMessageToL2
0xValera Sep 29, 2025
70e4918
add maxNumberOfZKChains to SystemContractsArgs
0xValera Sep 29, 2025
8d449b8
remove redundant build:foundry-fast
0xValera Sep 29, 2025
443cde3
add addChainBatchRoot to MRBase, we should have it on L1 in v30
0xValera Sep 29, 2025
a3a3875
Merge branch 'zksync-os-stable' of https://github.com/matter-labs/era…
0xValera Sep 29, 2025
7d8ef02
fixes after merge
0xValera Sep 29, 2025
3be8992
ctmChainId -> ctmRepresentativeChainId
0xValera Sep 29, 2025
0b28d7b
Merge branch 'draft-v30' of https://github.com/matter-labs/era-contra…
0xValera Sep 29, 2025
20b6edf
fix verifier
0xValera Sep 29, 2025
50a9bd5
fix hashes
0xValera Sep 29, 2025
ee8f83a
Merge branch 'draft-v30' of https://github.com/matter-labs/era-contra…
0xValera Sep 29, 2025
a85b79a
fix imports after resolving conflicts
0xValera Sep 29, 2025
f0f99cb
lint
0xValera Sep 29, 2025
3e9bec3
fix hashes
0xValera Sep 29, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/slither.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ jobs:

- name: Run Slither for L1 contracts
working-directory: ./l1-contracts
# FIXME? --skip assembly because otherwise IR for DummyVerifierPlonk can't be generated (Slither issue).
run: |
slither --config ./slither.config.json .
slither --config ./slither.config.json --skip-assembly .

- name: Run Slither for L2 contracts
working-directory: ./l2-contracts
Expand Down
694 changes: 299 additions & 395 deletions AllContractsHashes.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,14 @@ A contract that is responsible for facilitating initialization of a newly create

### Bridging-related contracts

`L2Bridgehub`, `L2AssetRouter`, `L2NativeTokenVault`, as well as `L2MessageRoot`.
- [`L2Bridgehub`](../../l1-contracts/contracts/bridgehub/L2Bridgehub.sol)
- [`L2AssetRouter`](../../l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol)
- [`L2NativeTokenVault`](../../l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol)
- [`L2MessageRoot`](../../l1-contracts/contracts/bridgehub/L2MessageRoot.sol)

These contracts are used to facilitate cross-chain communication as well value bridging. You can read more about then in [the asset router spec](../bridging/asset_router/overview.md).

Note, that [L2AssetRouter](../../l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol) and [L2NativeTokenVault](../../l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol) have unique code, the L2Bridgehub and L2MessageRoot share the same source code with their L1 precompiles, i.e. the L2Bridgehub has [this](../../l1-contracts/contracts/bridgehub/Bridgehub.sol) code and L2MessageRoot has [this](../../l1-contracts/contracts/bridgehub/MessageRoot.sol) code.
Note, that [L2AssetRouter](../../l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol) and [L2NativeTokenVault](../../l1-contracts/contracts/bridge/ntv/L2NativeTokenVault.sol) have unique code, the L2Bridgehub and L2MessageRoot share the same source code with their L1 precompiles, i.e. the L2Bridgehub has [this](../../l1-contracts/contracts/bridgehub/L2Bridgehub.sol) code and L2MessageRoot has [this](../../l1-contracts/contracts/bridgehub/L2MessageRoot.sol) code.

### SloadContract

Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ DEPLOY_GATEWAY_TX_FILTERER_INPUT=/script-config/deploy-gateway-tx-filterer.toml
DEPLOY_GATEWAY_TX_FILTERER_OUTPUT=/script-out/deploy-gateway-tx-filterer.toml
GATEWAY_VOTE_PREPARATION_INPUT=/script-config/gateway-vote-preparation.toml
GATEWAY_VOTE_PREPARATION_OUTPUT=/script-out/gateway-vote-preparation.toml
ZK_OS_V28_1_UPGRADE_ECOSYSTEM_INPUT=/script-config/zk-os-v28-1-upgrade-ecosystem.toml
ZK_OS_V28_1_UPGRADE_ECOSYSTEM_OUTPUT=/script-out/zk-os-v28-1-upgrade-ecosystem.toml
23 changes: 8 additions & 15 deletions l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity 0.8.28;

import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable-v4/access/Ownable2StepUpgradeable.sol";

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/access/Ownable2StepUpgradeable.sol

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/access/Ownable2StepUpgradeable.sol

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/access/Ownable2StepUpgradeable.sol
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable-v4/security/PausableUpgradeable.sol";

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/security/PausableUpgradeable.sol

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/security/PausableUpgradeable.sol

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-upgradeable-v4/security/PausableUpgradeable.sol

import {IERC20} from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";

Check warning on line 8 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol

Check warning on line 8 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol

Check warning on line 8 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol
import {SafeERC20} from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";

Check warning on line 9 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

Check warning on line 9 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

Check warning on line 9 in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/AssetRouterBase.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

import {IAssetRouterBase} from "./IAssetRouterBase.sol";
import {IAssetHandler} from "../interfaces/IAssetHandler.sol";
Expand All @@ -25,14 +25,15 @@
abstract contract AssetRouterBase is IAssetRouterBase, Ownable2StepUpgradeable, PausableUpgradeable {
using SafeERC20 for IERC20;

/// @dev Bridgehub smart contract that is used to operate with L2 via asynchronous L2 <-> L1 communication.
IBridgehub public immutable override BRIDGE_HUB;
/*//////////////////////////////////////////////////////////////
IMMUTABLE GETTERS
//////////////////////////////////////////////////////////////*/

function _bridgehub() internal view virtual returns (IBridgehub);

/// @dev Chain ID of L1 for bridging reasons
uint256 public immutable L1_CHAIN_ID;
function _l1ChainId() internal view virtual returns (uint256);

/// @dev Chain ID of Era for legacy reasons
uint256 public immutable ERA_CHAIN_ID;
function _eraChainId() internal view virtual returns (uint256);

/// @dev Maps asset ID to address of corresponding asset handler.
/// @dev Tracks the address of Asset Handler contracts, where bridged funds are locked for each asset.
Expand All @@ -55,20 +56,12 @@

/// @notice Checks that the message sender is the bridgehub.
modifier onlyBridgehub() {
if (msg.sender != address(BRIDGE_HUB)) {
if (msg.sender != address(_bridgehub())) {
revert Unauthorized(msg.sender);
}
_;
}

/// @dev Contract is expected to be used as proxy implementation.
/// @dev Initialize the implementation to prevent Parity hack.
constructor(uint256 _l1ChainId, uint256 _eraChainId, IBridgehub _bridgehub) {
L1_CHAIN_ID = _l1ChainId;
ERA_CHAIN_ID = _eraChainId;
BRIDGE_HUB = _bridgehub;
}

/// @inheritdoc IAssetRouterBase
function setAssetHandlerAddressThisChain(
bytes32 _assetRegistrationData,
Expand Down
26 changes: 25 additions & 1 deletion l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity 0.8.28;

import {IERC20} from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol

Check warning on line 5 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/IERC20.sol
import {SafeERC20} from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

Check warning on line 6 in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol

View workflow job for this annotation

GitHub Actions / lint

Import in l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol doesn't exist in: @openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol

import {IL1AssetRouter} from "./IL1AssetRouter.sol";
import {IL2AssetRouter} from "./IL2AssetRouter.sol";
Expand Down Expand Up @@ -36,6 +36,12 @@
contract L1AssetRouter is AssetRouterBase, IL1AssetRouter, ReentrancyGuard {
using SafeERC20 for IERC20;

/// @dev Bridgehub smart contract that is used to operate with L2 via asynchronous L2 <-> L1 communication.
IBridgehub public immutable override BRIDGE_HUB;

/// @dev Chain ID of Era for legacy reasons
uint256 public immutable ERA_CHAIN_ID;

/// @dev The address of the WETH token on L1.
address public immutable override L1_WETH_TOKEN;

Expand Down Expand Up @@ -94,8 +100,10 @@
address _l1Nullifier,
uint256 _eraChainId,
address _eraDiamondProxy
) reentrancyGuardInitializer AssetRouterBase(block.chainid, _eraChainId, IBridgehub(_bridgehub)) {
) reentrancyGuardInitializer {
_disableInitializers();
BRIDGE_HUB = IBridgehub(_bridgehub);
ERA_CHAIN_ID = _eraChainId;
L1_WETH_TOKEN = _l1WethAddress;
ERA_DIAMOND_PROXY = _eraDiamondProxy;
L1_NULLIFIER = IL1Nullifier(_l1Nullifier);
Expand Down Expand Up @@ -673,4 +681,20 @@
function l2BridgeAddress(uint256 _chainId) external view override returns (address) {
return L1_NULLIFIER.l2BridgeAddress(_chainId);
}

function L1_CHAIN_ID() external view override returns (uint256) {
return block.chainid;
}

function _bridgehub() internal view override returns (IBridgehub) {
return BRIDGE_HUB;
}

function _l1ChainId() internal view override returns (uint256) {
return block.chainid;
}

function _eraChainId() internal view override returns (uint256) {
return ERA_CHAIN_ID;
}
}
111 changes: 90 additions & 21 deletions l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {IBridgehub} from "../../bridgehub/IBridgehub.sol";
import {AddressAliasHelper} from "../../vendor/AddressAliasHelper.sol";
import {ReentrancyGuard} from "../../common/ReentrancyGuard.sol";

import {L2_BRIDGEHUB_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "../../common/l2-helpers/L2ContractAddresses.sol";
import {L2_BRIDGEHUB_ADDR, L2_COMPLEX_UPGRADER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "../../common/l2-helpers/L2ContractAddresses.sol";
import {L2ContractHelper} from "../../common/l2-helpers/L2ContractHelper.sol";
import {DataEncoding} from "../../common/libraries/DataEncoding.sol";
import {AmountMustBeGreaterThanZero, AssetIdNotSupported, EmptyAddress, InvalidCaller, TokenNotLegacy} from "../../common/L1ContractErrors.sol";
Expand All @@ -24,19 +24,41 @@ import {AmountMustBeGreaterThanZero, AssetIdNotSupported, EmptyAddress, InvalidC
/// @custom:security-contact [email protected]
/// @notice The "default" bridge implementation for the ERC20 tokens. Note, that it does not
/// support any custom token logic, i.e. rebase tokens' functionality is not supported.
/// @dev Important: L2 contracts are not allowed to have any immutable variables or constructors. This is needed for compatibility with ZKsyncOS.
contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
/// @dev The address of the L2 legacy shared bridge.
address public immutable L2_LEGACY_SHARED_BRIDGE;
/// @dev Bridgehub smart contract that is used to operate with L2 via asynchronous L2 <-> L1 communication.
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
IBridgehub public override BRIDGE_HUB;

/// @dev The asset id of the base token.
bytes32 public immutable BASE_TOKEN_ASSET_ID;
/// @dev Chain ID of L1 for bridging reasons.
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
uint256 public L1_CHAIN_ID;

/// @dev Chain ID of Era for legacy reasons.
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
uint256 public eraChainId;

/// @dev The address of the L1 asset router counterpart.
address public immutable override L1_ASSET_ROUTER;
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
address public L1_ASSET_ROUTER;

/// @dev The address of the L2 legacy shared bridge.
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
address public L2_LEGACY_SHARED_BRIDGE;

/// @dev The asset id of the base token.
/// @dev Note, that while it is a simple storage variable, the name is in capslock for the backward compatibility with
/// the old version where it was an immutable.
bytes32 public BASE_TOKEN_ASSET_ID;

/// @notice Checks that the message sender is the L1 Asset Router.
modifier onlyAssetRouterCounterpart(uint256 _originChainId) {
if (_originChainId == L1_CHAIN_ID) {
if (_originChainId == _l1ChainId()) {
// Only the L1 Asset Router counterpart can initiate and finalize the deposit.
if (AddressAliasHelper.undoL1ToL2Alias(msg.sender) != L1_ASSET_ROUTER) {
revert InvalidCaller(msg.sender);
Expand All @@ -49,7 +71,7 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {

/// @notice Checks that the message sender is the L1 Asset Router.
modifier onlyAssetRouterCounterpartOrSelf(uint256 _chainId) {
if (_chainId == L1_CHAIN_ID) {
if (_chainId == _l1ChainId()) {
// Only the L1 Asset Router counterpart can initiate and finalize the deposit.
if ((AddressAliasHelper.undoL1ToL2Alias(msg.sender) != L1_ASSET_ROUTER) && (msg.sender != address(this))) {
revert InvalidCaller(msg.sender);
Expand All @@ -75,26 +97,61 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
_;
}

/// @dev Disable the initialization to prevent Parity hack.
/// @dev this contract is deployed in the L2GenesisUpgrade, and is meant as direct deployment without a proxy.
/// @param _l1AssetRouter The address of the L1 Bridge contract.
constructor(
/// @dev Only allows calls from the complex upgrader contract on L2.
modifier onlyUpgrader() {
if (msg.sender != L2_COMPLEX_UPGRADER_ADDR) {
revert InvalidCaller(msg.sender);
}
_;
}

/// @notice Initializes the contract.
/// @dev This function is used to initialize the contract with the initial values.
/// @param _l1ChainId The chain id of L1.
/// @param _eraChainId The chain id of Era.
/// @param _l1AssetRouter The address of the L1 asset router.
/// @param _legacySharedBridge The address of the L2 legacy shared bridge.
/// @param _baseTokenAssetId The asset id of the base token.
/// @param _aliasedOwner The address of the owner of the contract.
function initL2(
uint256 _l1ChainId,
uint256 _eraChainId,
address _l1AssetRouter,
address _legacySharedBridge,
bytes32 _baseTokenAssetId,
address _aliasedOwner
) AssetRouterBase(_l1ChainId, _eraChainId, IBridgehub(L2_BRIDGEHUB_ADDR)) reentrancyGuardInitializer {
) public reentrancyGuardInitializer onlyUpgrader {
_disableInitializers();
// solhint-disable-next-line func-named-parameters
updateL2(_l1ChainId, _eraChainId, _l1AssetRouter, _legacySharedBridge, _baseTokenAssetId);
_setAssetHandler(_baseTokenAssetId, L2_NATIVE_TOKEN_VAULT_ADDR);
_transferOwnership(_aliasedOwner);
}

/// @notice Updates the contract.
/// @dev This function is used to initialize the new implementation of L2AssetRouter on existing chains during
/// the upgrade.
/// @param _l1ChainId The chain id of L1.
/// @param _eraChainId The chain id of Era.
/// @param _l1AssetRouter The address of the L1 asset router.
/// @param _legacySharedBridge The address of the L2 legacy shared bridge.
/// @param _baseTokenAssetId The asset id of the base token.
function updateL2(
uint256 _l1ChainId,
uint256 _eraChainId,
address _l1AssetRouter,
address _legacySharedBridge,
bytes32 _baseTokenAssetId
) public onlyUpgrader {
L2_LEGACY_SHARED_BRIDGE = _legacySharedBridge;
if (_l1AssetRouter == address(0)) {
revert EmptyAddress();
}
L1_CHAIN_ID = _l1ChainId;
L1_ASSET_ROUTER = _l1AssetRouter;
_setAssetHandler(_baseTokenAssetId, L2_NATIVE_TOKEN_VAULT_ADDR);
BASE_TOKEN_ASSET_ID = _baseTokenAssetId;
_disableInitializers();
_transferOwnership(_aliasedOwner);
eraChainId = _eraChainId;
BRIDGE_HUB = IBridgehub(L2_BRIDGEHUB_ADDR);
}

/// @inheritdoc IL2AssetRouter
Expand Down Expand Up @@ -136,15 +193,15 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
public
payable
override(AssetRouterBase, IAssetRouterBase)
onlyAssetRouterCounterpartOrSelf(L1_CHAIN_ID)
onlyAssetRouterCounterpartOrSelf(_l1ChainId())
nonReentrant
{
if (_assetId == BASE_TOKEN_ASSET_ID) {
revert AssetIdNotSupported(BASE_TOKEN_ASSET_ID);
}
_finalizeDeposit(L1_CHAIN_ID, _assetId, _transferData, L2_NATIVE_TOKEN_VAULT_ADDR);
_finalizeDeposit(_l1ChainId(), _assetId, _transferData, L2_NATIVE_TOKEN_VAULT_ADDR);

emit DepositFinalizedAssetRouter(L1_CHAIN_ID, _assetId, _transferData);
emit DepositFinalizedAssetRouter(_l1ChainId(), _assetId, _transferData);
}

/// @notice Initiates a withdrawal by burning funds on the contract and sending the message to L1
Expand Down Expand Up @@ -177,7 +234,7 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
bool _alwaysNewMessageFormat
) internal returns (bytes32 txHash) {
bytes memory l1bridgeMintData = _burn({
_chainId: L1_CHAIN_ID,
_chainId: _l1ChainId(),
_nextMsgValue: 0,
_assetId: _assetId,
_originalCaller: _sender,
Expand All @@ -204,7 +261,7 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
txHash = IL2SharedBridgeLegacy(L2_LEGACY_SHARED_BRIDGE).sendMessageToL1(message);
}

emit WithdrawalInitiatedAssetRouter(L1_CHAIN_ID, _sender, _assetId, _assetData);
emit WithdrawalInitiatedAssetRouter(_l1ChainId(), _sender, _assetId, _assetData);
}

/// @notice Encodes the message for l2ToL1log sent during withdraw initialization.
Expand Down Expand Up @@ -362,4 +419,16 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard {
function l1Bridge() external view returns (address) {
return L1_ASSET_ROUTER;
}

function _bridgehub() internal pure override returns (IBridgehub) {
return IBridgehub(L2_BRIDGEHUB_ADDR);
}

function _l1ChainId() internal view override returns (uint256) {
return L1_CHAIN_ID;
}

function _eraChainId() internal view override returns (uint256) {
return eraChainId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@ interface IL2WrappedBaseToken {
function depositTo(address _to) external payable;

function withdrawTo(address _to, uint256 _amount) external;

/// @notice Initializes a contract token for later use. Expected to be used in the proxy.
/// @notice This function is used to integrate the previously deployed WETH token with the bridge.
/// @dev Sets up `name`/`symbol`/`decimals` getters.
/// @param name_ The name of the token.
/// @param symbol_ The symbol of the token.
/// @param _l2Bridge Address of the L2 bridge
/// @param _l1Address Address of the L1 token that can be deposited to mint this L2 WETH.
/// Note: The decimals are hardcoded to 18, the same as on Ether.
function initializeV3(
string calldata name_,
string calldata symbol_,
address _l2Bridge,
address _l1Address,
bytes32 _baseTokenAssetId
) external;
}
Loading
Loading