From 0dc9e1a2e4a31a73f9b40336b1a7e7fac06ac4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CF=87=C2=B2?= <88190723+ChiTimesChi@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:56:22 +0000 Subject: [PATCH] refactor(contracts-rfq): fix compiler warnings in tests (#3357) * refactor: shadowing, pure * refactor: fix FastBridgeMock compiler warnings --- packages/contracts-rfq/test/FastBridge.t.sol | 6 +++--- packages/contracts-rfq/test/FastBridgeMock.sol | 16 +++++++++------- .../integration/FastBridge.MulticallTarget.t.sol | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/contracts-rfq/test/FastBridge.t.sol b/packages/contracts-rfq/test/FastBridge.t.sol index a571f50b40..0e7804e49a 100644 --- a/packages/contracts-rfq/test/FastBridge.t.sol +++ b/packages/contracts-rfq/test/FastBridge.t.sol @@ -60,9 +60,9 @@ contract FastBridgeTest is Test { internal virtual { - (uint96 timestamp, address relayer) = fastBridge.bridgeProofs(transactionId); - assertEq(timestamp, uint96(expectedTimestamp)); - assertEq(relayer, expectedRelayer); + (uint96 proofTimestamp, address proofRelayer) = fastBridge.bridgeProofs(transactionId); + assertEq(proofTimestamp, uint96(expectedTimestamp)); + assertEq(proofRelayer, expectedRelayer); } function _getBridgeRequestAndId( diff --git a/packages/contracts-rfq/test/FastBridgeMock.sol b/packages/contracts-rfq/test/FastBridgeMock.sol index a84ce7db72..87c660312d 100644 --- a/packages/contracts-rfq/test/FastBridgeMock.sol +++ b/packages/contracts-rfq/test/FastBridgeMock.sol @@ -39,6 +39,7 @@ contract FastBridgeMock is IFastBridge, Admin { } function mockBridgeRequest(bytes32 transactionId, address sender, BridgeParams memory params) external { + sender; uint256 originFeeAmount = (params.originAmount * protocolFeeRate) / FEE_BPS; params.originAmount -= originFeeAmount; @@ -73,6 +74,7 @@ contract FastBridgeMock is IFastBridge, Admin { } function mockBridgeRequestRaw(bytes32 transactionId, address sender, bytes memory request) external { + sender; BridgeTransaction memory transaction = getBridgeTransaction(request); emit BridgeRequested( transactionId, @@ -105,31 +107,31 @@ contract FastBridgeMock is IFastBridge, Admin { ); } - function bridge(BridgeParams memory params) external payable { + function bridge(BridgeParams memory) external payable { revert("not implemented"); } - function relay(bytes memory request) external payable { + function relay(bytes memory) external payable { revert("not implemented"); } - function prove(bytes memory request, bytes32 destTxHash) external { + function prove(bytes memory, bytes32) external pure { revert("not implemented"); } - function canClaim(bytes32 transactionid, address relayer) external view returns (bool) { + function canClaim(bytes32, address) external pure returns (bool) { revert("not implemented"); } - function claim(bytes memory request, address to) external { + function claim(bytes memory, address) external pure { revert("not implemented"); } - function dispute(bytes32 transactionId) external { + function dispute(bytes32) external pure { revert("not implemented"); } - function refund(bytes memory request) external { + function refund(bytes memory) external pure { revert("not implemented"); } } diff --git a/packages/contracts-rfq/test/integration/FastBridge.MulticallTarget.t.sol b/packages/contracts-rfq/test/integration/FastBridge.MulticallTarget.t.sol index ed826caefd..53c597136e 100644 --- a/packages/contracts-rfq/test/integration/FastBridge.MulticallTarget.t.sol +++ b/packages/contracts-rfq/test/integration/FastBridge.MulticallTarget.t.sol @@ -14,7 +14,7 @@ contract FastBridgeMulticallTargetTest is MulticallTargetIntegrationTest { function getEncodedBridgeTx(IFastBridge.BridgeTransaction memory bridgeTx) public - view + pure override returns (bytes memory) {