Skip to content

Commit

Permalink
fix: use use view for verify function
Browse files Browse the repository at this point in the history
  • Loading branch information
leosayous21 committed Jul 22, 2023
1 parent 52441ae commit aee373d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "sismo-connect-onchain-verifier",
"version": "1.0.0",
"name": "sismo-connect-solidity",
"version": "1.0.1",
"main": "index.js",
"repository": "[email protected]:sismo-core/sismo-connect-onchain-verifier.git",
"repository": "[email protected]:sismo-core/sismo-connect-solidity.git",
"author": "Hadrien Charlanes <[email protected]>",
"license": "MIT",
"devDependencies": {
Expand Down
50 changes: 25 additions & 25 deletions src/SismoConnectLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract SismoConnect {
ClaimRequest memory claim,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, claim, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -89,7 +89,7 @@ contract SismoConnect {
AuthRequest memory auth,
ClaimRequest memory claim,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, claim, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -100,7 +100,7 @@ contract SismoConnect {
AuthRequest memory auth,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -111,7 +111,7 @@ contract SismoConnect {
ClaimRequest memory claim,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claim, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -121,7 +121,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest memory auth,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -131,7 +131,7 @@ contract SismoConnect {
bytes memory responseBytes,
ClaimRequest memory claim,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claim, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -142,7 +142,7 @@ contract SismoConnect {
AuthRequest memory auth,
ClaimRequest memory claim,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, claim, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -152,7 +152,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest memory auth,
ClaimRequest memory claim
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, claim);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -162,7 +162,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest memory auth,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -172,7 +172,7 @@ contract SismoConnect {
bytes memory responseBytes,
ClaimRequest memory claim,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claim, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -181,7 +181,7 @@ contract SismoConnect {
function verify(
bytes memory responseBytes,
AuthRequest memory auth
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auth);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -190,7 +190,7 @@ contract SismoConnect {
function verify(
bytes memory responseBytes,
ClaimRequest memory claim
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claim);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -199,7 +199,7 @@ contract SismoConnect {
function verify(
bytes memory responseBytes,
SismoConnectRequest memory request
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
return _sismoConnectVerifier.verify(response, request, config());
}
Expand All @@ -210,7 +210,7 @@ contract SismoConnect {
ClaimRequest[] memory claims,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, claims, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -221,7 +221,7 @@ contract SismoConnect {
AuthRequest[] memory auths,
ClaimRequest[] memory claims,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, claims, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -232,7 +232,7 @@ contract SismoConnect {
AuthRequest[] memory auths,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -243,7 +243,7 @@ contract SismoConnect {
ClaimRequest[] memory claims,
SignatureRequest memory signature,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claims, signature, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -253,7 +253,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest[] memory auths,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -263,7 +263,7 @@ contract SismoConnect {
bytes memory responseBytes,
ClaimRequest[] memory claims,
bytes16 namespace
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claims, namespace);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -274,7 +274,7 @@ contract SismoConnect {
AuthRequest[] memory auths,
ClaimRequest[] memory claims,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, claims, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -284,7 +284,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest[] memory auths,
ClaimRequest[] memory claims
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, claims);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -294,7 +294,7 @@ contract SismoConnect {
bytes memory responseBytes,
AuthRequest[] memory auths,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -304,7 +304,7 @@ contract SismoConnect {
bytes memory responseBytes,
ClaimRequest[] memory claims,
SignatureRequest memory signature
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claims, signature);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -313,7 +313,7 @@ contract SismoConnect {
function verify(
bytes memory responseBytes,
AuthRequest[] memory auths
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(auths);
return _sismoConnectVerifier.verify(response, request, config());
Expand All @@ -322,7 +322,7 @@ contract SismoConnect {
function verify(
bytes memory responseBytes,
ClaimRequest[] memory claims
) internal returns (SismoConnectVerifiedResult memory) {
) internal view returns (SismoConnectVerifiedResult memory) {
SismoConnectResponse memory response = abi.decode(responseBytes, (SismoConnectResponse));
SismoConnectRequest memory request = buildRequest(claims);
return _sismoConnectVerifier.verify(response, request, config());
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISismoConnectVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ISismoConnectVerifier {
SismoConnectResponse memory response,
SismoConnectRequest memory request,
SismoConnectConfig memory config
) external returns (SismoConnectVerifiedResult memory);
) external view returns (SismoConnectVerifiedResult memory);

function SISMO_CONNECT_VERSION() external view returns (bytes32);
}
2 changes: 1 addition & 1 deletion test/misc/CheatSheet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract CheatSheet is SismoConnect {
SismoConnect(buildConfig({appId: _appId, isImpersonationMode: _isImpersonationMode}))
{}

function verifySismoConnectResponse(bytes memory response) public {
function verifySismoConnectResponse(bytes memory response) public view {
// Recreate the request made in the fontend to verify the proof
AuthRequest[] memory auths = new AuthRequest[](6);
auths[0] = _authRequestBuilder.build({authType: AuthType.VAULT});
Expand Down

0 comments on commit aee373d

Please sign in to comment.