Skip to content

Commit

Permalink
fix the epoch number error (#44)
Browse files Browse the repository at this point in the history
fix the epoch number error
  • Loading branch information
GalaxySciTech authored Jun 7, 2024
1 parent 840cf28 commit 2601094
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion contracts/FullCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ contract FullCheckpoint {
});
currentValidators = validators[1];
} else {
require(next.length > 0, "No Gap Validator Empty");
require(
next.length > 0 &&
uint64(uint256(gsbn % int256(uint256(initEpoch)))) ==
initEpoch - initGap + 1,
"No Gap Block"
);

validators[gapBlock.number] = Validators({
set: next,
threshold: int256((initialValidatorSet.length * certThreshold))
Expand All @@ -90,6 +96,7 @@ contract FullCheckpoint {
set: initialValidatorSet,
threshold: int256((initialValidatorSet.length * certThreshold))
});
epochNum = uint64(int64(gapBlock.number)) / initEpoch;
}

headerTree[gapHeaderHash] = Header({
Expand Down
2 changes: 1 addition & 1 deletion contracts/ReverseFullCheckpoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract ReverseFullCheckpoint {

address[] memory next = HeaderReader.getEpoch(v2esbnHeader);

require(next.length > 0, "No Epoch Validator Empty");
require(next.length > 0, "No Epoch Block");

HeaderReader.ValidationParams memory v2esbnBlock = HeaderReader
.getValidationParams(v2esbnHeader);
Expand Down

0 comments on commit 2601094

Please sign in to comment.