Skip to content

Commit

Permalink
chore: remove submodules from contracts-rfq (#2547)
Browse files Browse the repository at this point in the history
* build: install OZ as npm module

* chore: update remappings

* refactor: fix compiler warnings in test contract

* chore: remove forge-std submodule

* chore: remove `openzeppelin-contracts` submodule

* fix: restore padding in `.gitmodules`
  • Loading branch information
ChiTimesChi authored May 1, 2024
1 parent 1cf1b6d commit 3b0e967
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 44 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
[submodule "packages/contracts-core/lib/create3-factory"]
path = packages/contracts-core/lib/create3-factory
url = https://github.com/zeframlou/create3-factory
[submodule "packages/contracts-rfq/lib/forge-std"]
path = packages/contracts-rfq/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "packages/contracts-rfq/lib/openzeppelin-contracts"]
path = packages/contracts-rfq/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "services/rfq/external/canonical-weth"]
path = services/rfq/external/canonical-weth
url = https://github.com/gnosis/canonical-weth
Expand Down
1 change: 0 additions & 1 deletion packages/contracts-rfq/lib/forge-std
Submodule forge-std deleted from 80a8f6
1 change: 0 additions & 1 deletion packages/contracts-rfq/lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from 6ba452
3 changes: 3 additions & 0 deletions packages/contracts-rfq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"files": [
"src/*.sol"
],
"dependencies": {
"@openzeppelin/contracts": "5.0.1"
},
"devDependencies": {
"@synapsecns/solidity-devops": "^0.3.3",
"prettier": "^2.5.1",
Expand Down
7 changes: 3 additions & 4 deletions packages/contracts-rfq/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@synapsecns/solidity-devops=node_modules/@synapsecns/solidity-devops/
forge-std/=lib/forge-std/src/
ds-test/=lib/forge-std/lib/ds-test/src/
@openzeppelin/=node_modules/@openzeppelin/
@synapsecns/=node_modules/@synapsecns/
forge-std/=node_modules/forge-std/src/
60 changes: 29 additions & 31 deletions packages/contracts-rfq/test/FastBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ contract FastBridgeTest is Test {
uint256 protocolFeeRate
)
internal
view
returns (bytes memory request, bytes32 transactionId)
{
// Define input variables for the bridge transaction
address to = user;
address oldRelayer = relayer;
uint32 originChainId = uint32(chainId);
uint32 dstChainId = 1;
address originToken = address(arbUSDC);
Expand Down Expand Up @@ -96,11 +96,11 @@ contract FastBridgeTest is Test {
uint256 protocolFeeRate
)
internal
view
returns (bytes memory request, bytes32 transactionId)
{
// Define input variables for the bridge transaction
address to = user;
address oldRelayer = relayer;
uint32 originChainId = uint32(chainId);
uint32 dstChainId = 1;
address originToken = UniversalTokenLib.ETH_ADDRESS;
Expand Down Expand Up @@ -139,11 +139,11 @@ contract FastBridgeTest is Test {
uint256 protocolFeeRate
)
internal
view
returns (bytes memory request, bytes32 transactionId)
{
// Define input variables for the bridge transaction
address to = user;
address oldRelayer = relayer;
uint32 originChainId = uint32(chainId);
uint32 dstChainId = 1;
address originToken = address(arbUSDC);
Expand Down Expand Up @@ -182,11 +182,11 @@ contract FastBridgeTest is Test {
uint256 protocolFeeRate
)
internal
view
returns (bytes memory request, bytes32 transactionId)
{
// Define input variables for the bridge transaction
address to = user;
address oldRelayer = relayer;
uint32 originChainId = uint32(chainId);
uint32 dstChainId = 1;
address originToken = UniversalTokenLib.ETH_ADDRESS;
Expand Down Expand Up @@ -237,7 +237,7 @@ contract FastBridgeTest is Test {
}

/// @notice Test to check if the owner is correctly set
function test_owner() public {
function test_owner() public view {
assertTrue(fastBridge.hasRole(fastBridge.DEFAULT_ADMIN_ROLE(), owner));
}

Expand Down Expand Up @@ -498,7 +498,7 @@ contract FastBridgeTest is Test {

// get expected bridge request and tx id
uint256 currentNonce = fastBridge.nonce();
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, currentNonce, 0);
(, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, currentNonce, 0);

// Execute the bridge transaction
IFastBridge.BridgeParams memory params = IFastBridge.BridgeParams({
Expand Down Expand Up @@ -730,8 +730,7 @@ contract FastBridgeTest is Test {

// get expected bridge request and tx id
uint256 currentNonce = fastBridge.nonce();
(bytes memory request, bytes32 transactionId) =
_getBridgeRequestAndIdWithETHAndChainGas(block.chainid, currentNonce, 0);
(, bytes32 transactionId) = _getBridgeRequestAndIdWithETHAndChainGas(block.chainid, currentNonce, 0);

// Execute the bridge transaction
IFastBridge.BridgeParams memory params = IFastBridge.BridgeParams({
Expand Down Expand Up @@ -1233,7 +1232,7 @@ contract FastBridgeTest is Test {
setUpRoles();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(42_161, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(42_161, 0, 0);

// Start a prank with the relayer
vm.startPrank(relayer);
Expand All @@ -1255,7 +1254,7 @@ contract FastBridgeTest is Test {
setUpRoles();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(42_161, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(42_161, 0, 0);

// Start a prank with the relayer
vm.startPrank(relayer);
Expand Down Expand Up @@ -1303,7 +1302,7 @@ contract FastBridgeTest is Test {
setUpRoles();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(42_161, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(42_161, 0, 0);

// Start a prank with the relayer
vm.startPrank(guard);
Expand Down Expand Up @@ -1424,7 +1423,7 @@ contract FastBridgeTest is Test {
setUpRoles();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

// We start a prank with the relayer
vm.startPrank(relayer);
Expand All @@ -1445,7 +1444,7 @@ contract FastBridgeTest is Test {
setUpRoles();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

// We provide the relay proof
expectUnauthorized(address(this), fastBridge.RELAYER_ROLE());
Expand Down Expand Up @@ -1498,7 +1497,7 @@ contract FastBridgeTest is Test {
test_successfulBridgeWithETH();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndIdWithETH(block.chainid, 0, 0);

vm.startPrank(relayer);
fastBridge.prove(request, bytes32("0x04"));
Expand Down Expand Up @@ -1570,7 +1569,7 @@ contract FastBridgeTest is Test {

// get bridge request and tx id
uint256 protocolFeeRate = fastBridge.protocolFeeRate();
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, 0, protocolFeeRate);
(bytes memory request,) = _getBridgeRequestAndIdWithETH(block.chainid, 0, protocolFeeRate);

vm.startPrank(relayer);
fastBridge.prove(request, bytes32("0x04"));
Expand Down Expand Up @@ -1630,7 +1629,7 @@ contract FastBridgeTest is Test {
test_successfulBridge();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(relayer);

Expand All @@ -1643,7 +1642,7 @@ contract FastBridgeTest is Test {
vm.stopPrank();
}

function test_failedClaimNotoldRelayer() public {
function test_failedClaimNotOldRelayer() public {
setUpRoles();
test_successfulBridge();

Expand All @@ -1652,7 +1651,7 @@ contract FastBridgeTest is Test {
vm.stopPrank();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.warp(block.timestamp + 31 minutes);

Expand All @@ -1668,7 +1667,7 @@ contract FastBridgeTest is Test {
test_successfulBridge();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(relayer);
fastBridge.prove(request, bytes32("0x04"));
Expand All @@ -1685,7 +1684,7 @@ contract FastBridgeTest is Test {
test_successfulRelayProof();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.warp(block.timestamp + 31 minutes);

Expand All @@ -1700,7 +1699,7 @@ contract FastBridgeTest is Test {
test_successfulRelayProof();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(guard);

Expand All @@ -1727,7 +1726,7 @@ contract FastBridgeTest is Test {
test_successfulRelayProof();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.warp(block.timestamp + 25 minutes);

Expand All @@ -1750,7 +1749,7 @@ contract FastBridgeTest is Test {
test_successfulBridge();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(guard);

Expand All @@ -1766,7 +1765,7 @@ contract FastBridgeTest is Test {
test_successfulRelayProof();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(guard);

Expand All @@ -1784,7 +1783,7 @@ contract FastBridgeTest is Test {
test_successfulRelayProof();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);

expectUnauthorized(address(this), fastBridge.GUARD_ROLE());
fastBridge.dispute(transactionId);
Expand Down Expand Up @@ -1830,7 +1829,7 @@ contract FastBridgeTest is Test {
test_successfulBridgeWithETH();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndIdWithETH(block.chainid, 0, 0);

vm.startPrank(refunder);

Expand Down Expand Up @@ -1892,7 +1891,7 @@ contract FastBridgeTest is Test {

// get bridge request and tx id
uint256 protocolFeeRate = fastBridge.protocolFeeRate();
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndIdWithETH(block.chainid, 0, protocolFeeRate);
(bytes memory request,) = _getBridgeRequestAndIdWithETH(block.chainid, 0, protocolFeeRate);

vm.startPrank(refunder);

Expand Down Expand Up @@ -1952,7 +1951,7 @@ contract FastBridgeTest is Test {
test_successfulBridge();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(refunder);

Expand Down Expand Up @@ -2005,7 +2004,7 @@ contract FastBridgeTest is Test {
test_successfulBridge();

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

vm.startPrank(user);

Expand All @@ -2025,7 +2024,7 @@ contract FastBridgeTest is Test {
vm.startPrank(refunder);

// get bridge request and tx id
(bytes memory request, bytes32 transactionId) = _getBridgeRequestAndId(block.chainid, 0, 0);
(bytes memory request,) = _getBridgeRequestAndId(block.chainid, 0, 0);

skip(TX_DEADLINE + 1 seconds);

Expand Down Expand Up @@ -2093,7 +2092,6 @@ contract FastBridgeTest is Test {

vm.startPrank(governor);

uint256 preSweepProtocolFees = fastBridge.protocolFees(address(arbUSDC));
uint256 preSweepBalanceUser = arbUSDC.balanceOf(user);

fastBridge.sweepProtocolFees(address(arbUSDC), user);
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/UniversalTokenLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ contract UniversalTokenLibraryTest is Test {
libHarness.universalApproveInfinity(libHarness.ethAddress(), recipient, amount);
}

function testEthAddress() public {
function testEthAddress() public view {
// ETH address should have all bytes set to 0xEE
address ethAddress = libHarness.ethAddress();
for (uint256 i = 0; i < 20; i++) {
Expand Down

0 comments on commit 3b0e967

Please sign in to comment.