Skip to content

Commit 609bc3d

Browse files
Merge pull request #1180 from graphprotocol/ma/horizon-lint
lint: fix linting script
2 parents d07e8d9 + 7870182 commit 609bc3d

File tree

7 files changed

+65
-54
lines changed

7 files changed

+65
-54
lines changed

packages/horizon/contracts/payments/collectors/GraphTallyCollector.sol

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ contract GraphTallyCollector is EIP712, GraphDirectory, Authorizable, IGraphTall
102102
bytes calldata _data,
103103
uint256 _tokensToCollect
104104
) private returns (uint256) {
105-
(SignedRAV memory signedRAV, uint256 dataServiceCut, address receiverDestination) = abi.decode(_data, (SignedRAV, uint256, address));
105+
(SignedRAV memory signedRAV, uint256 dataServiceCut, address receiverDestination) = abi.decode(
106+
_data,
107+
(SignedRAV, uint256, address)
108+
);
106109

107110
// Ensure caller is the RAV data service
108111
require(
@@ -153,7 +156,15 @@ contract GraphTallyCollector is EIP712, GraphDirectory, Authorizable, IGraphTall
153156

154157
if (tokensToCollect > 0) {
155158
tokensCollected[dataService][collectionId][receiver][signedRAV.rav.payer] += tokensToCollect;
156-
_graphPaymentsEscrow().collect(_paymentType, signedRAV.rav.payer, receiver, tokensToCollect, dataService, dataServiceCut, receiverDestination);
159+
_graphPaymentsEscrow().collect(
160+
_paymentType,
161+
signedRAV.rav.payer,
162+
receiver,
163+
tokensToCollect,
164+
dataService,
165+
dataServiceCut,
166+
receiverDestination
167+
);
157168
}
158169

159170
emit PaymentCollected(_paymentType, collectionId, signedRAV.rav.payer, receiver, dataService, tokensToCollect);

packages/horizon/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"lint": "pnpm lint:ts && pnpm lint:sol",
1919
"lint:ts": "eslint '**/*.{js,ts}' --fix --no-warn-ignored",
2020
"lint:sol": "pnpm lint:sol:prettier && pnpm lint:sol:solhint",
21-
"lint:sol:prettier": "prettier --write contracts/**/*.sol test/**/*.sol",
22-
"lint:sol:solhint": "solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
21+
"lint:sol:prettier": "prettier --write \"contracts/**/*.sol\" \"test/**/*.sol\"",
22+
"lint:sol:solhint": "solhint --noPrompt --fix \"contracts/**/*.sol\" --config node_modules/solhint-graph-config/index.js",
2323
"lint:sol:natspec": "natspec-smells --config natspec-smells.config.js",
2424
"clean": "rm -rf build dist cache cache_forge typechain-types",
2525
"build": "hardhat compile",

packages/horizon/test/unit/escrow/GraphEscrow.t.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,17 @@ contract GraphEscrowTest is HorizonStakingSharedTest, PaymentsEscrowSharedTest {
199199
}
200200

201201
// Check receiver balance after payment
202-
assertEq(afterBalances.receiverBalance - previousBalances.receiverBalance, collectTokensData.receiverExpectedPayment);
202+
assertEq(
203+
afterBalances.receiverBalance - previousBalances.receiverBalance,
204+
collectTokensData.receiverExpectedPayment
205+
);
203206
assertEq(token.balanceOf(address(payments)), 0);
204207

205208
// Check delegation pool balance after payment
206-
assertEq(afterBalances.delegationPoolBalance - previousBalances.delegationPoolBalance, collectTokensData.tokensDelegation);
209+
assertEq(
210+
afterBalances.delegationPoolBalance - previousBalances.delegationPoolBalance,
211+
collectTokensData.tokensDelegation
212+
);
207213

208214
// Check that the escrow account has been updated
209215
assertEq(previousBalances.escrowBalance, afterBalances.escrowBalance + _tokens);
@@ -212,7 +218,10 @@ contract GraphEscrowTest is HorizonStakingSharedTest, PaymentsEscrowSharedTest {
212218
assertEq(previousBalances.paymentsBalance, afterBalances.paymentsBalance);
213219

214220
// Check data service balance after payment
215-
assertEq(afterBalances.dataServiceBalance - previousBalances.dataServiceBalance, collectTokensData.tokensDataService);
221+
assertEq(
222+
afterBalances.dataServiceBalance - previousBalances.dataServiceBalance,
223+
collectTokensData.tokensDataService
224+
);
216225

217226
// Check payers escrow balance after payment
218227
assertEq(previousBalances.payerEscrowBalance - _tokens, afterBalances.payerEscrowBalance);

packages/horizon/test/unit/shared/horizon-staking/HorizonStakingShared.t.sol

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,12 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
5454
_;
5555
}
5656

57-
modifier useProvision(
58-
uint256 tokens,
59-
uint32 maxVerifierCut,
60-
uint64 thawingPeriod
61-
) virtual {
57+
modifier useProvision(uint256 tokens, uint32 maxVerifierCut, uint64 thawingPeriod) virtual {
6258
_useProvision(subgraphDataServiceAddress, tokens, maxVerifierCut, thawingPeriod);
6359
_;
6460
}
6561

66-
modifier useProvisionDataService(
67-
address dataService,
68-
uint256 tokens,
69-
uint32 maxVerifierCut,
70-
uint64 thawingPeriod
71-
) {
62+
modifier useProvisionDataService(address dataService, uint256 tokens, uint32 maxVerifierCut, uint64 thawingPeriod) {
7263
_useProvision(dataService, tokens, maxVerifierCut, thawingPeriod);
7364
_;
7465
}

packages/subgraph-service/contracts/SubgraphService.sol

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,17 @@ contract SubgraphService is
425425
return _isOverAllocated(indexer, _delegationRatio);
426426
}
427427

428+
/**
429+
* @notice Sets the payments destination for an indexer to receive payments
430+
* @dev Emits a {PaymentsDestinationSet} event
431+
* @param _indexer The address of the indexer
432+
* @param _paymentsDestination The address where payments should be sent
433+
*/
434+
function _setPaymentsDestination(address _indexer, address _paymentsDestination) internal {
435+
paymentsDestination[_indexer] = _paymentsDestination;
436+
emit PaymentsDestinationSet(_indexer, _paymentsDestination);
437+
}
438+
428439
// -- Data service parameter getters --
429440
/**
430441
* @notice Getter for the accepted thawing period range for provisions
@@ -470,21 +481,21 @@ contract SubgraphService is
470481
* Emits a {StakeClaimLocked} event.
471482
* Emits a {QueryFeesCollected} event.
472483
*
473-
* @param indexer The address of the indexer
474-
* @param data Encoded data:
484+
* @param _indexer The address of the indexer
485+
* @param _data Encoded data:
475486
* - IGraphTallyCollector.SignedRAV `signedRav`: The signed RAV
476487
* - uint256 `tokensToCollect`: The amount of tokens to collect. Allows partially collecting a RAV. If 0, the entire RAV will
477488
* be collected.
478489
* @return The amount of fees collected
479490
*/
480-
function _collectQueryFees(address indexer, bytes calldata data) private returns (uint256) {
491+
function _collectQueryFees(address _indexer, bytes calldata _data) private returns (uint256) {
481492
(IGraphTallyCollector.SignedRAV memory signedRav, uint256 tokensToCollect) = abi.decode(
482-
data,
493+
_data,
483494
(IGraphTallyCollector.SignedRAV, uint256)
484495
);
485496
require(
486-
signedRav.rav.serviceProvider == indexer,
487-
SubgraphServiceIndexerMismatch(signedRav.rav.serviceProvider, indexer)
497+
signedRav.rav.serviceProvider == _indexer,
498+
SubgraphServiceIndexerMismatch(signedRav.rav.serviceProvider, _indexer)
488499
);
489500

490501
// Check that collectionId (256 bits) is a valid address (160 bits)
@@ -497,11 +508,11 @@ contract SubgraphService is
497508
Allocation.State memory allocation = _allocations.get(allocationId);
498509

499510
// Check RAV is consistent - RAV indexer must match the allocation's indexer
500-
require(allocation.indexer == indexer, SubgraphServiceInvalidRAV(indexer, allocation.indexer));
511+
require(allocation.indexer == _indexer, SubgraphServiceInvalidRAV(_indexer, allocation.indexer));
501512
bytes32 subgraphDeploymentId = allocation.subgraphDeploymentId;
502513

503514
// release expired stake claims
504-
_releaseStake(indexer, 0);
515+
_releaseStake(_indexer, 0);
505516

506517
// Collect from GraphPayments - only curators cut is sent back to the subgraph service
507518
uint256 tokensCollected;
@@ -523,7 +534,7 @@ contract SubgraphService is
523534
if (tokensCollected > 0) {
524535
// lock stake as economic security for fees
525536
_lockStake(
526-
indexer,
537+
_indexer,
527538
tokensCollected * stakeToFeesRatio,
528539
block.timestamp + _disputeManager().getDisputePeriod()
529540
);
@@ -539,7 +550,7 @@ contract SubgraphService is
539550
}
540551

541552
emit QueryFeesCollected(
542-
indexer,
553+
_indexer,
543554
signedRav.rav.payer,
544555
allocationId,
545556
subgraphDeploymentId,
@@ -551,31 +562,20 @@ contract SubgraphService is
551562

552563
/**
553564
* @notice Collect indexing rewards
554-
* @param indexer The address of the indexer
555-
* @param data Encoded data:
565+
* @param _indexer The address of the indexer
566+
* @param _data Encoded data:
556567
* - address `allocationId`: The id of the allocation
557568
* - bytes32 `poi`: The POI being presented
558569
* - bytes `poiMetadata`: The metadata associated with the POI. See {AllocationManager-_presentPOI} for more details.
559570
* @return The amount of indexing rewards collected
560571
*/
561-
function _collectIndexingRewards(address indexer, bytes calldata data) private returns (uint256) {
562-
(address allocationId, bytes32 poi_, bytes memory poiMetadata_) = abi.decode(data, (address, bytes32, bytes));
572+
function _collectIndexingRewards(address _indexer, bytes calldata _data) private returns (uint256) {
573+
(address allocationId, bytes32 poi_, bytes memory poiMetadata_) = abi.decode(_data, (address, bytes32, bytes));
563574
require(
564-
_allocations.get(allocationId).indexer == indexer,
565-
SubgraphServiceAllocationNotAuthorized(indexer, allocationId)
575+
_allocations.get(allocationId).indexer == _indexer,
576+
SubgraphServiceAllocationNotAuthorized(_indexer, allocationId)
566577
);
567-
return _presentPOI(allocationId, poi_, poiMetadata_, _delegationRatio, paymentsDestination[indexer]);
568-
}
569-
570-
/**
571-
* @notice Sets the payments destination for an indexer to receive payments
572-
* @dev Emits a {PaymentsDestinationSet} event
573-
* @param _indexer The address of the indexer
574-
* @param _paymentsDestination The address where payments should be sent
575-
*/
576-
function _setPaymentsDestination(address _indexer, address _paymentsDestination) internal {
577-
paymentsDestination[_indexer] = _paymentsDestination;
578-
emit PaymentsDestinationSet(_indexer, _paymentsDestination);
578+
return _presentPOI(allocationId, poi_, poiMetadata_, _delegationRatio, paymentsDestination[_indexer]);
579579
}
580580

581581
/**
@@ -591,14 +591,14 @@ contract SubgraphService is
591591
/**
592592
* @notice Encodes the data for the GraphTallyCollector
593593
* @dev The purpose of this function is just to avoid stack too deep errors
594-
* @param signedRav The signed RAV
595-
* @param curationCut The curation cut
594+
* @param _signedRav The signed RAV
595+
* @param _curationCut The curation cut
596596
* @return The encoded data
597597
*/
598598
function _encodeGraphTallyData(
599-
IGraphTallyCollector.SignedRAV memory signedRav,
600-
uint256 curationCut
599+
IGraphTallyCollector.SignedRAV memory _signedRav,
600+
uint256 _curationCut
601601
) private view returns (bytes memory) {
602-
return abi.encode(signedRav, curationCut, paymentsDestination[signedRav.rav.serviceProvider]);
602+
return abi.encode(_signedRav, _curationCut, paymentsDestination[_signedRav.rav.serviceProvider]);
603603
}
604604
}

packages/subgraph-service/contracts/mocks/imports.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ interface IServiceRegistryToolshed is IServiceRegistry {
2121

2222
interface IGNSToolshed is IGNS {
2323
function subgraphNFT() external view returns (address);
24-
}
24+
}

packages/subgraph-service/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"lint": "pnpm lint:ts && pnpm lint:sol",
1919
"lint:ts": "eslint '**/*.{js,ts}' --fix --no-warn-ignored",
2020
"lint:sol": "pnpm lint:sol:prettier && pnpm lint:sol:solhint",
21-
"lint:sol:prettier": "prettier --write contracts/**/*.sol test/**/*.sol",
22-
"lint:sol:solhint": "solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
21+
"lint:sol:prettier": "prettier --write \"contracts/**/*.sol\" \"test/**/*.sol\"",
22+
"lint:sol:solhint": "solhint --noPrompt --fix \"contracts/**/*.sol\" --config node_modules/solhint-graph-config/index.js",
2323
"lint:sol:natspec": "natspec-smells --config natspec-smells.config.js",
2424
"clean": "rm -rf build dist cache cache_forge typechain-types",
2525
"build": "hardhat compile",

0 commit comments

Comments
 (0)