From b8268646f454a3f2068701d490eb617ce72d42e2 Mon Sep 17 00:00:00 2001 From: kelemeno Date: Fri, 25 Oct 2024 15:18:54 +0100 Subject: [PATCH] fix: N-04 Unsafe ABI Encoding --- l1-contracts/contracts/governance/PermanentRestriction.sol | 2 +- l1-contracts/contracts/upgrades/GatewayUpgrade.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/l1-contracts/contracts/governance/PermanentRestriction.sol b/l1-contracts/contracts/governance/PermanentRestriction.sol index 153ce369e..7cf01a5d8 100644 --- a/l1-contracts/contracts/governance/PermanentRestriction.sol +++ b/l1-contracts/contracts/governance/PermanentRestriction.sol @@ -235,7 +235,7 @@ contract PermanentRestriction is IRestriction, IPermanentRestriction, Ownable2St // Note, that we do not use an explicit call here to ensure that the function does not panic in case of // incorrect `_chain` address. - (bool success, bytes memory data) = _chain.staticcall(abi.encodeWithSelector(IGetters.getChainId.selector)); + (bool success, bytes memory data) = _chain.staticcall(abi.encodeCall(IGetters.getChainId)); if (!success || data.length < 32) { revert NotAHyperchain(_chain); } diff --git a/l1-contracts/contracts/upgrades/GatewayUpgrade.sol b/l1-contracts/contracts/upgrades/GatewayUpgrade.sol index 9ce428f96..cf75e8d76 100644 --- a/l1-contracts/contracts/upgrades/GatewayUpgrade.sol +++ b/l1-contracts/contracts/upgrades/GatewayUpgrade.sol @@ -50,7 +50,7 @@ contract GatewayUpgrade is BaseZkSyncUpgrade, Initializable { ); // slither-disable-next-line controlled-delegatecall (bool success, ) = THIS_ADDRESS.delegatecall( - abi.encodeWithSelector(IGatewayUpgrade.upgradeExternal.selector, proposedUpgrade) + abi.encodeCall(IGatewayUpgrade.upgradeExternal, proposedUpgrade) ); // solhint-disable-next-line gas-custom-errors require(success, "GatewayUpgrade: upgrade failed");