Skip to content

Commit

Permalink
chore: fix all compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sujithsomraaj committed Jun 11, 2024
1 parent 1f5b1a7 commit 3fdd3bb
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 56 deletions.
34 changes: 17 additions & 17 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
AxelarHelperTest:testCustomOrderingAxelar() (gas: 341805)
AxelarHelperTest:testFancyAxelar() (gas: 236169)
AxelarHelperTest:testMultiDstAxelar() (gas: 391397)
AxelarHelperTest:testSimpleAxelar() (gas: 189999)
AxelarHelperTest:testCustomOrderingAxelar() (gas: 340185)
AxelarHelperTest:testFancyAxelar() (gas: 236007)
AxelarHelperTest:testMultiDstAxelar() (gas: 391073)
AxelarHelperTest:testSimpleAxelar() (gas: 189189)
CelerHelperTest:testCustomOrderingCeler() (gas: 108685)
CelerHelperTest:testFancyCeler() (gas: 118987)
CelerHelperTest:testFancyCeler() (gas: 123722)
CelerHelperTest:testMultiDstCeler() (gas: 151884)
CelerHelperTest:testSimpleCeler() (gas: 72229)
CelerHelperTest:testSimpleCelerWithEstimates() (gas: 72704)
CelerHelperTest:testSimpleCelerWithEstimates() (gas: 77270)
HyperlaneHelperTest:testCustomOrderingHL() (gas: 145598)
HyperlaneHelperTest:testFancyHL() (gas: 147384)
HyperlaneHelperTest:testMultiDstHL() (gas: 194040)
Expand All @@ -16,22 +16,22 @@ LayerZeroHelperTest:testCustomOrderingLZ() (gas: 340154)
LayerZeroHelperTest:testFancyLZ() (gas: 296242)
LayerZeroHelperTest:testMultiDstLZ() (gas: 476527)
LayerZeroHelperTest:testSimpleLZ() (gas: 245817)
LayerZeroHelperTest:testSimpleLZWithEstimates() (gas: 246414)
LayerZeroV2HelperTest:testCustomEventSelector() (gas: 341769)
LayerZeroV2HelperTest:testMultipleDestinations() (gas: 649473)
LayerZeroV2HelperTest:testMultipleDestinationsCustomEventSelector() (gas: 649584)
LayerZeroV2HelperTest:testSingleDestination() (gas: 344507)
LayerZeroHelperTest:testSimpleLZWithEstimates() (gas: 310319)
LayerZeroV2HelperTest:testCustomEventSelector() (gas: 341707)
LayerZeroV2HelperTest:testMultipleDestinations() (gas: 649225)
LayerZeroV2HelperTest:testMultipleDestinationsCustomEventSelector() (gas: 649336)
LayerZeroV2HelperTest:testSingleDestination() (gas: 344445)
StargateHelperTest:testCustomOrderingSG() (gas: 798922)
StargateHelperTest:testFancySG() (gas: 591061)
StargateHelperTest:testSimpleSG() (gas: 538333)
StargateHelperTest:testSimpleSGWithEstimates() (gas: 538863)
WormholeAutomaticRelayerHelperTest:testCctpWormhole() (gas: 680853)
StargateHelperTest:testSimpleSGWithEstimates() (gas: 604010)
WormholeAutomaticRelayerHelperTest:testCctpWormhole() (gas: 680870)
WormholeAutomaticRelayerHelperTest:testCustomOrderingWormhole() (gas: 282349)
WormholeAutomaticRelayerHelperTest:testFancyWormhole() (gas: 224754)
WormholeAutomaticRelayerHelperTest:testMultiDstWormhole() (gas: 345999)
WormholeAutomaticRelayerHelperTest:testMultiDstWormholeWithAdditionalVAA() (gas: 374447)
WormholeAutomaticRelayerHelperTest:testSimpleWormhole() (gas: 177619)
WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 599240)
WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332394)
WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635874)
WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 335186)
WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 599230)
WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332389)
WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635864)
WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 335181)
2 changes: 1 addition & 1 deletion src/celer/CelerHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ contract CelerHelper is Test {
/// @param fromMessageBus represents the source message bus address
/// @param message represents the message data
/// @return gasEstimate the estimated gas
function _estimateGas(address fromMessageBus, bytes memory message) internal returns (uint256 gasEstimate) {
function _estimateGas(address fromMessageBus, bytes memory message) internal view returns (uint256 gasEstimate) {
/// NOTE: In celer two fees are involved, but only the 1st one is
/// estimated here
/// 1: Sync, Sign and Store Cost [Source Fees]
Expand Down
1 change: 0 additions & 1 deletion src/layerzero-v2/LayerZeroV2Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ contract LayerZeroV2Helper is Test {
/// @return the decoded packet
function decodePacket(bytes calldata encodedPacket) public pure returns (Packet memory) {
/// @dev decode the packet header
uint8 version = uint8(encodedPacket[0]);
uint64 nonce = toUint64(encodedPacket, 1);
uint32 srcEid = toUint32(encodedPacket, 9);
address sender = toAddress(encodedPacket, 13);
Expand Down
4 changes: 2 additions & 2 deletions test/Axelar.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ contract AnotherTarget {
}

function execute(
bytes32 commandId,
bytes32, /*commandId*/
string calldata sourceChain,
string calldata sourceAddress,
string calldata, /*sourceAddress*/
bytes calldata payload
) external {
require(
Expand Down
15 changes: 9 additions & 6 deletions test/Celer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ contract Target {
Fail, // execution failed, finalized
Success, // execution succeeded, finalized
Retry // execution rejected, can retry later

}

function executeMessage(address _sender, uint64 _srcChainId, bytes calldata _message, address _executor)
external
payable
returns (ExecutionStatus)
{
function executeMessage(
address, /*_sender*/
uint64, /*_srcChainId*/
bytes calldata _message,
address /*_executor*/
) external payable returns (ExecutionStatus) {
value = abi.decode(_message, (uint256));

return ExecutionStatus.Success;
Expand All @@ -35,13 +37,14 @@ contract AnotherTarget {
Fail, // execution failed, finalized
Success, // execution succeeded, finalized
Retry // execution rejected, can retry later

}

constructor(uint64 _expectedChainId) {
expectedChainId = _expectedChainId;
}

function executeMessage(address _sender, uint64 _srcChainId, bytes calldata _message, address _executor)
function executeMessage(address, /*_sender*/ uint64 _srcChainId, bytes calldata _message, address /*_executor*/ )
external
payable
returns (ExecutionStatus)
Expand Down
4 changes: 2 additions & 2 deletions test/Hyperlane.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IInterchainGasPaymaster {
contract Target {
uint256 public value;

function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external {
function handle(uint32, /*_origin*/ bytes32, /*_sender*/ bytes calldata _message) external {
value = abi.decode(_message, (uint256));
}
}
Expand All @@ -38,7 +38,7 @@ contract AnotherTarget {
expectedOrigin = _expectedOrigin;
}

function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external {
function handle(uint32 _origin, bytes32, /*_sender*/ bytes calldata _message) external {
require(_origin == expectedOrigin, "Unexpected origin");
(value, kevin, bob) = abi.decode(_message, (uint256, address, bytes32));
}
Expand Down
11 changes: 7 additions & 4 deletions test/LayerZero.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ interface ILayerZeroEndpoint {
contract Target {
uint256 public value;

function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload)
external
{
function lzReceive(
uint16, /*_srcChainId*/
bytes calldata, /*_srcAddress*/
uint64, /*_nonce*/
bytes calldata _payload
) external {
value = abi.decode(_payload, (uint256));
}
}
Expand All @@ -37,7 +40,7 @@ contract AnotherTarget {
expectedId = _expectedId;
}

function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload)
function lzReceive(uint16 _srcChainId, bytes calldata, /*_srcAddress*/ uint64, /*_nonce*/ bytes calldata _payload)
external
{
require(_srcChainId == expectedId, "Unexpected id");
Expand Down
8 changes: 4 additions & 4 deletions test/LayerZeroV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ contract Target {
uint256 public value;

function lzReceive(
Origin calldata _origin,
bytes32 _guid,
Origin calldata, /*_origin*/
bytes32, /*_guid*/
bytes calldata _message,
address _executor,
bytes calldata _extraData
address, /*_executor*/
bytes calldata /*_extraData*/
) external payable {
value = abi.decode(_message, (uint256));
}
Expand Down
28 changes: 14 additions & 14 deletions test/Wormhole.AutomaticRelayer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ contract Target is IWormholeReceiver {

function receiveWormholeMessages(
bytes memory payload,
bytes[] memory additionalVaas,
bytes32 sourceAddress,
uint16 sourceChain,
bytes32 deliveryHash
bytes[] memory, /*additionalVaas*/
bytes32, /*sourceAddress*/
uint16, /*sourceChain*/
bytes32 /*deliveryHash*/
) external payable {
value = abi.decode(payload, (uint256));
}
Expand All @@ -97,9 +97,9 @@ contract AdditionalVAATarget is IWormholeReceiver {
function receiveWormholeMessages(
bytes memory payload,
bytes[] memory additionalVaas,
bytes32 sourceAddress,
uint16 sourceChain,
bytes32 deliveryHash
bytes32, /*sourceAddress*/
uint16, /*sourceChain*/
bytes32 /*deliveryHash*/
) external payable {
value = abi.decode(payload, (uint256));
vaalen = additionalVaas.length;
Expand All @@ -119,10 +119,10 @@ contract AnotherTarget {

function receiveWormholeMessages(
bytes memory payload,
bytes[] memory additionalVaas,
bytes32 sourceAddress,
bytes[] memory, /*additionalVaas*/
bytes32, /*sourceAddress*/
uint16 sourceChain,
bytes32 deliveryHash
bytes32 /*deliveryHash*/
) external payable {
require(sourceChain == expectedChainId, "Unexpected origin");
(value, kevin, bob) = abi.decode(payload, (uint256, address, bytes32));
Expand All @@ -137,11 +137,11 @@ contract CCTPTarget {
}

function receiveWormholeMessages(
bytes memory payload,
bytes memory, /*payload*/
bytes[] memory additionalVaas,
bytes32 sourceAddress,
uint16 sourceChain,
bytes32 deliveryHash
bytes32, /*sourceAddress*/
uint16, /*sourceChain*/
bytes32 /*deliveryHash*/
) external payable {
(bytes memory message, bytes memory attestation) = abi.decode(additionalVaas[0], (bytes, bytes));
transmitter.receiveMessage(message, attestation);
Expand Down
8 changes: 3 additions & 5 deletions test/Wormhole.SpecializedRelayer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ contract Target {

function receiveMessage(bytes memory encodedMessage) public {
// call the Wormhole core contract to parse and verify the encodedMessage
(IWormhole.VM memory wormholeMessage, bool valid, string memory reason) =
wormhole.parseAndVerifyVM(encodedMessage);
(IWormhole.VM memory wormholeMessage, bool valid,) = wormhole.parseAndVerifyVM(encodedMessage);
// do security checks and set value
require(valid);
value = abi.decode(wormholeMessage.payload, (uint256));
Expand All @@ -42,8 +41,7 @@ contract AnotherTarget {

function receiveMessage(bytes memory encodedMessage) public {
// call the Wormhole core contract to parse and verify the encodedMessage
(IWormhole.VM memory wormholeMessage, bool valid, string memory reason) =
wormhole.parseAndVerifyVM(encodedMessage);
(IWormhole.VM memory wormholeMessage, bool valid,) = wormhole.parseAndVerifyVM(encodedMessage);
// do security checks and set value
require(valid);
require(wormholeMessage.emitterChainId == 2);
Expand Down Expand Up @@ -93,7 +91,7 @@ contract WormholeSpecializedRelayerHelperTest is Test {

POLYGON_FORK_ID = vm.createSelectFork(RPC_POLYGON_MAINNET);
target = new Target(IWormhole(L2_1_CORE));
anotherTarget = new AnotherTarget(IWormhole(L2_1_CORE),address(this));
anotherTarget = new AnotherTarget(IWormhole(L2_1_CORE), address(this));

ARBITRUM_FORK_ID = vm.createSelectFork(RPC_ARBITRUM_MAINNET);
altTarget = new Target(IWormhole(L2_2_CORE));
Expand Down

0 comments on commit 3fdd3bb

Please sign in to comment.