@@ -49,6 +49,9 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
4949 /// @dev Address that can submit proofs
5050 address public proofSubmitter;
5151
52+ /// @dev Address authorized to revoke intermediate certificates (in addition to owner)
53+ address public revoker;
54+
5255 /// @dev Configuration mapping for each supported ZK coprocessor type
5356 mapping (ZkCoProcessorType => ZkCoProcessorConfig) public zkConfig;
5457
@@ -108,6 +111,9 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
108111 /// @dev Thrown when a zero address is provided for the verifier
109112 error InvalidVerifierAddress ();
110113
114+ /// @dev Thrown when caller is neither the owner nor the revoker
115+ error CallerNotOwnerOrRevoker ();
116+
111117 // ============ Events ============
112118
113119 /// @dev Emitted when a new verifier program ID is added/updated
@@ -143,9 +149,18 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
143149 /// @dev Event emitted when the maximum time difference is updated
144150 event MaxTimeDiffUpdated (uint64 newMaxTimeDiff );
145151
152+ /// @dev Event emitted when the revoker address is updated
153+ event RevokerUpdated (address indexed newRevoker );
154+
146155 /// @dev Thrown when initializeTrustedCerts and initializeTrustedCertExpiries have different lengths
147156 error CertExpiriesLengthMismatch (uint256 certsLen , uint256 expiriesLen );
148157
158+ /// @dev Restricts access to the owner or the revoker
159+ modifier onlyOwnerOrRevoker () {
160+ if (msg .sender != owner () && msg .sender != revoker) revert CallerNotOwnerOrRevoker ();
161+ _;
162+ }
163+
149164 /**
150165 * @dev Initializes the contract with owner, time tolerance and initial trusted certificates
151166 * @param owner Address to be set as the contract owner
@@ -154,6 +169,7 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
154169 * @param initializeTrustedCertExpiries Array of notAfter timestamps (seconds) for each initial cert
155170 * @param initialRootCert Hash of the AWS Nitro Enclave root certificate
156171 * @param initialProofSubmitter Address that is authorized to submit proofs
172+ * @param initialRevoker Address authorized to revoke intermediate certificates (can be address(0) to disable)
157173 * @param zkCoProcessor Type of ZK coprocessor to configure (RiscZero or Succinct)
158174 * @param config Configuration parameters for the ZK coprocessor
159175 * @param verifierProofId The verifierProofId corresponding to the verifierId in config
@@ -165,6 +181,7 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
165181 uint64 [] memory initializeTrustedCertExpiries ,
166182 bytes32 initialRootCert ,
167183 address initialProofSubmitter ,
184+ address initialRevoker ,
168185 ZkCoProcessorType zkCoProcessor ,
169186 ZkCoProcessorConfig memory config ,
170187 bytes32 verifierProofId
@@ -180,6 +197,7 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
180197 _initializeOwner (owner);
181198 _setRootCert (initialRootCert);
182199 _setProofSubmitter (initialProofSubmitter);
200+ revoker = initialRevoker;
183201 _setZkConfiguration (zkCoProcessor, config, verifierProofId);
184202 }
185203
@@ -321,13 +339,13 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
321339 * @param certHash Hash of the certificate to revoke
322340 *
323341 * Requirements:
324- * - Only callable by contract owner
342+ * - Only callable by contract owner or revoker
325343 * - Certificate must exist in the trusted intermediate certificates set
326344 *
327- * This function allows the owner to revoke compromised intermediate certificates
345+ * This function allows the owner or revoker to revoke compromised intermediate certificates
328346 * without affecting the root certificate or other trusted certificates.
329347 */
330- function revokeCert (bytes32 certHash ) external onlyOwner {
348+ function revokeCert (bytes32 certHash ) external onlyOwnerOrRevoker {
331349 if (trustedIntermediateCerts[certHash] == 0 ) {
332350 revert CertificateNotFound (certHash);
333351 }
@@ -424,6 +442,18 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
424442 _setProofSubmitter (submitter);
425443 }
426444
445+ /**
446+ * @dev Updates the revoker address
447+ * @param newRevoker New revoker address (can be address(0) to disable the revoker role)
448+ *
449+ * Requirements:
450+ * - Only callable by contract owner
451+ */
452+ function setRevoker (address newRevoker ) external onlyOwner {
453+ revoker = newRevoker;
454+ emit RevokerUpdated (newRevoker);
455+ }
456+
427457 // ============ Verification Functions ============
428458
429459 /**
@@ -662,8 +692,8 @@ contract NitroEnclaveVerifier is Ownable, INitroEnclaveVerifier, ISemver {
662692 }
663693
664694 /// @notice Semantic version.
665- /// @custom:semver 0.2 .0
695+ /// @custom:semver 0.3 .0
666696 function version () public pure virtual returns (string memory ) {
667- return "0.2 .0 " ;
697+ return "0.3 .0 " ;
668698 }
669699}
0 commit comments