@@ -5,8 +5,8 @@ import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initia
55import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol " ;
66import {UUPSUpgradeable} from "@openzeppelin-upgrades/contracts/proxy/utils/UUPSUpgradeable.sol " ;
77import {IAlignedProofAggregationService} from "./IAlignedProofAggregationService.sol " ;
8+ import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol " ;
89
9- /// Template for contract, SP1 verifiers needs to be added
1010contract AlignedProofAggregationService is
1111 IAlignedProofAggregationService ,
1212 Initializable ,
@@ -47,9 +47,9 @@ contract AlignedProofAggregationService is
4747
4848 function verify (
4949 bytes32 blobVersionedHash ,
50- // bytes32 sp1ProgramVKey,
51- bytes calldata sp1PublicValues
52- // bytes calldata sp1ProofBytes
50+ bytes32 sp1ProgramVKey ,
51+ bytes calldata sp1PublicValues ,
52+ bytes calldata sp1ProofBytes
5353 ) public onlyAlignedAggregator {
5454 // In dev mode, poofs are mocked, so we skip the verification part
5555 if (sp1VerifierAddress == VERIFIER_MOCK_ADDRESS) {
@@ -58,6 +58,15 @@ contract AlignedProofAggregationService is
5858 return ;
5959 }
6060
61+ try ISP1Verifier (sp1VerifierAddress).verifyProof (sp1ProgramVKey, sp1PublicValues, sp1ProofBytes) {
62+ (bytes32 merkleRoot ) = abi.decode (sp1PublicValues, (bytes32 ));
63+ _newAggregatedProof (merkleRoot, blobVersionedHash);
64+ } catch {
65+ AggregatedProof storage proof = aggregatedProofs[currentAggregatedProofNumber];
66+ proof.status = AggregatedProofStatus.Failed;
67+ emit NewAggregatedProof (currentAggregatedProofNumber, AggregatedProofStatus.Failed, 0x0 , 0x0 );
68+ currentAggregatedProofNumber += 1 ;
69+ }
6170 }
6271
6372 function markCurrentAggregatedProofAsMissed () public onlyAlignedAggregator {
0 commit comments