Skip to content

Commit 230d2d0

Browse files
committed
fix: rename misleading custom error name (OZ SR-03)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 61346b2 commit 230d2d0

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
@@ -510,6 +510,11 @@ interface IHorizonStakingMain {
510510
*/
511511
error HorizonStakingLegacySlashFailed();
512512

513+
/**
514+
* @notice Thrown when there attempting to slash a provision with no tokens to slash.
515+
*/
516+
error HorizonStakingNoTokensToSlash();
517+
513518
// -- Functions --
514519

515520
/**

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)