-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sync-layer-stable' of ssh://github.com/matter-labs/era-…
…contracts into kl/l2-native-token
- Loading branch information
Showing
35 changed files
with
2,557 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ import {ReentrancyGuard} from "../common/ReentrancyGuard.sol"; | |
import {TWO_BRIDGES_MAGIC_VALUE} from "../common/Config.sol"; | ||
import {L2_BRIDGEHUB_ADDR} from "../common/L2ContractAddresses.sol"; | ||
|
||
/// @dev The encoding version of the data. | ||
bytes1 constant CTM_DEPLOYMENT_TRACKER_ENCODING_VERSION = 0x01; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
/// @dev Contract to be deployed on L1, can link together other contracts based on AssetInfo. | ||
|
@@ -25,9 +28,6 @@ contract CTMDeploymentTracker is ICTMDeploymentTracker, ReentrancyGuard, Ownable | |
/// @dev Bridgehub smart contract that is used to operate with L2 via asynchronous L2 <-> L1 communication. | ||
IAssetRouterBase public immutable override L1_ASSET_ROUTER; | ||
|
||
/// @dev The encoding version of the data. | ||
bytes1 internal constant ENCODING_VERSION = 0x01; | ||
|
||
/// @notice Checks that the message sender is the bridgehub. | ||
modifier onlyBridgehub() { | ||
// solhint-disable-next-line gas-custom-errors | ||
|
@@ -93,7 +93,7 @@ contract CTMDeploymentTracker is ICTMDeploymentTracker, ReentrancyGuard, Ownable | |
|
||
require(_originalCaller == owner(), "CTMDT: not owner"); | ||
bytes1 encodingVersion = _data[0]; | ||
require(encodingVersion == ENCODING_VERSION, "CTMDT: wrong encoding version"); | ||
require(encodingVersion == CTM_DEPLOYMENT_TRACKER_ENCODING_VERSION, "CTMDT: wrong encoding version"); | ||
(address _ctmL1Address, address _ctmL2Address) = abi.decode(_data[1:], (address, address)); | ||
|
||
request = _registerCTMAssetOnL2Bridgehub(_chainId, _ctmL1Address, _ctmL2Address); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import {ITransactionFilterer} from "../state-transition/chain-interfaces/ITransa | |
import {IBridgehub} from "../bridgehub/IBridgehub.sol"; | ||
import {IL2Bridge} from "../bridge/interfaces/IL2Bridge.sol"; | ||
import {IAssetRouterBase} from "../bridge/asset-router/IAssetRouterBase.sol"; | ||
import {IL2AssetRouter} from "../bridge/asset-router/IL2AssetRouter.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
|
@@ -82,18 +83,28 @@ contract GatewayTransactionFilterer is ITransactionFilterer, ReentrancyGuard, Ow | |
) external view returns (bool) { | ||
if (sender == L1_ASSET_ROUTER) { | ||
bytes4 l2TxSelector = bytes4(l2Calldata[:4]); | ||
|
||
if (IL2AssetRouter.setAssetHandlerAddress.selector == l2TxSelector) { | ||
(, bytes32 decodedAssetId, ) = abi.decode(l2Calldata[4:], (uint256, bytes32, address)); | ||
return _checkSTMAssetId(decodedAssetId); | ||
} | ||
|
||
if ( | ||
(IAssetRouterBase.finalizeDeposit.selector != l2TxSelector) && | ||
(IL2Bridge.finalizeDeposit.selector != l2TxSelector) | ||
IAssetRouterBase.finalizeDeposit.selector != l2TxSelector && | ||
IL2Bridge.finalizeDeposit.selector != l2TxSelector | ||
) { | ||
revert InvalidSelector(l2TxSelector); | ||
} | ||
|
||
(, bytes32 decodedAssetId, ) = abi.decode(l2Calldata[4:], (uint256, bytes32, bytes)); | ||
address stmAddress = BRIDGE_HUB.ctmAssetIdToAddress(decodedAssetId); | ||
return (stmAddress != address(0)); | ||
return _checkSTMAssetId(decodedAssetId); | ||
} | ||
|
||
return whitelistedSenders[sender]; | ||
} | ||
|
||
function _checkSTMAssetId(bytes32 assetId) internal view returns (bool) { | ||
address stmAddress = BRIDGE_HUB.ctmAssetIdToAddress(assetId); | ||
return stmAddress != address(0); | ||
} | ||
} |
Oops, something went wrong.