Skip to content

Commit

Permalink
fix: adjust staleness check (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc authored Mar 19, 2024
1 parent f3b5fca commit 48e0aec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BLSSignatureChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ contract BLSSignatureChecker is IBLSSignatureChecker {
// is within withdrawalDelayBlocks
if (_staleStakesForbidden) {
require(
registryCoordinator.quorumUpdateBlockNumber(uint8(quorumNumbers[i])) + withdrawalDelayBlocks >= referenceBlockNumber,
registryCoordinator.quorumUpdateBlockNumber(uint8(quorumNumbers[i])) + withdrawalDelayBlocks > referenceBlockNumber,
"BLSSignatureChecker.checkSignatures: StakeRegistry updates must be within withdrawalDelayBlocks window"
);
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/BLSSignatureCheckerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ contract BLSSignatureCheckerUnitTests is BLSMockAVSDeployer {
}

// move referenceBlockNumber forward to a block number the last block number where the stakes will be considered "not stale"
referenceBlockNumber = uint32(stalestUpdateBlock + delegationMock.minWithdrawalDelayBlocks());
referenceBlockNumber = uint32(stalestUpdateBlock + delegationMock.minWithdrawalDelayBlocks()) - 1;
// roll forward to make the reference block number valid
// we roll to referenceBlockNumber + 1 because the current block number is not a valid reference block

cheats.roll(referenceBlockNumber + 1);
blsSignatureChecker.checkSignatures(
msgHash,
Expand Down

0 comments on commit 48e0aec

Please sign in to comment.