Skip to content

Commit 4439998

Browse files
Move the verifier type to the interface
1 parent 8635dba commit 4439998

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ contract AlignedProofAggregationService is
4242
/// verified against known and registered programs.
4343
mapping(bytes32 => uint8) public programIds;
4444

45-
enum VerifierType {
46-
INVALID, // This to prevent default value being considered valid (when mapping returns 0 for non-existing keys)
47-
SP1,
48-
RISC0
49-
}
50-
5145
constructor() {
5246
_disableInitializers();
5347
}
@@ -77,7 +71,7 @@ contract AlignedProofAggregationService is
7771
{
7872
(bytes32 merkleRoot) = abi.decode(sp1PublicValues, (bytes32));
7973

80-
require(programIds[programId] == uint8(VerifierType.SP1), "Invalid program ID");
74+
require(programIds[programId] == uint8(IAlignedProofAggregationService.VerifierType.SP1), "Invalid program ID");
8175

8276
// In dev mode, poofs are mocked, so we skip the verification part
8377
if (_isSP1VerificationEnabled()) {
@@ -94,7 +88,7 @@ contract AlignedProofAggregationService is
9488
{
9589
(bytes32 merkleRoot) = abi.decode(risc0JournalBytes, (bytes32));
9690

97-
require(programIds[programId] == uint8(VerifierType.RISC0), "Invalid program ID");
91+
require(programIds[programId] == uint8(IAlignedProofAggregationService.VerifierType.RISC0), "Invalid program ID");
9892

9993
// In dev mode, poofs are mocked, so we skip the verification part
10094
if (_isRisc0VerificationEnabled()) {
@@ -124,7 +118,7 @@ contract AlignedProofAggregationService is
124118
/// @param verifierType The type of verifier (SP1 or RISC0).
125119
///
126120
/// @return bool Returns true if the computed Merkle root is a recognized valid aggregated proof.
127-
function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 programId, bytes calldata publicInputs, VerifierType verifierType)
121+
function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 programId, bytes calldata publicInputs, IAlignedProofAggregationService.VerifierType verifierType)
128122
public
129123
view
130124
returns (bool)
@@ -172,7 +166,7 @@ contract AlignedProofAggregationService is
172166
emit SP1VerifierAddressUpdated(_sp1VerifierAddress);
173167
}
174168

175-
function addProgramId(bytes32 programId, VerifierType verifierType) external onlyOwner {
169+
function addProgramId(bytes32 programId, IAlignedProofAggregationService.VerifierType verifierType) external onlyOwner {
176170
programIds[programId] = uint8(verifierType);
177171
emit ProgramIdAdded(programId, verifierType);
178172
}

contracts/src/core/IAlignedProofAggregationService.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ interface IAlignedProofAggregationService {
5252
function deleteProgramId(bytes32 programId) external;
5353

5454
error OnlyAlignedAggregator(address sender);
55+
56+
enum VerifierType {
57+
INVALID, // This to prevent default value being considered valid (when mapping returns 0 for non-existing keys)
58+
SP1,
59+
RISC0
60+
}
5561
}

0 commit comments

Comments
 (0)