Skip to content

Commit f893677

Browse files
committed
chore: fix test
1 parent d4be673 commit f893677

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/test/mocks/OperatorTableUpdaterMock.sol

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,15 @@ import "src/contracts/interfaces/IOperatorTableUpdater.sol";
77
contract OperatorTableUpdaterMock is Test {
88
receive() external payable {}
99
fallback() external payable {}
10+
11+
mapping(uint32 referenceTimestamp => bool valid) internal _invalidRoots;
12+
13+
function isRootValidByTimestamp(uint32 referenceTimestamp) external view returns (bool) {
14+
// If the root is invalid, return false
15+
return !_invalidRoots[referenceTimestamp];
16+
}
17+
18+
function invalidateRoot(uint32 referenceTimestamp) external {
19+
_invalidRoots[referenceTimestamp] = true;
20+
}
1021
}

src/test/unit/BN254CertificateVerifierUnit.t.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,7 @@ contract BN254CertificateVerifierUnitTests_verifyCertificate is BN254Certificate
407407
uint32 referenceTimestamp = _initializeOperatorTableBase();
408408

409409
// Mock the operatorTableUpdater to return false for isRootValidByTimestamp
410-
vm.mockCall(
411-
address(operatorTableUpdaterMock),
412-
abi.encodeWithSelector(IOperatorTableUpdater.isRootValidByTimestamp.selector, referenceTimestamp),
413-
abi.encode(false)
414-
);
410+
operatorTableUpdaterMock.invalidateRoot(referenceTimestamp);
415411

416412
BN254Certificate memory cert;
417413
cert.referenceTimestamp = referenceTimestamp;

src/test/unit/ECDSACertificateVerifierUnit.t.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate
381381
// Initialize operator table with a valid root
382382
uint32 referenceTimestamp = _initializeOperatorTableBase();
383383

384-
// Mock the operatorTableUpdater to return false for isRootValidByTimestamp
385-
vm.mockCall(
386-
address(operatorTableUpdaterMock),
387-
abi.encodeWithSelector(IOperatorTableUpdater.isRootValidByTimestamp.selector, referenceTimestamp),
388-
abi.encode(false)
389-
);
384+
operatorTableUpdaterMock.invalidateRoot(referenceTimestamp);
390385

391386
IECDSACertificateVerifierTypes.ECDSACertificate memory cert;
392387
cert.referenceTimestamp = referenceTimestamp;

0 commit comments

Comments
 (0)