From 969d7050bdd81fb48f1fef396615cb08f555f32a Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 4 Nov 2024 17:10:51 +0100 Subject: [PATCH] fix: formatting --- solidity/src/Hyperlane.sol | 1 - solidity/src/PragmaDecoder.sol | 3 ++- solidity/test/PragmaDecoder.t.sol | 7 +++---- solidity/test/mocks/PragmaUpgraded.sol | 1 - solidity/test/utils/HyperlaneTestUtils.t.sol | 4 ++-- solidity/test/utils/TestConstants.sol | 2 ++ 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/solidity/src/Hyperlane.sol b/solidity/src/Hyperlane.sol index 503e97e6..00c6173e 100644 --- a/solidity/src/Hyperlane.sol +++ b/solidity/src/Hyperlane.sol @@ -112,7 +112,6 @@ contract Hyperlane is IHyperlane { index += 1; require(hyMsg.version == VERSION, "unsupported version"); - // Parse Signatures uint256 signersLen = encodedHyMsg.toUint8(index); index += 1; diff --git a/solidity/src/PragmaDecoder.sol b/solidity/src/PragmaDecoder.sol index 39c7c0f3..3cc85bf0 100644 --- a/solidity/src/PragmaDecoder.sol +++ b/solidity/src/PragmaDecoder.sol @@ -151,6 +151,7 @@ abstract contract PragmaDecoder { /// @return publishTime The timestamp of the feed data. function extractDataInfoFromUpdate(bytes calldata updateData, uint256 offset, bytes32 checkpointRoot) internal + pure returns (uint256 endOffset, ParsedData memory parsedData, bytes32 feedId, uint64 publishTime) { unchecked { @@ -208,7 +209,7 @@ abstract contract PragmaDecoder { // Extract header metadata offset = extractMetadataFromheader(updateData, offset); // Extract merkle root and number of updates from update data. - + bytes32 checkpointRoot; (offset, checkpointRoot, numUpdates) = extractCheckpointRootAndNumUpdates(updateData, offset); diff --git a/solidity/test/PragmaDecoder.t.sol b/solidity/test/PragmaDecoder.t.sol index d42fe812..856f86c6 100644 --- a/solidity/test/PragmaDecoder.t.sol +++ b/solidity/test/PragmaDecoder.t.sol @@ -40,15 +40,14 @@ contract PragmaHarnessTest is Test { hex"0100000130030100c1ec5070f1a4868b8e6bfa5bbd31ac77605c5af1a739bc4e7758d4ca1d88fa8835c1460646b647c4c4403b324c2297a04d70b84888dc873021f80d6d70ed015e1c00031b8b00611a3d0060240f2bccef7e64f920eec05c5bfffbc48c6ceaa4efca8748772b60cbafc30536953cdd0dd5b8e24428e4fb6eab5c143daba15f62b24606e50d822508faefd53032e26a3b1d1510dfe82a2ab8d6c0fc0f010dcdd3c410ba2f9fdad3479b1400031b8b15704e0efd1955cfe1c1182ba083bd5309707bdd795397cbbbb106cfc9b29bb00100010000000000000000000000000000000000000000000000000000004254432f5553440000000067225b110008080000000000000000000000000000000000000000000000000000068aa5cb9d630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004254432f5553440000000067225b11"; uint8 numUpdates = pragmaHarness.exposed_updateDataInfoFromUpdate(encodedUpdate); assertEq(numUpdates, 1, "Number of updates should be 1"); - bytes32 feedId= bytes32(0x000000000000000000000000000000000000000000000000004254432f555344); + bytes32 feedId = bytes32(0x000000000000000000000000000000000000000000000000004254432f555344); SpotMedian memory spotMedian = pragmaHarness.exposed_spotMedianFeeds(feedId); - assertEq(spotMedian.metadata.timestamp,uint64(0x67225b11), "Timestamp should match"); + assertEq(spotMedian.metadata.timestamp, uint64(0x67225b11), "Timestamp should match"); assertEq(spotMedian.metadata.numberOfSources, 8, "Number of sources should be 8"); assertEq(spotMedian.metadata.decimals, 8, "Decimals should be 8"); assertEq(spotMedian.metadata.feedId, feedId, "Feed ID should match"); assertEq(spotMedian.price, 0x68aa5cb9d63, "Price should match"); assertEq(spotMedian.volume, 0, "Volume should match"); - } function testUpdateDataInfoFromUpdateSpotMedian() public { @@ -195,7 +194,7 @@ contract PragmaUpgradeableTest is Test { user = address(0x1); } - function testInitialState() public { + function testInitialState() public view { assertEq(pragma_.owner(), owner); assertEq(pragma_.validTimePeriodSeconds(), 120); assertEq(pragma_.singleUpdateFeeInWei(), 0.1 ether); diff --git a/solidity/test/mocks/PragmaUpgraded.sol b/solidity/test/mocks/PragmaUpgraded.sol index 54641210..02b9975e 100644 --- a/solidity/test/mocks/PragmaUpgraded.sol +++ b/solidity/test/mocks/PragmaUpgraded.sol @@ -35,7 +35,6 @@ contract PragmaUpgraded is Initializable, UUPSUpgradeable, OwnableUpgradeable, I ) public initializer { __Ownable_init(initial_owner); __UUPSUpgradeable_init(); - // __PragmaDecoder_init(_hyperlane, _dataSourceEmitterChainIds, _dataSourceEmitterAddresses); __Pragma_init(_validTimePeriodSeconds, _singleUpdateFeeInWei); } diff --git a/solidity/test/utils/HyperlaneTestUtils.t.sol b/solidity/test/utils/HyperlaneTestUtils.t.sol index 5caddd40..83034f4a 100644 --- a/solidity/test/utils/HyperlaneTestUtils.t.sol +++ b/solidity/test/utils/HyperlaneTestUtils.t.sol @@ -34,7 +34,7 @@ abstract contract HyperlaneTestUtils is Test { bytes32 messageId, bytes memory payload, uint8 numSigners - ) public view returns (bytes memory updateData) { + ) public pure returns (bytes memory updateData) { bytes32[5] memory r = [ bytes32(0x83db08d4e1590714aef8600f5f1e3c967ab6a3b9f93bb4242de0306510e688ea), bytes32(0xf81a5dd3f871ad2d27a3b538e73663d723f8263fb3d289514346d43d000175f5), @@ -95,7 +95,7 @@ contract HyperlaneTestUtilsTest is Test, HyperlaneTestUtils { string memory reason, bytes memory updateData, IHyperlane hyperlane - ) private view { + ) private pure { assertTrue(valid); assertEq(reason, ""); assertEq(hyMsg.nonce, TEST_NONCE, "Nonce does not correspond"); diff --git a/solidity/test/utils/TestConstants.sol b/solidity/test/utils/TestConstants.sol index 79cbf899..4478eb3a 100644 --- a/solidity/test/utils/TestConstants.sol +++ b/solidity/test/utils/TestConstants.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.8.0; + /// @title Constants /// @author Pragma Labs /// @custom:contact security@pragma.build