Skip to content

Commit

Permalink
code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimazhornyk committed Mar 15, 2024
1 parent 5c5e22b commit f0ac3f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract TransactionFiltererFalse is ITransactionFilterer {
// add this to be excluded from coverage report
function test() internal virtual {}

function isTransactionAllowed(BridgehubL2TransactionRequest memory) external view returns (bool) {
function isTransactionAllowed(address, address, uint256, uint256) external view returns (bool){
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract TransactionFiltererTrue is ITransactionFilterer {
// add this to be excluded from coverage report
function test() internal virtual {}

function isTransactionAllowed(BridgehubL2TransactionRequest memory) external view returns (bool) {
function isTransactionAllowed(address, address, uint256, uint256) external view returns (bool){
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ contract MailboxFacet is ZkSyncStateTransitionBase, IMailbox {
) internal nonReentrant returns (bytes32 canonicalTxHash) {
// Check that the transaction is allowed by the filterer (if the filterer is set).
if (s.transactionFilterer != address(0)) {
require(ITransactionFilterer(s.transactionFilterer).isTransactionAllowed(_request), "tf");
require(ITransactionFilterer(s.transactionFilterer).isTransactionAllowed(
_request.sender,
_request.contractL2,
_request.mintValue,
_request.l2Value),
"tf");
}
// Change the sender address if it is a smart contract to prevent address collision between L1 and L2.
// Please note, currently zkSync address derivation is different from Ethereum one, but it may be changed in the future.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity 0.8.20;

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

Check failure on line 5 in l1-contracts/contracts/state-transition/chain-interfaces/ITransactionFilterer.sol

View workflow job for this annotation

GitHub Actions / lint

imported name BridgehubL2TransactionRequest is not used

Check failure on line 5 in l1-contracts/contracts/state-transition/chain-interfaces/ITransactionFilterer.sol

View workflow job for this annotation

GitHub Actions / lint

imported name BridgehubL2TransactionRequest is not used

Check failure on line 5 in l1-contracts/contracts/state-transition/chain-interfaces/ITransactionFilterer.sol

View workflow job for this annotation

GitHub Actions / lint

imported name BridgehubL2TransactionRequest is not used

/// @title The interface of the L1 <-> L2 transaction filterer.
/// @title The interface of the L1 -> L2 transaction filterer.
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface ITransactionFilterer {
function isTransactionAllowed(BridgehubL2TransactionRequest memory _request) external view returns (bool);
function isTransactionAllowed(address sender, address contractL2, uint256 mintValue, uint256 l2Value) external view returns (bool);
}

0 comments on commit f0ac3f5

Please sign in to comment.