Skip to content

Commit fd56cd7

Browse files
committed
chore: update horizon to latest linting config
Signed-off-by: Tomás Migone <[email protected]>
1 parent c7c8891 commit fd56cd7

Some content is hidden

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

61 files changed

+977
-684
lines changed

packages/horizon/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, but no data service will be deployed. If you want to deploy the Subgraph Service please refer to the [Subgraph Service README](../subgraph-service/README.md) for deploy instructions.
3232

3333
### New deployment
34+
3435
To deploy Graph Horizon from scratch 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, run the following commands. Note that some steps might need to be run by different accounts (deployer vs governor):
4244

4345
```bash
@@ -50,14 +52,15 @@ npx hardhat deploy:migrate --network hardhat --step 4 # Run with governor. Optio
5052
Steps 2, 3 and 4 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.
5153

5254
## Testing
55+
5356
- **unit**: Unit tests can be run with `pnpm test`
5457
- **integration**: Integration tests can be run with `pnpm test:integration`
5558
- Need to set `BLOCKCHAIN_RPC` for a chain where The Graph is already deployed
5659
- If no `BLOCKCHAIN_RPC` is detected it will try using `ARBITRUM_SEPOLIA_RPC`
5760
- **deployment**: Deployment tests can be run with `pnpm test:deployment --network <network>`, the following environment variables allow customizing the test suite for different scenarios:
58-
- `TEST_DEPLOYMENT_STEP` (default: 1) - Specify the latest deployment step that has been executed. Tests for later steps will be skipped.
59-
- `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.
60-
- `TEST_DEPLOYMENT_CONFIG` (default: `hre.network.name`) - The Ignition config file name to use for the test suite.
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.
6164

6265
## Verification
6366

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

packages/horizon/contracts/mocks/CurationMock.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
pragma solidity 0.8.27;
44

5-
import { MockGRTToken } from "./MockGRTToken.sol";
65

76
contract CurationMock {
87
mapping(bytes32 => uint256) public curation;

packages/horizon/eslint.config.js

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

packages/horizon/hardhat.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { hardhatBaseConfig, isProjectBuilt, loadTasks } from '@graphprotocol/toolshed/hardhat'
2-
import type { HardhatUserConfig } from 'hardhat/types'
3-
41
// Hardhat plugins
52
import '@nomicfoundation/hardhat-foundry'
63
import '@nomicfoundation/hardhat-toolbox'
74
import '@nomicfoundation/hardhat-ignition-ethers'
85
import 'hardhat-contract-sizer'
96
import 'hardhat-secure-accounts'
107

8+
import { hardhatBaseConfig, isProjectBuilt, loadTasks } from '@graphprotocol/toolshed/hardhat'
9+
import type { HardhatUserConfig } from 'hardhat/types'
10+
1111
// Skip importing hardhat-graph-protocol when building the project, it has circular dependency
1212
if (isProjectBuilt(__dirname)) {
1313
require('hardhat-graph-protocol')

packages/horizon/ignition/modules/core/GraphPayments.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
2-
import { deployImplementation } from '../proxy/implementation'
3-
import { upgradeTransparentUpgradeableProxy } from '../proxy/TransparentUpgradeableProxy'
42

3+
import GraphPaymentsArtifact from '../../../build/contracts/contracts/payments/GraphPayments.sol/GraphPayments.json'
54
import GraphPeripheryModule, { MigratePeripheryModule } from '../periphery/periphery'
5+
import { deployImplementation } from '../proxy/implementation'
6+
import { upgradeTransparentUpgradeableProxy } from '../proxy/TransparentUpgradeableProxy'
67
import HorizonProxiesModule, { MigrateHorizonProxiesDeployerModule } from './HorizonProxies'
78

8-
import GraphPaymentsArtifact from '../../../build/contracts/contracts/payments/GraphPayments.sol/GraphPayments.json'
9-
109
export default buildModule('GraphPayments', (m) => {
1110
const { Controller } = m.useModule(GraphPeripheryModule)
1211
const { GraphPaymentsProxyAdmin, GraphPaymentsProxy } = m.useModule(HorizonProxiesModule)
@@ -15,21 +14,28 @@ export default buildModule('GraphPayments', (m) => {
1514
const protocolPaymentCut = m.getParameter('protocolPaymentCut')
1615

1716
// Deploy GraphPayments implementation - requires periphery and proxies to be registered in the controller
18-
const GraphPaymentsImplementation = deployImplementation(m, {
19-
name: 'GraphPayments',
20-
artifact: GraphPaymentsArtifact,
21-
constructorArgs: [Controller, protocolPaymentCut],
22-
}, { after: [GraphPeripheryModule, HorizonProxiesModule] })
17+
const GraphPaymentsImplementation = deployImplementation(
18+
m,
19+
{
20+
name: 'GraphPayments',
21+
artifact: GraphPaymentsArtifact,
22+
constructorArgs: [Controller, protocolPaymentCut],
23+
},
24+
{ after: [GraphPeripheryModule, HorizonProxiesModule] },
25+
)
2326

2427
// Upgrade proxy to implementation contract
25-
const GraphPayments = upgradeTransparentUpgradeableProxy(m,
28+
const GraphPayments = upgradeTransparentUpgradeableProxy(
29+
m,
2630
GraphPaymentsProxyAdmin,
2731
GraphPaymentsProxy,
28-
GraphPaymentsImplementation, {
32+
GraphPaymentsImplementation,
33+
{
2934
name: 'GraphPayments',
3035
artifact: GraphPaymentsArtifact,
3136
initArgs: [],
32-
})
37+
},
38+
)
3339

3440
m.call(GraphPaymentsProxyAdmin, 'transferOwnership', [governor], { after: [GraphPayments] })
3541

@@ -55,14 +61,17 @@ export const MigrateGraphPaymentsModule = buildModule('GraphPayments', (m) => {
5561
})
5662

5763
// Upgrade proxy to implementation contract
58-
const GraphPayments = upgradeTransparentUpgradeableProxy(m,
64+
const GraphPayments = upgradeTransparentUpgradeableProxy(
65+
m,
5966
GraphPaymentsProxyAdmin,
6067
GraphPaymentsProxy,
61-
GraphPaymentsImplementation, {
68+
GraphPaymentsImplementation,
69+
{
6270
name: 'GraphPayments',
6371
artifact: GraphPaymentsArtifact,
6472
initArgs: [],
65-
})
73+
},
74+
)
6675

6776
m.call(GraphPaymentsProxyAdmin, 'transferOwnership', [governor], { after: [GraphPayments] })
6877

packages/horizon/ignition/modules/core/GraphTallyCollector.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
22

3+
import GraphTallyCollectorArtifact from '../../../build/contracts/contracts/payments/collectors/GraphTallyCollector.sol/GraphTallyCollector.json'
34
import GraphPeripheryModule, { MigratePeripheryModule } from '../periphery/periphery'
45
import HorizonProxiesModule from './HorizonProxies'
56

6-
import GraphTallyCollectorArtifact from '../../../build/contracts/contracts/payments/collectors/GraphTallyCollector.sol/GraphTallyCollector.json'
7-
87
export default buildModule('GraphTallyCollector', (m) => {
98
const { Controller } = m.useModule(GraphPeripheryModule)
109

@@ -33,11 +32,12 @@ export const MigrateGraphTallyCollectorModule = buildModule('GraphTallyCollector
3332
const version = m.getParameter('eip712Version')
3433
const revokeSignerThawingPeriod = m.getParameter('revokeSignerThawingPeriod')
3534

36-
const GraphTallyCollector = m.contract(
37-
'GraphTallyCollector',
38-
GraphTallyCollectorArtifact,
39-
[name, version, Controller, revokeSignerThawingPeriod],
40-
)
35+
const GraphTallyCollector = m.contract('GraphTallyCollector', GraphTallyCollectorArtifact, [
36+
name,
37+
version,
38+
Controller,
39+
revokeSignerThawingPeriod,
40+
])
4141

4242
return { GraphTallyCollector }
4343
})

packages/horizon/ignition/modules/core/HorizonProxies.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
2-
import { deployGraphProxy } from '../proxy/GraphProxy'
3-
import { deployTransparentUpgradeableProxy } from '../proxy/TransparentUpgradeableProxy'
42
import { ethers } from 'ethers'
53

6-
import GraphPeripheryModule from '../periphery/periphery'
7-
import { MigrateControllerGovernorModule } from '../periphery/Controller'
8-
94
import GraphPaymentsArtifact from '../../../build/contracts/contracts/payments/GraphPayments.sol/GraphPayments.json'
105
import PaymentsEscrowArtifact from '../../../build/contracts/contracts/payments/PaymentsEscrow.sol/PaymentsEscrow.json'
6+
import { MigrateControllerGovernorModule } from '../periphery/Controller'
7+
import GraphPeripheryModule from '../periphery/periphery'
8+
import { deployGraphProxy } from '../proxy/GraphProxy'
9+
import { deployTransparentUpgradeableProxy } from '../proxy/TransparentUpgradeableProxy'
1110

1211
// HorizonStaking, GraphPayments and PaymentsEscrow use GraphDirectory but they are also in the directory.
1312
// So we need to deploy their proxies, register them in the controller before being able to deploy the implementations
@@ -16,32 +15,38 @@ export default buildModule('HorizonProxies', (m) => {
1615

1716
// Deploy HorizonStaking proxy with no implementation
1817
const HorizonStakingProxy = deployGraphProxy(m, GraphProxyAdmin)
19-
m.call(Controller, 'setContractProxy',
20-
[ethers.keccak256(ethers.toUtf8Bytes('Staking')), HorizonStakingProxy],
21-
{ id: 'setContractProxy_HorizonStaking' },
22-
)
18+
m.call(Controller, 'setContractProxy', [ethers.keccak256(ethers.toUtf8Bytes('Staking')), HorizonStakingProxy], {
19+
id: 'setContractProxy_HorizonStaking',
20+
})
2321

2422
// Deploy and register GraphPayments proxy
2523
const { Proxy: GraphPaymentsProxy, ProxyAdmin: GraphPaymentsProxyAdmin } = deployTransparentUpgradeableProxy(m, {
2624
name: 'GraphPayments',
2725
artifact: GraphPaymentsArtifact,
2826
})
29-
m.call(Controller, 'setContractProxy',
30-
[ethers.keccak256(ethers.toUtf8Bytes('GraphPayments')), GraphPaymentsProxy],
31-
{ id: 'setContractProxy_GraphPayments' },
32-
)
27+
m.call(Controller, 'setContractProxy', [ethers.keccak256(ethers.toUtf8Bytes('GraphPayments')), GraphPaymentsProxy], {
28+
id: 'setContractProxy_GraphPayments',
29+
})
3330

3431
// Deploy and register PaymentsEscrow proxy
3532
const { Proxy: PaymentsEscrowProxy, ProxyAdmin: PaymentsEscrowProxyAdmin } = deployTransparentUpgradeableProxy(m, {
3633
name: 'PaymentsEscrow',
3734
artifact: PaymentsEscrowArtifact,
3835
})
39-
m.call(Controller, 'setContractProxy',
36+
m.call(
37+
Controller,
38+
'setContractProxy',
4039
[ethers.keccak256(ethers.toUtf8Bytes('PaymentsEscrow')), PaymentsEscrowProxy],
4140
{ id: 'setContractProxy_PaymentsEscrow' },
4241
)
4342

44-
return { HorizonStakingProxy, GraphPaymentsProxy, PaymentsEscrowProxy, GraphPaymentsProxyAdmin, PaymentsEscrowProxyAdmin }
43+
return {
44+
HorizonStakingProxy,
45+
GraphPaymentsProxy,
46+
PaymentsEscrowProxy,
47+
GraphPaymentsProxyAdmin,
48+
PaymentsEscrowProxyAdmin,
49+
}
4550
})
4651

4752
export const MigrateHorizonProxiesDeployerModule = buildModule('HorizonProxiesDeployer', (m) => {
@@ -67,15 +72,19 @@ export const MigrateHorizonProxiesGovernorModule = buildModule('HorizonProxiesGo
6772
const paymentsEscrowAddress = m.getParameter('paymentsEscrowAddress')
6873

6974
// Register proxies in controller
70-
m.call(Controller, 'setContractProxy',
75+
m.call(
76+
Controller,
77+
'setContractProxy',
7178
[ethers.keccak256(ethers.toUtf8Bytes('GraphPayments')), graphPaymentsAddress],
7279
{ id: 'setContractProxy_GraphPayments' },
7380
)
7481

75-
m.call(Controller, 'setContractProxy',
82+
m.call(
83+
Controller,
84+
'setContractProxy',
7685
[ethers.keccak256(ethers.toUtf8Bytes('PaymentsEscrow')), paymentsEscrowAddress],
7786
{ id: 'setContractProxy_PaymentsEscrow' },
7887
)
7988

80-
return { }
89+
return {}
8190
})

packages/horizon/ignition/modules/core/HorizonStaking.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
import GraphProxyArtifact from '@graphprotocol/contracts/artifacts/contracts/upgrades/GraphProxy.sol/GraphProxy.json'
2+
import GraphProxyAdminArtifact from '@graphprotocol/contracts/artifacts/contracts/upgrades/GraphProxyAdmin.sol/GraphProxyAdmin.json'
13
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'
2-
import { deployImplementation } from '../proxy/implementation'
3-
import { upgradeGraphProxy } from '../proxy/GraphProxy'
44

5-
import GraphPeripheryModule, { MigratePeripheryModule } from '../periphery/periphery'
6-
import HorizonProxiesModule from './HorizonProxies'
7-
8-
import ExponentialRebatesArtifact from '../../../build/contracts/contracts/staking/libraries/ExponentialRebates.sol/ExponentialRebates.json'
9-
import GraphProxyAdminArtifact from '@graphprotocol/contracts/artifacts/contracts/upgrades/GraphProxyAdmin.sol/GraphProxyAdmin.json'
10-
import GraphProxyArtifact from '@graphprotocol/contracts/artifacts/contracts/upgrades/GraphProxy.sol/GraphProxy.json'
115
import HorizonStakingArtifact from '../../../build/contracts/contracts/staking/HorizonStaking.sol/HorizonStaking.json'
126
import HorizonStakingExtensionArtifact from '../../../build/contracts/contracts/staking/HorizonStakingExtension.sol/HorizonStakingExtension.json'
7+
import ExponentialRebatesArtifact from '../../../build/contracts/contracts/staking/libraries/ExponentialRebates.sol/ExponentialRebates.json'
8+
import GraphPeripheryModule, { MigratePeripheryModule } from '../periphery/periphery'
9+
import { upgradeGraphProxy } from '../proxy/GraphProxy'
10+
import { deployImplementation } from '../proxy/implementation'
11+
import HorizonProxiesModule from './HorizonProxies'
1312

1413
export default buildModule('HorizonStaking', (m) => {
1514
const { Controller, GraphProxyAdmin } = m.useModule(GraphPeripheryModule)
@@ -20,14 +19,17 @@ export default buildModule('HorizonStaking', (m) => {
2019

2120
// Deploy HorizonStakingExtension - requires periphery and proxies to be registered in the controller
2221
const ExponentialRebates = m.library('ExponentialRebates', ExponentialRebatesArtifact)
23-
const HorizonStakingExtension = m.contract('HorizonStakingExtension',
22+
const HorizonStakingExtension = m.contract(
23+
'HorizonStakingExtension',
2424
HorizonStakingExtensionArtifact,
25-
[Controller, subgraphServiceAddress], {
25+
[Controller, subgraphServiceAddress],
26+
{
2627
libraries: {
2728
ExponentialRebates: ExponentialRebates,
2829
},
2930
after: [GraphPeripheryModule, HorizonProxiesModule],
30-
})
31+
},
32+
)
3133

3234
// Deploy HorizonStaking implementation
3335
const HorizonStakingImplementation = deployImplementation(m, {
@@ -60,13 +62,16 @@ export const MigrateHorizonStakingDeployerModule = buildModule('HorizonStakingDe
6062

6163
// Deploy HorizonStakingExtension - requires periphery and proxies to be registered in the controller
6264
const ExponentialRebates = m.library('ExponentialRebates', ExponentialRebatesArtifact)
63-
const HorizonStakingExtension = m.contract('HorizonStakingExtension',
65+
const HorizonStakingExtension = m.contract(
66+
'HorizonStakingExtension',
6467
HorizonStakingExtensionArtifact,
65-
[Controller, subgraphServiceAddress], {
68+
[Controller, subgraphServiceAddress],
69+
{
6670
libraries: {
6771
ExponentialRebates: ExponentialRebates,
6872
},
69-
})
73+
},
74+
)
7075

7176
// Deploy HorizonStaking implementation
7277
const HorizonStakingImplementation = deployImplementation(m, {
@@ -84,7 +89,11 @@ export const MigrateHorizonStakingGovernorModule = buildModule('HorizonStakingGo
8489
const horizonStakingAddress = m.getParameter('horizonStakingAddress')
8590
const horizonStakingImplementationAddress = m.getParameter('horizonStakingImplementationAddress')
8691

87-
const HorizonStakingImplementation = m.contractAt('HorizonStakingImplementation', HorizonStakingArtifact, horizonStakingImplementationAddress)
92+
const HorizonStakingImplementation = m.contractAt(
93+
'HorizonStakingImplementation',
94+
HorizonStakingArtifact,
95+
horizonStakingImplementationAddress,
96+
)
8897
const HorizonStakingProxy = m.contractAt('HorizonStakingProxy', GraphProxyArtifact, horizonStakingAddress)
8998
const GraphProxyAdmin = m.contractAt('GraphProxyAdmin', GraphProxyAdminArtifact, graphProxyAdminAddress)
9099

0 commit comments

Comments
 (0)