Skip to content

Commit c8cf416

Browse files
committed
add start checkpoint but to the interface, but don't use in implementation
1 parent b221644 commit c8cf416

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

src/protocol/CheckpointTracker.sol

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ contract CheckpointTracker is ICheckpointTracker {
3535
}
3636

3737
/// @inheritdoc ICheckpointTracker
38-
function proveTransition(Checkpoint calldata end, uint256 numPublications, bytes calldata proof) external {
38+
/// @dev This function does not use the `start` checkpoint since we don't support parallel transitions.
39+
function proveTransition(
40+
Checkpoint calldata,
41+
Checkpoint calldata end,
42+
uint256 numPublications,
43+
bytes calldata proof
44+
) external {
3945
require(
4046
proverManager == address(0) || msg.sender == proverManager, "Only the prover manager can call this function"
4147
);

src/protocol/ICheckpointTracker.sol

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ interface ICheckpointTracker {
1515
function getProvenCheckpoint() external view returns (Checkpoint memory);
1616

1717
/// @notice Verifies a transition between two checkpoints. Update the latest `provenCheckpoint` if possible
18+
/// @param start The initial checkpoint before the transition
1819
/// @param end The final checkpoint after the transition
1920
/// @param numPublications The number of publications that need to be processed between the two checkpoints.
2021
/// Note that this is not necessarily (end.publicationId - start.publicationId) because there could be irrelevant
2122
/// publications.
2223
/// @param proof Arbitrary data passed to the `verifier` contract to confirm the transition validity
23-
function proveTransition(Checkpoint calldata end, uint256 numPublications, bytes calldata proof) external;
24+
function proveTransition(
25+
Checkpoint calldata start,
26+
Checkpoint calldata end,
27+
uint256 numPublications,
28+
bytes calldata proof
29+
) external;
2430
}

src/protocol/taiko_alethia/ProverManager.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ contract ProverManager is IProposerFees, IProverManager {
238238
require(start.publicationId + 1 == firstPub.id, "First publication not immediately after start checkpoint");
239239
require(firstPub.timestamp > previousPeriodEnd, "First publication is before the period");
240240

241-
checkpointTracker.proveTransition(end, numPublications, proof);
241+
checkpointTracker.proveTransition(start, end, numPublications, proof);
242242

243243
bool isPastDeadline = block.timestamp > period.deadline && period.deadline != 0;
244244
if (isPastDeadline) {

test/CheckpointTracker.t.sol

+9-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ contract CheckpointTrackerTest is Test {
6565

6666
vm.expectEmit();
6767
emit ICheckpointTracker.CheckpointUpdated(end);
68-
tracker.proveTransition(end, numRelevantPublications, proof);
68+
69+
// Empty checkpoint needed to comply with the interface, but not used in `CheckpointTracker`
70+
ICheckpointTracker.Checkpoint memory emptyCheckpoint =
71+
ICheckpointTracker.Checkpoint({publicationId: 0, commitment: bytes32(0)});
72+
tracker.proveTransition(emptyCheckpoint, end, numRelevantPublications, proof);
6973

7074
ICheckpointTracker.Checkpoint memory provenCheckpoint = tracker.getProvenCheckpoint();
7175
assertEq(provenCheckpoint.publicationId, end.publicationId);
@@ -78,7 +82,10 @@ contract CheckpointTrackerTest is Test {
7882
uint256 numRelevantPublications = 2;
7983

8084
vm.expectRevert("Checkpoint commitment cannot be 0");
81-
tracker.proveTransition(end, numRelevantPublications, proof);
85+
// Empty checkpoint needed to comply with the interface, but not used in `CheckpointTracker`
86+
ICheckpointTracker.Checkpoint memory emptyCheckpoint =
87+
ICheckpointTracker.Checkpoint({publicationId: 0, commitment: bytes32(0)});
88+
tracker.proveTransition(emptyCheckpoint, end, numRelevantPublications, proof);
8289
}
8390

8491
function createSampleFeed() private {

test/mocks/MockCheckpointTracker.sol

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ contract MockCheckpointTracker is ICheckpointTracker {
1313
}
1414

1515
/// @notice Do nothing. All checkpoints and proofs are accepted.
16-
function proveTransition(Checkpoint calldata end, uint256 numPublications, bytes calldata proof) external {}
16+
function proveTransition(
17+
Checkpoint calldata,
18+
Checkpoint calldata end,
19+
uint256 numPublications,
20+
bytes calldata proof
21+
) external {}
1722

1823
/// @notice Helper to set the proven hash for easier testing
1924
/// @param checkpoint the checkpoint to set as proven, that will be hashed and stored as the proven hash

0 commit comments

Comments
 (0)