Skip to content

Commit

Permalink
Chore/3446 cleanup errors and interfaces V2 (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: count-sum <andrei.alexandru@consensys.net>
Co-authored-by: thedarkjester <grant.southey@consensys.net>
  • Loading branch information
3 people authored Sep 24, 2024
1 parent 7005fcd commit 39e0d76
Show file tree
Hide file tree
Showing 10 changed files with 398 additions and 407 deletions.
14 changes: 0 additions & 14 deletions contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ pragma solidity 0.8.26;
* @custom:security-contact security-report@linea.build
*/
interface IL1MessageManagerV1 {
/**
* @notice Emitted when L2->L1 message hashes have been added to L1 storage.
* @param messageHash The indexed hash of the message parameters.
* @dev DEPRECATED - This is kept for backwards compatability for external consumers.
*/
event L2L1MessageHashAddedToInbox(bytes32 indexed messageHash);

/**
* @notice Emitted when L1->L2 messages have been anchored on L2 and updated on L1.
* @param messageHashes The collection of hashes indicating which messages were added on L2. of the message parameters.
* @dev DEPRECATED - This is kept for backwards compatability for external consumers.
*/
event L1L2MessagesReceivedOnL2(bytes32[] messageHashes);

/**
* @dev Thrown when the message has already been claimed.
*/
Expand Down
12 changes: 8 additions & 4 deletions contracts/contracts/interfaces/l1/IL1MessageService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ interface IL1MessageService {
bytes data;
}

/**
* @notice Emitted when initializing Linea Rollup contract with a system migration block.
*/
event SystemMigrationBlockInitialized(uint256 systemMigrationBlock);
/**
* @dev Thrown when L2 merkle root does not exist.
*/
Expand All @@ -51,4 +47,12 @@ interface IL1MessageService {
* @dev Thrown when merkle depth doesn't match proof length.
*/
error ProofLengthDifferentThanMerkleDepth(uint256 actual, uint256 expected);

/**
* @notice Claims and delivers a cross-chain message using merkle proof.
* @dev if merkle depth is empty, it will revert with L2MerkleRootDoesNotExist.
* @dev if merkle depth is different than proof size, it will revert with ProofLengthDifferentThanMerkleDepth.
* @param _params Collection of claim data with proof and supporting data.
*/
function claimMessageWithProof(ClaimMessageWithProofParams calldata _params) external;
}
5 changes: 0 additions & 5 deletions contracts/contracts/interfaces/l1/ILineaRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ interface ILineaRollup {
*/
error SnarkHashIsZeroHash();

/**
* @dev Thrown when parent stateRootHash does not match.
*/
error ParentStateRootHashInvalid(bytes32 expected, bytes32 actual);

/**
* @dev Thrown when the block being finalized until does not match that of the shnarf data.
*/
Expand Down
9 changes: 0 additions & 9 deletions contracts/contracts/interfaces/l1/IZkEvmV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ pragma solidity 0.8.26;
* @custom:security-contact security-report@linea.build
*/
interface IZkEvmV2 {
/**
* @notice Emitted when a L2 block has been finalized on L1.
* @param blockNumber The indexed L2 block number that is finalized in the finalization.
* @param stateRootHash The indexed state root hash for the L2 block.
* @param finalizedWithProof Indicates if the L2 block in the finalization is proven or not.
* @dev DEPRECATED. This has been left for existing consumers.
*/
event BlockFinalized(uint256 indexed blockNumber, bytes32 indexed stateRootHash, bool indexed finalizedWithProof);

/**
* @notice Emitted when a L2 blocks have been finalized on L1.
* @param lastBlockFinalized The indexed L2 block number the finalization is up until.
Expand Down
12 changes: 6 additions & 6 deletions contracts/contracts/interfaces/l2/IL2MessageManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ interface IL2MessageManager {
*/
event RollingHashUpdated(uint256 indexed messageNumber, bytes32 indexed rollingHash);

/**
* @dev Emitted when the service switches over to a new version.
* @dev This is currently not in use, but left for future migrations and for existing consumers.
*/
event ServiceVersionMigrated(uint256 indexed version);

/**
* @dev Reverts when the message hashes array length is zero.
*/
Expand All @@ -36,12 +42,6 @@ interface IL2MessageManager {
*/
error FinalRollingHashIsZero();

/**
* @dev Emitted when the service switches over to a new version.
* @dev This is currently not in use, but left for future migrations and for existing consumers.
*/
event ServiceVersionMigrated(uint256 indexed version);

/**
* @notice Anchor L1-> L2 message hashes with expected message number and rolling hash.
* @dev Reverts if computed rolling hash and ending message number don't match.
Expand Down
15 changes: 15 additions & 0 deletions contracts/contracts/interfaces/l2/IL2MessageServiceV1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.19;

/**
* @title L2 Message Service interface for pre-existing functions, events and errors.
* @author ConsenSys Software Inc.
* @custom:security-contact security-report@linea.build
*/
interface IL2MessageServiceV1 {
/**
* @notice The Fee Manager sets a minimum fee to address DOS protection.
* @param _feeInWei New minimum fee in Wei.
*/
function setMinimumFee(uint256 _feeInWei) external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.19;
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { IMessageService } from "../../../interfaces/IMessageService.sol";
import { IL2MessageServiceV1 } from "../../../interfaces/l2/IL2MessageServiceV1.sol";
import { IGenericErrors } from "../../../interfaces/IGenericErrors.sol";
import { RateLimiter } from "../../lib/RateLimiter.sol";
import { L2MessageManagerV1 } from "./L2MessageManagerV1.sol";
Expand All @@ -20,6 +21,7 @@ abstract contract L2MessageServiceV1 is
L2MessageManagerV1,
ReentrancyGuardUpgradeable,
IMessageService,
IL2MessageServiceV1,
IGenericErrors
{
using MessageHashing for *;
Expand Down
16 changes: 16 additions & 0 deletions contracts/contracts/tokenBridge/interfaces/ITokenBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ interface ITokenBridge {
bytes calldata _tokenMetadata
) external;

/**
* @dev Change the status to DEPLOYED to the tokens passed in parameter
* Will call the method setDeployed on the other chain using the message Service
* @param _tokens Array of bridged tokens that have been deployed.
*/
function confirmDeployment(address[] memory _tokens) external payable;

/**
* @dev Change the address of the Message Service.
* @param _messageService The address of the new Message Service.
Expand All @@ -125,6 +132,15 @@ interface ITokenBridge {
*/
function setDeployed(address[] memory _nativeTokens) external;

/**
* @dev Linea can reserve tokens. In this case, the token cannot be bridged.
* Linea can only reserve tokens that have not been bridged before.
* @notice Make sure that _token is native to the current chain
* where you are calling this function from
* @param _token The address of the token to be set as reserved.
*/
function setReserved(address _token) external;

/**
* @dev Sets the address of the remote token bridge. Can only be called once.
* @param _remoteTokenBridge The address of the remote token bridge to be set.
Expand Down
Loading

0 comments on commit 39e0d76

Please sign in to comment.