Skip to content

Commit

Permalink
remove missed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nonergodic committed Sep 2, 2024
1 parent ca2dfe3 commit a12a15c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/QueryResponse.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ library QueryResponseLib {
if(!signaturesValid)
revert VerificationFailed();
}}

function parseQueryResponse(
bytes memory response
) internal pure returns (QueryResponse memory ret) { unchecked {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/Proxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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"))));

Expand Down
16 changes: 8 additions & 8 deletions test/QueryResponse.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -593,15 +593,15 @@ 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();
wrapper.parseAndVerifyQueryResponse(wormhole, resp, getSignature(resp));
}

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();
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions test/QueryTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
Expand All @@ -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",
Expand Down Expand Up @@ -231,7 +231,7 @@ contract QueryResponseTest is Test {
/* targetBlockTimeUs */ 0x10642ac0,
/* followingBlockNumber */ 350,
/* followingBlockHash */ hex"04b022afaab8da2dd80bd8e6ae55e6303473a5e1de846a5de76d619e162429ce",
/* followingBlockTimeUs */ 0x10736d00,
/* followingBlockTimeUs */ 0x10736d00,
/* numResults */ 2,
/* results */ hex"000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d5772617070656420457468657200000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000012"
);
Expand Down

0 comments on commit a12a15c

Please sign in to comment.