From 24df83713efd3061cf24d10fc5e20aedbbab0bf1 Mon Sep 17 00:00:00 2001 From: Ermyas Abebe Date: Mon, 20 Nov 2023 18:52:17 +1100 Subject: [PATCH 1/2] Add storage gap to upgradeable contracts --- src/child/ChildAxelarBridgeAdaptor.sol | 3 +++ src/child/ChildERC20Bridge.sol | 3 +++ src/root/RootAxelarBridgeAdaptor.sol | 3 +++ src/root/RootERC20Bridge.sol | 3 +++ src/root/flowrate/FlowRateDetection.sol | 2 +- src/root/flowrate/RootERC20BridgeFlowRate.sol | 2 +- 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/child/ChildAxelarBridgeAdaptor.sol b/src/child/ChildAxelarBridgeAdaptor.sol index e85d7316..00f7d8a9 100644 --- a/src/child/ChildAxelarBridgeAdaptor.sol +++ b/src/child/ChildAxelarBridgeAdaptor.sol @@ -131,4 +131,7 @@ contract ChildAxelarBridgeAdaptor is emit AdaptorExecute(sourceChain_, sourceAddress_, payload_); childBridge.onMessageReceive(sourceChain_, sourceAddress_, payload_); } + + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gapChildAxelarBridgeAdaptor; } diff --git a/src/child/ChildERC20Bridge.sol b/src/child/ChildERC20Bridge.sol index 8b8cb93b..2ba0f291 100644 --- a/src/child/ChildERC20Bridge.sol +++ b/src/child/ChildERC20Bridge.sol @@ -429,4 +429,7 @@ contract ChildERC20Bridge is IChildERC20BridgeErrors, IChildERC20Bridge, IChildE emit IMXDeposit(rootToken, sender, receiver, amount); } } + + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gapChildERC20Bridge; } diff --git a/src/root/RootAxelarBridgeAdaptor.sol b/src/root/RootAxelarBridgeAdaptor.sol index 78061547..dff465a5 100644 --- a/src/root/RootAxelarBridgeAdaptor.sol +++ b/src/root/RootAxelarBridgeAdaptor.sol @@ -137,4 +137,7 @@ contract RootAxelarBridgeAdaptor is emit AdaptorExecute(sourceChain_, sourceAddress_, payload_); rootBridge.onMessageReceive(sourceChain_, sourceAddress_, payload_); } + + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gapRootAxelarBridgeAdaptor; } diff --git a/src/root/RootERC20Bridge.sol b/src/root/RootERC20Bridge.sol index 75909b5e..d5fb65ea 100644 --- a/src/root/RootERC20Bridge.sol +++ b/src/root/RootERC20Bridge.sol @@ -488,4 +488,7 @@ contract RootERC20Bridge is IRootERC20Bridge, IRootERC20BridgeEvents, IRootERC20 } // slither-disable-next-line reentrancy-events } + + // slither-disable-next-line unused-state,naming-convention + uint256[50] private __gapRootERC20Bridge; } diff --git a/src/root/flowrate/FlowRateDetection.sol b/src/root/flowrate/FlowRateDetection.sol index c234aedd..c3e790a8 100644 --- a/src/root/flowrate/FlowRateDetection.sol +++ b/src/root/flowrate/FlowRateDetection.sol @@ -126,5 +126,5 @@ abstract contract FlowRateDetection { } // slither-disable-next-line unused-state,naming-convention - uint256[50] private __gapFlowRateDetecton; + uint256[50] private __gapFlowRateDetection; } diff --git a/src/root/flowrate/RootERC20BridgeFlowRate.sol b/src/root/flowrate/RootERC20BridgeFlowRate.sol index 2efe5084..2b4d96bc 100644 --- a/src/root/flowrate/RootERC20BridgeFlowRate.sol +++ b/src/root/flowrate/RootERC20BridgeFlowRate.sol @@ -255,5 +255,5 @@ contract RootERC20BridgeFlowRate is } // slither-disable-next-line unused-state,naming-convention - uint256[50] private __gapRootERC20PredicateFlowRate; + uint256[50] private __gapRootERC20BridgeFlowRate; } From 42b6f5993924098d412a699f67bb50628795dab6 Mon Sep 17 00:00:00 2001 From: Ermyas Abebe Date: Tue, 21 Nov 2023 06:45:56 +1100 Subject: [PATCH 2/2] Update order of imports --- src/child/ChildAxelarBridgeAdaptor.sol | 4 ++-- src/child/ChildERC20Bridge.sol | 2 +- src/root/RootAxelarBridgeAdaptor.sol | 4 ++-- src/root/RootERC20Bridge.sol | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/child/ChildAxelarBridgeAdaptor.sol b/src/child/ChildAxelarBridgeAdaptor.sol index 00f7d8a9..361130df 100644 --- a/src/child/ChildAxelarBridgeAdaptor.sol +++ b/src/child/ChildAxelarBridgeAdaptor.sol @@ -13,12 +13,12 @@ import {IChildERC20BridgeAdaptor} from "../interfaces/child/IChildERC20BridgeAda import {AdaptorRoles} from "../common/AdaptorRoles.sol"; contract ChildAxelarBridgeAdaptor is + AdaptorRoles, AxelarExecutable, IChildERC20BridgeAdaptor, IChildAxelarBridgeAdaptorErrors, IChildAxelarBridgeAdaptorEvents, - IChildAxelarBridgeAdaptor, - AdaptorRoles + IChildAxelarBridgeAdaptor { /// @notice Address of bridge to relay messages to. IChildERC20Bridge public childBridge; diff --git a/src/child/ChildERC20Bridge.sol b/src/child/ChildERC20Bridge.sol index 2ba0f291..ab357823 100644 --- a/src/child/ChildERC20Bridge.sol +++ b/src/child/ChildERC20Bridge.sol @@ -23,7 +23,7 @@ import {BridgeRoles} from "../common/BridgeRoles.sol"; * @dev Because of this pattern, any checks or logic that is agnostic to the messaging protocol should be done in ChildERC20Bridge. * @dev Any checks or logic that is specific to the underlying messaging protocol should be done in the bridge adaptor. */ -contract ChildERC20Bridge is IChildERC20BridgeErrors, IChildERC20Bridge, IChildERC20BridgeEvents, BridgeRoles { +contract ChildERC20Bridge is BridgeRoles, IChildERC20BridgeErrors, IChildERC20Bridge, IChildERC20BridgeEvents { /// @dev leave this as the first param for the integration tests mapping(address => address) public rootTokenToChildToken; diff --git a/src/root/RootAxelarBridgeAdaptor.sol b/src/root/RootAxelarBridgeAdaptor.sol index dff465a5..0edd3c1a 100644 --- a/src/root/RootAxelarBridgeAdaptor.sol +++ b/src/root/RootAxelarBridgeAdaptor.sol @@ -16,12 +16,12 @@ import {AdaptorRoles} from "../common/AdaptorRoles.sol"; * @notice RootAxelarBridgeAdaptor is a bridge adaptor that allows the RootERC20Bridge to communicate with the Axelar Gateway. */ contract RootAxelarBridgeAdaptor is + AdaptorRoles, AxelarExecutable, IRootERC20BridgeAdaptor, IRootAxelarBridgeAdaptorEvents, IRootAxelarBridgeAdaptorErrors, - IRootAxelarBridgeAdaptor, - AdaptorRoles + IRootAxelarBridgeAdaptor { IRootERC20Bridge public rootBridge; string public childChain; diff --git a/src/root/RootERC20Bridge.sol b/src/root/RootERC20Bridge.sol index d5fb65ea..07606b73 100644 --- a/src/root/RootERC20Bridge.sol +++ b/src/root/RootERC20Bridge.sol @@ -28,7 +28,7 @@ import {BridgeRoles} from "../common/BridgeRoles.sol"; * @dev Any checks or logic that is specific to the underlying messaging protocol should be done in the bridge adaptor. * @dev Note that there is undefined behaviour for bridging non-standard ERC20 tokens (e.g. rebasing tokens). Please approach such cases with great care. */ -contract RootERC20Bridge is IRootERC20Bridge, IRootERC20BridgeEvents, IRootERC20BridgeErrors, BridgeRoles { +contract RootERC20Bridge is BridgeRoles, IRootERC20Bridge, IRootERC20BridgeEvents, IRootERC20BridgeErrors { using SafeERC20 for IERC20Metadata; /// @dev leave this as the first param for the integration tests