Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
810 commits
Select commit Hold shift + click to select a range
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
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
9efcb94
basic contracts
kelemeno Nov 5, 2025
51af655
chore(v30): make currentSettlementLayerChainId public (#1801)
zkzoomer Nov 6, 2025
0bc7cf0
more fixes
kelemeno Nov 10, 2025
cee7e54
Merge branch 'sb/fix-kl-medium-interop-server' of ssh://github.com/ma…
kelemeno Nov 10, 2025
f9447b5
get interop to work, start debugging aave interactions
kelemeno Nov 11, 2025
8f13871
build fix
kelemeno Nov 11, 2025
7199f9a
linting
kelemeno Nov 11, 2025
4b71920
trace
kelemeno Nov 11, 2025
b59987d
bridge back still failing
kelemeno Nov 11, 2025
0e96ac2
batch number from profos, readme, gas values
kelemeno Nov 20, 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
159 changes: 159 additions & 0 deletions l1-contracts/contracts/dummy-interop/L1InteropHandler.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;


import {L2_BRIDGEHUB_ADDR} from "../common/l2-helpers/L2ContractAddresses.sol";

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used
import {FinalizeL1DepositParams} from "../bridge/interfaces/IL1Nullifier.sol";

/// @author Matter Labs
/// @custom:security-contact security@matterlabs.dev
/// @dev The L1InteropHandler contract is responsible for handling interops from L2.
contract L1InteropHandler {

address public l2InteropCenterAddress;

address public l1BridgehubAddress;

function receiveInteropFromL2(

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_bundleWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_tokenWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_bundleWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_tokenWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_bundleWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated

Check failure on line 18 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

GC: [_tokenWithdrawalParams] argument on Function [receiveInteropFromL2] could be [calldata] if it's not being updated
FinalizeL1DepositParams memory _tokenWithdrawalParams,
FinalizeL1DepositParams memory _bundleWithdrawalParams
) external returns (address l1Receiver, address l1Token, uint256 amount) {
(l1Receiver, l1Token, amount) = _parseL2WithdrawalMessage(_tokenWithdrawalParams.message);

// deploy shadow account if needed
address shadowAccount = _deployShadowAccount(_tokenWithdrawalParams.l2Sender);

Check failure on line 25 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "shadowAccount" is unused

Check failure on line 25 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "shadowAccount" is unused

Check failure on line 25 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "shadowAccount" is unused

// execute bundle withdrawal
_executeBundleWithdrawal(_bundleWithdrawalParams);
}

/// @notice Verifies the validity of a withdrawal message from L2 and returns withdrawal details.
/// @param _finalizeWithdrawalParams The structure that holds all necessary data to finalize withdrawal
/// @return assetId The ID of the bridged asset.
/// @return transferData The transfer data used to finalize withdawal.
function _verifyWithdrawal(
FinalizeL1DepositParams memory _finalizeWithdrawalParams,
bool overrideL2Sender

Check failure on line 37 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "overrideL2Sender" is unused

Check failure on line 37 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "overrideL2Sender" is unused

Check failure on line 37 in l1-contracts/contracts/dummy-interop/L1InteropHandler.sol

View workflow job for this annotation

GitHub Actions / lint

Variable "overrideL2Sender" is unused
) internal returns (bytes32 assetId, bytes memory transferData) {
(assetId, transferData) = _parseL2WithdrawalMessage(
_finalizeWithdrawalParams.chainId,
_finalizeWithdrawalParams.message
);
L2Message memory l2ToL1Message;
{
address l2Sender = _finalizeWithdrawalParams.l2Sender;
bool baseTokenWithdrawal = (assetId == BRIDGE_HUB.baseTokenAssetId(_finalizeWithdrawalParams.chainId));

bool isL2SenderCorrect = l2Sender == L2_ASSET_ROUTER_ADDR ||
l2Sender == L2_BASE_TOKEN_SYSTEM_CONTRACT_ADDR ||
l2Sender == __DEPRECATED_l2BridgeAddress[_finalizeWithdrawalParams.chainId];
if (!isL2SenderCorrect) {
revert WrongL2Sender(l2Sender);
}

l2ToL1Message = L2Message({
txNumberInBatch: _finalizeWithdrawalParams.l2TxNumberInBatch,
sender: baseTokenWithdrawal ? L2_BASE_TOKEN_SYSTEM_CONTRACT_ADDR : l2Sender,
data: _finalizeWithdrawalParams.message
});
}

bool success = BRIDGE_HUB.proveL2MessageInclusion({
_chainId: _finalizeWithdrawalParams.chainId,
_batchNumber: _finalizeWithdrawalParams.l2BatchNumber,
_index: _finalizeWithdrawalParams.l2MessageIndex,
_message: l2ToL1Message,
_proof: _finalizeWithdrawalParams.merkleProof
});
// withdrawal wrong proof
if (!success) {
revert InvalidProof();
}
}

/// @notice Parses the withdrawal message and returns withdrawal details.
/// @dev Currently, 3 different encoding versions are supported: legacy mailbox withdrawal, ERC20 bridge withdrawal,
/// @dev and the latest version supported by shared bridge. Selectors are used for versioning.
/// @param _chainId The ZK chain ID.
/// @param _l2ToL1message The encoded L2 -> L1 message.
/// @return assetId The ID of the bridged asset.
/// @return transferData The transfer data used to finalize withdawal.
function _parseL2WithdrawalMessage(
uint256 _chainId,
bytes memory _l2ToL1message
) internal returns (bytes32 assetId, bytes memory transferData) {
// Please note that there are three versions of the message:
// 1. The message that is sent from `L2BaseToken` to withdraw base token.
// 2. The message that is sent from L2 Legacy Shared Bridge to withdraw ERC20 tokens or base token.
// 3. The message that is sent from L2 Asset Router to withdraw ERC20 tokens or base token.

uint256 amount;
address l1Receiver;

(uint32 functionSignature, uint256 offset) = UnsafeBytes.readUint32(_l2ToL1message, 0);
if (bytes4(functionSignature) == IMailboxImpl.finalizeEthWithdrawal.selector) {
// The data is expected to be at least 56 bytes long.
if (_l2ToL1message.length < 56) {
revert L2WithdrawalMessageWrongLength(_l2ToL1message.length);
}
// this message is a base token withdrawal
(l1Receiver, offset) = UnsafeBytes.readAddress(_l2ToL1message, offset);
// slither-disable-next-line unused-return
(amount, ) = UnsafeBytes.readUint256(_l2ToL1message, offset);
assetId = BRIDGE_HUB.baseTokenAssetId(_chainId);
transferData = DataEncoding.encodeBridgeMintData({
_originalCaller: address(0),
_remoteReceiver: l1Receiver,
// Note, that `assetId` could belong to a token native to an L2, and so
// the logic for determining the correct origin token address will be complex.
// It is expected that this value won't be used in the NativeTokenVault and so providing
// any value is acceptable here.
_originToken: address(0),
_amount: amount,
_erc20Metadata: new bytes(0)
});
} else if (bytes4(functionSignature) == IL1ERC20Bridge.finalizeWithdrawal.selector) {
// this message is a token withdrawal

// Check that the message length is correct.
// It should be equal to the length of the function signature + address + address + uint256 = 4 + 20 + 20 + 32 =
// 76 (bytes).
if (_l2ToL1message.length != 76) {
revert L2WithdrawalMessageWrongLength(_l2ToL1message.length);
}
(l1Receiver, offset) = UnsafeBytes.readAddress(_l2ToL1message, offset);
// We use the IL1ERC20Bridge for backward compatibility with old withdrawals.
address l1Token;
(l1Token, offset) = UnsafeBytes.readAddress(_l2ToL1message, offset);
// slither-disable-next-line unused-return
(amount, ) = UnsafeBytes.readUint256(_l2ToL1message, offset);

assetId = l1NativeTokenVault.ensureTokenIsRegistered(l1Token);
bytes32 expectedAssetId = DataEncoding.encodeNTVAssetId(block.chainid, l1Token);
// This method is only expected to use L1-based tokens.
if (assetId != expectedAssetId) {
revert TokenNotLegacy();
}
transferData = DataEncoding.encodeBridgeMintData({
_originalCaller: address(0),
_remoteReceiver: l1Receiver,
_originToken: l1Token,
_amount: amount,
_erc20Metadata: new bytes(0)
});
} else if (bytes4(functionSignature) == IAssetRouterBase.finalizeDeposit.selector) {
// The data is expected to be at least 68 bytes long to contain assetId.
if (_l2ToL1message.length < 68) {
revert WrongMsgLength(68, _l2ToL1message.length);
}
// slither-disable-next-line unused-return
(, offset) = UnsafeBytes.readUint256(_l2ToL1message, offset); // originChainId, not used for L2->L1 txs
(assetId, offset) = UnsafeBytes.readBytes32(_l2ToL1message, offset);
transferData = UnsafeBytes.readRemainingBytes(_l2ToL1message, offset);
} else {
revert InvalidSelector(bytes4(functionSignature));
}
}

}
28 changes: 28 additions & 0 deletions l1-contracts/contracts/dummy-interop/L1ShadowAccount.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;


import {L2_BRIDGEHUB_ADDR} from "../common/l2-helpers/L2ContractAddresses.sol";

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1ShadowAccount.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1ShadowAccount.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used

Check failure on line 6 in l1-contracts/contracts/dummy-interop/L1ShadowAccount.sol

View workflow job for this annotation

GitHub Actions / lint

imported name L2_BRIDGEHUB_ADDR is not used

/// @author Matter Labs
/// @custom:security-contact security@matterlabs.dev
/// @dev The L1ShadowAccount contract.
contract L1ShadowAccount {

address public l1InteropHandlerAddress;

constructor() {
l1InteropHandlerAddress = msg.sender;
}

function executeFromIH(
address target,
uint256 value,
bytes calldata data
) external {
require(msg.sender == l1InteropHandlerAddress, "L1ShadowAccount: not authorized");
(bool success, ) = target.call{value: value}(data);
require(success, "L1ShadowAccount: call failed");
}
}
34 changes: 34 additions & 0 deletions l1-contracts/contracts/dummy-interop/L2InteropCenter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;


import {L2_BRIDGEHUB_ADDR} from "../common/l2-helpers/L2ContractAddresses.sol";

/// @author Matter Labs
/// @custom:security-contact security@matterlabs.dev
/// @dev The L2InteropCenter contract is responsible for sending interops to L1.
contract L2InteropCenter {

address public l1InteropHandlerAddress;

/// send bundle to L1
/// 1. withdraw token to L1 shadow account
/// 2. deploy shadow account if needed on L1.
/// 3+. arbitrary calls from shadow account to arbitrary L1 contracts.


function sendTokenWithdrawalAndBundleToL1(
bytes32 assetId,
uint256 amount,
ShadowAccountOp[] memory shadowAccountOps
) external {

}

function l1ShadowAccount(
address _l2CallerAddress
) returns (address) {
// get create2 address from l1 interop handler and shadow account bytecode
}
}
Loading