Skip to content

Commit 62d76b5

Browse files
cryptoAtwillcryptoAtwill
andauthored
fix: remove pruneBottomUpCheckpoints (#1341)
Co-authored-by: cryptoAtwill <willes.lau@protocol.ai>
1 parent 20c513c commit 62d76b5

2 files changed

Lines changed: 0 additions & 27 deletions

File tree

contracts/contracts/gateway/router/CheckpointingFacet.sol

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,6 @@ contract CheckpointingFacet is GatewayActorModifiers {
7979
emit ActivityRollupRecorded(uint64(checkpoint.blockHeight), activity);
8080
}
8181

82-
/// @notice Set a new checkpoint retention height and garbage collect all checkpoints in range [`retentionHeight`, `newRetentionHeight`)
83-
/// @dev `retentionHeight` is the height of the first incomplete checkpointswe must keep to implement checkpointing.
84-
/// All checkpoints with a height less than `retentionHeight` are removed from the history, assuming they are committed to the parent.
85-
/// @param newRetentionHeight - the height of the oldest checkpoint to keep
86-
function pruneBottomUpCheckpoints(uint256 newRetentionHeight) external systemActorOnly {
87-
// we need to clean manually the checkpoints because Solidity does not support passing
88-
// a storage variable as an interface (so we can iterate and remove directly inside pruneQuorums)
89-
for (uint256 h = s.checkpointQuorumMap.retentionHeight; h < newRetentionHeight; ) {
90-
delete s.bottomUpCheckpoints[h];
91-
delete s.bottomUpMsgBatches[h];
92-
unchecked {
93-
++h;
94-
}
95-
}
96-
97-
LibQuorum.pruneQuorums(s.checkpointQuorumMap, newRetentionHeight);
98-
}
99-
10082
/// @notice checks whether the provided checkpoint signature for the block at height `height` is valid and accumulates that it
10183
/// @dev If adding the signature leads to reaching the threshold, then the checkpoint is removed from `incompleteCheckpoints`
10284
/// @param height - the height of the block in the checkpoint

contracts/test/integration/GatewayDiamond.t.sol

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,15 +1589,6 @@ contract GatewayActorDiamondTest is Test, IntegrationTestBase, SubnetWithNativeT
15891589

15901590
uint256[] memory heights = gatewayDiamond.getter().getIncompleteCheckpointHeights();
15911591
require(heights.length == n, "heights.len is not n");
1592-
1593-
vm.startPrank(FilAddress.SYSTEM_ACTOR);
1594-
gatewayDiamond.checkpointer().pruneBottomUpCheckpoints(4);
1595-
vm.stopPrank();
1596-
1597-
index = gatewayDiamond.getter().getCheckpointRetentionHeight();
1598-
require(index == 4, "height was not updated");
1599-
heights = gatewayDiamond.getter().getIncompleteCheckpointHeights();
1600-
require(heights.length == n, "index is not the same");
16011592
}
16021593

16031594
function testGatewayDiamond_commitCheckpoint_Fails_WrongNumberMessages() public {

0 commit comments

Comments
 (0)