Skip to content

Commit de54468

Browse files
authored
[GROVE-250] chore: shorten error strings (#100)
1 parent fc3482f commit de54468

File tree

16 files changed

+88
-88
lines changed

16 files changed

+88
-88
lines changed

src/ForeignController.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ contract ForeignController is AccessControl {
167167
modifier rateLimitExists(bytes32 key) {
168168
require(
169169
rateLimits.getRateLimitData(key).maxAmount > 0,
170-
"ForeignController/invalid-action"
170+
"FC/invalid-action"
171171
);
172172
_;
173173
}
@@ -196,7 +196,7 @@ contract ForeignController is AccessControl {
196196
external
197197
onlyRole(DEFAULT_ADMIN_ROLE)
198198
{
199-
require(maxSlippage <= 1e18, "ForeignController/max-slippage-out-of-bounds");
199+
require(maxSlippage <= 1e18, "FC/max-slippage-oob");
200200
maxSlippages[pool] = maxSlippage;
201201
emit MaxSlippageSet(pool, maxSlippage);
202202
}
@@ -215,7 +215,7 @@ contract ForeignController is AccessControl {
215215
require(
216216
maxTickDelta > 0 &&
217217
maxTickDelta <= UniswapV3Lib.MAX_TICK_DELTA,
218-
"ForeignController/max-tick-delta-out-of-bounds"
218+
"FC/max-tick-delta-oob"
219219
);
220220

221221
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
@@ -225,15 +225,15 @@ contract ForeignController is AccessControl {
225225

226226
function setUniswapV3AddLiquidityLowerTickBound(address pool, int24 lowerTickBound) external onlyRole(DEFAULT_ADMIN_ROLE) {
227227
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
228-
require(lowerTickBound >= MIN_TICK && lowerTickBound < params.addLiquidityTickBounds.upper, "ForeignController/lower-tick-out-of-bounds");
228+
require(lowerTickBound >= MIN_TICK && lowerTickBound < params.addLiquidityTickBounds.upper, "FC/lower-tick-oob");
229229

230230
params.addLiquidityTickBounds.lower = lowerTickBound;
231231
emit UniswapV3PoolLowerTickUpdated(pool, lowerTickBound);
232232
}
233233

234234
function setUniswapV3AddLiquidityUpperTickBound(address pool, int24 upperTickBound) external onlyRole(DEFAULT_ADMIN_ROLE) {
235235
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
236-
require(upperTickBound > params.addLiquidityTickBounds.lower && upperTickBound <= MAX_TICK, "ForeignController/upper-tick-out-of-bounds");
236+
require(upperTickBound > params.addLiquidityTickBounds.lower && upperTickBound <= MAX_TICK, "FC/upper-tick-oob");
237237

238238
params.addLiquidityTickBounds.upper = upperTickBound;
239239
emit UniswapV3PoolUpperTickUpdated(pool, upperTickBound);
@@ -243,7 +243,7 @@ contract ForeignController is AccessControl {
243243
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
244244
// Required due to casting in UniswapV3OracleLibrary.consult
245245
// Limits twapSecondsAgo to approximately 68 years
246-
require(twapSecondsAgo < uint32(type(int32).max), "ForeignController/twap-seconds-ago-out-of-bounds");
246+
require(twapSecondsAgo < uint32(type(int32).max), "FC/twap-seconds-ago-oob");
247247
params.twapSecondsAgo = twapSecondsAgo;
248248
emit UniswapV3PoolTwapSecondsAgoUpdated(pool, twapSecondsAgo);
249249
}
@@ -259,7 +259,7 @@ contract ForeignController is AccessControl {
259259
function setMaxExchangeRate(address token, uint256 shares, uint256 maxExpectedAssets) external {
260260
_checkRole(DEFAULT_ADMIN_ROLE);
261261

262-
require(token != address(0), "ForeignController/token-zero-address");
262+
require(token != address(0), "FC/token-zero-address");
263263

264264
emit MaxExchangeRateSet(
265265
token,
@@ -436,7 +436,7 @@ contract ForeignController is AccessControl {
436436

437437
require(
438438
_getExchangeRate(shares, amount) <= maxExchangeRates[token],
439-
"ForeignController/exchange-rate-too-high"
439+
"FC/exchange-rate-too-high"
440440
);
441441
}
442442

@@ -621,7 +621,7 @@ contract ForeignController is AccessControl {
621621
);
622622

623623
bytes32 recipient = centrifugeRecipients[destinationCentrifugeId];
624-
require(recipient != 0, "ForeignController/centrifuge-id-not-configured");
624+
require(recipient != 0, "FC/id-not-configured");
625625

626626
ICentrifugeV3VaultLike centrifugeVault = ICentrifugeV3VaultLike(token);
627627

@@ -654,7 +654,7 @@ contract ForeignController is AccessControl {
654654
onlyRole(RELAYER)
655655
rateLimitedAsset(LIMIT_AAVE_DEPOSIT, aToken, amount)
656656
{
657-
require(maxSlippages[aToken] != 0, "ForeignController/max-slippage-not-set");
657+
require(maxSlippages[aToken] != 0, "FC/max-slippage-not-set");
658658

659659
IERC20 underlying = IERC20(IATokenWithPool(aToken).UNDERLYING_ASSET_ADDRESS());
660660
IAavePool pool = IAavePool(IATokenWithPool(aToken).POOL());
@@ -674,7 +674,7 @@ contract ForeignController is AccessControl {
674674

675675
require(
676676
newATokens >= amount * maxSlippages[aToken] / 1e18,
677-
"ForeignController/slippage-too-high"
677+
"FC/slippage-too-high"
678678
);
679679
}
680680

@@ -780,7 +780,7 @@ contract ForeignController is AccessControl {
780780

781781
function toggleOperatorMerkl(address operator) external {
782782
_checkRole(RELAYER);
783-
require(address(merklDistributor) != address(0), "ForeignController/merkl-distributor-not-set");
783+
require(address(merklDistributor) != address(0), "FC/merkl-distributor-not-set");
784784

785785
MerklLib.toggleOperator(MerklLib.MerklToggleOperatorParams({
786786
proxy : proxy,
@@ -928,7 +928,7 @@ contract ForeignController is AccessControl {
928928
if (assets == 0) return 0;
929929

930930
// Zero shares with non-zero assets is invalid (infinite exchange rate).
931-
if (shares == 0) revert("ForeignController/zero-shares");
931+
if (shares == 0) revert("FC/zero-shares");
932932

933933
return (EXCHANGE_RATE_PRECISION * assets) / shares;
934934
}

src/MainnetController.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ contract MainnetController is AccessControl {
205205

206206
function setMaxSlippage(address pool, uint256 maxSlippage) external {
207207
_checkRole(DEFAULT_ADMIN_ROLE);
208-
require(maxSlippage <= 1e18, "MainnetController/max-slippage-out-of-bounds");
208+
require(maxSlippage <= 1e18, "MC/max-slippage-oob");
209209
maxSlippages[pool] = maxSlippage;
210210
emit MaxSlippageSet(pool, maxSlippage);
211211
}
@@ -216,7 +216,7 @@ contract MainnetController is AccessControl {
216216
require(
217217
maxTickDelta > 0 &&
218218
maxTickDelta <= UniswapV3Lib.MAX_TICK_DELTA,
219-
"MainnetController/max-tick-delta-out-of-bounds"
219+
"MC/max-tick-delta-oob"
220220
);
221221

222222
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
@@ -226,15 +226,15 @@ contract MainnetController is AccessControl {
226226

227227
function setUniswapV3AddLiquidityLowerTickBound(address pool, int24 lowerTickBound) external onlyRole(DEFAULT_ADMIN_ROLE) {
228228
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
229-
require(lowerTickBound >= MIN_TICK && lowerTickBound < params.addLiquidityTickBounds.upper, "MainnetController/lower-tick-out-of-bounds");
229+
require(lowerTickBound >= MIN_TICK && lowerTickBound < params.addLiquidityTickBounds.upper, "MC/lower-tick-oob");
230230

231231
params.addLiquidityTickBounds.lower = lowerTickBound;
232232
emit UniswapV3PoolLowerTickUpdated(pool, lowerTickBound);
233233
}
234234

235235
function setUniswapV3AddLiquidityUpperTickBound(address pool, int24 upperTickBound) external onlyRole(DEFAULT_ADMIN_ROLE) {
236236
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
237-
require(upperTickBound > params.addLiquidityTickBounds.lower && upperTickBound <= MAX_TICK, "MainnetController/upper-tick-out-of-bounds");
237+
require(upperTickBound > params.addLiquidityTickBounds.lower && upperTickBound <= MAX_TICK, "MC/upper-tick-oob");
238238

239239
params.addLiquidityTickBounds.upper = upperTickBound;
240240
emit UniswapV3PoolUpperTickUpdated(pool, upperTickBound);
@@ -244,7 +244,7 @@ contract MainnetController is AccessControl {
244244
UniswapV3Lib.UniswapV3PoolParams storage params = uniswapV3PoolParams[pool];
245245
// Required due to casting in UniswapV3OracleLibrary.consult
246246
// Limits twapSecondsAgo to approximately 68 years
247-
require(twapSecondsAgo < uint32(type(int32).max), "MainnetController/twap-seconds-ago-out-of-bounds");
247+
require(twapSecondsAgo < uint32(type(int32).max), "MC/twap-seconds-ago-oob");
248248
params.twapSecondsAgo = twapSecondsAgo;
249249
emit UniswapV3PoolTwapSecondsAgoUpdated(pool, twapSecondsAgo);
250250
}
@@ -258,7 +258,7 @@ contract MainnetController is AccessControl {
258258
function setMaxExchangeRate(address token, uint256 shares, uint256 maxExpectedAssets) external {
259259
_checkRole(DEFAULT_ADMIN_ROLE);
260260

261-
require(token != address(0), "MainnetController/token-zero-address");
261+
require(token != address(0), "MC/token-zero-address");
262262

263263
emit MaxExchangeRateSet(
264264
token,
@@ -350,7 +350,7 @@ contract MainnetController is AccessControl {
350350

351351
require(
352352
_getExchangeRate(shares, amount) <= maxExchangeRates[token],
353-
"MainnetController/exchange-rate-too-high"
353+
"MC/exchange-rate-too-high"
354354
);
355355
}
356356

@@ -506,7 +506,7 @@ contract MainnetController is AccessControl {
506506
_checkRole(RELAYER);
507507
_rateLimitedAsset(LIMIT_AAVE_DEPOSIT, aToken, amount);
508508

509-
require(maxSlippages[aToken] != 0, "MainnetController/max-slippage-not-set");
509+
require(maxSlippages[aToken] != 0, "MC/max-slippage-not-set");
510510

511511
IERC20 underlying = IERC20(IATokenWithPool(aToken).UNDERLYING_ASSET_ADDRESS());
512512
IAavePool pool = IAavePool(IATokenWithPool(aToken).POOL());
@@ -526,7 +526,7 @@ contract MainnetController is AccessControl {
526526

527527
require(
528528
newATokens >= amount * maxSlippages[aToken] / 1e18,
529-
"MainnetController/slippage-too-high"
529+
"MC/slippage-too-high"
530530
);
531531
}
532532

@@ -994,7 +994,7 @@ contract MainnetController is AccessControl {
994994
function _rateLimitExists(bytes32 key) internal view {
995995
require(
996996
rateLimits.getRateLimitData(key).maxAmount > 0,
997-
"MainnetController/invalid-action"
997+
"MC/invalid-action"
998998
);
999999
}
10001000

@@ -1035,7 +1035,7 @@ contract MainnetController is AccessControl {
10351035
if (assets == 0) return 0;
10361036

10371037
// Zero shares with non-zero assets is invalid (infinite exchange rate).
1038-
if (shares == 0) revert("MainnetController/zero-shares");
1038+
if (shares == 0) revert("MC/zero-shares");
10391039

10401040
return (EXCHANGE_RATE_PRECISION * assets) / shares;
10411041
}

src/libraries/CentrifugeLib.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ library CentrifugeLib {
8989
params.amount
9090
);
9191

92-
require(params.recipient != 0, "MainnetController/centrifuge-id-not-configured");
92+
require(params.recipient != 0, "CentrifugeLib/id-not-configured");
9393

9494
ICentrifugeV3VaultLike centrifugeVault = ICentrifugeV3VaultLike(params.token);
9595

@@ -124,7 +124,7 @@ library CentrifugeLib {
124124
function _rateLimitExists(IRateLimits rateLimits, bytes32 key) internal view {
125125
require(
126126
rateLimits.getRateLimitData(key).maxAmount > 0,
127-
"MainnetController/invalid-action"
127+
"CentrifugeLib/invalid-action"
128128
);
129129
}
130130
}

src/libraries/UniswapV3Lib.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ library UniswapV3Lib {
464464
) = _fetchPositionData(params.tokenId, params.positionManager);
465465

466466
require(positionToken0 == token0 && positionToken1 == token1 && positionFee == fee, "UniswapV3Lib/invalid-pool");
467-
require(params.liquidity > 0 && params.liquidity <= positionLiquidity, "UniswapV3Lib/liquidity-out-of-bounds");
467+
require(params.liquidity > 0 && params.liquidity <= positionLiquidity, "UniswapV3Lib/liquidity-oob");
468468
}
469469

470470
function _decreaseLiquidityCall(

test/grove-avalanche-fork/Centrifuge.t.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ contract ForeignControllerClaimDepositERC7540FailureTests is CentrifugeTestBase
172172

173173
function test_claimDepositERC7540_invalidVault() external {
174174
vm.prank(ALM_RELAYER);
175-
vm.expectRevert("ForeignController/invalid-action");
175+
vm.expectRevert("FC/invalid-action");
176176
foreignController.claimDepositERC7540(makeAddr("fake-vault"));
177177
}
178178

@@ -343,7 +343,7 @@ contract ForeignControllerCancelCentrifugeDepositFailureTests is CentrifugeTestB
343343

344344
function test_cancelCentrifugeDepositRequest_invalidVault() external {
345345
vm.prank(ALM_RELAYER);
346-
vm.expectRevert("ForeignController/invalid-action");
346+
vm.expectRevert("FC/invalid-action");
347347
foreignController.cancelCentrifugeDepositRequest(makeAddr("fake-vault"));
348348
}
349349

@@ -399,7 +399,7 @@ contract ForeignControllerClaimCentrifugeCancelDepositFailureTests is Centrifuge
399399

400400
function test_claimCentrifugeCancelDepositRequest_invalidVault() external {
401401
vm.prank(ALM_RELAYER);
402-
vm.expectRevert("ForeignController/invalid-action");
402+
vm.expectRevert("FC/invalid-action");
403403
foreignController.claimCentrifugeCancelDepositRequest(makeAddr("fake-vault"));
404404
}
405405

@@ -592,7 +592,7 @@ contract ForeignControllerClaimRedeemERC7540FailureTests is CentrifugeTestBase {
592592

593593
function test_claimRedeemERC7540_invalidVault() external {
594594
vm.prank(ALM_RELAYER);
595-
vm.expectRevert("ForeignController/invalid-action");
595+
vm.expectRevert("FC/invalid-action");
596596
foreignController.claimRedeemERC7540(makeAddr("fake-vault"));
597597
}
598598

@@ -795,7 +795,7 @@ contract ForeignControllerCancelCentrifugeRedeemRequestFailureTests is Centrifug
795795

796796
function test_cancelCentrifugeRedeemRequest_invalidVault() external {
797797
vm.prank(ALM_RELAYER);
798-
vm.expectRevert("ForeignController/invalid-action");
798+
vm.expectRevert("FC/invalid-action");
799799
foreignController.cancelCentrifugeRedeemRequest(makeAddr("fake-vault"));
800800
}
801801

@@ -855,7 +855,7 @@ contract ForeignControllerClaimCentrifugeCancelRedeemRequestFailureTests is Cent
855855

856856
function test_claimCentrifugeCancelRedeemRequest_invalidVault() external {
857857
vm.prank(ALM_RELAYER);
858-
vm.expectRevert("ForeignController/invalid-action");
858+
vm.expectRevert("FC/invalid-action");
859859
foreignController.claimCentrifugeCancelRedeemRequest(makeAddr("fake-vault"));
860860
}
861861

@@ -1012,7 +1012,7 @@ contract ForeignControllerTransferSharesCentrifugeFailureTests is CentrifugeTest
10121012
deal(ALM_RELAYER, 1 ether); // Gas cost for Centrifuge
10131013

10141014
vm.startPrank(ALM_RELAYER);
1015-
vm.expectRevert("ForeignController/centrifuge-id-not-configured");
1015+
vm.expectRevert("FC/id-not-configured");
10161016
foreignController.transferSharesCentrifuge{value: 0.5 ether}(
10171017
CENTRIFUGE_VAULT,
10181018
10_000_000e6,

test/grove-base-fork/Merkl.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ contract MerklBaseTest is ForkTestBase {
2929
contract ForeignControllerToggleOperatorMerklFailureTests is MerklBaseTest {
3030

3131
function test_toggleOperatorMerkl_merklDistributorNotSet() external {
32-
vm.expectRevert("ForeignController/merkl-distributor-not-set");
32+
vm.expectRevert("FC/merkl-distributor-not-set");
3333

3434
vm.prank(relayer);
3535
foreignController.toggleOperatorMerkl(operator1);

test/grove-base-fork/UniswapV3.t.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,19 @@ contract ForeignControllerConfigFailureTests is UniswapV3TestBase {
219219

220220
function test_setUniswapV3PoolMaxTickDelta_isZero() public {
221221
vm.prank(GROVE_EXECUTOR);
222-
vm.expectRevert("ForeignController/max-tick-delta-out-of-bounds");
222+
vm.expectRevert("FC/max-tick-delta-oob");
223223
foreignController.setUniswapV3PoolMaxTickDelta(_getPool(), 0);
224224
}
225225

226226
function test_setUniswapV3PoolMaxTickDelta_isTooLarge() public {
227227
vm.prank(GROVE_EXECUTOR);
228-
vm.expectRevert("ForeignController/max-tick-delta-out-of-bounds");
228+
vm.expectRevert("FC/max-tick-delta-oob");
229229
foreignController.setUniswapV3PoolMaxTickDelta(_getPool(), UniswapV3Lib.MAX_TICK_DELTA + 1);
230230
}
231231

232232
function test_setUniswapV3AddLiquidityLowerTickBound_isTooSmall() public {
233233
vm.prank(GROVE_EXECUTOR);
234-
vm.expectRevert("ForeignController/lower-tick-out-of-bounds");
234+
vm.expectRevert("FC/lower-tick-oob");
235235
foreignController.setUniswapV3AddLiquidityLowerTickBound(_getPool(), MIN_UNISWAP_TICK - 1);
236236
}
237237

@@ -240,13 +240,13 @@ contract ForeignControllerConfigFailureTests is UniswapV3TestBase {
240240
int24 currentUpper = tickBounds.upper;
241241

242242
vm.prank(GROVE_EXECUTOR);
243-
vm.expectRevert("ForeignController/lower-tick-out-of-bounds");
243+
vm.expectRevert("FC/lower-tick-oob");
244244
foreignController.setUniswapV3AddLiquidityLowerTickBound(_getPool(), currentUpper);
245245
}
246246

247247
function test_setUniswapV3AddLiquidityUpperTickBound_isTooLarge() public {
248248
vm.prank(GROVE_EXECUTOR);
249-
vm.expectRevert("ForeignController/upper-tick-out-of-bounds");
249+
vm.expectRevert("FC/upper-tick-oob");
250250
foreignController.setUniswapV3AddLiquidityUpperTickBound(_getPool(), MAX_UNISWAP_TICK + 1);
251251
}
252252
}
@@ -264,13 +264,13 @@ contract ForeignControllerSwapUniswapV3FailureTests is UniswapV3TestBase {
264264

265265
function test_setUniswapV3PoolMaxTickDelta_zeroTickDelta() public {
266266
vm.prank(GROVE_EXECUTOR);
267-
vm.expectRevert("ForeignController/max-tick-delta-out-of-bounds");
267+
vm.expectRevert("FC/max-tick-delta-oob");
268268
foreignController.setUniswapV3PoolMaxTickDelta(_getPool(), 0);
269269
}
270270

271271
function test_setUniswapV3PoolMaxTickDelta_outOfBounds() public {
272272
vm.prank(GROVE_EXECUTOR);
273-
vm.expectRevert("ForeignController/max-tick-delta-out-of-bounds");
273+
vm.expectRevert("FC/max-tick-delta-oob");
274274
foreignController.setUniswapV3PoolMaxTickDelta(_getPool(), UniswapV3Lib.MAX_TICK_DELTA + 1);
275275
}
276276

@@ -1244,7 +1244,7 @@ contract ForeignControllerRemoveLiquidityFailureTests is UniswapV3TestBase {
12441244

12451245
function test_removeLiquidityUniswapV3_zeroLiquidity() public {
12461246
vm.startPrank(ALM_RELAYER);
1247-
vm.expectRevert("UniswapV3Lib/liquidity-out-of-bounds");
1247+
vm.expectRevert("UniswapV3Lib/liquidity-oob");
12481248
foreignController.removeLiquidityUniswapV3(
12491249
_getPool(),
12501250
tokenId,
@@ -1257,7 +1257,7 @@ contract ForeignControllerRemoveLiquidityFailureTests is UniswapV3TestBase {
12571257

12581258
function test_removeLiquidityUniswapV3_liquidityTooHigh() public {
12591259
vm.startPrank(ALM_RELAYER);
1260-
vm.expectRevert("UniswapV3Lib/liquidity-out-of-bounds");
1260+
vm.expectRevert("UniswapV3Lib/liquidity-oob");
12611261
foreignController.removeLiquidityUniswapV3(
12621262
_getPool(),
12631263
tokenId,

0 commit comments

Comments
 (0)