From fa83f4a14f84f2a7f6cad30c457585a7d96c261f Mon Sep 17 00:00:00 2001 From: Justin Hernandez Date: Mon, 2 Feb 2026 19:19:15 -0800 Subject: [PATCH] formatting (#1683) --- .../disclose/Verifier_vc_and_disclose_kyc.sol | 37 +++++++++---------- .../verifiers/gcp/Verifier_gcp_jwt.sol | 37 +++++++++---------- .../register_kyc/Verifier_register_kyc.sol | 37 +++++++++---------- .../ignition/modules/hub/updateRegistries.ts | 2 - .../modules/registry/updateRegistries.ts | 30 +++++---------- 5 files changed, 64 insertions(+), 79 deletions(-) diff --git a/contracts/contracts/verifiers/disclose/Verifier_vc_and_disclose_kyc.sol b/contracts/contracts/verifiers/disclose/Verifier_vc_and_disclose_kyc.sol index b8de45e2c..cf4a82547 100644 --- a/contracts/contracts/verifiers/disclose/Verifier_vc_and_disclose_kyc.sol +++ b/contracts/contracts/verifiers/disclose/Verifier_vc_and_disclose_kyc.sol @@ -22,17 +22,17 @@ pragma solidity >=0.7.0 <0.9.0; contract Groth16Verifier { // Scalar field size - uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; + uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; // Base field size - uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; + uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; // Verification Key data - uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; - uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; - uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; - uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; - uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; - uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; + uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; + uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; + uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; + uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; + uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; + uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; @@ -42,7 +42,6 @@ contract Groth16Verifier { uint256 constant deltay1 = 8725996148009629609617423651062395041554350094385944632997372312828608644955; uint256 constant deltay2 = 19505227144542990355285832777856832082655385455315296491381347497982380087331; - uint256 constant IC0x = 16649376790350306128495410672000438222835355361873864679185308928608342391377; uint256 constant IC0y = 1365830659239397567654193478106544803466926587095831397836882385286292210457; @@ -133,14 +132,18 @@ contract Groth16Verifier { uint256 constant IC29x = 1170885743391113947515531032472753161485583617637753865725092942330476093342; uint256 constant IC29y = 19204742121781488340297839383055704899252648836617466985181418250802660585322; - // Memory data uint16 constant pVk = 0; uint16 constant pPairing = 128; uint16 constant pLastMem = 896; - function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[29] calldata _pubSignals) public view returns (bool) { + function verifyProof( + uint[2] calldata _pA, + uint[2][2] calldata _pB, + uint[2] calldata _pC, + uint[29] calldata _pubSignals + ) public view returns (bool) { assembly { function checkField(v) { if iszero(lt(v, r)) { @@ -242,7 +245,6 @@ contract Groth16Verifier { g1_mulAccC(_pVk, IC29x, IC29y, calldataload(add(pubSignals, 896))) - // -A mstore(_pPairing, calldataload(pA)) mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q)) @@ -267,7 +269,6 @@ contract Groth16Verifier { mstore(add(_pPairing, 384), mload(add(pMem, pVk))) mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32)))) - // gamma2 mstore(add(_pPairing, 448), gammax1) mstore(add(_pPairing, 480), gammax2) @@ -284,7 +285,6 @@ contract Groth16Verifier { mstore(add(_pPairing, 704), deltay1) mstore(add(_pPairing, 736), deltay2) - let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20) isOk := and(success, mload(_pPairing)) @@ -353,12 +353,11 @@ contract Groth16Verifier { checkField(calldataload(add(_pubSignals, 896))) - // Validate all evaluations let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem) mstore(0, isValid) - return(0, 0x20) - } - } - } + return(0, 0x20) + } + } +} diff --git a/contracts/contracts/verifiers/gcp/Verifier_gcp_jwt.sol b/contracts/contracts/verifiers/gcp/Verifier_gcp_jwt.sol index 4d36ea61c..629ddd7a7 100644 --- a/contracts/contracts/verifiers/gcp/Verifier_gcp_jwt.sol +++ b/contracts/contracts/verifiers/gcp/Verifier_gcp_jwt.sol @@ -22,17 +22,17 @@ pragma solidity >=0.7.0 <0.9.0; contract Verifier_gcp_jwt { // Scalar field size - uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; + uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; // Base field size - uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; + uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; // Verification Key data - uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; - uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; - uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; - uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; - uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; - uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; + uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; + uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; + uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; + uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; + uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; + uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; @@ -42,7 +42,6 @@ contract Verifier_gcp_jwt { uint256 constant deltay1 = 4195707504005103778106485021796359604414786496137920116128130440872062477216; uint256 constant deltay2 = 20513207510859042996645896574478474889840017920990203652675014165180462273668; - uint256 constant IC0x = 6972951741762339913362267428319005943611938060812676091174501911982947323821; uint256 constant IC0y = 4968121098705797351946375443564156998686441710551907423285338106315203657372; @@ -106,14 +105,18 @@ contract Verifier_gcp_jwt { uint256 constant IC20x = 13029408846315391045768292892963336300734709802776968717851605403617397448869; uint256 constant IC20y = 21441391199269244274037661931659719640029973634066921385003370500690694569608; - // Memory data uint16 constant pVk = 0; uint16 constant pPairing = 128; uint16 constant pLastMem = 896; - function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[20] calldata _pubSignals) public view returns (bool) { + function verifyProof( + uint[2] calldata _pA, + uint[2][2] calldata _pB, + uint[2] calldata _pC, + uint[20] calldata _pubSignals + ) public view returns (bool) { assembly { function checkField(v) { if iszero(lt(v, r)) { @@ -197,7 +200,6 @@ contract Verifier_gcp_jwt { g1_mulAccC(_pVk, IC20x, IC20y, calldataload(add(pubSignals, 608))) - // -A mstore(_pPairing, calldataload(pA)) mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q)) @@ -222,7 +224,6 @@ contract Verifier_gcp_jwt { mstore(add(_pPairing, 384), mload(add(pMem, pVk))) mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32)))) - // gamma2 mstore(add(_pPairing, 448), gammax1) mstore(add(_pPairing, 480), gammax2) @@ -239,7 +240,6 @@ contract Verifier_gcp_jwt { mstore(add(_pPairing, 704), deltay1) mstore(add(_pPairing, 736), deltay2) - let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20) isOk := and(success, mload(_pPairing)) @@ -290,12 +290,11 @@ contract Verifier_gcp_jwt { checkField(calldataload(add(_pubSignals, 608))) - // Validate all evaluations let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem) mstore(0, isValid) - return(0, 0x20) - } - } - } + return(0, 0x20) + } + } +} diff --git a/contracts/contracts/verifiers/register_kyc/Verifier_register_kyc.sol b/contracts/contracts/verifiers/register_kyc/Verifier_register_kyc.sol index 263f6efd9..5665feac8 100644 --- a/contracts/contracts/verifiers/register_kyc/Verifier_register_kyc.sol +++ b/contracts/contracts/verifiers/register_kyc/Verifier_register_kyc.sol @@ -22,17 +22,17 @@ pragma solidity >=0.7.0 <0.9.0; contract Verifier_register_kyc { // Scalar field size - uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; + uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; // Base field size - uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; + uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; // Verification Key data - uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; - uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; - uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; - uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; - uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; - uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; + uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; + uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; + uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; + uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; + uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; + uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; @@ -42,7 +42,6 @@ contract Verifier_register_kyc { uint256 constant deltay1 = 10401404284625717188368140886450294801087446278285114268746933223843924747393; uint256 constant deltay2 = 21623976071772575613470418289568781837131470676146510317928308200173145329920; - uint256 constant IC0x = 3168135977548073774669686196671110956985263260631963004209946350111009871783; uint256 constant IC0y = 19251271161827058925074199219712324559154387560340229136388386911360884273664; @@ -58,14 +57,18 @@ contract Verifier_register_kyc { uint256 constant IC4x = 11598465374717791235735036209864180918816853983932860910077820062417244512066; uint256 constant IC4y = 10915386471964999341016166937952548568058036159601535214565672698374193076432; - // Memory data uint16 constant pVk = 0; uint16 constant pPairing = 128; uint16 constant pLastMem = 896; - function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[4] calldata _pubSignals) public view returns (bool) { + function verifyProof( + uint[2] calldata _pA, + uint[2][2] calldata _pB, + uint[2] calldata _pC, + uint[4] calldata _pubSignals + ) public view returns (bool) { assembly { function checkField(v) { if iszero(lt(v, r)) { @@ -117,7 +120,6 @@ contract Verifier_register_kyc { g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96))) - // -A mstore(_pPairing, calldataload(pA)) mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q)) @@ -142,7 +144,6 @@ contract Verifier_register_kyc { mstore(add(_pPairing, 384), mload(add(pMem, pVk))) mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32)))) - // gamma2 mstore(add(_pPairing, 448), gammax1) mstore(add(_pPairing, 480), gammax2) @@ -159,7 +160,6 @@ contract Verifier_register_kyc { mstore(add(_pPairing, 704), deltay1) mstore(add(_pPairing, 736), deltay2) - let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20) isOk := and(success, mload(_pPairing)) @@ -178,12 +178,11 @@ contract Verifier_register_kyc { checkField(calldataload(add(_pubSignals, 96))) - // Validate all evaluations let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem) mstore(0, isValid) - return(0, 0x20) - } - } - } + return(0, 0x20) + } + } +} diff --git a/contracts/ignition/modules/hub/updateRegistries.ts b/contracts/ignition/modules/hub/updateRegistries.ts index 29754b337..032794a71 100644 --- a/contracts/ignition/modules/hub/updateRegistries.ts +++ b/contracts/ignition/modules/hub/updateRegistries.ts @@ -63,8 +63,6 @@ export default buildModule("UpdateHubRegistries", (m) => { const hubContract = updateHubRegistries(m, hubAddress, deployedAddresses); - - return { hubContract, }; diff --git a/contracts/ignition/modules/registry/updateRegistries.ts b/contracts/ignition/modules/registry/updateRegistries.ts index 29a89d0c8..c6de52a80 100644 --- a/contracts/ignition/modules/registry/updateRegistries.ts +++ b/contracts/ignition/modules/registry/updateRegistries.ts @@ -41,7 +41,7 @@ const registries = { gcpJWTVerifier: "0x13ee8CEa15a262D81a245b37889F7b4bEd015f4c", pcr0Manager: "0xf2810D5E9938816D42F0Ae69D33F013a23C0aED2", imageDigest: "0x67368d91dc708dee7be8fd9d85eff1fce3181e6e5b9fdfa37fc2d99034ea88e6", - gcpRootCAPubkeyHash: "14165687497759817957828709957846495993787741657460065475757428560999622217191" + gcpRootCAPubkeyHash: "14165687497759817957828709957846495993787741657460065475757428560999622217191", }, }; @@ -99,35 +99,25 @@ export function handleRegistryDeployment( if (registryData.passportNoOfac) { const callOptions = { after: [currentOperation], id: ids() }; - currentOperation = m.call( - registryContract, - "updatePassportNoOfacRoot", - [registryData.passportNoOfac], - callOptions, - ); + currentOperation = m.call(registryContract, "updatePassportNoOfacRoot", [registryData.passportNoOfac], callOptions); } if (registryData.nameAndDobOfac) { const callOptions = { after: [currentOperation], id: ids() }; - currentOperation = m.call( - registryContract, - "updateNameAndDobOfacRoot", - [registryData.nameAndDobOfac], - callOptions, - ); + currentOperation = m.call(registryContract, "updateNameAndDobOfacRoot", [registryData.nameAndDobOfac], callOptions); } if (registryData.nameAndYobOfac) { const callOptions = { after: [currentOperation], id: ids() }; - currentOperation = m.call( - registryContract, - "updateNameAndYobOfacRoot", - [registryData.nameAndYobOfac], - callOptions, - ); + currentOperation = m.call(registryContract, "updateNameAndYobOfacRoot", [registryData.nameAndYobOfac], callOptions); } if (registryData.gcpRootCAPubkeyHash) { const callOptions = { after: [currentOperation], id: ids() }; - currentOperation = m.call(registryContract, "updateGCPRootCAPubkeyHash", [registryData.gcpRootCAPubkeyHash], callOptions); + currentOperation = m.call( + registryContract, + "updateGCPRootCAPubkeyHash", + [registryData.gcpRootCAPubkeyHash], + callOptions, + ); } if (registryData.pubkeyCommitments && registryData.pubkeyCommitments.length > 0) {