Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CertManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,13 @@ contract CertManager is ICertManager {
}

function unrevokeCert(bytes32 certId) external onlyOwner {
if (!revoked[certId]) return;
revoked[certId] = false;
emit CertUnrevoked(certId, msg.sender);
}

function _revokeCert(bytes32 certId) internal {
if (revoked[certId]) return;
revoked[certId] = true;
emit CertRevoked(certId, msg.sender);
}
Expand Down
14 changes: 14 additions & 0 deletions test/CertManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,20 @@ contract CertRevocationEventTest is Test {
cm.unrevokeCert(CERT_ID);
}

function test_RepeatedRevokeDoesNotEmitEvent() public {
cm.revokeCert(CERT_ID);

vm.recordLogs();
cm.revokeCert(CERT_ID);
assertEq(vm.getRecordedLogs().length, 0, "repeated revoke emitted event");
}

function test_RepeatedUnrevokeDoesNotEmitEvent() public {
vm.recordLogs();
cm.unrevokeCert(CERT_ID);
assertEq(vm.getRecordedLogs().length, 0, "repeated unrevoke emitted event");
}

/// @dev The recorded account is the actual caller, not the contract: a delegated revoker
/// address shows up in the event topic.
function test_RevokeCertRecordsActualCaller() public {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/CertManagerDemo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IP384Verifier} from "../../src/IP384Verifier.sol";
/// @notice Demo-only certificate manager with configurable certificate expiry grace.
/// @dev This exists only to replay expired Nitro fixtures on testnets. Do not use in production or audit target deployments.
contract CertManagerDemo is CertManager {
uint256 public immutable certificateExpiryGraceSeconds;
uint256 private immutable certificateExpiryGraceSeconds;

constructor(IP384Verifier p384Verifier_, uint256 certificateExpiryGraceSeconds_) CertManager(p384Verifier_) {
certificateExpiryGraceSeconds = certificateExpiryGraceSeconds_;
Expand Down
Loading