Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
805 commits
Select commit Hold shift + click to select a range
b3e2a5b
linting
kelemeno Sep 30, 2025
8e8fb36
build issues
kelemeno Sep 30, 2025
514a330
delete removed contract
kelemeno Sep 30, 2025
d3dcb79
errors lint fix
kelemeno Sep 30, 2025
1cceeb7
more test fixes
kelemeno Sep 30, 2025
7c0a2b7
lint
kelemeno Sep 30, 2025
ee1205d
redundunt check in L1AT
kelemeno Sep 30, 2025
c6d18cb
remove eraVMCTM
kelemeno Sep 30, 2025
f24e144
Update l1-contracts/contracts/bridge/asset-tracker/L1AssetTracker.sol
kelemeno Sep 30, 2025
b32524e
wrong access management for registerL2NativeToken
kelemeno Sep 30, 2025
ba60c62
set L2DaValidator to 0
kelemeno Sep 30, 2025
aea34c8
remove ThisAddress from BaseUupgrade
kelemeno Sep 30, 2025
7ac9441
remove bad onlyChainAdmin
kelemeno Sep 30, 2025
6e6d849
separate out registerNewToken logic
kelemeno Sep 30, 2025
85350f9
fix todos
kelemeno Sep 30, 2025
f1d128e
add back PriorityQueueNotFullyProcessed
kelemeno Sep 30, 2025
5c54719
redundunt asset tracker
kelemeno Oct 1, 2025
191b846
slither fixes
kelemeno Oct 1, 2025
d489db2
add missing error
kelemeno Oct 1, 2025
2cf3811
lint
kelemeno Oct 1, 2025
eeecb94
Merge pull request #1684 from matter-labs/kl/30-09-25
kelemeno Oct 1, 2025
831ebe4
linting
kelemeno Oct 1, 2025
0c89daa
typos
kelemeno Oct 1, 2025
b183a11
fix some zkfoundry tests
kelemeno Oct 1, 2025
24cdb4d
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 1, 2025
0d38d3d
Merge pull request #1686 from matter-labs/kl/01-10-25/1
kelemeno Oct 1, 2025
71673ac
errors
kelemeno Oct 1, 2025
8de412e
Merge pull request #1688 from matter-labs/kl/01-10-25/2
kelemeno Oct 1, 2025
616e068
don't save transient in L1AT for base token
kelemeno Oct 1, 2025
6b458da
check migrate data version
kelemeno Oct 1, 2025
b5e4633
add more comments
StanislavBreadless Oct 1, 2025
ebef355
sync with origin
StanislavBreadless Oct 1, 2025
8567b0d
remove redundunt L2GenesisForceDeployments
kelemeno Oct 1, 2025
d0033af
delete changes to L2BaseToken
kelemeno Oct 1, 2025
2222a14
Merge branch 'kl/01-10-25/4' of ssh://github.com/matter-labs/era-cont…
kelemeno Oct 1, 2025
63a587c
redundunt check
kelemeno Oct 1, 2025
8307029
remove old requestL2TransactionToGatewayMailbox
kelemeno Oct 1, 2025
92be3dd
fix _needToForceSetAssetMigrationOnL2 in l2AT
kelemeno Oct 1, 2025
c106c01
compilation fix
kelemeno Oct 1, 2025
ed9b54c
compilation
kelemeno Oct 1, 2025
3c712c6
fix test and comment
kelemeno Oct 1, 2025
6eec1de
fix double assignment max token bug
kelemeno Oct 1, 2025
c60e6b0
move L2V30upgrade
kelemeno Oct 1, 2025
b2512c3
Merge branch 'draft-v30' of ssh://github.com/matter-labs/era-contract…
kelemeno Oct 1, 2025
e2ac3e8
fixes
kelemeno Oct 1, 2025
9458351
build issues
kelemeno Oct 1, 2025
8097804
build issue
kelemeno Oct 1, 2025
4349eed
setAddressesV30
kelemeno Oct 1, 2025
72c182a
hardcode legacySharedBridgeAddresses
kelemeno Oct 1, 2025
6673bd4
add back pq fully processed check
kelemeno Oct 1, 2025
a5d3ce1
build issues
kelemeno Oct 1, 2025
d23ddce
comment out failing tests
kelemeno Oct 1, 2025
eca1b5b
remove registerNewToken
kelemeno Oct 1, 2025
5371636
incorrect delete bytes32
kelemeno Oct 1, 2025
9562f56
build fixes, lint
0xValera Oct 1, 2025
1111fa6
lint errors
0xValera Oct 1, 2025
c4943fe
build fixes
0xValera Oct 1, 2025
1e7b960
errors lint
0xValera Oct 1, 2025
be956f2
fix
0xValera Oct 1, 2025
a5b15f6
Merge pull request #1691 from matter-labs/kl/01-10-25/merge-draft-v30
kelemeno Oct 1, 2025
7879945
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 1, 2025
ffc603b
linting
kelemeno Oct 1, 2025
fa26fb0
more lint
kelemeno Oct 1, 2025
9abc1fc
fix tests
kelemeno Oct 1, 2025
19ad7f7
missing libraries
kelemeno Oct 1, 2025
8934b46
Merge pull request #1689 from matter-labs/kl/01-10-25/4
kelemeno Oct 1, 2025
c4be9c5
indirect migration for origin chain in L1AT
kelemeno Oct 1, 2025
ff33726
l1 token balance migration
kelemeno Oct 1, 2025
cecce69
parity in L1AT simplification
kelemeno Oct 1, 2025
edc6418
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 1, 2025
76cc6fe
general assetIdCheck in GWAssetTracker
kelemeno Oct 1, 2025
be73d2d
maxChainBalanceAssigned deduplication
kelemeno Oct 1, 2025
87acc97
build issues
kelemeno Oct 1, 2025
e4c1930
linting
kelemeno Oct 1, 2025
d5d1e6d
lint 2
kelemeno Oct 1, 2025
1e55b2f
one more lint
kelemeno Oct 1, 2025
ffb1b13
Merge pull request #1694 from matter-labs/kl/01-10-25/5
kelemeno Oct 2, 2025
2efe252
fix 2 small issues in AT tests
0xValera Oct 2, 2025
f9e9261
Merge pull request #1695 from matter-labs/vg/fix-2-small-foundry-tests
kelemeno Oct 2, 2025
ea05b90
add unpauseDeposits for chain admin (issue #19)
0xValera Oct 2, 2025
0a63088
make signature database update optional to speed up linter
0xValera Oct 2, 2025
6b35266
Delete GatewayUpgrade files (24)
0xValera Oct 2, 2025
39b98b9
linter
0xValera Oct 2, 2025
a44ed0e
chainBalance initialization in L2AT
0xValera Oct 2, 2025
487f501
wait for pause window in _checkV30UpgradeProcessed
0xValera Oct 2, 2025
a39ffdd
add some more comments
StanislavBreadless Oct 2, 2025
104321a
pausedDepositsTimestamp mapping to variable
0xValera Oct 2, 2025
10bbd13
Merge branch 'vg/02-10-2025' of https://github.com/matter-labs/era-co…
0xValera Oct 2, 2025
e802b36
fix + lint after pulling
0xValera Oct 2, 2025
f9498c5
minor updates
StanislavBreadless Oct 2, 2025
578ba46
sync with base
StanislavBreadless Oct 2, 2025
8748252
add permissionless chainBalance initialization to L2AT
0xValera Oct 3, 2025
7aec612
reuse _depositsPaused()
0xValera Oct 3, 2025
68a169c
move depositsPaused check out of _checkV30UpgradeProcessed
0xValera Oct 3, 2025
d79e087
remove redundunt assetMigrationNumber check
kelemeno Oct 3, 2025
e4ae8ca
fix some comments
StanislavBreadless Oct 3, 2025
43ac018
small comment removal, redundunt check, error importing
kelemeno Oct 3, 2025
4d49456
deduplicate maxChainBalanceAssignment
kelemeno Oct 3, 2025
ac13d7e
just return array
kelemeno Oct 3, 2025
133f674
request full list for legacySharedBridge
kelemeno Oct 3, 2025
f9d3fa6
remove onlyWithdrawals
kelemeno Oct 3, 2025
0b875d6
check all batches executed
kelemeno Oct 3, 2025
c18c1ad
rename gateway chain id
kelemeno Oct 3, 2025
d27e121
unneded var
kelemeno Oct 3, 2025
d1a2280
follow CEI
0xValera Oct 3, 2025
3dd0b04
migrateTokenBalance only for tokens native to the current chain
0xValera Oct 3, 2025
89ed957
redundant check
0xValera Oct 3, 2025
4403097
remove l2 native token registration
kelemeno Oct 3, 2025
95a9c9d
remove parity check from L1AT
kelemeno Oct 3, 2025
e15cc51
linting
kelemeno Oct 3, 2025
4e0ae48
lint 2
kelemeno Oct 3, 2025
707c703
errors check
kelemeno Oct 3, 2025
cbf22fb
chainBalance fix
0xValera Oct 3, 2025
31c986f
fix test
kelemeno Oct 3, 2025
3b0abde
Merge pull request #1698 from matter-labs/kl/03-10-25/1
kelemeno Oct 3, 2025
94d2723
address comments
0xValera Oct 3, 2025
55e457c
Merge branch 'kl/medium-interop' of https://github.com/matter-labs/er…
0xValera Oct 3, 2025
e1864ce
Merge pull request #1696 from matter-labs/vg/02-10-2025
kelemeno Oct 3, 2025
6573240
upd bootloader hash
StanislavBreadless Oct 3, 2025
024e8eb
sync with base
StanislavBreadless Oct 3, 2025
6f1da2b
readd parity check
kelemeno Oct 5, 2025
72047aa
parity check comment
kelemeno Oct 5, 2025
8547bcc
delete oz master dependency
StanislavBreadless Oct 5, 2025
a8b4362
adapt deps for removal of master oz
StanislavBreadless Oct 5, 2025
e64b837
migration window check
kelemeno Oct 5, 2025
fbc4180
upd constants
StanislavBreadless Oct 5, 2025
6ef6d39
linting
kelemeno Oct 5, 2025
2c56e35
lint 2
kelemeno Oct 5, 2025
db3bd15
Merge pull request #1701 from matter-labs/kl/05-10-25/add-chain-migra…
kelemeno Oct 5, 2025
308c997
change note of possible deprecation
0xValera Oct 6, 2025
e77e86e
Update l1-contracts/contracts/common/Config.sol
kelemeno Oct 6, 2025
4421880
allow immediate pause of deposits for new chains
0xValera Oct 6, 2025
c6a5244
errors fix
kelemeno Oct 6, 2025
24e13e2
enable migration from GW for when chain migrated back to GW
kelemeno Oct 6, 2025
554d096
save correct savedTotalSupply
kelemeno Oct 6, 2025
21d6f40
missing access control
kelemeno Oct 6, 2025
e84cf10
save chainBalance for correct migration number -2
kelemeno Oct 6, 2025
709cefd
incorrect location in function
kelemeno Oct 6, 2025
01a6ae9
make migrationNumber deprecatable public, delete gated getter
0xValera Oct 6, 2025
c624a99
fixes so far
StanislavBreadless Oct 6, 2025
b870553
gw asset tracker fix
kelemeno Oct 6, 2025
46ae089
Merge branch 'kl/06-10-25/1' of ssh://github.com/matter-labs/era-cont…
kelemeno Oct 6, 2025
ef888ff
lint
0xValera Oct 6, 2025
5a2a7f4
Merge branch 'kl/medium-interop' of https://github.com/matter-labs/er…
0xValera Oct 6, 2025
a6a26cb
errors lint
0xValera Oct 6, 2025
9fa9e2f
add a todo comment
0xValera Oct 6, 2025
0d2a4e0
Various CI fixes (#1690)
zkzoomer Oct 6, 2025
90865fc
Merge branch 'kl/medium-interop' of https://github.com/matter-labs/er…
0xValera Oct 6, 2025
312f02a
Merge branch 'kl/medium-interop' into vg/06-10-2025
0xValera Oct 6, 2025
35c94ec
Apply suggestions from code review
0xValera Oct 6, 2025
c0a2cc2
Merge pull request #1702 from matter-labs/vg/06-10-2025
kelemeno Oct 6, 2025
f68672f
remove unprocessed deposits in GW AT
kelemeno Oct 6, 2025
322fa1d
cherrypick Stas's PR
0xValera Oct 6, 2025
fb6a11d
Merge pull request #1705 from matter-labs/vg/sb-server-fixes-cherrypick
0xValera Oct 6, 2025
f64c0ef
pause deposits on GW
kelemeno Oct 6, 2025
25b20d9
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 6, 2025
4c36eb4
puased deposits check also on GW for chain migration
kelemeno Oct 6, 2025
a5cc118
rename GW savedTotalUpply
kelemeno Oct 6, 2025
ebb95f6
migrationNumber selector
kelemeno Oct 6, 2025
1065567
some comments
0xValera Oct 6, 2025
00ba368
server bump
zkzoomer Oct 6, 2025
ce365aa
L1BatchEnv fixes
zkzoomer Oct 6, 2025
ec71a1b
replay protection
kelemeno Oct 6, 2025
b08496e
some more comments
0xValera Oct 6, 2025
1a32cf2
lint
0xValera Oct 6, 2025
10cd713
Merge branch 'kl/medium-interop' of https://github.com/matter-labs/er…
0xValera Oct 6, 2025
005d439
slither silencers
0xValera Oct 6, 2025
508a518
fix dependencies
zkzoomer Oct 6, 2025
83369c6
fix test
zkzoomer Oct 6, 2025
1b26555
some more fixes
0xValera Oct 6, 2025
1ed4348
Merge pull request #1706 from matter-labs/sma/medium-interop-ci-fixes-ii
kelemeno Oct 6, 2025
f01dde5
fix link in readme
0xValera Oct 6, 2025
c022c57
address outdated comment
0xValera Oct 6, 2025
34f3a5d
typo
0xValera Oct 6, 2025
b7d1f05
add interop balance change
kelemeno Oct 6, 2025
44c3997
testing linting
kelemeno Oct 6, 2025
9a4e523
add AssetTracker to mocks
zkzoomer Oct 6, 2025
cea5177
Merge pull request #1707 from matter-labs/vg/fix-broken-link
kelemeno Oct 6, 2025
e954643
lint
zkzoomer Oct 6, 2025
10c283a
reentrancy, typo
kelemeno Oct 6, 2025
5b5b9a1
slither 2
kelemeno Oct 6, 2025
c6c17b1
fix constants
zkzoomer Oct 6, 2025
c5983ae
fixing contract size
kelemeno Oct 6, 2025
48f64de
linting
kelemeno Oct 6, 2025
4c1e38d
errors
kelemeno Oct 6, 2025
22afe1e
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 6, 2025
1129bc7
avoid avoidViaIrStruct
0xValera Oct 7, 2025
7831684
stylistic issues
0xValera Oct 7, 2025
f32677e
avoid stack too deep
0xValera Oct 7, 2025
5e1200e
lint
0xValera Oct 7, 2025
d8c9cc5
a bit more
0xValera Oct 7, 2025
bf00aad
Merge pull request #1699 from matter-labs/sb/additional-comments-for-…
kelemeno Oct 7, 2025
5ddc2b5
Merge pull request #1709 from matter-labs/vg/avoid-avoid-via-ir
kelemeno Oct 7, 2025
11fe14b
Merge branch 'kl/medium-interop' of ssh://github.com/matter-labs/era-…
kelemeno Oct 7, 2025
f1e259f
push for review, incomplete
kelemeno Oct 7, 2025
d0f1bec
linting
kelemeno Oct 7, 2025
d12dc60
fix issue with l1 asset tracker token balance migration
kelemeno Oct 7, 2025
e7947c8
source vs destination chain id
kelemeno Oct 7, 2025
166ec4e
source vs destination chain id 2
kelemeno Oct 7, 2025
ada702b
rename pauseDepositsBeforeInitiatingMigration
kelemeno Oct 7, 2025
a531675
save chainBalance correctly, don't reset chainBalance to 0
kelemeno Oct 7, 2025
907cfef
save chainBalance in confirmMigrationOnGateway
kelemeno Oct 7, 2025
7e82465
replace chainBalance increase with special function
kelemeno Oct 7, 2025
f894e11
only pause deposits on L1
kelemeno Oct 7, 2025
ca7ac52
add l1 chain id check in IH
kelemeno Oct 7, 2025
f7065f7
linting
kelemeno Oct 7, 2025
639f7e2
no iterated migrations
kelemeno Oct 7, 2025
f33b264
deduplicate some code
kelemeno Oct 7, 2025
6ad872d
linting
kelemeno Oct 7, 2025
92d56bf
one more comment
kelemeno Oct 7, 2025
7fcd5f2
fix test
kelemeno Oct 7, 2025
227955a
Merge pull request #1703 from matter-labs/kl/06-10-25/1
kelemeno Oct 7, 2025
313c35a
delete received interop messages
kelemeno Oct 7, 2025
1d3452c
linting
kelemeno Oct 7, 2025
923f5bd
Merge pull request #1710 from matter-labs/kl/07-10-25/1
kelemeno Oct 7, 2025
a290ce1
add back assetMigratin check
kelemeno Oct 7, 2025
4b0c50e
correct aMN check
kelemeno Oct 7, 2025
884d5bd
A bit more comments (#1712)
StanislavBreadless Oct 7, 2025
2f88afe
Merge pull request #1711 from matter-labs/kl/07-10-25/2
kelemeno Oct 7, 2025
be61bd9
Kl/08 10 25/oz fixes (#1714)
kelemeno Oct 8, 2025
21e0ad4
sync with base
StanislavBreadless Oct 8, 2025
a6c9e56
small issue in gw at
StanislavBreadless Oct 10, 2025
a2c706a
upd test
StanislavBreadless Oct 10, 2025
ed31c01
Merge branch 'draft-v30' of ssh://github.com/matter-labs/era-contract…
kelemeno Oct 13, 2025
b56fcb4
build fixes
kelemeno Oct 13, 2025
d5a5e31
stack too deep
kelemeno Oct 13, 2025
20f2dbe
wrong contract name
kelemeno Oct 13, 2025
6915321
selectors
kelemeno Oct 13, 2025
5af0e12
add initialChainMigrationNumber
kelemeno Oct 14, 2025
73d998a
linting
kelemeno Oct 14, 2025
68ab974
upd
StanislavBreadless Oct 14, 2025
8691f05
small fixes to base token
kelemeno Oct 15, 2025
4b08f5b
Merge branch 'sb/fix-kl-medium-interop-server' of ssh://github.com/ma…
kelemeno Oct 15, 2025
524c0cd
fix test
kelemeno Oct 17, 2025
3d96c70
linting
kelemeno Oct 17, 2025
5190830
Merge pull request #1721 from matter-labs/kl/13-10-25/merge-draft
kelemeno Oct 17, 2025
1079469
Merge branch 'draft-v30' of ssh://github.com/matter-labs/era-contract…
kelemeno Oct 17, 2025
d86014c
imports
kelemeno Oct 17, 2025
43496f7
getting to build
kelemeno Oct 17, 2025
7cdf58b
lint
kelemeno Oct 17, 2025
899b659
Merge pull request #1733 from matter-labs/kl/17-10-25/merge-draft
kelemeno Oct 17, 2025
39c0970
add back paused deposits to make it mergeable
kelemeno Oct 17, 2025
f631ebd
avoid AvoidStackTooDeep struct
0xValera Oct 17, 2025
fd84f92
fix build
0xValera Oct 17, 2025
68f79ed
Merge remote-tracking branch 'origin/draft-v30' into kl/medium-interop
zkzoomer Oct 22, 2025
0741356
merge fixes
zkzoomer Oct 22, 2025
3fcd17d
Merge branch 'kl/medium-interop' into sb/fix-kl-medium-interop-server
zkzoomer Oct 22, 2025
3bef405
Merge pull request #1724 from matter-labs/kl/13-10-25/iterated-migrat…
kelemeno Oct 24, 2025
7455f1f
Revert "linting"
kelemeno Oct 28, 2025
4ed0218
Revert "add initialChainMigrationNumber"
kelemeno Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install foundry-zksync
run: |
mkdir ./foundry-zksync
curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-27360d4c8d12beddbb730dae07ad33a206b38f4b/foundry_nightly_linux_amd64.tar.gz
curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-34fe0bc655c6b15e869ffd465addde001f6b474d/foundry_nightly_linux_amd64.tar.gz
tar zxf foundry_nightly_linux_amd64.tar.gz -C ./foundry-zksync
chmod +x ./foundry-zksync/forge ./foundry-zksync/cast
echo "$PWD/foundry-zksync" >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/invariant-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install foundry-zksync
uses: dutterbutter/foundry-zksync-toolchain@5b0459c3701903f1913b8b2558a22bf49138e495 # v1.0.0
with:
version: nightly-27360d4c8d12beddbb730dae07ad33a206b38f4b
version: nightly-34fe0bc655c6b15e869ffd465addde001f6b474d

- name: Show forge version
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/l1-contracts-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ jobs:
defaults:
run:
working-directory: l1-contracts
needs: [build, lint]
needs: [build] # TODO return lint into dependencies when it's fully fixed
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
system-contracts/zkout

- name: Run coverage
run: yarn test:foundry && yarn coverage:foundry --report summary --report lcov
run: yarn test:foundry --no-match-path 'test/foundry/l1/unit/concrete/Executor/*' && yarn coverage:foundry --report summary --report lcov

# Installing the specific version of `lcov` because of
# the `genhtml: ERROR: line ... of ... has branchcov but no linecov data` error.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ l1-contracts/out/*
l1-contracts/zkout/*
l1-contracts/broadcast/*
l1-contracts/script-config/*
l1-contracts/snapshots/*
!l1-contracts/script-config/artifacts
l1-contracts/script-out/*
l1-contracts/test/foundry/l1/integration/deploy-scripts/script-out/*.toml
Expand Down
1 change: 1 addition & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"func-name-mixedcase": "off",
"func-named-parameters": ["error", 4],
"func-visibility": ["error", { "ignoreConstructors": true }],
"import-path-check": "off",
"imports-on-top": "error",
"max-states-count": "off",
"modifier-name-mixedcase": "error",
Expand Down
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ l1-contracts/lib
l1-contracts/node_modules
l1-contracts/contracts/dev-contracts
l1-contracts/test
l1-contracts/snapshots/*
l1-contracts/deploy-scripts
!l1-contracts/deploy-scripts/DeployCTM.s.sol
!l1-contracts/deploy-scripts/DeployUtils.s.sol
Expand Down
1,492 changes: 1,222 additions & 270 deletions AllContractsHashes.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/chain_management/upgrade_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Upgrade information is composed in the form of a [DiamondCutData](../../l1-contr
1. [BaseZkSyncUpgrade](../../l1-contracts/contracts/upgrades/BaseZkSyncUpgrade.sol) - Generic template with function that can be useful for upgrades
2. [DefaultUpgrade](../../l1-contracts/contracts/upgrades/DefaultUpgrade.sol) - Default implementation of the `BaseZkSyncUpgrade`, contract that is most often planned to be used as diamond initialization when doing upgrades.

> Note, that the Gateway upgrade will be more complex than the usual ones and so a similar, but separate [process](<../upgrade_history/gateway_preparation_upgrade/upgrade_process_(no_gateway_chain).md>) will be used for it. It will also use its own custom implementation of the `BaseZkSyncUpgrade`: [GatewayUpgrade](../../l1-contracts/contracts/upgrades/GatewayUpgrade.sol).
> Note, that the Gateway upgrade was more complex than the usual ones and so a similar, but separate [process](<../upgrade_history/gateway_preparation_upgrade/upgrade_process_(no_gateway_chain).md>) was used for it. It was done using its own custom implementation of the `BaseZkSyncUpgrade`: [GatewayUpgrade](https://github.com/matter-labs/era-contracts/blob/14961f1efecac1030139c4cf0655b14135197772/l1-contracts/contracts/upgrades/GatewayUpgrade.sol).

### Protocol version

Expand Down
1 change: 1 addition & 0 deletions l1-contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ 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
CONTRACTS_PATH=..
6 changes: 5 additions & 1 deletion l1-contracts/contracts/bridge/BridgeHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {DataEncoding} from "../common/libraries/DataEncoding.sol";
* @notice Helper library for working with native tokens on both L1 and L2.
*/
library BridgeHelper {
/// @dev Receives and parses (name, symbol, decimals) from the token contract
/// @notice Retrieves and encodes token metadata (name, symbol, decimals) for bridging purposes.
/// @dev For ETH_TOKEN_ADDRESS, returns hardcoded ETH metadata.
/// @param _token The token address to query metadata from.
/// @param _originChainId The chain ID where the token originates.
/// @return Encoded token data containing name, symbol, decimals, and origin chain ID.
function getERC20Getters(address _token, uint256 _originChainId) internal view returns (bytes memory) {
bytes memory name;
bytes memory symbol;
Expand Down
34 changes: 18 additions & 16 deletions l1-contracts/contracts/bridge/BridgedStandardERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ contract BridgedStandardERC20 is ERC20PermitUpgradeable, IBridgedStandardToken,
/// @notice OpenZeppelin token represents `name` and `symbol` as storage variables and `decimals` as constant.
uint8 private decimals_;

/// @notice The l2Bridge now is deprecated, use the L2AssetRouter and L2NativeTokenVault instead.
/// @dev Address of the L2 bridge that is used as trustee who can mint/burn tokens
/// @notice The l2Bridge is deprecated, use the L2AssetRouter and L2NativeTokenVault instead.
/// @dev Address of the deprecated L2 bridge that was used as trustee to mint/burn tokens
address public override l2Bridge;

/// @dev Address of the token on its origin chain that can be deposited to mint this bridged token
Expand All @@ -59,18 +59,14 @@ contract BridgedStandardERC20 is ERC20PermitUpgradeable, IBridgedStandardToken,
originToken
);
}
if (msg.sender != ntv) {
revert Unauthorized(msg.sender);
}
require(msg.sender == ntv, Unauthorized(msg.sender));
_;
}

modifier onlyNextVersion(uint8 _version) {
// The version should be incremented by 1. Otherwise, the governor risks disabling
// future reinitialization of the token by providing too large a version.
if (_version != _getInitializedVersion() + 1) {
revert NonSequentialVersion();
}
require(_version == _getInitializedVersion() + 1, NonSequentialVersion());
_;
}

Expand All @@ -87,9 +83,7 @@ contract BridgedStandardERC20 is ERC20PermitUpgradeable, IBridgedStandardToken,
/// @param _data The additional data that the L1 bridge provide for initialization.
/// In this case, it is packed `name`/`symbol`/`decimals` of the L1 token.
function bridgeInitialize(bytes32 _assetId, address _originToken, bytes calldata _data) external initializer {
if (_originToken == address(0)) {
revert ZeroAddress();
}
require(_originToken != address(0), ZeroAddress());
originToken = _originToken;
assetId = _assetId;

Expand Down Expand Up @@ -160,9 +154,7 @@ contract BridgedStandardERC20 is ERC20PermitUpgradeable, IBridgedStandardToken,
// It is expected that this token is deployed as a beacon proxy, so we'll
// allow the governor of the beacon to reinitialize the token.
address beaconAddress = _getBeacon();
if (msg.sender != UpgradeableBeacon(beaconAddress).owner()) {
revert Unauthorized(msg.sender);
}
require(msg.sender == UpgradeableBeacon(beaconAddress).owner(), Unauthorized(msg.sender));

__ERC20_init_unchained(_newName, _newSymbol);
__ERC20Permit_init(_newName);
Expand All @@ -189,30 +181,40 @@ contract BridgedStandardERC20 is ERC20PermitUpgradeable, IBridgedStandardToken,
emit BridgeBurn(_from, _amount);
}

/// @dev External function to decode a string from bytes.
/// @notice Decodes a string from ABI-encoded bytes.
/// @param _input The ABI-encoded bytes containing a string.
/// @return result The decoded string.
function decodeString(bytes calldata _input) external pure returns (string memory result) {
(result) = abi.decode(_input, (string));
}

/// @dev External function to decode a uint8 from bytes.
/// @notice Decodes a uint8 from ABI-encoded bytes.
/// @param _input The ABI-encoded bytes containing a uint8.
/// @return result The decoded uint8 value.
function decodeUint8(bytes calldata _input) external pure returns (uint8 result) {
(result) = abi.decode(_input, (uint8));
}

/// @notice Returns the token name, reverts if name getter is disabled.
/// @return The token name string.
function name() public view override returns (string memory) {
// If method is not available, behave like a token that does not implement this method - revert on call.
// solhint-disable-next-line reason-string, gas-custom-errors
if (availableGetters.ignoreName) revert();
return super.name();
}

/// @notice Returns the token symbol, reverts if symbol getter is disabled.
/// @return The token symbol string.
function symbol() public view override returns (string memory) {
// If method is not available, behave like a token that does not implement this method - revert on call.
// solhint-disable-next-line reason-string, gas-custom-errors
if (availableGetters.ignoreSymbol) revert();
return super.symbol();
}

/// @notice Returns the token decimals, reverts if decimals getter is disabled.
/// @return The number of decimals for the token.
function decimals() public view override returns (uint8) {
// If method is not available, behave like a token that does not implement this method - revert on call.
// solhint-disable-next-line reason-string, gas-custom-errors
Expand Down
10 changes: 4 additions & 6 deletions l1-contracts/contracts/bridge/L1BridgeContractErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ pragma solidity ^0.8.21;
error ClaimFailedDepositFailed();
// 0x066f53b1
error EmptyToken();
// 0x6d963f88
error EthTransferFailed();
// 0x82b0de47
error EthAlreadyMigratedToL1NTV();
// 0x1c55230b
error NativeTokenVaultAlreadySet();
// 0xfeda3bf8
error WrongAmountTransferred(uint256 balance, uint256 nullifierChainBalance);
// 0x84204265
error TokenAlreadyInBridgedTokensList();
// 0xb4aeddbc
error WrongCounterpart();
// 0x636c90db
error WrongL2Sender(address providedL2Sender);
// 0x61cdb17e
error WrongMsgLength(uint256 expected, uint256 length);
// 0xe4742c42
error ZeroAmountToTransfer();
37 changes: 15 additions & 22 deletions l1-contracts/contracts/bridge/L1ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
ERA_CHAIN_ID = _eraChainId;
}

/// @dev Initializes the reentrancy guard. Expected to be used in the proxy.
/// @notice Initializes the reentrancy guard for the proxy implementation.
function initialize() external reentrancyGuardInitializer {}

/*//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -131,9 +131,7 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
bytes calldata _message,
bytes32[] calldata _merkleProof
) external nonReentrant {
if (isWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex]) {
revert WithdrawalAlreadyFinalized();
}
require(!isWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex], WithdrawalAlreadyFinalized());
// We don't need to set finalizeWithdrawal here, as we set it in the L1 Nullifier

FinalizeL1DepositParams memory finalizeWithdrawalParams = FinalizeL1DepositParams({
Expand All @@ -149,7 +147,6 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
}

/// @notice Initiates a deposit by locking funds on the contract and sending the request
/// @dev Initiates a deposit by locking funds on the contract and sending the request
/// of processing an L2 transaction where tokens would be minted
/// @dev If the token is bridged for the first time, the L2 token contract will be deployed. Note however, that the
/// newly-deployed token does not support any custom logic, i.e. rebase tokens' functionality is not supported.
Expand Down Expand Up @@ -181,18 +178,12 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
uint256 _l2TxGasPerPubdataByte,
address _refundRecipient
) public payable nonReentrant returns (bytes32 l2TxHash) {
if (_amount == 0) {
// empty deposit amount
revert EmptyDeposit();
}
if (_l1Token == ETH_TOKEN_ADDRESS) {
revert ETHDepositNotSupported();
}
// empty deposit amount
require(_amount != 0, EmptyDeposit());
require(_l1Token != ETH_TOKEN_ADDRESS, ETHDepositNotSupported());
uint256 amount = _approveFundsToAssetRouter(msg.sender, IERC20(_l1Token), _amount);
if (amount != _amount) {
// The token has non-standard transfer logic
revert TokensWithFeesNotSupported();
}
// The token has non-standard transfer logic
require(amount == _amount, TokensWithFeesNotSupported());

l2TxHash = L1_ASSET_ROUTER.depositLegacyErc20Bridge{value: msg.value}({
_originalCaller: msg.sender,
Expand All @@ -204,9 +195,8 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
_refundRecipient: _refundRecipient
});
// Ensuring that all the funds that were locked into this bridge were spent by the asset router / native token vault.
if (IERC20(_l1Token).allowance(address(this), address(L1_ASSET_ROUTER)) != 0) {
revert AssetRouterAllowanceNotZero();
}
uint256 allowance = IERC20(_l1Token).allowance(address(this), address(L1_ASSET_ROUTER));
require(allowance == 0, AssetRouterAllowanceNotZero());
depositAmount[msg.sender][_l1Token][l2TxHash] = _amount;
emit DepositInitiated({
l2DepositTxHash: l2TxHash,
Expand All @@ -223,6 +213,9 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {

/// @dev Transfers tokens from the depositor address to this contract and force approves those
/// to the asset router address.
/// @param _from The address to transfer tokens from.
/// @param _token The ERC20 token to transfer.
/// @param _amount The amount of tokens to transfer.
/// @return The difference between the contract balance before and after the transferring of funds.
function _approveFundsToAssetRouter(address _from, IERC20 _token, uint256 _amount) internal returns (uint256) {
uint256 balanceBefore = _token.balanceOf(address(this));
Expand Down Expand Up @@ -252,9 +245,7 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
) external nonReentrant {
uint256 amount = depositAmount[_depositSender][_l1Token][_l2TxHash];
// empty deposit
if (amount == 0) {
revert EmptyDeposit();
}
require(amount != 0, EmptyDeposit());
delete depositAmount[_depositSender][_l1Token][_l2TxHash];

L1_NULLIFIER.claimFailedDepositLegacyErc20Bridge({
Expand All @@ -274,6 +265,8 @@ contract L1ERC20Bridge is IL1ERC20Bridge, ReentrancyGuard {
ERA LEGACY GETTERS
//////////////////////////////////////////////////////////////*/

/// @notice Calculates the L2 token address for a given L1 token using CREATE2.
/// @param _l1Token The L1 token address to calculate the L2 counterpart for.
/// @return The L2 token address that would be minted for deposit of the given L1 token on ZKsync Era.
function l2TokenAddress(address _l1Token) external view returns (address) {
bytes32 constructorInputHash = keccak256(abi.encode(l2TokenBeacon, ""));
Expand Down
Loading
Loading