Skip to content

Commit

Permalink
update universal verifier abi
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroga committed Feb 4, 2025
1 parent 3e7500c commit c3172bc
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/iden3comm/handlers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const processProofAuth = async (
);

authResponse = {
authType: ('zk-' + circuitId) as string,
authMethod: ('zk-' + circuitId) as string,
circuitId: authProof.circuitId,
proof: zkpRes.proof,
pub_signals: zkpRes.pub_signals
Expand Down
2 changes: 1 addition & 1 deletion src/iden3comm/types/protocol/contract-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ export type ContractInvokeTransactionData = {

/** AuthProofResponse represents structure of zkp response */
export type AuthProofResponse = {
authType: string;
authMethod: string;
circuitId: string;
} & ZKProof;
135 changes: 73 additions & 62 deletions src/storage/blockchain/abi/UniversalVerifier.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "AuthTypeAlreadyExists",
"name": "AuthMethodAlreadyExists",
"type": "error"
},
{
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "AuthTypeNotFound",
"name": "AuthMethodNotFound",
"type": "error"
},
{
"inputs": [],
"name": "ChallengeIsInvalid",
"type": "error"
},
{
Expand Down Expand Up @@ -297,17 +302,23 @@
{
"indexed": true,
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
},
{
"indexed": true,
"indexed": false,
"internalType": "address",
"name": "caller",
"name": "validator",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "AuthResponseSubmitted",
"name": "AuthMethodSet",
"type": "event"
},
{
Expand All @@ -316,23 +327,17 @@
{
"indexed": true,
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
},
{
"indexed": false,
"indexed": true,
"internalType": "address",
"name": "validator",
"name": "caller",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "AuthTypeSet",
"name": "AuthResponseSubmitted",
"type": "event"
},
{
Expand Down Expand Up @@ -362,6 +367,12 @@
"internalType": "uint256[]",
"name": "requestIds",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "groupIds",
"type": "uint256[]"
}
],
"name": "MultiRequestSet",
Expand Down Expand Up @@ -531,15 +542,39 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "multiRequestId",
"type": "uint256"
},
{
"internalType": "address",
"name": "userAddress",
"type": "address"
}
],
"name": "areMultiRequestProofsVerified",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "authTypeExists",
"name": "authMethodExists",
"outputs": [
{
"internalType": "bool",
Expand All @@ -554,11 +589,11 @@
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "disableAuthType",
"name": "disableAuthMethod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand All @@ -580,11 +615,11 @@
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "enableAuthType",
"name": "enableAuthMethod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand All @@ -606,11 +641,11 @@
"inputs": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
}
],
"name": "getAuthType",
"name": "getAuthMethod",
"outputs": [
{
"components": [
Expand All @@ -630,8 +665,8 @@
"type": "bool"
}
],
"internalType": "struct Verifier.AuthTypeData",
"name": "authMethod",
"internalType": "struct Verifier.AuthMethodData",
"name": "authMethodData",
"type": "tuple"
}
],
Expand Down Expand Up @@ -751,7 +786,7 @@
"type": "address"
}
],
"name": "getMultiRequestStatus",
"name": "getMultiRequestProofsStatus",
"outputs": [
{
"components": [
Expand All @@ -776,7 +811,7 @@
"type": "uint256"
}
],
"internalType": "struct IVerifier.RequestStatus[]",
"internalType": "struct IVerifier.RequestProofStatus[]",
"name": "",
"type": "tuple[]"
}
Expand Down Expand Up @@ -862,7 +897,7 @@
"type": "uint256"
}
],
"name": "getRequestStatus",
"name": "getRequestProofStatus",
"outputs": [
{
"components": [
Expand All @@ -887,7 +922,7 @@
"type": "uint256"
}
],
"internalType": "struct IVerifier.RequestStatus",
"internalType": "struct IVerifier.RequestProofStatus",
"name": "",
"type": "tuple"
}
Expand Down Expand Up @@ -1036,30 +1071,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "multiRequestId",
"type": "uint256"
},
{
"internalType": "address",
"name": "userAddress",
"type": "address"
}
],
"name": "isMultiRequestVerified",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1092,7 +1103,7 @@
"type": "uint256"
}
],
"name": "isRequestVerified",
"name": "isRequestProofVerified",
"outputs": [
{
"internalType": "bool",
Expand Down Expand Up @@ -1212,7 +1223,7 @@
"components": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
},
{
Expand All @@ -1226,12 +1237,12 @@
"type": "bytes"
}
],
"internalType": "struct IVerifier.AuthType",
"name": "authType",
"internalType": "struct IVerifier.AuthMethod",
"name": "authMethod",
"type": "tuple"
}
],
"name": "setAuthType",
"name": "setAuthMethod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand Down Expand Up @@ -1356,7 +1367,7 @@
"components": [
{
"internalType": "string",
"name": "authType",
"name": "authMethod",
"type": "string"
},
{
Expand Down
10 changes: 5 additions & 5 deletions src/storage/blockchain/onchain-verifier-multi-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const maxGasLimit = 10000000n;
* Supported function signature for SubmitResponse
*/
export enum FunctionSignaturesMultiQuery {
//function submitResponse(tuple(string authType,bytes proof),tuple[](uint256 requestId,bytes proof,bytes metadata),bytes crossChainProof)
//function submitResponse(tuple(string authMethod,bytes proof),tuple[](uint256 requestId,bytes proof,bytes metadata),bytes crossChainProof)
SubmitResponse = '06c86a91'
}
/**
Expand Down Expand Up @@ -125,7 +125,7 @@ export class OnChainVerifierMultiQuery implements IOnChainVerifierMultiQuery {
}

private static async _processAuthProof(authProof: AuthProofResponse) {
const authType = authProof.authType;
const authMethod = authProof.authMethod;
const inputs = authProof.pub_signals;

if (!this._supportedCircuits.includes(authProof.circuitId as CircuitId)) {
Expand All @@ -142,7 +142,7 @@ export class OnChainVerifierMultiQuery implements IOnChainVerifierMultiQuery {
authProof.proof.pi_c.slice(0, 2)
);

return { authType, zkProofEncoded };
return { authMethod, zkProofEncoded };
}

private static async _processProof(zkProof: ZeroKnowledgeProofResponse) {
Expand Down Expand Up @@ -201,8 +201,8 @@ export class OnChainVerifierMultiQuery implements IOnChainVerifierMultiQuery {
const payloadResponses = [];

// 1. Process auth response
const { authType, zkProofEncoded } = await this._processAuthProof(authResponse);
const payloadAuthResponse = { authType: authType, proof: zkProofEncoded };
const { authMethod, zkProofEncoded } = await this._processAuthProof(authResponse);
const payloadAuthResponse = { authMethod: authMethod, proof: zkProofEncoded };

// 2. Process all the responses
for (const zkProof of responses) {
Expand Down

0 comments on commit c3172bc

Please sign in to comment.