Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 07aeb21

Browse files
committedMar 25, 2025
fix: rename misleading custom error name (OZ CR-XX)
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
1 parent da95d8b commit 07aeb21

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed
 

‎packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol

+5
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ interface IHorizonStakingMain {
508508
*/
509509
error HorizonStakingLegacySlashFailed();
510510

511+
/**
512+
* @notice Thrown when there attempting to slash a provision with no tokens to slash.
513+
*/
514+
error HorizonStakingNoTokensToSlash();
515+
511516
// -- Functions --
512517

513518
/**

‎packages/horizon/contracts/staking/HorizonStaking.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
410410
Provision storage prov = _provisions[serviceProvider][verifier];
411411
DelegationPoolInternal storage pool = _getDelegationPool(serviceProvider, verifier);
412412
uint256 tokensProvisionTotal = prov.tokens + pool.tokens;
413-
require(tokensProvisionTotal != 0, HorizonStakingInsufficientTokens(tokensProvisionTotal, tokens));
413+
require(tokensProvisionTotal != 0, HorizonStakingNoTokensToSlash());
414414

415415
uint256 tokensToSlash = MathUtils.min(tokens, tokensProvisionTotal);
416416

‎packages/horizon/test/staking/slash/slash.t.sol

+1-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ contract HorizonStakingSlashTest is HorizonStakingTest {
9797
function testSlash_RevertWhen_NoProvision(uint256 tokens, uint256 slashTokens) public useIndexer useStake(tokens) {
9898
vm.assume(slashTokens > 0);
9999
bytes memory expectedError = abi.encodeWithSelector(
100-
IHorizonStakingMain.HorizonStakingInsufficientTokens.selector,
101-
0,
102-
slashTokens
100+
IHorizonStakingMain.HorizonStakingNoTokensToSlash.selector
103101
);
104102
vm.expectRevert(expectedError);
105103
vm.startPrank(subgraphDataServiceAddress);

0 commit comments

Comments
 (0)
Please sign in to comment.