Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
3803bf5
interop center comment clarification
0xValera Jun 25, 2025
c8cc107
InteropCenter onlyL1 correct error
0xValera Jun 25, 2025
2ae0ded
fix imports
0xValera Jun 25, 2025
1713601
split setAddresses into two functions, add events
0xValera Jun 25, 2025
6cbda51
onlyL2NotToL1 -> onlyL2ToL2
0xValera Jun 25, 2025
e0a3093
fixing function sections, public -> external
0xValera Jun 25, 2025
931ffe0
nextContract -> to for clarity. fix comments.
0xValera Jun 26, 2025
53c5ef2
pause InteropCenter functionality, lint errors
0xValera Jun 26, 2025
bf37d0d
callAttributes -> attributes for readability and consistency
0xValera Jun 26, 2025
2358b04
Revert "callAttributes -> attributes for readability and consistency"
0xValera Jun 26, 2025
ac45bfb
callAtributes -> attributes for consistency
0xValera Jun 26, 2025
3482e6d
comments fixes
0xValera Jun 26, 2025
57e5d09
if + revert -> require
0xValera Jun 26, 2025
8988efa
verify bundle message sender, lint
0xValera Jun 26, 2025
072de6c
change branching for readability
0xValera Jun 26, 2025
0b150b2
blacklist -> whitelist in status verification in unbundling
0xValera Jun 26, 2025
6ba3f93
shadow account comment
0xValera Jun 26, 2025
07f3150
revert callAttributes -> attributes changes
0xValera Jun 27, 2025
90c5d1d
destination chainId check
0xValera Jun 27, 2025
82208e1
unbundler address check
0xValera Jun 27, 2025
0c09915
Combine _sendBundle and _finalizeAndSendBundle
0xValera Jun 27, 2025
b18fdf9
fix _sendBundle bundleHash
0xValera Jun 27, 2025
0219b32
Revert "split setAddresses into two functions, add events"
0xValera Jul 2, 2025
41121f2
Merge branch 'kl/medium-interop' into vg/interop-center-and-handler-r…
0xValera Jul 4, 2025
dddb810
fix two tests and bug in decodeAddress
0xValera Jul 4, 2025
bf2d9e5
lint
0xValera Jul 8, 2025
26bd484
comment out broken tests (containing hardcoded proof), to be fixed
0xValera Jul 9, 2025
201c643
address -> InteroperableAddress in 7786 attributes
0xValera Jul 9, 2025
6cc17e4
sendCall -> sendMessage, executeMessage -> receiveMessage
0xValera Jul 9, 2025
eae4c41
IERC7786Receiver -> Recipient, fix bug
0xValera Jul 9, 2025
aa67dab
IERC7786 -> IERC7786GatewaySource
0xValera Jul 9, 2025
b4d9df6
7786 events
0xValera Jul 9, 2025
8cfad47
add receiveMessage to InteropHandler for unbundle/execute bundle support
0xValera Jul 9, 2025
67063db
address raised issues
0xValera Jul 10, 2025
afe240a
some test fixes, linting, access control fix
0xValera Jul 10, 2025
ea9290a
remove unused error
0xValera Jul 10, 2025
59d5bd7
fix tests
0xValera Jul 11, 2025
44eec16
Revert "fix tests"
0xValera Jul 11, 2025
dd737a0
fix tests
0xValera Jul 11, 2025
f31f6c5
Merge branch 'kl/medium-interop' into vg/medium-interop-review-fixes
0xValera Jul 11, 2025
7e044d1
linting
0xValera Jul 11, 2025
d0ad54a
add IL2CrossChainSender, polish ILxCrossChainSender's
0xValera Jul 18, 2025
4f56bd5
Merge branch 'kl/medium-interop' into vg/medium-interop-review-fixes
0xValera Jul 18, 2025
1940b80
sync Kalman's fix for onlyAssetRouterCounterpartOrSelf
0xValera Jul 18, 2025
4aea347
Update Messaging.sol
0xValera Jul 21, 2025
96360e3
Update InteropCenter.sol
0xValera Jul 21, 2025
1a46489
Update l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol
0xValera Jul 21, 2025
568e083
unify Unauthorized and InvalidCaller errors
0xValera Jul 21, 2025
25aaba2
Update l1-contracts/contracts/interop/InteropCenter.sol
0xValera Jul 21, 2025
4ba9dff
parseEvmV1Calldata where applicable
0xValera Jul 21, 2025
b228190
remove underscore to keep code consistent
0xValera Jul 21, 2025
bf0c8b9
Update l1-contracts/contracts/interop/InteropCenter.sol
0xValera Jul 21, 2025
7464198
use selector instead of index in AttributeAlreadySet
0xValera Jul 21, 2025
01357d0
Update InteropCenter.sol
0xValera Jul 21, 2025
a88db11
gas optimization
0xValera Jul 21, 2025
53fe4c3
add _ensureL2ToL2 to remove code duplication
0xValera Jul 21, 2025
c9ddc7e
Update InteropErrors.sol
0xValera Jul 21, 2025
16c8a75
restrict state mutability of `_ensureL2ToL2`
nikitastupin-matterlabs Jul 21, 2025
7ee8ca0
wording
nikitastupin-matterlabs Jul 21, 2025
3e01f73
update notice of `initialize`
nikitastupin-matterlabs Jul 21, 2025
c6ca994
add user-facing comments for receiveMessage in IH
0xValera Jul 21, 2025
8991b7a
fix the issue of parsing when the execution address is not specified
0xValera Jul 21, 2025
7005097
simplify require statements
nikitastupin-matterlabs Jul 21, 2025
3aa681f
wording
nikitastupin-matterlabs Jul 21, 2025
8a39b2e
wording
0xValera Jul 21, 2025
3ebb1fc
lint
0xValera Jul 21, 2025
7062284
rework parseAttributes
0xValera Jul 21, 2025
7226db5
sendMessage and sendBundle 7786 events rework
0xValera Jul 21, 2025
1e5c7c8
fix: bundle attributes are used with the `OnlyCallAttributes` restric…
nikitastupin-matterlabs Jul 22, 2025
b692e99
refacot: flatten require statements
nikitastupin-matterlabs Jul 22, 2025
ad21f3a
wording
nikitastupin-matterlabs Jul 22, 2025
4828a27
Revert "sendMessage and sendBundle 7786 events rework"
0xValera Jul 22, 2025
dbf7939
fix compilation, lint
0xValera Jul 22, 2025
3f25388
unify attributes errors into AttributeViolatesRestriction
0xValera Jul 22, 2025
a8e2e07
shuffle gitmodule
0xValera Jul 22, 2025
e56c68d
Merge branch 'kl/medium-interop' into vg/medium-interop-review-fixes
0xValera Jul 22, 2025
66f7434
Update IERC7786Attributes.sol
0xValera Jul 22, 2025
bdfaf6c
events on setAddresses
0xValera Jul 22, 2025
f9cb577
fmt
0xValera Jul 23, 2025
c62089d
add events and storage checks to execute/unbundle bundle tests
0xValera Jul 23, 2025
4ba3f66
linter
0xValera Jul 23, 2025
b7588f7
directCall -> indirectCall
0xValera Jul 23, 2025
f482ce2
add regression test for verify bundle access control fix
0xValera Jul 23, 2025
100ff8f
add regression test for verification of one bundle on multiple chains…
0xValera Jul 23, 2025
01f5b0b
use whitelist in executeBundle, use require
0xValera Jul 23, 2025
c625156
add pause/unpause and setAddresses tests for IC
0xValera Jul 23, 2025
39569c6
public -> internal fix in AssetRouterBase
0xValera Jul 23, 2025
c361bb6
public -> external for functions not used internally
0xValera Jul 23, 2025
b30b0a7
add missing onlyL2InteropCenter
0xValera Jul 23, 2025
6cab264
fix indirectCallMessageValue accounting issue
0xValera Jul 23, 2025
d577e03
remove outdated comments
0xValera Jul 25, 2025
842ec55
interopCenterInitiateBridge -> initiateBridging
0xValera Jul 25, 2025
8fe4540
Update L2AssetRouter.sol
0xValera Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@
[submodule "lib/@matterlabs/zksync-contracts"]
path = lib/@matterlabs/zksync-contracts
url = https://github.com/matter-labs/v2-testnet-contracts
[submodule "l1-contracts/lib/openzeppelin-contracts-master"]
path = l1-contracts/lib/openzeppelin-contracts-master
url = https://github.com/OpenZeppelin/openzeppelin-contracts.git
4 changes: 2 additions & 2 deletions l1-contracts/contracts/bridge/L2SharedBridgeLegacy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {IL2AssetRouter} from "./asset-router/IL2AssetRouter.sol";
import {IL2NativeTokenVault} from "./ntv/IL2NativeTokenVault.sol";

import {IL2SharedBridgeLegacy} from "./interfaces/IL2SharedBridgeLegacy.sol";
import {AmountMustBeGreaterThanZero, DeployFailed, EmptyBytes32, Unauthorized, ZeroAddress, InvalidCaller} from "../common/L1ContractErrors.sol";
import {AmountMustBeGreaterThanZero, DeployFailed, EmptyBytes32, Unauthorized, ZeroAddress} from "../common/L1ContractErrors.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
Expand Down Expand Up @@ -113,7 +113,7 @@ contract L2SharedBridgeLegacy is IL2SharedBridgeLegacy, Initializable {
AddressAliasHelper.undoL1ToL2Alias(msg.sender) != l1Bridge &&
AddressAliasHelper.undoL1ToL2Alias(msg.sender) != l1SharedBridge
) {
revert InvalidCaller(msg.sender);
revert Unauthorized(msg.sender);
}

IL2AssetRouter(L2_ASSET_ROUTER_ADDR).finalizeDepositLegacyBridge({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ abstract contract AssetRouterBase is IAssetRouterBase, Ownable2StepUpgradeable,
bytes32 _assetId,
address _originalCaller,
uint256 _amount
) public payable virtual;
) external payable virtual;

function _bridgehubDepositBaseToken(
uint256 _chainId,
bytes32 _assetId,
address _originalCaller,
uint256 _amount
) public payable virtual {
) internal virtual {
address assetHandler = assetHandlerAddress[_assetId];
require(assetHandler != address(0), AssetHandlerDoesNotExist(_assetId));

Expand Down Expand Up @@ -220,7 +220,7 @@ abstract contract AssetRouterBase is IAssetRouterBase, Ownable2StepUpgradeable,
//////////////////////////////////////////////////////////////*/

/// @inheritdoc IAssetRouterBase
function finalizeDeposit(uint256 _chainId, bytes32 _assetId, bytes calldata _transferData) public payable virtual;
function finalizeDeposit(uint256 _chainId, bytes32 _assetId, bytes calldata _transferData) external payable virtual;

function _finalizeDeposit(
uint256 _chainId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IAssetRouterBase} from "./IAssetRouterBase.sol";
import {L2TransactionRequestTwoBridgesInner} from "../../bridgehub/IBridgehub.sol";
import {IL1SharedBridgeLegacy} from "../interfaces/IL1SharedBridgeLegacy.sol";
import {IL1ERC20Bridge} from "../interfaces/IL1ERC20Bridge.sol";
import {IL1CrossChainSender} from "./IL1CrossChainSender.sol";
import {IL1CrossChainSender} from "../interfaces/IL1CrossChainSender.sol";

/// @title L1 Bridge contract interface
/// @author Matter Labs
Expand Down
19 changes: 2 additions & 17 deletions l1-contracts/contracts/bridge/asset-router/IL2AssetRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
pragma solidity ^0.8.20;

import {IAssetRouterBase} from "./IAssetRouterBase.sol";
import {InteropCallStarter} from "../../common/Messaging.sol";
import {IL2CrossChainSender} from "../interfaces/IL2CrossChainSender.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IL2AssetRouter is IAssetRouterBase {
interface IL2AssetRouter is IAssetRouterBase, IL2CrossChainSender {
event WithdrawalInitiatedAssetRouter(
uint256 chainId,
address indexed l2Sender,
Expand Down Expand Up @@ -37,19 +37,4 @@ interface IL2AssetRouter is IAssetRouterBase {
/// a legacy asset.
/// @param _assetId The assetId of the legacy token.
function setLegacyTokenAssetHandler(bytes32 _assetId) external;

/// @notice Function that returns an InteropCallStarter corresponding to the interop call. Effectively this initiates bridging,
/// BH part is processed within this function via `_bridgehubDeposit` call which also returns the data for an l2 call
/// on the destination chain (which will be processed with the returned InteropCallStarter from this function).
/// @param _chainId Destination chain ID.
/// @param _originalCaller The `msg.sender` address from the external call that initiated current one.
/// @param _value The `msg.value` to be deposited on the target chain.
/// @param _data The calldata for the second bridge deposit.
/// @return interopCallStarter InteropCallStarter corresponding to the second bridge call.
function interopCenterInitiateBridge(
uint256 _chainId,
address _originalCaller,
uint256 _value,
bytes calldata _data
) external payable returns (InteropCallStarter memory interopCallStarter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {IL1AssetRouter} from "./IL1AssetRouter.sol";
import {IL2AssetRouter} from "./IL2AssetRouter.sol";
import {IAssetRouterBase, LEGACY_ENCODING_VERSION, SET_ASSET_HANDLER_COUNTERPART_ENCODING_VERSION} from "./IAssetRouterBase.sol";
import {AssetRouterBase} from "./AssetRouterBase.sol";
import {IL1CrossChainSender} from "../interfaces/IL1CrossChainSender.sol";

import {IL1AssetHandler} from "../interfaces/IL1AssetHandler.sol";
import {IL1ERC20Bridge} from "../interfaces/IL1ERC20Bridge.sol";
Expand Down Expand Up @@ -195,7 +196,7 @@ contract L1AssetRouter is AssetRouterBase, IL1AssetRouter, ReentrancyGuard {
_bridgehubDepositBaseToken(_chainId, _assetId, _originalCaller, _amount);
}

/// @inheritdoc IL1AssetRouter
/// @inheritdoc IL1CrossChainSender
function bridgehubDeposit(
uint256 _chainId,
address _originalCaller,
Expand Down
70 changes: 30 additions & 40 deletions l1-contracts/contracts/bridge/asset-router/L2AssetRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity 0.8.28;

import {IL2AssetRouter} from "./IL2AssetRouter.sol";
import {IL2CrossChainSender} from "../interfaces/IL2CrossChainSender.sol";
import {IAssetRouterBase} from "./IAssetRouterBase.sol";
import {AssetRouterBase} from "./AssetRouterBase.sol";

Expand All @@ -20,15 +21,16 @@ import {InteropCallStarter} from "../../common/Messaging.sol";
import {L2_BRIDGEHUB_ADDR, L2_INTEROP_CENTER_ADDR, L2_NATIVE_TOKEN_VAULT_ADDR} from "../../common/l2-helpers/L2ContractAddresses.sol";
import {L2ContractHelper} from "../../common/l2-helpers/L2ContractHelper.sol";
import {DataEncoding} from "../../common/libraries/DataEncoding.sol";
import {AmountMustBeGreaterThanZero, AssetIdNotSupported, EmptyAddress, InvalidCaller, Unauthorized, TokenNotLegacy, InvalidSelector, PayloadTooShort, ExecuteMessageFailed} from "../../common/L1ContractErrors.sol";
import {IERC7786Receiver} from "../../interop/IERC7786Receiver.sol";
import {AmountMustBeGreaterThanZero, AssetIdNotSupported, EmptyAddress, Unauthorized, TokenNotLegacy, InvalidSelector, PayloadTooShort, ExecuteMessageFailed} from "../../common/L1ContractErrors.sol";
import {IERC7786Recipient} from "../../interop/IERC7786Recipient.sol";
import {IERC7786Attributes} from "../../interop/IERC7786Attributes.sol";
import {InteroperableAddress} from "@openzeppelin/contracts-master/utils/draft-InteroperableAddress.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
/// @notice The "default" bridge implementation for the ERC20 tokens. Note, that it does not
/// support any custom token logic, i.e. rebase tokens' functionality is not supported.
contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC7786Receiver {
contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC7786Recipient {
/// @dev The address of the L2 legacy shared bridge.
address public immutable L2_LEGACY_SHARED_BRIDGE;

Expand All @@ -42,9 +44,9 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC
modifier onlyAssetRouterCounterpart(uint256 _originChainId) {
if (_originChainId == L1_CHAIN_ID) {
// Only the L1 Asset Router counterpart can initiate and finalize the deposit.
require(AddressAliasHelper.undoL1ToL2Alias(msg.sender) == L1_ASSET_ROUTER, InvalidCaller(msg.sender));
require(AddressAliasHelper.undoL1ToL2Alias(msg.sender) == L1_ASSET_ROUTER, Unauthorized(msg.sender));
} else {
revert InvalidCaller(msg.sender); // xL2 messaging not supported for now
revert Unauthorized(msg.sender);
}
_;
}
Expand All @@ -53,27 +55,25 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC
modifier onlyAssetRouterCounterpartOrSelf(uint256 _chainId) {
if (_chainId == L1_CHAIN_ID) {
// Only the L1 Asset Router counterpart can initiate and finalize the deposit.
if (
(AddressAliasHelper.undoL1ToL2Alias(msg.sender) != L1_ASSET_ROUTER) &&
msg.sender != address(this) &&
(AddressAliasHelper.undoL1ToL2Alias(msg.sender) != address(this))
) {
revert InvalidCaller(msg.sender);
if ((AddressAliasHelper.undoL1ToL2Alias(msg.sender) != L1_ASSET_ROUTER) && msg.sender != address(this)) {
revert Unauthorized(msg.sender);
}
} else {
revert InvalidCaller(msg.sender); // xL2 messaging not supported for now
if (msg.sender != address(this)) {
revert Unauthorized(msg.sender);
}
}
_;
}

/// @notice Checks that the message sender is the legacy L2 bridge.
modifier onlyLegacyBridge() {
require(msg.sender == L2_LEGACY_SHARED_BRIDGE, InvalidCaller(msg.sender));
require(msg.sender == L2_LEGACY_SHARED_BRIDGE, Unauthorized(msg.sender));
_;
}

modifier onlyNTV() {
require(msg.sender == L2_NATIVE_TOKEN_VAULT_ADDR, InvalidCaller(msg.sender));
require(msg.sender == L2_NATIVE_TOKEN_VAULT_ADDR, Unauthorized(msg.sender));
_;
}

Expand Down Expand Up @@ -130,42 +130,32 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC
}

/// @notice Executes cross-chain interop messages following ERC-7786 standard
/// @param messageId Gateway-specific message identifier (currently unused)
/// @param sourceChain CAIP-2 chain identifier where the message originated
/// @param sender CAIP-10 account address that initiated the cross-chain message
/// @param sender ERC-7930 Address of the message sender
/// @param payload Encoded function call data (must be finalizeDeposit)
/// @param attributes ERC-7786 message attributes (currently unused)
/// @return Function selector confirming successful execution per ERC-7786
function executeMessage(
// kl todo: change back to strings
// solhint-disable-next-line no-unused-vars
bytes32 messageId, // Gateway-specific message identifier
uint256 sourceChain, // [CAIP-2] chain identifier
address sender, // [CAIP-10] account address
bytes calldata payload,
// solhint-disable-next-line no-unused-vars
bytes[] calldata attributes
function receiveMessage(
bytes32 /* receiveId */, // Unique identifier
bytes calldata sender, // ERC-7930 address
bytes calldata payload
) external payable returns (bytes4) {
// This function serves as the L2AssetRouter's entry point for processing cross-chain bridge operations
// initiated through the InteropCenter system. It implements critical security validations:
// - L1->L2 calls: Only L1_ASSET_ROUTER can send messages from L1_CHAIN_ID
// - L1->L2 calls: Currently Interop can only be initiated on L2, so this case shouldn't be covered.
// - L2->L2 calls: Only this contract (L2AssetRouter) can send messages from other L2 chains
//
// This dual validation prevents attackers from spoofing cross-chain messages by requiring
// both correct source chain ID and authorized sender address.
//
// INDIRECT CALL PATTERN (L2->L2 interop flow):
// 1. User calls InteropCenter on source L2
// 2. InteropCenter calls interopCenterInitiateBridge() on source chain's L2AssetRouter
// 2. InteropCenter calls initiateBridging() on source chain's L2AssetRouter
// 3. Source L2AssetRouter becomes the "sender" for the destination L2 call
// 4. Destination L2 validates sender == address(this) for non-L1 sources
// 4. Destination L2 validates senderAddress == address(this) for non-L1 sources
// (L2AssetRouter address is equal for all ZKsync chains)

require(
(sourceChain == L1_CHAIN_ID && sender == L1_ASSET_ROUTER) ||
(sourceChain != L1_CHAIN_ID && sender == address(this)),
InvalidCaller(sender)
);
(uint256 senderChainId, address senderAddress) = InteroperableAddress.parseEvmV1Calldata(sender);

require((senderChainId != L1_CHAIN_ID && senderAddress == address(this)), Unauthorized(senderAddress));

// The payload must contain a valid finalizeDeposit selector to ensure only legitimate
// bridge operations are executed. This prevents arbitrary function calls through the interop system.
Expand All @@ -177,7 +167,7 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC

(bool success, ) = address(this).call(payload);
require(success, ExecuteMessageFailed());
return IERC7786Receiver.executeMessage.selector;
return IERC7786Recipient.receiveMessage.selector;
}

/*//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -219,13 +209,13 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC
emit DepositFinalizedAssetRouter(_originChainId, _assetId, _transferData);
}

/// @inheritdoc IL2AssetRouter
function interopCenterInitiateBridge(
/// @inheritdoc IL2CrossChainSender
function initiateBridging(
uint256 _chainId,
address _originalCaller,
uint256 _value,
bytes calldata _data
) external payable returns (InteropCallStarter memory interopCallStarter) {
) external payable onlyL2InteropCenter returns (InteropCallStarter memory interopCallStarter) {
// This function is called by the InteropCenter when processing indirect interop calls.
// It prepares the bridge operation for cross-chain execution through these steps:
// 1. Processing the deposit through the standard bridgehub flow
Expand All @@ -252,7 +242,7 @@ contract L2AssetRouter is AssetRouterBase, IL2AssetRouter, ReentrancyGuard, IERC
bytes[] memory attributes = new bytes[](1);
attributes[0] = abi.encode(IERC7786Attributes.interopCallValue.selector, _value);
interopCallStarter = InteropCallStarter({
nextContract: request.l2Contract,
to: request.l2Contract,
data: request.l2Calldata,
callAttributes: attributes
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {L2_ASSET_ROUTER_ADDR, L2_ASSET_TRACKER_ADDR, L2_INTEROP_CENTER_ADDR, L2_
import {DataEncoding} from "../../common/libraries/DataEncoding.sol";
import {IAssetRouterBase} from "../asset-router/IAssetRouterBase.sol";
import {INativeTokenVault} from "../ntv/INativeTokenVault.sol";
import {InsufficientChainBalanceAssetTracker, InvalidInteropCalldata, InvalidMessage, InvalidProof, ReconstructionMismatch, Unauthorized, ChainIdNotRegistered} from "../../common/L1ContractErrors.sol";
import {InsufficientChainBalanceAssetTracker, InvalidInteropCalldata, InvalidMessage, InvalidProof, ReconstructionMismatch, Unauthorized, ChainIdNotRegistered, InvalidChainId} from "../../common/L1ContractErrors.sol";
import {IMessageRoot} from "../../bridgehub/IMessageRoot.sol";
import {ProcessLogsInput} from "../../state-transition/chain-interfaces/IExecutor.sol";
import {DynamicIncrementalMerkleMemory} from "../../common/libraries/DynamicIncrementalMerkleMemory.sol";
Expand All @@ -24,7 +24,7 @@ import {FinalizeL1DepositParams} from "../../bridge/interfaces/IL1Nullifier.sol"
import {TransientPrimitivesLib} from "../../common/libraries/TransientPrimitves/TransientPrimitives.sol";
import {AddressAliasHelper} from "../../vendor/AddressAliasHelper.sol";
// import {IChainAssetHandler} from "../../bridgehub/IChainAssetHandler.sol";
import {NotMigratedChain, InvalidAssetId, InvalidAmount, InvalidChainId, InvalidSender} from "./AssetTrackerErrors.sol";
import {NotMigratedChain, InvalidAssetId, InvalidAmount, InvalidSender} from "./AssetTrackerErrors.sol";

contract AssetTracker is IAssetTracker, Ownable2StepUpgradeable, AssetHandlerModifiers {
using DynamicIncrementalMerkleMemory for DynamicIncrementalMerkleMemory.Bytes32PushTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ pragma solidity ^0.8.21;
error InvalidAmount();
// 0xfafca5a0
error InvalidAssetId();
// 0x7a47c9a2
error InvalidChainId();
// 0x4ecc0587
error InvalidMigrationNumber();
// 0xddb5de5e
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: MIT
// 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;

import {InteropCallStarter} from "../../common/Messaging.sol";

/// @title L2 Cross Chain Sender interface
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IL2CrossChainSender {
/// @notice Function that returns an InteropCallStarter corresponding to the interop call. Effectively this initiates bridging,
/// BH part is processed within this function via `_bridgehubDeposit` call which also returns the data for an l2 call
/// on the destination chain (which will be processed with the returned InteropCallStarter from this function).
/// @param _chainId Destination chain ID.
/// @param _originalCaller The `msg.sender` address from the external call that initiated current one.
/// @param _value The `msg.value` to be deposited on the target chain.
/// @param _data The calldata for the second bridge deposit.
/// @return interopCallStarter InteropCallStarter corresponding to the second bridge call.
function initiateBridging(
uint256 _chainId,
address _originalCaller,
uint256 _value,
bytes calldata _data
) external payable returns (InteropCallStarter memory interopCallStarter);
}
Loading
Loading