-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into deniallugo-chain-registrator
- Loading branch information
Showing
66 changed files
with
2,894 additions
and
1,878 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ import {ETH_TOKEN_ADDRESS, TWO_BRIDGES_MAGIC_VALUE} from "../common/Config.sol"; | |
import {IBridgehub, L2TransactionRequestTwoBridgesInner, L2TransactionRequestDirect} from "../bridgehub/IBridgehub.sol"; | ||
import {IGetters} from "../state-transition/chain-interfaces/IGetters.sol"; | ||
import {L2_BASE_TOKEN_SYSTEM_CONTRACT_ADDR} from "../common/L2ContractAddresses.sol"; | ||
import {Unauthorized, ZeroAddress, SharedBridgeValueAlreadySet, SharedBridgeKey, NoFundsTransferred, ZeroBalance, ValueMismatch, TokensWithFeesNotSupported, NonEmptyMsgValue, L2BridgeNotSet, TokenNotSupported, DepositIncorrectAmount, EmptyDeposit, DepositExists, AddressAlreadyUsed, InvalidProof, DepositDoesNotExist, InsufficientChainBalance, SharedBridgeValueNotSet, WithdrawalAlreadyFinalized, WithdrawFailed, L2WithdrawalMessageWrongLength, InvalidSelector, SharedBridgeBalanceMismatch, SharedBridgeValueNotSet} from "../common/L1ContractErrors.sol"; | ||
import {Unauthorized, ZeroAddress, SharedBridgeValueAlreadySet, SharedBridgeKey, NoFundsTransferred, ZeroBalance, ValueMismatch, TokensWithFeesNotSupported, NonEmptyMsgValue, L2BridgeNotSet, TokenNotSupported, DepositIncorrectAmount, EmptyDeposit, DepositExists, AddressAlreadyUsed, InvalidProof, DepositDoesNotExist, InsufficientChainBalance, SharedBridgeValueNotSet, WithdrawalAlreadyFinalized, WithdrawFailed, L2WithdrawalMessageWrongLength, InvalidSelector, SharedBridgeBalanceMismatch, SharedBridgeValueNotSet, NotPendingAdmin, L2BridgeAlreadySet} from "../common/L1ContractErrors.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
|
@@ -130,7 +130,9 @@ contract L1SharedBridge is IL1SharedBridge, ReentrancyGuard, Ownable2StepUpgrade | |
|
||
/// @notice Checks that the message sender is either the owner or admin. | ||
modifier onlyOwnerOrAdmin() { | ||
require(msg.sender == owner() || msg.sender == admin, "ShB not owner or admin"); | ||
if (msg.sender != owner() && msg.sender != admin) { | ||
revert Unauthorized(msg.sender); | ||
} | ||
_; | ||
} | ||
|
||
|
@@ -174,7 +176,9 @@ contract L1SharedBridge is IL1SharedBridge, ReentrancyGuard, Ownable2StepUpgrade | |
/// @notice Accepts transfer of admin rights. Only pending admin can accept the role. | ||
function acceptAdmin() external { | ||
address currentPendingAdmin = pendingAdmin; | ||
require(msg.sender == currentPendingAdmin, "ShB not pending admin"); // Only proposed by current admin address can claim the admin rights | ||
if (msg.sender != currentPendingAdmin) { | ||
revert NotPendingAdmin(); | ||
} | ||
|
||
address previousAdmin = admin; | ||
admin = currentPendingAdmin; | ||
|
@@ -276,8 +280,12 @@ contract L1SharedBridge is IL1SharedBridge, ReentrancyGuard, Ownable2StepUpgrade | |
/// @param _chainId The chain ID for which the l2Bridge address is being initialized. | ||
/// @param _l2BridgeAddress The address of the L2 bridge contract. | ||
function initializeChainGovernance(uint256 _chainId, address _l2BridgeAddress) external onlyOwnerOrAdmin { | ||
require(l2BridgeAddress[_chainId] == address(0), "ShB: l2 bridge already set"); | ||
require(_l2BridgeAddress != address(0), "ShB: l2 bridge 0"); | ||
if (l2BridgeAddress[_chainId] != address(0)) { | ||
revert L2BridgeAlreadySet(_chainId); | ||
} | ||
if (_l2BridgeAddress == address(0)) { | ||
revert ZeroAddress(); | ||
} | ||
l2BridgeAddress[_chainId] = _l2BridgeAddress; | ||
} | ||
|
||
|
@@ -287,7 +295,9 @@ contract L1SharedBridge is IL1SharedBridge, ReentrancyGuard, Ownable2StepUpgrade | |
/// @param _chainId The chain ID for which the l2Bridge address is being initialized. | ||
/// @param _l2BridgeAddress The address of the L2 bridge contract. | ||
function reinitializeChainGovernance(uint256 _chainId, address _l2BridgeAddress) external onlyOwner { | ||
require(l2BridgeAddress[_chainId] != address(0), "ShB: l2 bridge not yet set"); | ||
if (l2BridgeAddress[_chainId] == address(0)) { | ||
revert L2BridgeNotSet(_chainId); | ||
} | ||
l2BridgeAddress[_chainId] = _l2BridgeAddress; | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @dev Represents a call to be made during multicall. | ||
/// @param target The address to which the call will be made. | ||
/// @param value The amount of Ether (in wei) to be sent along with the call. | ||
/// @param data The calldata to be executed on the `target` address. | ||
struct Call { | ||
address target; | ||
uint256 value; | ||
bytes data; | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
// 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 {Call} from "./Common.sol"; | ||
|
||
/// @title Governance contract interface | ||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
|
@@ -18,16 +20,6 @@ interface IGovernance { | |
Done | ||
} | ||
|
||
/// @dev Represents a call to be made during an operation. | ||
/// @param target The address to which the call will be made. | ||
/// @param value The amount of Ether (in wei) to be sent along with the call. | ||
/// @param data The calldata to be executed on the `target` address. | ||
struct Call { | ||
address target; | ||
uint256 value; | ||
bytes data; | ||
} | ||
|
||
/// @dev Defines the structure of an operation that Governance executes. | ||
/// @param calls An array of `Call` structs, each representing a call to be made during the operation. | ||
/// @param predecessor The hash of the predecessor operation, that should be executed before this operation. | ||
|
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
Oops, something went wrong.