Skip to content

Commit

Permalink
feat: add view functions in tests to remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yum0e committed Jul 23, 2023
1 parent 7a6700f commit ec6dee5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/verifiers/HydraS3Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
}

function _checkSnarkProof(HydraS3ProofData memory snarkProofData) internal view {
// low-level call to the `verifyProof` function
// since the function only accepts arguments located in calldata
bool isVerified = this.verifyProof(
snarkProofData.proof.a,
snarkProofData.proof.b,
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/SismoConnectE2E.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
cheatsheet = new CheatSheet();
}

function test_SismoConnectLibWithOnlyClaimAndMessage() public {
function test_SismoConnectLibWithOnlyClaimAndMessage() public view {
(, bytes memory responseEncoded) = hydraS3Proofs.getResponseWithOneClaimAndSignature();

sismoConnect.exposed_verify({
Expand All @@ -85,7 +85,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
});
}

function test_SismoConnectLibWithTwoClaimsAndMessage() public {
function test_SismoConnectLibWithTwoClaimsAndMessage() public view {
(, bytes memory responseEncoded) = hydraS3Proofs.getResponseWithTwoClaimsAndSignature();

ClaimRequest[] memory claims = new ClaimRequest[](2);
Expand Down Expand Up @@ -144,7 +144,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
zkdrop.claimWithSismoConnect(responseEncoded, user);
}

function test_TwoClaimsOneVaultAuthWithSignature() public {
function test_TwoClaimsOneVaultAuthWithSignature() public view {
ClaimRequest[] memory claims = new ClaimRequest[](2);
claims[0] = claimRequestBuilder.build({groupId: 0xe9ed316946d3d98dfcd829a53ec9822e});
claims[1] = claimRequestBuilder.build({groupId: 0x02d241fdb9d4330c564ffc0a36af05f6});
Expand All @@ -168,7 +168,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
console.log("Claims in Verified result: %s", verifiedResult.claims.length);
}

function test_ThreeClaimsOneVaultAuthWithSignatureOneClaimOptional() public {
function test_ThreeClaimsOneVaultAuthWithSignatureOneClaimOptional() public view {
ClaimRequest[] memory claims = new ClaimRequest[](3);
claims[0] = claimRequestBuilder.build({groupId: 0xe9ed316946d3d98dfcd829a53ec9822e});
claims[1] = claimRequestBuilder.build({groupId: 0x02d241fdb9d4330c564ffc0a36af05f6});
Expand Down Expand Up @@ -197,7 +197,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
console.log("Claims in Verified result: %s", verifiedResult.claims.length);
}

function test_ThreeClaimsOneVaultAuthOneTwitterAuthWithSignatureOneClaimOptional() public {
function test_ThreeClaimsOneVaultAuthOneTwitterAuthWithSignatureOneClaimOptional() public view {
ClaimRequest[] memory claims = new ClaimRequest[](3);
claims[0] = claimRequestBuilder.build({groupId: 0xe9ed316946d3d98dfcd829a53ec9822e});
claims[1] = claimRequestBuilder.build({groupId: 0x02d241fdb9d4330c564ffc0a36af05f6});
Expand Down Expand Up @@ -231,7 +231,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
console.log("Claims in Verified result: %s", verifiedResult.claims.length);
}

function test_OneClaimOneOptionalTwitterAuthOneGithubAuthWithSignature() public {
function test_OneClaimOneOptionalTwitterAuthOneGithubAuthWithSignature() public view {
ClaimRequest[] memory claims = new ClaimRequest[](1);
claims[0] = claimRequestBuilder.build({groupId: 0xe9ed316946d3d98dfcd829a53ec9822e});

Expand Down Expand Up @@ -259,7 +259,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
console.log("Claims in Verified result: %s", verifiedResult.claims.length);
}

function test_GitHubAuth() public {
function test_GitHubAuth() public view {
(, bytes memory encodedResponse) = hydraS3Proofs.getResponseWithGitHubAuth();

SismoConnectRequest memory request = requestBuilder.build({
Expand All @@ -270,7 +270,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
sismoConnect.exposed_verify({responseBytes: encodedResponse, request: request});
}

function test_GitHubAuthWithoutSignature() public {
function test_GitHubAuthWithoutSignature() public view {
(, bytes memory encodedResponse) = hydraS3Proofs.getResponseWithGitHubAuthWithoutSignature();

SismoConnectRequest memory request = requestBuilder.build({
Expand Down Expand Up @@ -343,7 +343,7 @@ contract SismoConnectE2E is HydraS3BaseTest {
sismoConnect.exposed_verify({responseBytes: abi.encode(response), request: request});
}

function test_CheatSheet() public {
function test_CheatSheet() public view {
bytes memory responseBytes = hydraS3Proofs.getCheatSheetResponse();
cheatsheet.verifySismoConnectResponse(responseBytes);
}
Expand Down

0 comments on commit ec6dee5

Please sign in to comment.