Skip to content

Commit

Permalink
fix: use blocknumber instead of timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Nov 21, 2023
1 parent e4f39f6 commit 7db7e0a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/BLSRegistryCoordinatorWithIndices.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ contract BLSRegistryCoordinatorWithIndices is EIP712, Initializable, IBLSRegistr
mapping(address => OperatorInfo) internal _operatorInfo;
/// @notice whether the salt has been used for an operator churn approval
mapping(bytes32 => bool) public isChurnApproverSaltUsed;
/// @notice mapping from quorum number to the latest timestamp that all quorums were updated all at once
mapping(uint8 => uint256) public quorumUpdateTimestamp;
/// @notice mapping from quorum number to the latest block that all quorums were updated all at once
mapping(uint8 => uint256) public quorumUpdateBlocknumber;


/// @notice the dynamic-length array of the registries this coordinator is coordinating
Expand Down Expand Up @@ -325,8 +325,8 @@ contract BLSRegistryCoordinatorWithIndices is EIP712, Initializable, IBLSRegistr
}

// Update timestamp that all operators in quorum have been updated all at once
quorumUpdateTimestamp[quorumNumber] = block.timestamp;
emit QuorumTimestampUpdated(quorumNumber, block.timestamp);
quorumUpdateBlocknumber[quorumNumber] = block.number;
emit QuorumBlocknumberUpdated(quorumNumber, block.number);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/BLSSignatureChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
BN254.G1Point memory apk = BN254.G1Point(0, 0);
for (uint i = 0; i < quorumNumbers.length; i++) {
require(
registryCoordinator.quorumUpdateTimestamp(uint8(quorumNumbers[i])) + delegation.withdrawalDelayBlocks() <= block.timestamp,
registryCoordinator.quorumUpdateBlocknumber(uint8(quorumNumbers[i])) + delegation.withdrawalDelayBlocks() <= block.number,
"BLSSignatureChecker.checkSignatures: StakeRegistry updates must be within QUORUM_STAKES_UPDATE_WINDOW"
);
require(
Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/IRegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface IRegistryCoordinator {
event OperatorDeregistered(address indexed operator, bytes32 indexed operatorId);

/// @notice emitted when all the operators for a quorum are updated at once
event QuorumTimestampUpdated(uint8 indexed quorumNumber, uint256 timestamp);
event QuorumBlocknumberUpdated(uint8 indexed quorumNumber, uint256 blocknumber);

// DATA STRUCTURES
enum OperatorStatus
Expand Down Expand Up @@ -87,6 +87,6 @@ interface IRegistryCoordinator {
/// @notice Returns the number of registries
function numRegistries() external view returns (uint256);

/// @notice returns the timestamp the quorum was last updated all at once for all operators
function quorumUpdateTimestamp(uint8 quorumNumber) external view returns (uint256);
/// @notice returns the blocknumber the quorum was last updated all at once for all operators
function quorumUpdateBlocknumber(uint8 quorumNumber) external view returns (uint256);
}

0 comments on commit 7db7e0a

Please sign in to comment.