@@ -59,54 +59,37 @@ contract CheckpointTrackerTest is Test {
59
59
}
60
60
61
61
function test_proveTransition_SuccessfulTransition () public {
62
- ICheckpointTracker.Checkpoint memory start =
63
- ICheckpointTracker.Checkpoint ({publicationId: 0 , commitment: keccak256 (abi.encode ("genesis " ))});
64
62
ICheckpointTracker.Checkpoint memory end =
65
63
ICheckpointTracker.Checkpoint ({publicationId: 3 , commitment: keccak256 (abi.encode ("end " ))});
66
64
uint256 numRelevantPublications = 2 ;
67
65
68
66
vm.expectEmit ();
69
67
emit ICheckpointTracker.CheckpointUpdated (end);
70
- tracker.proveTransition (start, end, numRelevantPublications, proof);
68
+ tracker.proveTransition (end, numRelevantPublications, proof);
71
69
72
70
ICheckpointTracker.Checkpoint memory provenCheckpoint = tracker.getProvenCheckpoint ();
73
71
assertEq (provenCheckpoint.publicationId, end.publicationId);
74
72
assertEq (provenCheckpoint.commitment, end.commitment);
75
73
}
76
74
77
75
function test_proveTransition_RevertWhenEndCommitmentIsZero () public {
78
- ICheckpointTracker.Checkpoint memory start =
79
- ICheckpointTracker.Checkpoint ({publicationId: 0 , commitment: keccak256 (abi.encode ("genesis " ))});
80
76
ICheckpointTracker.Checkpoint memory end =
81
77
ICheckpointTracker.Checkpoint ({publicationId: 3 , commitment: bytes32 (0 )});
82
78
uint256 numRelevantPublications = 2 ;
83
79
84
80
vm.expectRevert ("Checkpoint commitment cannot be 0 " );
85
- tracker.proveTransition (start, end, numRelevantPublications, proof);
86
- }
87
-
88
- function test_proveTransition_RevertWhenStartCheckpointNotLatestProven () public {
89
- ICheckpointTracker.Checkpoint memory start =
90
- ICheckpointTracker.Checkpoint ({publicationId: 1 , commitment: keccak256 (abi.encode ("wrong " ))});
91
- ICheckpointTracker.Checkpoint memory end =
92
- ICheckpointTracker.Checkpoint ({publicationId: 3 , commitment: keccak256 (abi.encode ("end " ))});
93
- uint256 numRelevantPublications = 2 ;
94
-
95
- vm.expectRevert ("Start checkpoint must be the latest proven checkpoint " );
96
- tracker.proveTransition (start, end, numRelevantPublications, proof);
81
+ tracker.proveTransition (end, numRelevantPublications, proof);
97
82
}
98
83
99
84
function test_proveTransition_RevertWhenEndPublicationNotAfterStart () public {
100
- ICheckpointTracker.Checkpoint memory start =
101
- ICheckpointTracker.Checkpoint ({publicationId: 0 , commitment: keccak256 (abi.encode ("genesis " ))});
102
85
ICheckpointTracker.Checkpoint memory end =
103
86
ICheckpointTracker.Checkpoint ({publicationId: 0 , commitment: keccak256 (abi.encode ("end " ))});
104
87
// this is nonsensical, but we're testing the publicationId check so I think it makes sense for the other
105
88
// parameters to match previous tests.
106
89
uint256 numRelevantPublications = 2 ;
107
90
108
91
vm.expectRevert ("End publication must be after the last proven publication " );
109
- tracker.proveTransition (start, end, numRelevantPublications, proof);
92
+ tracker.proveTransition (end, numRelevantPublications, proof);
110
93
}
111
94
112
95
function createSampleFeed () private {
0 commit comments