Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library fix review #1146

Merged
merged 286 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
286 commits
Select commit Hold shift + click to select a range
ff10238
Stas issues
kelemeno Aug 16, 2024
d4bb8c5
removed unsued function + some changes
StanislavBreadless Aug 16, 2024
2a22e23
fixes
kelemeno Aug 16, 2024
590d207
fix some legacy methods
StanislavBreadless Aug 17, 2024
83cd458
fmt
StanislavBreadless Aug 17, 2024
42e7e0a
additional changes
StanislavBreadless Aug 18, 2024
aff1f4e
fmt
StanislavBreadless Aug 18, 2024
8099c0e
commented out code
StanislavBreadless Aug 19, 2024
ce27e0b
lint fix
StanislavBreadless Aug 19, 2024
ec64d85
should work
StanislavBreadless Aug 19, 2024
ea24b02
move some methods around
StanislavBreadless Aug 19, 2024
e58a3ee
fmt
StanislavBreadless Aug 19, 2024
d0a4401
remove useless change
StanislavBreadless Aug 19, 2024
ade586e
codespell
StanislavBreadless Aug 19, 2024
9e52539
router
StanislavBreadless Aug 19, 2024
8e59135
upd some files
StanislavBreadless Aug 19, 2024
859eed8
fix tests
StanislavBreadless Aug 19, 2024
568d65c
Merge remote-tracking branch 'origin/sb-sync-layer-reorg-stable-sync-…
StanislavBreadless Aug 19, 2024
a94a1b1
fmt
StanislavBreadless Aug 19, 2024
e7865bc
Merge pull request #712 from matter-labs/sb-sync-layer-reorg-stable-s…
StanislavBreadless Aug 19, 2024
9ebe7aa
fix lint
StanislavBreadless Aug 19, 2024
f105566
fix sys contracts tests
StanislavBreadless Aug 19, 2024
0640579
lint
StanislavBreadless Aug 19, 2024
ad726f7
fix
StanislavBreadless Aug 19, 2024
fa16bcb
fix
StanislavBreadless Aug 19, 2024
d50bf31
Merge pull request #714 from matter-labs/sb-fix-sl-stable
StanislavBreadless Aug 19, 2024
6a5dada
Merge branch 'sync-layer-stable' into sb-reduce-owner-footprint-on-ge…
StanislavBreadless Aug 19, 2024
1b8393b
fix check hashes
StanislavBreadless Aug 20, 2024
3de3430
Remove Base Token Address from Chain Registration (#700)
Raid5594 Aug 20, 2024
a91bc7a
Merge pull request #711 from matter-labs/sb-reduce-owner-footprint-on…
StanislavBreadless Aug 20, 2024
5853c3a
feat(consensus): add L2 registry contract (BFT-434) (#555) (#718)
pompon0 Aug 20, 2024
8f4aad4
Merge pull request #719 from matter-labs/sync-layer-stable
StanislavBreadless Aug 20, 2024
9b24cce
merge dev into the kl sync layer reorg
StanislavBreadless Aug 20, 2024
66e8494
fix sc build
StanislavBreadless Aug 20, 2024
47495d1
fix some lints
StanislavBreadless Aug 20, 2024
def5d47
fix lint
StanislavBreadless Aug 20, 2024
336e40c
Merge pull request #721 from matter-labs/sb-merge-dev-kl-reorg
StanislavBreadless Aug 20, 2024
fb536f2
fix chainRegistered
kelemeno Aug 20, 2024
21a10e0
gw fixes
StanislavBreadless Aug 20, 2024
86d2cc0
script fixes
kelemeno Aug 20, 2024
092d198
local zk fmt breaks...
kelemeno Aug 20, 2024
ed036a2
fmt
StanislavBreadless Aug 21, 2024
792d059
fix comment
StanislavBreadless Aug 21, 2024
7ef7a6d
fmt
StanislavBreadless Aug 21, 2024
739fabb
some contract fixes
kelemeno Aug 21, 2024
d7928ba
commented out code
kelemeno Aug 21, 2024
8b45eff
some more fixes
kelemeno Aug 21, 2024
95f5085
forgot await
kelemeno Aug 21, 2024
4d5cdc9
undo getL1ChainId, its async
kelemeno Aug 21, 2024
c1675c3
fix tests
StanislavBreadless Aug 21, 2024
96fa8e4
wip
StanislavBreadless Aug 21, 2024
c7b7123
foundry test fixes
kelemeno Aug 21, 2024
1e13d50
add a getAssetId function
kelemeno Aug 21, 2024
e7442e6
Merge pull request #725 from matter-labs/sb-some-gw-messaing-fixes
StanislavBreadless Aug 21, 2024
d29195b
first round of conflict resolution
StanislavBreadless Aug 21, 2024
9e19b5a
system contracts compile
StanislavBreadless Aug 21, 2024
a7a10ae
l2 contracts compile
StanislavBreadless Aug 21, 2024
ad7c0ad
Stas issue fixes
kelemeno Aug 21, 2024
d31866a
Merge branch 'kl/sync-layer-reorg' of ssh://github.com/matter-labs/er…
kelemeno Aug 21, 2024
3274507
fix remappings
Deniallugo Aug 21, 2024
37245fa
foundry test and small fixes
kelemeno Aug 21, 2024
a7e3d0a
linting
kelemeno Aug 21, 2024
daf396e
make l1 contracts compile
StanislavBreadless Aug 21, 2024
a59077c
script fix
kelemeno Aug 21, 2024
1d62e8e
foundry test are running
StanislavBreadless Aug 21, 2024
8a2d7c8
Merge branch 'kl/script-fixes' of ssh://github.com/matter-labs/era-co…
kelemeno Aug 21, 2024
391fa4d
fix: script fixes (#726)
kelemeno Aug 21, 2024
70a0660
Merge branch 'sync-layer-stable' of ssh://github.com/matter-labs/era-…
kelemeno Aug 21, 2024
2b2af24
foundry tests pass (though some were commented out)
StanislavBreadless Aug 21, 2024
d1b5149
Merge branch 'sync-layer-stable' of ssh://github.com/matter-labs/era-…
kelemeno Aug 21, 2024
00f7d8e
partial l1 test fix
StanislavBreadless Aug 21, 2024
446d391
Add admin role to shared bridge (#727)
StanislavBreadless Aug 21, 2024
94b2646
chore: Kl/merge-stable (#730)
kelemeno Aug 21, 2024
5ec24e2
Kl/merge-stable2 (#731)
kelemeno Aug 21, 2024
8421abc
forceDeploymetns data
kelemeno Aug 21, 2024
095a55a
bad merge
StanislavBreadless Aug 22, 2024
4e084b7
merge kl reorg branch
StanislavBreadless Aug 22, 2024
ab605b2
foundry tests pass
StanislavBreadless Aug 22, 2024
9e0c329
make more tests pass
StanislavBreadless Aug 22, 2024
377d0aa
fmt
StanislavBreadless Aug 22, 2024
9a168a6
Merge branch 'kl/sync-layer-reorg-dev' into kl/sync-layer-reorg-foundry
StanislavBreadless Aug 22, 2024
a80a667
message root fix
kelemeno Aug 22, 2024
4255c63
renaming and some fixes
kelemeno Aug 22, 2024
51d5dc4
lint
kelemeno Aug 22, 2024
f741346
wip
StanislavBreadless Aug 22, 2024
f617301
erc20 tests in foundry work
StanislavBreadless Aug 22, 2024
0d7ee23
aggregated root return value
kelemeno Aug 22, 2024
d2f83db
cover most of weth tsts
StanislavBreadless Aug 22, 2024
ebfb6d2
port the rest of the tests
StanislavBreadless Aug 22, 2024
c90c9f6
remove old tests
StanislavBreadless Aug 23, 2024
3c1b796
old proof support
StanislavBreadless Aug 23, 2024
6225350
unit tests
StanislavBreadless Aug 23, 2024
5e1ada2
fix lint
StanislavBreadless Aug 23, 2024
774ef90
fix comment
StanislavBreadless Aug 23, 2024
7931924
Merge pull request #736 from matter-labs/sb-support-old-proving-format
StanislavBreadless Aug 26, 2024
a4a2b06
add a few events for migration
StanislavBreadless Aug 26, 2024
e05866e
ensure that the STM has to be whitelisted before it is used
StanislavBreadless Aug 26, 2024
18f66ba
some fixes
StanislavBreadless Aug 26, 2024
7c8ef21
fix lint
StanislavBreadless Aug 26, 2024
9a3b546
rename event
StanislavBreadless Aug 26, 2024
b6d6c47
lint
StanislavBreadless Aug 26, 2024
e5b44c6
remove unused methods from validator timelock and executor
StanislavBreadless Aug 26, 2024
a478e2e
some more fixes
StanislavBreadless Aug 26, 2024
823ef65
Merge remote-tracking branch 'origin/sb-set-of-fixes-2' into sb-set-o…
StanislavBreadless Aug 26, 2024
3f17ff8
fix compile
StanislavBreadless Aug 26, 2024
caf4192
fix some more stuff
StanislavBreadless Aug 26, 2024
ae9add5
lint
StanislavBreadless Aug 26, 2024
dc1da58
migrate tests
StanislavBreadless Aug 26, 2024
60b7fc4
lint fix
StanislavBreadless Aug 26, 2024
2071f78
test
StanislavBreadless Aug 26, 2024
d5ecc4a
fmt
StanislavBreadless Aug 26, 2024
075eed8
Merge pull request #737 from matter-labs/sb-set-of-fixes-2
StanislavBreadless Aug 27, 2024
3a4fc67
make scripts work with the server
StanislavBreadless Aug 27, 2024
5cb5a03
sync with sync-layer-stable
StanislavBreadless Aug 27, 2024
d273ebf
fmt
StanislavBreadless Aug 27, 2024
95c501b
Merge pull request #744 from matter-labs/sb-port-kl/sync-layer-reorg
StanislavBreadless Aug 27, 2024
709bd86
Merge pull request #746 from matter-labs/sync-layer-stable
StanislavBreadless Aug 27, 2024
c82a950
sync with dev
StanislavBreadless Aug 28, 2024
7bcf8ac
sync with kl/sync-layer-reorg
StanislavBreadless Aug 28, 2024
a102e75
fix l1 tests
StanislavBreadless Aug 28, 2024
1dfc1ef
fmt
StanislavBreadless Aug 28, 2024
ad046e0
most of lints
StanislavBreadless Aug 28, 2024
4ac4e01
tmp: submodules work
StanislavBreadless Aug 28, 2024
d77b6a8
remove forge std
StanislavBreadless Aug 28, 2024
60935d3
remove l1-contracts/lib/murky
StanislavBreadless Aug 28, 2024
2c03a8d
remove mode subdmoules
StanislavBreadless Aug 28, 2024
f3e83dd
fix unit tests
StanislavBreadless Aug 28, 2024
8b025a4
fmt
StanislavBreadless Aug 28, 2024
60a1f7b
fix ci
StanislavBreadless Aug 28, 2024
f3a9481
fix spelling
StanislavBreadless Aug 28, 2024
fa4baf0
check hashes
StanislavBreadless Aug 28, 2024
6fa9393
better compare
StanislavBreadless Aug 28, 2024
8632559
correct address
StanislavBreadless Aug 28, 2024
2d92a68
comments
StanislavBreadless Aug 28, 2024
277d61d
fix addr
StanislavBreadless Aug 28, 2024
955979c
lint
StanislavBreadless Aug 28, 2024
10ec8ba
Merge pull request #749 from matter-labs/kl/sync-layer-reorg-dev
StanislavBreadless Aug 28, 2024
ac415e2
Merge pull request #753 from matter-labs/kl/sync-layer-reorg
StanislavBreadless Aug 28, 2024
03644e6
Merge branch 'kl/sync-layer-reorg' into kl/sync-layer-reorg-foundry
StanislavBreadless Aug 29, 2024
a557c01
upd workflow
StanislavBreadless Aug 29, 2024
487dd71
forge install: v2-testnet-contracts
StanislavBreadless Aug 29, 2024
4bac7cb
wip
StanislavBreadless Aug 29, 2024
1a2390c
forge install: @matterlabs/zksync-contracts
StanislavBreadless Aug 29, 2024
2d9ad08
using foundry deps
StanislavBreadless Aug 29, 2024
bc54d47
remove unneeded changes
StanislavBreadless Aug 29, 2024
e4689f0
wip
StanislavBreadless Aug 29, 2024
0a5e318
fix typo
StanislavBreadless Aug 29, 2024
6775587
install foundry zksync in ci
StanislavBreadless Aug 29, 2024
12cb8d0
fix lint
StanislavBreadless Aug 29, 2024
db7eafb
more efficient forge install
StanislavBreadless Aug 29, 2024
e70b722
fmt
StanislavBreadless Aug 29, 2024
e572c91
compile sc contracts also
StanislavBreadless Aug 29, 2024
dfd969c
Merge pull request #755 from matter-labs/kl/sync-layer-reorg-foundry
StanislavBreadless Aug 29, 2024
c905dd3
sync with stable
StanislavBreadless Aug 29, 2024
f17d7e1
Merge branch 'kl/sync-layer-reorg' into kl/migrate-back-from-gw
StanislavBreadless Aug 29, 2024
8affc3c
fix compile
StanislavBreadless Aug 29, 2024
adc2e76
Merge pull request #706 from matter-labs/kl/migrate-back-from-gw
StanislavBreadless Aug 29, 2024
3301a13
add ability to recover from failed migration (#715)
koloz193 Aug 29, 2024
de2cca7
sync with stable
StanislavBreadless Aug 29, 2024
464382e
fix compile
StanislavBreadless Aug 29, 2024
c05daf6
Fixed yarn clean - to remove zksync artifacts too
mm-zk Aug 30, 2024
262ee7e
Merge pull request #759 from matter-labs/mmzk_0830_fix_cleanup
StanislavBreadless Aug 30, 2024
989f2c1
L2 verifier support (#756)
StanislavBreadless Aug 30, 2024
d669a5f
Merge pull request #758 from matter-labs/sb-sync-sync-layer-stable
StanislavBreadless Aug 30, 2024
b212535
sync with kl sync layer reorg
StanislavBreadless Aug 30, 2024
840df35
fix comile
StanislavBreadless Aug 30, 2024
9fa2d66
fix lint
StanislavBreadless Aug 30, 2024
f469e7c
fix script
StanislavBreadless Aug 30, 2024
9d319e7
Merge branch 'sync-layer-stable' into kl/message-root-update
StanislavBreadless Aug 30, 2024
73ddd6d
Merge pull request #724 from matter-labs/kl/message-root-update
StanislavBreadless Aug 30, 2024
d368769
feat: Deploy ConsensusRegistry through L1 to L2 transaction (BFT-504)…
aakoshh Sep 2, 2024
3a1aecc
Fix token info upon migration (#760)
StanislavBreadless Sep 2, 2024
7f2c27a
Small PR to Fix "Ethers" and "ETH" encoding (#762)
Raid5594 Sep 3, 2024
78b0ce8
STM -> CTM
StanislavBreadless Sep 4, 2024
213f990
chore: Kl/merge-dev-sync-layer-stable (#763)
kelemeno Sep 4, 2024
249e012
Merge branch 'kl/sync-layer-reorg' into sb-rename-stm
StanislavBreadless Sep 4, 2024
28aadaa
migrate in script files as well
StanislavBreadless Sep 4, 2024
e8d47b4
l1 foundry test work
StanislavBreadless Sep 4, 2024
ae911bb
fix ts tests
StanislavBreadless Sep 4, 2024
b23bf7c
lint
StanislavBreadless Sep 4, 2024
566a54b
Resolve some of the leftover todos (#765)
StanislavBreadless Sep 5, 2024
9d1ce13
fix lib to remove it from coverage report
StanislavBreadless Sep 5, 2024
6fff2b1
sync with base
StanislavBreadless Sep 5, 2024
af14533
recalc hashes
StanislavBreadless Sep 5, 2024
aab2f77
toml file
StanislavBreadless Sep 5, 2024
3d6e02f
Set foundry optimizer_runs (#770)
perekopskiy Sep 5, 2024
42933cd
Merge pull request #766 from matter-labs/sb-rename-stm
StanislavBreadless Sep 5, 2024
4a062d0
Rename hyperchain -> ZK chain (#771)
StanislavBreadless Sep 5, 2024
8b5b296
Implement restriction to allow limiting chain admin in power (#699)
StanislavBreadless Sep 5, 2024
c95f623
sync with dev
StanislavBreadless Sep 6, 2024
93ed4dc
fix l1 compile
StanislavBreadless Sep 6, 2024
265166b
fix l1 foundry tests
StanislavBreadless Sep 6, 2024
1a23102
fix l2 compile
StanislavBreadless Sep 6, 2024
bd438c5
fix lint
StanislavBreadless Sep 6, 2024
99e9a0a
hopefully fix ci
StanislavBreadless Sep 6, 2024
2929483
hopefully fix ci 2
StanislavBreadless Sep 6, 2024
a1705ab
delete duplicated contract
StanislavBreadless Sep 6, 2024
6892ccc
Add admin permission to add custom base tokens (#776)
vladbochok Sep 6, 2024
b6c7130
merge main into dev
StanislavBreadless Sep 6, 2024
0fa0fa2
foundry tests pass
StanislavBreadless Sep 6, 2024
00ddc06
fix compile for registry
StanislavBreadless Sep 6, 2024
b6766b0
Merge pull request #777 from matter-labs/sb-merge-dev-kl-sync-layer-r…
StanislavBreadless Sep 6, 2024
ef33539
lint
StanislavBreadless Sep 6, 2024
dccc114
Remove most info from relayed L1->GW priority ops (#775)
StanislavBreadless Sep 6, 2024
b653ac8
Merge pull request #778 from matter-labs/sb-merge-main-to-dev
StanislavBreadless Sep 6, 2024
cb3c177
sync with reorg
StanislavBreadless Sep 6, 2024
23f5e3c
fmt
StanislavBreadless Sep 6, 2024
cb42ae4
Merge pull request #779 from matter-labs/sb-sync-reorg-with-stable
StanislavBreadless Sep 6, 2024
49868af
Change Executor.sol interface (#780)
vladbochok Sep 9, 2024
bebdefc
(feat): add tx filterer contract (#772)
Raid5594 Sep 10, 2024
f95beef
Ra/split asset router (#595)
Raid5594 Sep 10, 2024
8479868
chore: merge stable (#785)
kelemeno Sep 10, 2024
d1b7e16
Update l1-contracts/contracts/bridge/L1Nullifier.sol
kelemeno Sep 10, 2024
e741471
Update l1-contracts/contracts/bridge/asset-router/IL1AssetRouter.sol
kelemeno Sep 10, 2024
a42b991
fix: vlad issues (#788)
kelemeno Sep 10, 2024
2508f36
Recover some tests (#789)
StanislavBreadless Sep 10, 2024
b3564ef
Kl/chain balance fix (#786)
kelemeno Sep 10, 2024
1404dc0
Merge branch 'dev' of ssh://github.com/matter-labs/era-contracts into…
kelemeno Sep 10, 2024
cc3b2ac
chore: merge main (#790)
kelemeno Sep 10, 2024
8155711
Merge branch 'dev' of ssh://github.com/matter-labs/era-contracts into…
kelemeno Sep 10, 2024
c0d45fa
test fixes
kelemeno Sep 10, 2024
6de2963
Merge pull request #791 from matter-labs/kl/merge-dev
StanislavBreadless Sep 10, 2024
07d0462
Fixes (#792)
vladbochok Sep 11, 2024
1673186
sync head with base
StanislavBreadless Sep 11, 2024
eb3583a
delete unneeded files
StanislavBreadless Sep 11, 2024
e5727a0
Sync audit head with base (#797)
StanislavBreadless Sep 11, 2024
ef318e2
Merge pull request #798 from matter-labs/sb-sync-head-base
StanislavBreadless Sep 11, 2024
8208402
Better governance protection (audit) (#822)
StanislavBreadless Sep 26, 2024
e6205d7
Fix library M-01 (#981)
vladbochok Oct 27, 2024
5b57c7f
Fix library L-01 (#983)
vladbochok Oct 27, 2024
431d076
feat: ZKChain Upgrades and Libraries Diff Audit merged fixes (#1050)
Raid5594 Dec 12, 2024
41d4f06
fix: lint & build
Dec 13, 2024
0113da1
fix: lint
Dec 13, 2024
8a6b292
(test): lcov ignore unused patters
Dec 13, 2024
5103d10
test
Dec 13, 2024
4ff2464
test
Dec 13, 2024
68c32ef
test
Dec 13, 2024
e0bf2b4
test
Dec 13, 2024
40e9353
(resolve merge conflicts)
Dec 17, 2024
5ca0ffd
(fix): build errors
Dec 17, 2024
d4af332
Merge branch 'oz-audit-sep-base' into library-fix-review
Raid5594 Dec 17, 2024
3ea5878
fixes
Dec 17, 2024
250de04
more fixes
Dec 17, 2024
28dee17
more fixes
Dec 17, 2024
b7a8ff8
fix & lint
Dec 17, 2024
90ec0c0
lint
Dec 17, 2024
e5f16a1
fixes
Dec 17, 2024
00dd3c3
fixes
Dec 17, 2024
1b77ee7
error linting
Dec 17, 2024
14d468c
system hashes
Dec 17, 2024
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: 3 additions & 0 deletions .github/workflows/l1-contracts-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- name: Build da-contracts artifacts
run: yarn da build:foundry

- name: Build l1 artifacts
run: yarn l1 build

- name: Create cache
uses: actions/cache/save@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions l1-contracts/contracts/bridge/L1Nullifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ contract L1Nullifier is IL1Nullifier, ReentrancyGuard, Ownable2StepUpgradeable,
address baseToken = BRIDGE_HUB.baseToken(_chainId);
transferData = DataEncoding.encodeBridgeMintData({
_originalCaller: address(0),
_remoteReceiver: l1Receiver,
_originToken: baseToken,
_l2Receiver: l1Receiver,
_l1Token: baseToken,
_amount: amount,
_erc20Metadata: new bytes(0)
});
Expand All @@ -598,8 +598,8 @@ contract L1Nullifier is IL1Nullifier, ReentrancyGuard, Ownable2StepUpgradeable,
assetId = DataEncoding.encodeNTVAssetId(block.chainid, l1Token);
transferData = DataEncoding.encodeBridgeMintData({
_originalCaller: address(0),
_remoteReceiver: l1Receiver,
_originToken: l1Token,
_l2Receiver: l1Receiver,
_l1Token: l1Token,
_amount: amount,
_erc20Metadata: new bytes(0)
});
Expand Down
8 changes: 4 additions & 4 deletions l1-contracts/contracts/bridge/ntv/NativeTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ abstract contract NativeTokenVault is INativeTokenVault, IAssetHandler, Ownable2

_bridgeMintData = DataEncoding.encodeBridgeMintData({
_originalCaller: _originalCaller,
_remoteReceiver: _receiver,
_originToken: originToken,
_l2Receiver: _receiver,
_l1Token: originToken,
_amount: _amount,
_erc20Metadata: erc20Metadata
});
Expand Down Expand Up @@ -295,8 +295,8 @@ abstract contract NativeTokenVault is INativeTokenVault, IAssetHandler, Ownable2
}
_bridgeMintData = DataEncoding.encodeBridgeMintData({
_originalCaller: _originalCaller,
_remoteReceiver: _receiver,
_originToken: nativeToken,
_l2Receiver: _receiver,
_l1Token: nativeToken,
_amount: amount,
_erc20Metadata: erc20Metadata
});
Expand Down
24 changes: 10 additions & 14 deletions l1-contracts/contracts/common/L1ContractErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ error ChainIdCantBeCurrentChain();
error ChainIdMismatch();
// 0x23f3c357
error ChainIdNotRegistered(uint256 chainId);
// 0x5de72107
error ChainNotLegacy();
// 0x8f620a06
error ChainIdTooBig();
// 0xf7a01e4d
Expand All @@ -87,12 +89,16 @@ error DiamondNotFrozen();
error EmptyAddress();
// 0x2d4d012f
error EmptyAssetId();
// 0xfc7ab1d3
error EmptyBlobVersionHash(uint256 index);
// 0x1c25715b
error EmptyBytes32();
// 0x95b66fe9
error EmptyDeposit();
// 0x627e0872
error ETHDepositNotSupported();
// 0x1bdfd505
error FailedToTransferTokens(address tokenContract, address to, uint256 amount);
// 0xac4a3f98
error FacetExists(bytes4 selector, address);
// 0xc91cf3b1
Expand All @@ -115,6 +121,8 @@ error ZKChainLimitReached();
error IncorrectBridgeHubAddress(address bridgehub);
// 0x826fb11e
error InsufficientChainBalance();
// 0x356680b7
error InsufficientFunds();
// 0xcbd9d2e0
error InvalidCaller(address);
// 0x4fbe5dba
Expand Down Expand Up @@ -314,10 +322,10 @@ error IncorrectBatchBounds(
);
// 0x64107968
error AssetHandlerNotRegistered(bytes32 assetId);
// 0x64846fe4
error NotARestriction(address addr);
// 0xfa5cd00f
error NotAllowed(address addr);
// 0x64846fe4
error NotARestriction(address addr);
// 0xccdd18d2
error BytecodeAlreadyPublished(bytes32 bytecodeHash);
// 0x25d8333c
Expand All @@ -338,22 +346,10 @@ error IncorrectPricingMode();
error NotSettlementLayer();
// 0x7a4902ad
error TimerAlreadyStarted();

// 0x09aa9830
error MerklePathLengthMismatch(uint256 pathLength, uint256 expectedLength);

// 0xc33e6128
error MerkleNothingToProve();

// 0xafbb7a4e
error MerkleIndexOrHeightMismatch();

// 0x1b582fcf
error MerkleWrongIndex(uint256 index, uint256 maxNodeNumber);

// 0x485cfcaa
error MerkleWrongLength(uint256 newLeavesLength, uint256 leafNumber);

// 0xce63ce17
error NoCTMForAssetId(bytes32 assetId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ pragma solidity ^0.8.21;

/**
* @author Matter Labs
* @notice System smart contract that is responsible for deploying other smart contracts on a ZK chain.
* @custom:security-contact [email protected]
* @notice Interface for the contract that is used to deploy contracts on L2.
* @dev Identical interface is defined in L2ContractHelper library. Duplication is for testing purposes only.
*/
interface IL2ContractDeployer {
/// @notice A struct that describes a forced deployment on an address.
Expand Down
57 changes: 31 additions & 26 deletions l1-contracts/contracts/common/libraries/DataEncoding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ import {UnsupportedEncodingVersion} from "../L1ContractErrors.sol";
library DataEncoding {
/// @notice Abi.encodes the data required for bridgeMint on remote chain.
/// @param _originalCaller The address which initiated the transfer.
/// @param _remoteReceiver The address which to receive tokens on remote chain.
/// @param _originToken The transferred token address.
/// @param _l2Receiver The address which to receive tokens on remote chain.
/// @param _l1Token The transferred token address.
/// @param _amount The amount of token to be transferred.
/// @param _erc20Metadata The transferred token metadata.
/// @return The encoded bridgeMint data
function encodeBridgeMintData(
address _originalCaller,
address _remoteReceiver,
address _originToken,
address _l2Receiver,
address _l1Token,
uint256 _amount,
bytes memory _erc20Metadata
) internal pure returns (bytes memory) {
// solhint-disable-next-line func-named-parameters
return abi.encode(_originalCaller, _remoteReceiver, _originToken, _amount, _erc20Metadata);
return abi.encode(_originalCaller, _l2Receiver, _l1Token, _amount, _erc20Metadata);
}

/// @notice Function decoding transfer data previously encoded with this library.
/// @param _bridgeMintData The encoded bridgeMint data
/// @return _originalCaller The address which initiated the transfer.
/// @return _remoteReceiver The address which to receive tokens on remote chain.
/// @return _parsedOriginToken The transferred token address.
/// @return _l2Receiver The address which to receive tokens on remote chain.
/// @return _parsedL1Token The transferred token address.
/// @return _amount The amount of token to be transferred.
/// @return _erc20Metadata The transferred token metadata.
function decodeBridgeMintData(
Expand All @@ -45,18 +45,32 @@ library DataEncoding {
pure
returns (
address _originalCaller,
address _remoteReceiver,
address _parsedOriginToken,
address _l2Receiver,
address _parsedL1Token,
uint256 _amount,
bytes memory _erc20Metadata
)
{
(_originalCaller, _remoteReceiver, _parsedOriginToken, _amount, _erc20Metadata) = abi.decode(
(_originalCaller, _l2Receiver, _parsedL1Token, _amount, _erc20Metadata) = abi.decode(
_bridgeMintData,
(address, address, address, uint256, bytes)
);
}

/// @notice Encodes the legacy transaction data hash.
/// @dev the encoding strats with 0t
/// @param _originalCaller The address of the entity that initiated the deposit.
/// @param _l1Token The address of the L1 token.
/// @param _amount The amount of the L1 token.
/// @return txDataHash The resulting encoded transaction data hash.
function encodeLegacyTxDataHash(
address _originalCaller,
address _l1Token,
uint256 _amount
) internal pure returns (bytes32) {
return keccak256(abi.encode(_originalCaller, _l1Token, _amount));
}

/// @notice Encodes the asset data by combining chain id, asset deployment tracker and asset data.
/// @param _chainId The id of the chain token is native to.
/// @param _assetData The asset data that has to be encoded.
Expand Down Expand Up @@ -108,7 +122,7 @@ library DataEncoding {
if (_encodingVersion == LEGACY_ENCODING_VERSION) {
address tokenAddress = INativeTokenVault(_nativeTokenVault).tokenAddress(_assetId);
(uint256 depositAmount, ) = abi.decode(_transferData, (uint256, address));
txDataHash = encodeLegacyTxDataHash(_originalCaller, tokenAddress, depositAmount);
txDataHash = keccak256(abi.encode(_originalCaller, tokenAddress, depositAmount));
} else if (_encodingVersion == NEW_ENCODING_VERSION) {
// Similarly to calldata, the txDataHash is collision-resistant.
// In the legacy data hash, the first encoded variable was the address, which is padded with zeros during `abi.encode`.
Expand All @@ -120,21 +134,12 @@ library DataEncoding {
}
}

/// @notice Encodes the legacy transaction data hash.
/// @dev the encoding strats with 0t
/// @param _originalCaller The address of the entity that initiated the deposit.
/// @param _l1Token The address of the L1 token.
/// @param _amount The amount of the L1 token.
/// @return txDataHash The resulting encoded transaction data hash.
function encodeLegacyTxDataHash(
address _originalCaller,
address _l1Token,
uint256 _amount
) internal pure returns (bytes32) {
return keccak256(abi.encode(_originalCaller, _l1Token, _amount));
}

/// @notice Decodes the token data by combining chain id, asset deployment tracker and asset data.
/// @notice Decodes the token data
/// @dev Note that all the returned metadata of the token is ABI encoded.
/// @return chainId The chainId of the origin of the token
/// @return name The name of the token.
/// @return symbol The symbol of the token.
/// @return decimals The decimals of the token.
function decodeTokenData(
bytes calldata _tokenData
) internal pure returns (uint256 chainId, bytes memory name, bytes memory symbol, bytes memory decimals) {
Expand Down
17 changes: 6 additions & 11 deletions l1-contracts/contracts/common/libraries/Merkle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// 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;

// solhint-disable gas-custom-errors

import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol";
import {MerklePathEmpty, MerklePathOutOfBounds, MerkleIndexOutOfBounds, MerklePathLengthMismatch, MerkleNothingToProve, MerkleIndexOrHeightMismatch} from "../../common/L1ContractErrors.sol";
import {MerklePathEmpty, MerklePathOutOfBounds, MerkleIndexOutOfBounds} from "../../common/L1ContractErrors.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
Expand All @@ -12,7 +14,6 @@ library Merkle {

/// @dev Calculate Merkle root by the provided Merkle proof.
/// NOTE: When using this function, check that the _path length is equal to the tree height to prevent shorter/longer paths attack
/// however, for chains settling on GW the proof includes the GW proof, so the path increases. See Mailbox for more details.
/// @param _path Merkle path from the leaf to the root
/// @param _index Leaf index in the tree
/// @param _itemHash Hash of leaf content
Expand Down Expand Up @@ -75,9 +76,7 @@ library Merkle {
bytes32[] memory _itemHashes
) internal pure returns (bytes32) {
uint256 pathLength = _startPath.length;
if (pathLength != _endPath.length) {
revert MerklePathLengthMismatch(pathLength, _endPath.length);
}
require(pathLength == _endPath.length, "Merkle: path length mismatch");
if (pathLength >= 256) {
revert MerklePathOutOfBounds();
}
Expand All @@ -86,12 +85,8 @@ library Merkle {
if (pathLength == 0 && (_startIndex != 0 || levelLen != 1)) {
revert MerklePathEmpty();
}
if (levelLen == 0) {
revert MerkleNothingToProve();
}
if (_startIndex + levelLen > (1 << pathLength)) {
revert MerkleIndexOrHeightMismatch();
}
require(levelLen > 0, "Merkle: nothing to prove");
require(_startIndex + levelLen <= (1 << pathLength), "Merkle: index/height mismatch");
bytes32[] memory itemHashes = _itemHashes;

for (uint256 level; level < pathLength; level = level.uncheckedInc()) {
Expand Down
15 changes: 15 additions & 0 deletions l1-contracts/contracts/governance/IRestriction.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.24;

import {Call} from "./Common.sol";

/// @title Restriction contract interface
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IRestriction {
/// @notice Ensures that the invoker has the required role to call the function.
/// @param _call The call data.
/// @param _invoker The address of the invoker.
function validateCall(Call calldata _call, address _invoker) external view;
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ struct ZKChainStorage {
/// @dev The address of the baseToken contract. Eth is address(1)
address __DEPRECATED_baseToken;
/// @dev The address of the baseTokenbridge. Eth also uses the shared bridge
address __DEPRECATED_baseTokenBridge;
/// @notice gasPriceMultiplier for each baseToken, so that each L1->L2 transaction pays for its transaction on the destination
address baseTokenBridge;
/// @notice gasPriceMultiplier for each baseToken, so that each L1->L2 transaction pays for its transaction on the destination
/// we multiply by the nominator, and divide by the denominator
uint128 baseTokenGasPriceMultiplierNominator;
uint128 baseTokenGasPriceMultiplierDenominator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ interface IL2GenesisUpgrade {
function genesisUpgrade(
uint256 _chainId,
address _ctmDeployer,
bytes calldata _fixedForceDeploymentsData,
bytes calldata _additionalForceDeploymentsData
bytes calldata _forceDeploymentsData
) external payable;
}
42 changes: 14 additions & 28 deletions l1-contracts/contracts/upgrades/GatewayUpgrade.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import {DataEncoding} from "../common/libraries/DataEncoding.sol";
import {Diamond} from "../state-transition/libraries/Diamond.sol";
import {PriorityQueue} from "../state-transition/libraries/PriorityQueue.sol";
import {PriorityTree} from "../state-transition/libraries/PriorityTree.sol";
import {GatewayUpgradeFailed} from "./ZkSyncUpgradeErrors.sol";

import {IGatewayUpgrade} from "./IGatewayUpgrade.sol";
import {IL2ContractDeployer} from "../common/interfaces/IL2ContractDeployer.sol";
import {L1GatewayHelper} from "./L1GatewayHelper.sol";
import {IL1SharedBridgeLegacy} from "../bridge/interfaces/IL1SharedBridgeLegacy.sol";

import {IBridgehub} from "../bridgehub/IBridgehub.sol";

// solhint-disable-next-line gas-struct-packing
struct GatewayUpgradeEncodedInput {
Expand Down Expand Up @@ -45,40 +46,25 @@ contract GatewayUpgrade is BaseZkSyncUpgrade {
/// @param _proposedUpgrade The upgrade to be executed.
/// @dev Doesn't require any access-control restrictions as the contract is used in the delegate call.
function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) {
GatewayUpgradeEncodedInput memory encodedInput = abi.decode(
(bytes memory l2TxDataStart, bytes memory l2TxDataFinish) = abi.decode(
_proposedUpgrade.postUpgradeCalldata,
(GatewayUpgradeEncodedInput)
(bytes, bytes)
);

bytes32 baseTokenAssetId = DataEncoding.encodeNTVAssetId(block.chainid, s.__DEPRECATED_baseToken);

s.baseTokenAssetId = baseTokenAssetId;
s.baseTokenAssetId = DataEncoding.encodeNTVAssetId(block.chainid, s.__DEPRECATED_baseToken);
s.priorityTree.setup(s.priorityQueue.getTotalPriorityTxs());
s.validators[encodedInput.oldValidatorTimelock] = false;
s.validators[encodedInput.newValidatorTimelock] = true;
IBridgehub(s.bridgehub).setLegacyBaseTokenAssetId(s.chainId);
ProposedUpgrade memory proposedUpgrade = _proposedUpgrade;

bytes memory gatewayUpgradeCalldata = abi.encode(
encodedInput.ctmDeployer,
encodedInput.fixedForceDeploymentsData,
L1GatewayHelper.getZKChainSpecificForceDeploymentsData(
s,
encodedInput.wrappedBaseTokenStore,
s.__DEPRECATED_baseToken
)
address l2LegacyBridge = IL1SharedBridgeLegacy(s.baseTokenBridge).l2BridgeAddress(s.chainId);
proposedUpgrade.l2ProtocolUpgradeTx.data = bytes.concat(
l2TxDataStart,
bytes32(uint256(uint160(l2LegacyBridge))),
l2TxDataFinish
);
encodedInput.forceDeployments[encodedInput.l2GatewayUpgradePosition].input = gatewayUpgradeCalldata;

proposedUpgrade.l2ProtocolUpgradeTx.data = abi.encodeCall(
IL2ContractDeployer.forceDeployOnAddresses,
(encodedInput.forceDeployments)
);

// slither-disable-next-line controlled-delegatecall
(bool success, ) = THIS_ADDRESS.delegatecall(abi.encodeCall(IGatewayUpgrade.upgradeExternal, proposedUpgrade));
if (!success) {
revert GatewayUpgradeFailed();
}
// solhint-disable-next-line gas-custom-errors
require(success, "GatewayUpgrade: upgrade failed");
return Diamond.DIAMOND_INIT_SUCCESS_RETURN_VALUE;
}

Expand Down
Loading
Loading