Skip to content

Commit 2872fd3

Browse files
committed
chore: fix linting issues
Signed-off-by: Tomás Migone <[email protected]>
1 parent 88498d1 commit 2872fd3

File tree

10 files changed

+184
-181
lines changed

10 files changed

+184
-181
lines changed

packages/horizon/contracts/data-service/DataService.sol

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,6 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1
3535
*/
3636
constructor(address controller) GraphDirectory(controller) {}
3737

38-
/**
39-
* @notice Initializes the contract and any parent contracts.
40-
*/
41-
// solhint-disable-next-line func-name-mixedcase
42-
function __DataService_init() internal onlyInitializing {
43-
__ProvisionManager_init_unchained();
44-
__DataService_init_unchained();
45-
}
46-
47-
/**
48-
* @notice Initializes the contract.
49-
*/
50-
// solhint-disable-next-line func-name-mixedcase
51-
function __DataService_init_unchained() internal onlyInitializing {}
52-
5338
/**
5439
* @notice See {IDataService-getThawingPeriodRange}.
5540
*/
@@ -77,4 +62,19 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1
7762
function getDelegationRatio() external view returns (uint32) {
7863
return _getDelegationRatio();
7964
}
65+
66+
/**
67+
* @notice Initializes the contract and any parent contracts.
68+
*/
69+
// solhint-disable-next-line func-name-mixedcase
70+
function __DataService_init() internal onlyInitializing {
71+
__ProvisionManager_init_unchained();
72+
__DataService_init_unchained();
73+
}
74+
75+
/**
76+
* @notice Initializes the contract.
77+
*/
78+
// solhint-disable-next-line func-name-mixedcase
79+
function __DataService_init_unchained() internal onlyInitializing {}
8080
}

packages/horizon/contracts/interfaces/ITAPCollector.sol

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,6 @@ interface ITAPCollector is IPaymentsCollector {
239239
*/
240240
function revokeAuthorizedSigner(address signer) external;
241241

242-
/**
243-
* @dev Recovers the signer address of a signed ReceiptAggregateVoucher (RAV).
244-
* @param signedRAV The SignedRAV containing the RAV and its signature.
245-
* @return The address of the signer.
246-
*/
247-
function recoverRAVSigner(SignedRAV calldata signedRAV) external view returns (address);
248-
249-
/**
250-
* @dev Computes the hash of a ReceiptAggregateVoucher (RAV).
251-
* @param rav The RAV for which to compute the hash.
252-
* @return The hash of the RAV.
253-
*/
254-
function encodeRAV(ReceiptAggregateVoucher calldata rav) external view returns (bytes32);
255-
256242
/**
257243
* @notice See {IPaymentsCollector.collect}
258244
* This variant adds the ability to partially collect a RAV by specifying the amount of tokens to collect.
@@ -269,4 +255,18 @@ interface ITAPCollector is IPaymentsCollector {
269255
bytes calldata data,
270256
uint256 tokensToCollect
271257
) external returns (uint256);
258+
259+
/**
260+
* @dev Recovers the signer address of a signed ReceiptAggregateVoucher (RAV).
261+
* @param signedRAV The SignedRAV containing the RAV and its signature.
262+
* @return The address of the signer.
263+
*/
264+
function recoverRAVSigner(SignedRAV calldata signedRAV) external view returns (address);
265+
266+
/**
267+
* @dev Computes the hash of a ReceiptAggregateVoucher (RAV).
268+
* @param rav The RAV for which to compute the hash.
269+
* @return The hash of the RAV.
270+
*/
271+
function encodeRAV(ReceiptAggregateVoucher calldata rav) external view returns (bytes32);
272272
}

packages/horizon/contracts/interfaces/internal/IHorizonStakingExtension.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ interface IHorizonStakingExtension is IRewardsIssuer {
105105
*/
106106
function collect(uint256 tokens, address allocationID) external;
107107

108+
/**
109+
* @notice Slash the indexer stake. Delegated tokens are not subject to slashing.
110+
* @dev Can only be called by the slasher role.
111+
* @param indexer Address of indexer to slash
112+
* @param tokens Amount of tokens to slash from the indexer stake
113+
* @param reward Amount of reward tokens to send to a beneficiary
114+
* @param beneficiary Address of a beneficiary to receive a reward for the slashing
115+
*/
116+
function legacySlash(address indexer, uint256 tokens, uint256 reward, address beneficiary) external;
117+
108118
/**
109119
* @notice Return true if operator is allowed for indexer.
110120
* @param operator Address of the operator
@@ -154,14 +164,4 @@ interface IHorizonStakingExtension is IRewardsIssuer {
154164
*/
155165
// solhint-disable-next-line func-name-mixedcase
156166
function __DEPRECATED_getThawingPeriod() external view returns (uint64);
157-
158-
/**
159-
* @notice Slash the indexer stake. Delegated tokens are not subject to slashing.
160-
* @dev Can only be called by the slasher role.
161-
* @param indexer Address of indexer to slash
162-
* @param tokens Amount of tokens to slash from the indexer stake
163-
* @param reward Amount of reward tokens to send to a beneficiary
164-
* @param beneficiary Address of a beneficiary to receive a reward for the slashing
165-
*/
166-
function legacySlash(address indexer, uint256 tokens, uint256 reward, address beneficiary) external;
167167
}

packages/horizon/contracts/staking/HorizonStaking.sol

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
430430
// Check if sender is authorized to slash on the deprecated list
431431
if (__DEPRECATED_slashers[msg.sender]) {
432432
// Forward call to staking extension
433+
// solhint-disable-next-line avoid-low-level-calls
433434
(bool success, ) = STAKING_EXTENSION_ADDRESS.delegatecall(
434435
abi.encodeWithSelector(
435436
IHorizonStakingExtension.legacySlash.selector,
@@ -439,7 +440,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
439440
verifierDestination
440441
)
441442
);
442-
require(success, "Delegatecall to legacySlash failed");
443+
require(success, "Delegatecall: legacySlash failed");
443444
return;
444445
}
445446

@@ -1032,60 +1033,62 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
10321033
/**
10331034
* @notice Traverses a thaw request list and fulfills expired thaw requests.
10341035
* @dev Emits a {ThawRequestsFulfilled} event and a {ThawRequestFulfilled} event for each thaw request fulfilled.
1035-
* @param params The parameters for fulfilling thaw requests
1036+
* @param _params The parameters for fulfilling thaw requests
10361037
* @return The amount of thawed tokens
10371038
* @return The amount of tokens still thawing
10381039
* @return The amount of shares still thawing
10391040
*/
1040-
function _fulfillThawRequests(FulfillThawRequestsParams memory params) private returns (uint256, uint256, uint256) {
1041+
function _fulfillThawRequests(
1042+
FulfillThawRequestsParams memory _params
1043+
) private returns (uint256, uint256, uint256) {
10411044
LinkedList.List storage thawRequestList = _getThawRequestList(
1042-
params.requestType,
1043-
params.serviceProvider,
1044-
params.verifier,
1045-
params.owner
1045+
_params.requestType,
1046+
_params.serviceProvider,
1047+
_params.verifier,
1048+
_params.owner
10461049
);
10471050
require(thawRequestList.count > 0, HorizonStakingNothingThawing());
10481051

1049-
TraverseThawRequestsResults memory results = _traverseThawRequests(params, thawRequestList);
1052+
TraverseThawRequestsResults memory results = _traverseThawRequests(_params, thawRequestList);
10501053

10511054
emit ThawRequestsFulfilled(
1052-
params.serviceProvider,
1053-
params.verifier,
1054-
params.owner,
1055+
_params.serviceProvider,
1056+
_params.verifier,
1057+
_params.owner,
10551058
results.requestsFulfilled,
10561059
results.tokensThawed,
1057-
params.requestType
1060+
_params.requestType
10581061
);
10591062

10601063
return (results.tokensThawed, results.tokensThawing, results.sharesThawing);
10611064
}
10621065

10631066
/**
10641067
* @notice Traverses a thaw request list and fulfills expired thaw requests.
1065-
* @param params The parameters for fulfilling thaw requests
1066-
* @param thawRequestList The list of thaw requests to traverse
1068+
* @param _params The parameters for fulfilling thaw requests
1069+
* @param _thawRequestList The list of thaw requests to traverse
10671070
* @return The results of the traversal
10681071
*/
10691072
function _traverseThawRequests(
1070-
FulfillThawRequestsParams memory params,
1071-
LinkedList.List storage thawRequestList
1073+
FulfillThawRequestsParams memory _params,
1074+
LinkedList.List storage _thawRequestList
10721075
) private returns (TraverseThawRequestsResults memory) {
1073-
function(bytes32) view returns (bytes32) getNextItem = _getNextThawRequest(params.requestType);
1074-
function(bytes32) deleteItem = _getDeleteThawRequest(params.requestType);
1076+
function(bytes32) view returns (bytes32) getNextItem = _getNextThawRequest(_params.requestType);
1077+
function(bytes32) deleteItem = _getDeleteThawRequest(_params.requestType);
10751078

10761079
bytes memory acc = abi.encode(
1077-
params.requestType,
1080+
_params.requestType,
10781081
uint256(0),
1079-
params.tokensThawing,
1080-
params.sharesThawing,
1081-
params.thawingNonce
1082+
_params.tokensThawing,
1083+
_params.sharesThawing,
1084+
_params.thawingNonce
10821085
);
1083-
(uint256 thawRequestsFulfilled, bytes memory data) = thawRequestList.traverse(
1086+
(uint256 thawRequestsFulfilled, bytes memory data) = _thawRequestList.traverse(
10841087
getNextItem,
10851088
_fulfillThawRequest,
10861089
deleteItem,
10871090
acc,
1088-
params.nThawRequests
1091+
_params.nThawRequests
10891092
);
10901093

10911094
(, uint256 tokensThawed, uint256 tokensThawing, uint256 sharesThawing) = abi.decode(
@@ -1152,21 +1155,6 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
11521155
return (false, _acc);
11531156
}
11541157

1155-
/**
1156-
* @notice Determines the correct callback function for `deleteItem` based on the request type.
1157-
* @param _requestType The type of thaw request (Provision or Delegation).
1158-
* @return A function pointer to the appropriate `deleteItem` callback.
1159-
*/
1160-
function _getDeleteThawRequest(ThawRequestType _requestType) private pure returns (function(bytes32)) {
1161-
if (_requestType == ThawRequestType.Provision) {
1162-
return _deleteProvisionThawRequest;
1163-
} else if (_requestType == ThawRequestType.Delegation) {
1164-
return _deleteDelegationThawRequest;
1165-
} else {
1166-
revert HorizonStakingInvalidThawRequestType();
1167-
}
1168-
}
1169-
11701158
/**
11711159
* @notice Deletes a thaw request for a provision.
11721160
* @param _thawRequestId The ID of the thaw request to delete.
@@ -1213,4 +1201,19 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
12131201
return _operatorAuth[_serviceProvider][_verifier][_operator];
12141202
}
12151203
}
1204+
1205+
/**
1206+
* @notice Determines the correct callback function for `deleteItem` based on the request type.
1207+
* @param _requestType The type of thaw request (Provision or Delegation).
1208+
* @return A function pointer to the appropriate `deleteItem` callback.
1209+
*/
1210+
function _getDeleteThawRequest(ThawRequestType _requestType) private pure returns (function(bytes32)) {
1211+
if (_requestType == ThawRequestType.Provision) {
1212+
return _deleteProvisionThawRequest;
1213+
} else if (_requestType == ThawRequestType.Delegation) {
1214+
return _deleteDelegationThawRequest;
1215+
} else {
1216+
revert HorizonStakingInvalidThawRequestType();
1217+
}
1218+
}
12161219
}

packages/horizon/contracts/staking/HorizonStakingBase.sol

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -298,23 +298,6 @@ abstract contract HorizonStakingBase is
298298
return _provisions[_serviceProvider][_verifier].tokens - _provisions[_serviceProvider][_verifier].tokensThawing;
299299
}
300300

301-
/**
302-
* @notice Determines the correct callback function for `getNextItem` based on the request type.
303-
* @param _requestType The type of thaw request (Provision or Delegation).
304-
* @return A function pointer to the appropriate `getNextItem` callback.
305-
*/
306-
function _getNextThawRequest(
307-
ThawRequestType _requestType
308-
) internal pure returns (function(bytes32) view returns (bytes32)) {
309-
if (_requestType == ThawRequestType.Provision) {
310-
return _getNextProvisionThawRequest;
311-
} else if (_requestType == ThawRequestType.Delegation) {
312-
return _getNextDelegationThawRequest;
313-
} else {
314-
revert HorizonStakingInvalidThawRequestType();
315-
}
316-
}
317-
318301
/**
319302
* @notice Retrieves the next thaw request for a provision.
320303
* @param _thawRequestId The ID of the current thaw request.
@@ -367,6 +350,23 @@ abstract contract HorizonStakingBase is
367350
return _thawRequests[_requestType][_thawRequestId];
368351
}
369352

353+
/**
354+
* @notice Determines the correct callback function for `getNextItem` based on the request type.
355+
* @param _requestType The type of thaw request (Provision or Delegation).
356+
* @return A function pointer to the appropriate `getNextItem` callback.
357+
*/
358+
function _getNextThawRequest(
359+
ThawRequestType _requestType
360+
) internal pure returns (function(bytes32) view returns (bytes32)) {
361+
if (_requestType == ThawRequestType.Provision) {
362+
return _getNextProvisionThawRequest;
363+
} else if (_requestType == ThawRequestType.Delegation) {
364+
return _getNextDelegationThawRequest;
365+
} else {
366+
revert HorizonStakingInvalidThawRequestType();
367+
}
368+
}
369+
370370
/**
371371
* @notice See {IHorizonStakingBase-getDelegatedTokensAvailable}.
372372
*/

0 commit comments

Comments
 (0)