From a12a15cc8e293b1d8eb528adcd083c239741882a Mon Sep 17 00:00:00 2001 From: nonergodic Date: Mon, 2 Sep 2024 13:40:57 -0700 Subject: [PATCH] remove missed trailing spaces --- src/QueryResponse.sol | 4 ++-- test/Proxy.t.sol | 4 ++-- test/QueryResponse.t.sol | 16 ++++++++-------- test/QueryTest.t.sol | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/QueryResponse.sol b/src/QueryResponse.sol index 6ce8e17..5e96c74 100644 --- a/src/QueryResponse.sol +++ b/src/QueryResponse.sol @@ -195,7 +195,7 @@ library QueryResponseLib { if(!signaturesValid) revert VerificationFailed(); }} - + function parseQueryResponse( bytes memory response ) internal pure returns (QueryResponse memory ret) { unchecked { @@ -537,7 +537,7 @@ library QueryResponseLib { ) internal pure { unchecked { if (validContractAddresses.length > 0) validateContractAddress(ecd.contractAddress, validContractAddresses); - + if (validFunctionSignatures.length > 0) { (bytes4 funcSig,) = ecd.callData.asBytes4(0); validateFunctionSignature(funcSig, validFunctionSignatures); diff --git a/test/Proxy.t.sol b/test/Proxy.t.sol index e666745..b49a804 100644 --- a/test/Proxy.t.sol +++ b/test/Proxy.t.sol @@ -34,7 +34,7 @@ contract LogicContractV1 is ProxyBase { function customUpgradeFun(address newImplementation, bytes calldata data) external { if (msg.sender != adminState().admin) revert NotAuthorized(); - + _upgradeTo(newImplementation, data); } } @@ -62,7 +62,7 @@ contract TestProxy is Test { abi.encodePacked(bytes4(NoValueAllowed.selector)) )); new Proxy{value: 1 ether}(logic1, abi.encode("v1")); - + //deploy LogicContractV1 contrct = LogicContractV1(address(new Proxy(logic1, abi.encode("v1")))); diff --git a/test/QueryResponse.t.sol b/test/QueryResponse.t.sol index a79b8c3..247efc2 100644 --- a/test/QueryResponse.t.sol +++ b/test/QueryResponse.t.sol @@ -30,7 +30,7 @@ contract QueryResponseLibWrapper { ) external view { return QueryResponseLib.verifyQueryResponse(wormhole, response, signatures); } - + function parseQueryResponse( bytes memory response ) external pure returns (QueryResponse memory ret) { @@ -300,7 +300,7 @@ contract TestQueryResponse is Test { assertEq(eqr.targetBlockTime, 0x03f4810cc0); assertEq(eqr.followingBlockNum, 0x0000000000004272); assertEq(eqr.followingBlockHash, hex"0b1608c2cddfd9d7fb4ec94f79ec1389e2410e611a2c2bbde94e9ad37519ebbb"); - assertEq(eqr.followingBlockTime, 0x03f4904f00); + assertEq(eqr.followingBlockTime, 0x03f4904f00); assertEq(eqr.results.length, 2); assertEq(eqr.results[0].contractAddress, address(0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E)); @@ -495,7 +495,7 @@ contract TestQueryResponse is Test { assertEq(sar.results[0].owner, hex"02c806312cbe5b79ef8aa6c17e3f423d8fdfe1d46909fb1f6cdf65ee8e2e6faa"); assertEq(sar.results[0].data, hex"57cd18b7f8a4d91a2da9ab4af05d0fbece2dcd65"); } - + function test_parseSolanaPdaQueryResponseRevertWrongQueryType() public { // Pass an ETH per chain response into the Solana parser. PerChainQueryResponse memory r = PerChainQueryResponse({ @@ -593,7 +593,7 @@ contract TestQueryResponse is Test { function testFuzz_parseAndVerifyQueryResponse_fuzzQueryRequestLen(uint32 _queryRequestLen, bytes calldata _perChainQueries) public { // We add 6 to account for version + nonce + numPerChainQueries - vm.assume(_queryRequestLen != _perChainQueries.length + 6); + vm.assume(_queryRequestLen != _perChainQueries.length + 6); bytes memory resp = concatenateQueryResponseBytesOffChain(version, senderChainId, signature, queryRequestVersion, queryRequestNonce, numPerChainQueries, _perChainQueries, numPerChainResponses, perChainResponses); vm.expectRevert(); @@ -601,7 +601,7 @@ contract TestQueryResponse is Test { } function testFuzz_parseAndVerifyQueryResponse_fuzzQueryRequestVersion(uint8 _version, uint8 _queryRequestVersion) public { - vm.assume(_version != _queryRequestVersion); + vm.assume(_version != _queryRequestVersion); bytes memory resp = concatenateQueryResponseBytesOffChain(_version, senderChainId, signature, _queryRequestVersion, queryRequestNonce, numPerChainQueries, perChainQueries, numPerChainResponses, perChainResponses); vm.expectRevert(); @@ -611,7 +611,7 @@ contract TestQueryResponse is Test { function testFuzz_parseAndVerifyQueryResponse_fuzzQueryRequestNonce(uint32 _queryRequestNonce) public { bytes memory resp = concatenateQueryResponseBytesOffChain(version, senderChainId, signature, queryRequestVersion, _queryRequestNonce, numPerChainQueries, perChainQueries, numPerChainResponses, perChainResponses); QueryResponse memory r = wrapper.parseAndVerifyQueryResponse(wormhole, resp, getSignature(resp)); - + assertEq(r.nonce, _queryRequestNonce); } @@ -686,10 +686,10 @@ contract TestQueryResponse is Test { function testFuzz_verifyQueryResponse_validSignatureWrongPrefix(bytes calldata responsePrefix) public { vm.assume(keccak256(responsePrefix) != keccak256(QueryResponseLib.RESPONSE_PREFIX)); - + bytes memory resp = concatenateQueryResponseBytesOffChain(version, senderChainId, signature, queryRequestVersion, queryRequestNonce, numPerChainQueries, perChainQueries, numPerChainResponses, perChainResponses); bytes32 responseDigest = keccak256(abi.encodePacked(responsePrefix, keccak256(resp))); - + (uint8 sigV, bytes32 sigR, bytes32 sigS) = vm.sign(DEVNET_GUARDIAN_PRIVATE_KEY, responseDigest); IWormhole.Signature[] memory signatures = new IWormhole.Signature[](1); signatures[0] = IWormhole.Signature(sigR, sigS, sigV, SIG_GUARDIAN_INDEX); diff --git a/test/QueryTest.t.sol b/test/QueryTest.t.sol index 91d6965..6fa3916 100644 --- a/test/QueryTest.t.sol +++ b/test/QueryTest.t.sol @@ -38,17 +38,17 @@ contract QueryRequestTest is Test { bytes memory ecr = QueryTest.buildEthCallByTimestampRequestBytes( /* targetTimeUs */ 0x10642ac0, /* targetBlockHint */ "0x15d", - /* followingBlockHint */ "0x15e", + /* followingBlockHint */ "0x15e", /* numCallData */ 2, /* callData */ hex"ddb64fe46a91d46ee29420539fc25fd07c5fea3e0000000406fdde03ddb64fe46a91d46ee29420539fc25fd07c5fea3e00000004313ce567" ); assertEq(ecr, hex"0000000010642ac000000005307831356400000005307831356502ddb64fe46a91d46ee29420539fc25fd07c5fea3e0000000406fdde03ddb64fe46a91d46ee29420539fc25fd07c5fea3e00000004313ce567"); } - + function test_buildEthCallWithFinalityRequestBytes() public { bytes memory ecr = QueryTest.buildEthCallWithFinalityRequestBytes( /* blockId */ "0x1f8", - /* finality */ "finalized", + /* finality */ "finalized", /* numCallData */ 2, /* callData */ hex"ddb64fe46a91d46ee29420539fc25fd07c5fea3e0000000406fdde03ddb64fe46a91d46ee29420539fc25fd07c5fea3e00000004313ce567" ); @@ -66,8 +66,8 @@ contract QueryRequestTest is Test { /* callData */ hex"313ce567" ); assertEq(ecd2, hex"ddb64fe46a91d46ee29420539fc25fd07c5fea3e00000004313ce567"); - } - + } + function test_buildSolanaAccountRequestBytes() public { bytes memory ecr = QueryTest.buildSolanaAccountRequestBytes( /* commitment */ "finalized", @@ -231,7 +231,7 @@ contract QueryResponseTest is Test { /* targetBlockTimeUs */ 0x10642ac0, /* followingBlockNumber */ 350, /* followingBlockHash */ hex"04b022afaab8da2dd80bd8e6ae55e6303473a5e1de846a5de76d619e162429ce", - /* followingBlockTimeUs */ 0x10736d00, + /* followingBlockTimeUs */ 0x10736d00, /* numResults */ 2, /* results */ hex"000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d5772617070656420457468657200000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000012" );