Skip to content

Commit 6955215

Browse files
authored
Fix CI breakages surfaced by PR #115 (#116)
* Fix formatting * Fix variable name conflict * Fix missing checkout for Slither CI job * Fix E2E by using ts-node CJS register in mocharc
1 parent 69e118e commit 6955215

22 files changed

Lines changed: 144 additions & 120 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
contents: read
3333
runs-on: ubuntu-latest
3434
steps:
35+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
persist-credentials: false
38+
submodules: recursive
39+
3540
- uses: crytic/slither-action@b52cc1cbfee9ca3e8722dd5224299d16c9a6b80f # v0.4.2
3641
with:
3742
fail-on: high

.mocharc.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extensions": ["ts"],
3-
"node-option": [
4-
"experimental-specifier-resolution=node",
5-
"loader=ts-node/esm"
6-
]
7-
}
3+
"require": ["ts-node/register"]
4+
}

foundry.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"lib/axelar-cgp-solidity": {
3+
"rev": "97df254f2307797dd4810ec0e8a549b337840976"
4+
},
5+
"lib/axelar-gmp-sdk-solidity": {
6+
"rev": "5092666b1a9213722ebf3769a42ca7148e8fd3ff"
7+
},
8+
"lib/forge-std": {
9+
"rev": "1d9650e951204a0ddce9ff89c32f1997984cef4d"
10+
},
11+
"lib/openzeppelin-contracts": {
12+
"rev": "fd81a96f01cc42ef1c9a5399364968d0e07e9e90"
13+
},
14+
"lib/openzeppelin-contracts-upgradeable": {
15+
"rev": "3d4c0d5741b131c231e558d7a6213392ab3672a5"
16+
}
17+
}

src/child/ChildERC20Bridge.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ contract ChildERC20Bridge is
121121
}
122122
if (
123123
newBridgeAdaptor == address(0) || newChildTokenTemplate == address(0) || newRootIMXToken == address(0)
124-
|| newRoles.defaultAdmin == address(0) || newRoles.pauser == address(0) || newRoles.unpauser == address(0)
125-
|| newRoles.adaptorManager == address(0) || newRoles.treasuryManager == address(0)
126-
|| newWIMXToken == address(0)
124+
|| newRoles.defaultAdmin == address(0) || newRoles.pauser == address(0)
125+
|| newRoles.unpauser == address(0) || newRoles.adaptorManager == address(0)
126+
|| newRoles.treasuryManager == address(0) || newWIMXToken == address(0)
127127
) {
128128
revert ZeroAddress();
129129
}

src/interfaces/child/IChildERC20.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
pragma solidity 0.8.19;
55

6-
import {IERC20MetadataUpgradeable} from
7-
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
6+
import {
7+
IERC20MetadataUpgradeable
8+
} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
89

910
/**
1011
* @dev Interface of IChildERC20

src/root/RootERC20Bridge.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ contract RootERC20Bridge is
168168
}
169169
if (
170170
newRootBridgeAdaptor == address(0) || newChildERC20Bridge == address(0)
171-
|| newChildTokenTemplate == address(0) || newRootIMXToken == address(0) || newRootWETHToken == address(0)
172-
|| newRoles.defaultAdmin == address(0) || newRoles.pauser == address(0) || newRoles.unpauser == address(0)
171+
|| newChildTokenTemplate == address(0) || newRootIMXToken == address(0)
172+
|| newRootWETHToken == address(0) || newRoles.defaultAdmin == address(0)
173+
|| newRoles.pauser == address(0) || newRoles.unpauser == address(0)
173174
|| newRoles.variableManager == address(0) || newRoles.adaptorManager == address(0)
174175
) {
175176
revert ZeroAddress();

test/fork/root/RootERC20BridgeFlowRate.t.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ contract RootERC20BridgeFlowRateForkTest is Test, Utils {
284284
}
285285

286286
function createAddress(uint256 index) private view returns (address) {
287-
return address(
288-
uint160(uint256(keccak256(abi.encodePacked("root-bridge-fork-test", index, blockhash(block.number)))))
289-
);
287+
return
288+
address(
289+
uint160(uint256(keccak256(abi.encodePacked("root-bridge-fork-test", index, blockhash(block.number)))))
290+
);
290291
}
291292
}

test/fuzzing/FuzzIntegrityChildERC20Bridge.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ contract FuzzChildERC20BridgeIntegrity is HandlerChildERC20Bridge, FuzzIntegrity
7373
* @notice Checks the integrity of handler_withdraw
7474
*/
7575
function fuzz_withdraw(uint8 childTokenSelector, uint256 amount, uint256 value) public {
76-
bytes memory callData =
77-
abi.encodeWithSelector(HandlerChildERC20Bridge.handler_withdraw.selector, childTokenSelector, amount, value);
76+
bytes memory callData = abi.encodeWithSelector(
77+
HandlerChildERC20Bridge.handler_withdraw.selector, childTokenSelector, amount, value
78+
);
7879

7980
(bool success, bytes4 errorSelector) = _testSelf(callData);
8081
if (!success) {

test/fuzzing/FuzzSetup.sol

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ contract FuzzSetup is FuzzBase, FuzzStorageVariables {
117117
initialDepositor: address(this),
118118
treasuryManager: address(this)
119119
});
120-
ChildERC20Bridge(payable(childERC20Bridge)).initialize(
121-
childRoles, mockAdaptorChild, tokenTemplate, rootIMXToken, wIMX
122-
);
120+
ChildERC20Bridge(payable(childERC20Bridge))
121+
.initialize(childRoles, mockAdaptorChild, tokenTemplate, rootIMXToken, wIMX);
123122
}
124123

125124
function createRootBridge() private {
@@ -131,16 +130,17 @@ contract FuzzSetup is FuzzBase, FuzzStorageVariables {
131130
variableManager: address(this),
132131
adaptorManager: address(this)
133132
});
134-
RootERC20BridgeFlowRate(payable(rootERC20BridgeFlowRate)).initialize(
135-
rootRoles,
136-
mockAdaptorRoot,
137-
childERC20Bridge,
138-
tokenTemplate,
139-
address(rootIMXToken),
140-
address(wETH),
141-
IMX_DEPOSIT_LIMIT,
142-
address(this)
143-
);
133+
RootERC20BridgeFlowRate(payable(rootERC20BridgeFlowRate))
134+
.initialize(
135+
rootRoles,
136+
mockAdaptorRoot,
137+
childERC20Bridge,
138+
tokenTemplate,
139+
address(rootIMXToken),
140+
address(wETH),
141+
IMX_DEPOSIT_LIMIT,
142+
address(this)
143+
);
144144
}
145145

146146
function initializeMockAdaptors() private {
@@ -160,15 +160,16 @@ contract FuzzSetup is FuzzBase, FuzzStorageVariables {
160160
}
161161

162162
function generateMapTokens() private {
163-
MockAdaptor(mockAdaptorChild).onMessageReceive(
164-
abi.encode(
165-
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
166-
rootSixDecimalInitial,
167-
"Six Child Generated",
168-
"6CG",
169-
ChildERC20(rootSixDecimalInitial).decimals()
170-
)
171-
);
163+
MockAdaptor(mockAdaptorChild)
164+
.onMessageReceive(
165+
abi.encode(
166+
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
167+
rootSixDecimalInitial,
168+
"Six Child Generated",
169+
"6CG",
170+
ChildERC20(rootSixDecimalInitial).decimals()
171+
)
172+
);
172173
childSixDecimalGenerated =
173174
RootERC20Bridge(payable(rootERC20BridgeFlowRate)).mapToken{value: 1}(IERC20Metadata(rootSixDecimalInitial));
174175

@@ -178,15 +179,16 @@ contract FuzzSetup is FuzzBase, FuzzStorageVariables {
178179
== ChildERC20Bridge(payable(childERC20Bridge)).rootTokenToChildToken(rootSixDecimalInitial)
179180
);
180181

181-
MockAdaptor(mockAdaptorChild).onMessageReceive(
182-
abi.encode(
183-
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
184-
rootEightDecimalInitial,
185-
"Eight Child Generated",
186-
"8CG",
187-
ChildERC20(rootEightDecimalInitial).decimals()
188-
)
189-
);
182+
MockAdaptor(mockAdaptorChild)
183+
.onMessageReceive(
184+
abi.encode(
185+
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
186+
rootEightDecimalInitial,
187+
"Eight Child Generated",
188+
"8CG",
189+
ChildERC20(rootEightDecimalInitial).decimals()
190+
)
191+
);
190192
childEightDecimalGenerated = RootERC20Bridge(payable(rootERC20BridgeFlowRate)).mapToken{value: 1}(
191193
IERC20Metadata(rootEightDecimalInitial)
192194
);
@@ -197,15 +199,16 @@ contract FuzzSetup is FuzzBase, FuzzStorageVariables {
197199
== ChildERC20Bridge(payable(childERC20Bridge)).rootTokenToChildToken(rootEightDecimalInitial)
198200
);
199201

200-
MockAdaptor(mockAdaptorChild).onMessageReceive(
201-
abi.encode(
202-
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
203-
rootEighteenDecimalInitial,
204-
"Eighteen Child Generated",
205-
"18CG",
206-
ChildERC20(rootEighteenDecimalInitial).decimals()
207-
)
208-
);
202+
MockAdaptor(mockAdaptorChild)
203+
.onMessageReceive(
204+
abi.encode(
205+
ChildERC20Bridge(payable(childERC20Bridge)).MAP_TOKEN_SIG(),
206+
rootEighteenDecimalInitial,
207+
"Eighteen Child Generated",
208+
"18CG",
209+
ChildERC20(rootEighteenDecimalInitial).decimals()
210+
)
211+
);
209212
childEighteenDecimalGenerated = RootERC20Bridge(payable(rootERC20BridgeFlowRate)).mapToken{value: 1}(
210213
IERC20Metadata(rootEighteenDecimalInitial)
211214
);

test/fuzzing/helper/handlers/HandlerChildERC20Bridge.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ contract HandlerChildERC20Bridge is PreconditionsChildERC20Bridge, Postcondition
2929
uint8 receiverSelector,
3030
uint256 amount
3131
) public setCurrentActor {
32-
OnMessageReceiveChildParams memory params =
33-
onMessageReceiveChildPreconditions(isDeposit, rootTokenSelector, senderSelector, receiverSelector, amount);
32+
OnMessageReceiveChildParams memory params = onMessageReceiveChildPreconditions(
33+
isDeposit, rootTokenSelector, senderSelector, receiverSelector, amount
34+
);
3435

3536
address[] memory actorsToUpdate = new address[](1);
3637
actorsToUpdate[0] = params.receiver;

0 commit comments

Comments
 (0)