Skip to content

Commit f129d36

Browse files
committed
chore: update subgraph service to use latest lint config
Signed-off-by: Tomás Migone <[email protected]>
1 parent 767ba2c commit f129d36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1030
-871
lines changed

packages/subgraph-service/.solhintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/subgraph-service/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ pnpm build
3131
Note that this instructions will help you deploy Graph Horizon contracts alongside the Subgraph Service. If you want to deploy just the core Horizon contracts please refer to the [Horizon README](../horizon/README.md) for deploy instructions.
3232

3333
### New deployment
34+
3435
To deploy Graph Horizon from scratch including the Subgraph Service run the following command:
3536

3637
```bash
3738
npx hardhat deploy:protocol --network hardhat
3839
```
3940

4041
### Upgrade deployment
42+
4143
Usually you would run this against a network (or a fork) where the original Graph Protocol was previously deployed. To upgrade an existing deployment of the original Graph Protocol to Graph Horizon including the Subgraph Service, run the following commands. Note that some steps might need to be run by different accounts (deployer vs governor):
4244

4345
```bash
@@ -53,14 +55,15 @@ cd horizon && npx hardhat deploy:migrate --network hardhat --step 4 && cd .. # R
5355
Horizon Steps 2, 3 and 4, and Subgraph Service Step 2 require patching the configuration file with addresses from previous steps. The files are located in the `ignition/configs` directory and need to be manually edited. You can also pass `--patch-config` flag to the deploy command to automatically patch the configuration reading values from the address book. Note that this will NOT update the configuration file.
5456

5557
## Testing
58+
5659
- **unit**: Unit tests can be run with `pnpm test`
5760
- **integration**: Integration tests can be run with `pnpm test:integration`
5861
- Need to set `BLOCKCHAIN_RPC` for a chain where The Graph is already deployed
5962
- If no `BLOCKCHAIN_RPC` is detected it will try using `ARBITRUM_SEPOLIA_RPC`
6063
- **deployment**: Deployment tests can be run with `pnpm test:deployment --network <network>`, the following environment variables allow customizing the test suite for different scenarios:
61-
- `TEST_DEPLOYMENT_STEP` (default: 1) - Specify the latest deployment step that has been executed. Tests for later steps will be skipped.
62-
- `TEST_DEPLOYMENT_TYPE` (default: migrate) - The deployment type `protocol/migrate` that is being tested. Test suite has been developed for `migrate` use case but can be run against a `protocol` deployment, likely with some failed tests.
63-
- `TEST_DEPLOYMENT_CONFIG` (default: `hre.network.name`) - The Ignition config file name to use for the test suite.
64+
- `TEST_DEPLOYMENT_STEP` (default: 1) - Specify the latest deployment step that has been executed. Tests for later steps will be skipped.
65+
- `TEST_DEPLOYMENT_TYPE` (default: migrate) - The deployment type `protocol/migrate` that is being tested. Test suite has been developed for `migrate` use case but can be run against a `protocol` deployment, likely with some failed tests.
66+
- `TEST_DEPLOYMENT_CONFIG` (default: `hre.network.name`) - The Ignition config file name to use for the test suite.
6467

6568
## Verification
6669

@@ -70,4 +73,4 @@ To verify contracts on a network, run the following commands:
7073
./scripts/pre-verify <ignition-deployment-id>
7174
npx hardhat ignition verify --network <network> --include-unrelated-contracts <ignition-deployment-id>
7275
./scripts/post-verify
73-
```
76+
```

packages/subgraph-service/contracts/SubgraphService.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { ISubgraphService } from "./interfaces/ISubgraphService.sol";
1111
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
1212
import { MulticallUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
1313
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
14-
import { DataServicePausableUpgradeable } from "@graphprotocol/horizon/contracts/data-service/extensions/DataServicePausableUpgradeable.sol";
14+
import {
15+
DataServicePausableUpgradeable
16+
} from "@graphprotocol/horizon/contracts/data-service/extensions/DataServicePausableUpgradeable.sol";
1517
import { DataService } from "@graphprotocol/horizon/contracts/data-service/DataService.sol";
1618
import { DataServiceFees } from "@graphprotocol/horizon/contracts/data-service/extensions/DataServiceFees.sol";
1719
import { Directory } from "./utilities/Directory.sol";

packages/subgraph-service/eslint.config.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/subgraph-service/hardhat.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { hardhatBaseConfig, isProjectBuilt, loadTasks } from '@graphprotocol/toolshed/hardhat'
2-
import { HardhatUserConfig } from 'hardhat/config'
3-
41
// Hardhat plugins
52
import '@nomicfoundation/hardhat-foundry'
63
import '@nomicfoundation/hardhat-toolbox'
@@ -9,6 +6,9 @@ import 'hardhat-contract-sizer'
96
import 'hardhat-secure-accounts'
107
import 'solidity-docgen'
118

9+
import { hardhatBaseConfig, isProjectBuilt, loadTasks } from '@graphprotocol/toolshed/hardhat'
10+
import { HardhatUserConfig } from 'hardhat/config'
11+
1212
// Skip importing hardhat-graph-protocol when building the project, it has circular dependency
1313
if (isProjectBuilt(__dirname)) {
1414
require('hardhat-graph-protocol')
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { buildModule } from '@nomicfoundation/ignition-core'
2-
31
import CurationArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json'
2+
import { buildModule } from '@nomicfoundation/ignition-core'
43

54
// Note that this module is a no-op, we only run it to get curation addresses into the address book.
65
// Curation deployment should be managed by ignition scripts in subgraph-service package however
@@ -11,7 +10,11 @@ export default buildModule('L2Curation', (m) => {
1110
const curationImplementationAddress = m.getParameter('curationImplementationAddress')
1211

1312
const L2Curation = m.contractAt('L2CurationAddressBook', CurationArtifact, curationProxyAddress)
14-
const L2CurationImplementation = m.contractAt('L2CurationImplementationAddressBook', CurationArtifact, curationImplementationAddress)
13+
const L2CurationImplementation = m.contractAt(
14+
'L2CurationImplementationAddressBook',
15+
CurationArtifact,
16+
curationImplementationAddress,
17+
)
1518

1619
return { L2Curation, L2CurationImplementation }
1720
})

packages/subgraph-service/ignition/modules/DisputeManager.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
21
import { deployImplementation } from '@graphprotocol/horizon/ignition/modules/proxy/implementation'
32
import { upgradeTransparentUpgradeableProxy } from '@graphprotocol/horizon/ignition/modules/proxy/TransparentUpgradeableProxy'
4-
5-
import DisputeManagerArtifact from '../../build/contracts/contracts/DisputeManager.sol/DisputeManager.json'
3+
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
64
import ProxyAdminArtifact from '@openzeppelin/contracts/build/contracts/ProxyAdmin.json'
75
import TransparentUpgradeableProxyArtifact from '@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json'
86

7+
import DisputeManagerArtifact from '../../build/contracts/contracts/DisputeManager.sol/DisputeManager.json'
8+
99
export default buildModule('DisputeManager', (m) => {
1010
const deployer = m.getAccount(0)
1111
const governor = m.getParameter('governor')
@@ -20,7 +20,11 @@ export default buildModule('DisputeManager', (m) => {
2020
const maxSlashingCut = m.getParameter('maxSlashingCut')
2121

2222
const DisputeManagerProxyAdmin = m.contractAt('ProxyAdmin', ProxyAdminArtifact, disputeManagerProxyAdminAddress)
23-
const DisputeManagerProxy = m.contractAt('DisputeManagerProxy', TransparentUpgradeableProxyArtifact, disputeManagerProxyAddress)
23+
const DisputeManagerProxy = m.contractAt(
24+
'DisputeManagerProxy',
25+
TransparentUpgradeableProxyArtifact,
26+
disputeManagerProxyAddress,
27+
)
2428

2529
// Deploy implementation
2630
const DisputeManagerImplementation = deployImplementation(m, {
@@ -30,21 +34,17 @@ export default buildModule('DisputeManager', (m) => {
3034
})
3135

3236
// Upgrade implementation
33-
const DisputeManager = upgradeTransparentUpgradeableProxy(m,
37+
const DisputeManager = upgradeTransparentUpgradeableProxy(
38+
m,
3439
DisputeManagerProxyAdmin,
3540
DisputeManagerProxy,
36-
DisputeManagerImplementation, {
41+
DisputeManagerImplementation,
42+
{
3743
name: 'DisputeManager',
3844
artifact: DisputeManagerArtifact,
39-
initArgs: [
40-
deployer,
41-
arbitrator,
42-
disputePeriod,
43-
disputeDeposit,
44-
fishermanRewardCut,
45-
maxSlashingCut,
46-
],
47-
})
45+
initArgs: [deployer, arbitrator, disputePeriod, disputeDeposit, fishermanRewardCut, maxSlashingCut],
46+
},
47+
)
4848

4949
const callSetSubgraphService = m.call(DisputeManager, 'setSubgraphService', [subgraphServiceProxyAddress])
5050

packages/subgraph-service/ignition/modules/GNS.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
2-
3-
import L2GNSArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json'
41
import SubgraphNFTArtifact from '@graphprotocol/contracts/artifacts/contracts/discovery/SubgraphNFT.sol/SubgraphNFT.json'
2+
import L2GNSArtifact from '@graphprotocol/contracts/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json'
3+
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
54

65
// Note that this module is a no-op, we only run it to get gns addresses into the address book.
76
// GNS deployment should be managed by ignition scripts in subgraph-service package however

packages/subgraph-service/ignition/modules/Proxies.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
21
import { deployTransparentUpgradeableProxy } from '@graphprotocol/horizon/ignition/modules/proxy/TransparentUpgradeableProxy'
2+
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
33

44
import DisputeManagerArtifact from '../../build/contracts/contracts/DisputeManager.sol/DisputeManager.json'
55
import SubgraphServiceArtifact from '../../build/contracts/contracts/SubgraphService.sol/SubgraphService.json'
66

77
export default buildModule('SubgraphServiceProxies', (m) => {
88
// Deploy proxies contracts using OZ TransparentUpgradeableProxy
9-
const {
10-
Proxy: DisputeManagerProxy,
11-
ProxyAdmin: DisputeManagerProxyAdmin,
12-
} = deployTransparentUpgradeableProxy(m, {
9+
const { Proxy: DisputeManagerProxy, ProxyAdmin: DisputeManagerProxyAdmin } = deployTransparentUpgradeableProxy(m, {
1310
name: 'DisputeManager',
1411
artifact: DisputeManagerArtifact,
1512
})
16-
const {
17-
Proxy: SubgraphServiceProxy,
18-
ProxyAdmin: SubgraphServiceProxyAdmin,
19-
} = deployTransparentUpgradeableProxy(m, {
13+
const { Proxy: SubgraphServiceProxy, ProxyAdmin: SubgraphServiceProxyAdmin } = deployTransparentUpgradeableProxy(m, {
2014
name: 'SubgraphService',
2115
artifact: SubgraphServiceArtifact,
2216
})

packages/subgraph-service/ignition/modules/SubgraphService.ts

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
21
import { deployImplementation } from '@graphprotocol/horizon/ignition/modules/proxy/implementation'
32
import { upgradeTransparentUpgradeableProxy } from '@graphprotocol/horizon/ignition/modules/proxy/TransparentUpgradeableProxy'
4-
3+
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
54
import ProxyAdminArtifact from '@openzeppelin/contracts/build/contracts/ProxyAdmin.json'
6-
import SubgraphServiceArtifact from '../../build/contracts/contracts/SubgraphService.sol/SubgraphService.json'
75
import TransparentUpgradeableProxyArtifact from '@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json'
86

7+
import SubgraphServiceArtifact from '../../build/contracts/contracts/SubgraphService.sol/SubgraphService.json'
8+
99
export default buildModule('SubgraphService', (m) => {
1010
const deployer = m.getAccount(0)
1111
const governor = m.getParameter('governor')
@@ -23,7 +23,11 @@ export default buildModule('SubgraphService', (m) => {
2323
const curationCut = m.getParameter('curationCut')
2424

2525
const SubgraphServiceProxyAdmin = m.contractAt('ProxyAdmin', ProxyAdminArtifact, subgraphServiceProxyAdminAddress)
26-
const SubgraphServiceProxy = m.contractAt('SubgraphServiceProxy', TransparentUpgradeableProxyArtifact, subgraphServiceProxyAddress)
26+
const SubgraphServiceProxy = m.contractAt(
27+
'SubgraphServiceProxy',
28+
TransparentUpgradeableProxyArtifact,
29+
subgraphServiceProxyAddress,
30+
)
2731

2832
// Deploy implementation
2933
const SubgraphServiceImplementation = deployImplementation(m, {
@@ -32,27 +36,43 @@ export default buildModule('SubgraphService', (m) => {
3236
})
3337

3438
// Upgrade implementation
35-
const SubgraphService = upgradeTransparentUpgradeableProxy(m,
39+
const SubgraphService = upgradeTransparentUpgradeableProxy(
40+
m,
3641
SubgraphServiceProxyAdmin,
3742
SubgraphServiceProxy,
38-
SubgraphServiceImplementation, {
43+
SubgraphServiceImplementation,
44+
{
3945
name: 'SubgraphService',
4046
artifact: SubgraphServiceArtifact,
41-
initArgs: [
42-
deployer,
43-
minimumProvisionTokens,
44-
maximumDelegationRatio,
45-
stakeToFeesRatio,
46-
],
47-
})
48-
49-
const callSetPauseGuardianGovernor = m.call(SubgraphService, 'setPauseGuardian', [governor, true], { id: 'setPauseGuardianGovernor' })
50-
const callSetPauseGuardianPauseGuardian = m.call(SubgraphService, 'setPauseGuardian', [pauseGuardian, true], { id: 'setPauseGuardianPauseGuardian' })
47+
initArgs: [deployer, minimumProvisionTokens, maximumDelegationRatio, stakeToFeesRatio],
48+
},
49+
)
50+
51+
const callSetPauseGuardianGovernor = m.call(SubgraphService, 'setPauseGuardian', [governor, true], {
52+
id: 'setPauseGuardianGovernor',
53+
})
54+
const callSetPauseGuardianPauseGuardian = m.call(SubgraphService, 'setPauseGuardian', [pauseGuardian, true], {
55+
id: 'setPauseGuardianPauseGuardian',
56+
})
5157
const callSetMaxPOIStaleness = m.call(SubgraphService, 'setMaxPOIStaleness', [maxPOIStaleness])
5258
const callSetCurationCut = m.call(SubgraphService, 'setCurationCut', [curationCut])
5359

54-
m.call(SubgraphService, 'transferOwnership', [governor], { after: [callSetPauseGuardianGovernor, callSetPauseGuardianPauseGuardian, callSetMaxPOIStaleness, callSetCurationCut] })
55-
m.call(SubgraphServiceProxyAdmin, 'transferOwnership', [governor], { after: [callSetPauseGuardianGovernor, callSetPauseGuardianPauseGuardian, callSetMaxPOIStaleness, callSetCurationCut] })
60+
m.call(SubgraphService, 'transferOwnership', [governor], {
61+
after: [
62+
callSetPauseGuardianGovernor,
63+
callSetPauseGuardianPauseGuardian,
64+
callSetMaxPOIStaleness,
65+
callSetCurationCut,
66+
],
67+
})
68+
m.call(SubgraphServiceProxyAdmin, 'transferOwnership', [governor], {
69+
after: [
70+
callSetPauseGuardianGovernor,
71+
callSetPauseGuardianPauseGuardian,
72+
callSetMaxPOIStaleness,
73+
callSetCurationCut,
74+
],
75+
})
5676

5777
return {
5878
SubgraphService,

0 commit comments

Comments
 (0)