Skip to content

Commit aa1e8fb

Browse files
committed
feat: verify proof inclusion in proof aggregation contract
1 parent e02d28b commit aa1e8fb

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {UUPSUpgradeable} from "@openzeppelin-upgrades/contracts/proxy/utils/UUPS
77
import {IAlignedProofAggregationService} from "./IAlignedProofAggregationService.sol";
88
import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";
99
import {IRiscZeroVerifier} from "@risc0-contracts/IRiscZeroVerifier.sol";
10+
import {MerkleProof} from "../../lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
1011

1112
contract AlignedProofAggregationService is
1213
IAlignedProofAggregationService,
@@ -89,6 +90,11 @@ contract AlignedProofAggregationService is
8990
emit AggregatedProofVerified(merkleRoot, blobVersionedHash);
9091
}
9192

93+
function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 proofCommitment) public view returns (bool) {
94+
bytes32 merkleRoot = MerkleProof.processProofCalldata(merklePath, proofCommitment);
95+
return aggregatedProofs[merkleRoot];
96+
}
97+
9298
function _isSP1VerificationEnabled() internal view returns (bool) {
9399
return sp1VerifierAddress != VERIFIER_MOCK_ADDRESS;
94100
}

contracts/src/core/IAlignedProofAggregationService.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ interface IAlignedProofAggregationService {
2222
bytes calldata risc0JournalBytes
2323
) external;
2424

25+
function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 proofCommitment)
26+
external
27+
view
28+
returns (bool);
29+
2530
/// @notice event that gets emitted after a successful aggregated proof verification
2631
event AggregatedProofVerified(bytes32 indexed merkleRoot, bytes32 blobVersionedHash);
2732

0 commit comments

Comments
 (0)