Skip to content

Commit 6e8335d

Browse files
authored
Merge pull request #1101 from graphprotocol/tmigone/horizon-fix-ci
2 parents dfc6c97 + 83dae89 commit 6e8335d

File tree

20 files changed

+279
-294
lines changed

20 files changed

+279
-294
lines changed

.github/workflows/ci-subgraph-service.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,26 @@ jobs:
2424
submodules: recursive
2525
- name: Set up environment
2626
uses: ./.github/actions/setup
27-
- name: Build
27+
- name: Build contracts
28+
run: |
29+
pushd packages/contracts
30+
yarn build
31+
popd
32+
- name: Build horizon
33+
run: |
34+
pushd packages/horizon
35+
yarn build
36+
popd
37+
- name: Build subgraph service
2838
run: |
2939
pushd packages/subgraph-service
3040
yarn build
41+
popd
42+
- name: Build hardhat-graph-protocol
43+
run: |
44+
pushd packages/hardhat-graph-protocol
45+
yarn build
46+
popd
3147
- name: Run tests
3248
run: |
3349
pushd packages/subgraph-service

packages/hardhat-graph-protocol/src/sdk/hardhat.base.config.ts

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,23 @@ import { vars } from 'hardhat/config'
22

33
import type { HardhatUserConfig, NetworksUserConfig, ProjectPathsUserConfig, SolidityUserConfig } from 'hardhat/types'
44
import type { EtherscanConfig } from '@nomicfoundation/hardhat-verify/types'
5+
import type { GraphRuntimeEnvironmentOptions } from '../types'
56

6-
// This next import ensures secure accounts config is correctly typed
7-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8-
import 'hardhat-secure-accounts'
9-
10-
// Environment variables
11-
const ARBISCAN_API_KEY = vars.get('ARBISCAN_API_KEY', undefined)
7+
// TODO: this should be imported from hardhat-secure-accounts, but currently it's not exported
8+
interface SecureAccountsOptions {
9+
enabled?: boolean
10+
}
1211

1312
// RPCs
14-
const VIRTUAL_ARBITRUM_SEPOLIA_RPC = vars.has('VIRTUAL_ARBITRUM_SEPOLIA_RPC') ? vars.get('VIRTUAL_ARBITRUM_SEPOLIA_RPC') : undefined
13+
const ARBITRUM_ONE_RPC = vars.get('ARBITRUM_ONE_RPC', 'https://arb1.arbitrum.io/rpc')
1514
const ARBITRUM_SEPOLIA_RPC = vars.get('ARBITRUM_SEPOLIA_RPC', 'https://sepolia-rollup.arbitrum.io/rpc')
16-
const VIRTUAL_ARBITRUM_ONE_RPC = vars.has('VIRTUAL_ARBITRUM_ONE_RPC') ? vars.get('VIRTUAL_ARBITRUM_ONE_RPC') : undefined
17-
18-
// Tenderly API Key
19-
const TENDERLY_API_KEY = vars.has('TENDERLY_API_KEY') ? vars.get('TENDERLY_API_KEY') : undefined
2015

2116
// Accounts
22-
const DEPLOYER_PRIVATE_KEY = vars.get('DEPLOYER_PRIVATE_KEY', undefined)
23-
const GOVERNOR_PRIVATE_KEY = vars.get('GOVERNOR_PRIVATE_KEY', undefined)
2417
const getTestnetAccounts = () => {
2518
const accounts: string[] = []
26-
if (DEPLOYER_PRIVATE_KEY) accounts.push(DEPLOYER_PRIVATE_KEY)
27-
if (GOVERNOR_PRIVATE_KEY) accounts.push(GOVERNOR_PRIVATE_KEY)
28-
return accounts.length > 0 ? accounts : undefined
19+
if (vars.has('DEPLOYER_PRIVATE_KEY')) accounts.push(vars.get('DEPLOYER_PRIVATE_KEY'))
20+
if (vars.has('GOVERNOR_PRIVATE_KEY')) accounts.push(vars.get('GOVERNOR_PRIVATE_KEY'))
21+
return accounts
2922
}
3023
const getHardhatAccounts = () => {
3124
return {
@@ -50,42 +43,43 @@ export const projectPathsUserConfig: ProjectPathsUserConfig = {
5043

5144
export const etherscanUserConfig: Partial<EtherscanConfig> = {
5245
apiKey: {
53-
arbitrumSepolia: ARBISCAN_API_KEY,
54-
...(TENDERLY_API_KEY && {
55-
virtualArbitrumSepolia: TENDERLY_API_KEY,
56-
virtualArbitrumOne: TENDERLY_API_KEY,
46+
...(vars.has('ARBISCAN_API_KEY') && {
47+
arbitrumSepolia: vars.get('ARBISCAN_API_KEY'),
48+
}),
49+
...(vars.has('TENDERLY_API_KEY') && {
50+
virtualArbitrumSepolia: vars.get('TENDERLY_API_KEY'),
51+
virtualArbitrumOne: vars.get('TENDERLY_API_KEY'),
5752
}),
5853
},
5954
customChains: [
60-
{
61-
network: 'arbitrumSepolia',
62-
chainId: 421614,
63-
urls: { apiURL: 'https://api-sepolia.arbiscan.io/api', browserURL: 'https://sepolia.arbiscan.io/' },
64-
},
65-
{
66-
network: 'virtualArbitrumSepolia',
67-
chainId: 421615,
68-
urls: {
69-
apiURL: VIRTUAL_ARBITRUM_SEPOLIA_RPC + '/verify/etherscan',
70-
browserURL: VIRTUAL_ARBITRUM_SEPOLIA_RPC || 'https://sepolia.arbiscan.io/',
71-
},
72-
},
73-
{
74-
network: 'virtualArbitrumOne',
75-
chainId: 42162,
76-
urls: {
77-
apiURL: VIRTUAL_ARBITRUM_ONE_RPC + '/verify/etherscan',
78-
browserURL: VIRTUAL_ARBITRUM_SEPOLIA_RPC || 'https://arbiscan.io/',
79-
},
80-
},
55+
...(vars.has('VIRTUAL_ARBITRUM_SEPOLIA_RPC')
56+
? [{
57+
network: 'virtualArbitrumSepolia',
58+
chainId: 421615,
59+
urls: {
60+
apiURL: `${vars.get('VIRTUAL_ARBITRUM_SEPOLIA_RPC')}/verify/etherscan`,
61+
browserURL: vars.get('VIRTUAL_ARBITRUM_SEPOLIA_RPC') || 'https://sepolia.arbiscan.io/',
62+
},
63+
}]
64+
: []),
65+
...(vars.has('VIRTUAL_ARBITRUM_ONE_RPC')
66+
? [{
67+
network: 'virtualArbitrumOne',
68+
chainId: 42162,
69+
urls: {
70+
apiURL: `${vars.get('VIRTUAL_ARBITRUM_ONE_RPC')}/verify/etherscan`,
71+
browserURL: vars.get('VIRTUAL_ARBITRUM_ONE_RPC') || 'https://arbiscan.io/',
72+
},
73+
}]
74+
: []),
8175
],
8276
}
8377

8478
// In general:
8579
// - hardhat is used for unit tests
8680
// - localhost is used for local development on a hardhat network or fork
8781
// - virtualArbitrumSepolia is for Tenderly Virtual Testnet
88-
export const networksUserConfig: NetworksUserConfig = {
82+
export const networksUserConfig: NetworksUserConfig & Record<string, { secureAccounts?: SecureAccountsOptions }> = {
8983
hardhat: {
9084
chainId: 31337,
9185
accounts: getHardhatAccounts(),
@@ -95,30 +89,41 @@ export const networksUserConfig: NetworksUserConfig = {
9589
url: 'http://localhost:8545',
9690
accounts: getTestnetAccounts(),
9791
},
92+
arbitrumOne: {
93+
chainId: 42161,
94+
url: ARBITRUM_ONE_RPC,
95+
secureAccounts: {
96+
enabled: true,
97+
},
98+
},
9899
arbitrumSepolia: {
99100
chainId: 421614,
100101
url: ARBITRUM_SEPOLIA_RPC,
101102
secureAccounts: {
102103
enabled: true,
103104
},
104105
},
105-
...(VIRTUAL_ARBITRUM_SEPOLIA_RPC && {
106+
...(vars.has('VIRTUAL_ARBITRUM_SEPOLIA_RPC') && {
106107
virtualArbitrumSepolia: {
107108
chainId: 421615,
108-
url: VIRTUAL_ARBITRUM_SEPOLIA_RPC,
109+
url: vars.get('VIRTUAL_ARBITRUM_SEPOLIA_RPC'),
109110
accounts: getTestnetAccounts(),
110111
},
111112
}),
112-
...(VIRTUAL_ARBITRUM_ONE_RPC && {
113+
...(vars.has('VIRTUAL_ARBITRUM_ONE_RPC') && {
113114
virtualArbitrumOne: {
114115
chainId: 42162,
115-
url: VIRTUAL_ARBITRUM_ONE_RPC,
116+
url: vars.get('VIRTUAL_ARBITRUM_ONE_RPC'),
116117
accounts: getTestnetAccounts(),
117118
},
118119
}),
119120
}
120121

121-
export const hardhatBaseConfig: HardhatUserConfig & { etherscan: Partial<EtherscanConfig> } = {
122+
type HardhatBaseConfig = HardhatUserConfig &
123+
{ etherscan: Partial<EtherscanConfig> } &
124+
{ graph: GraphRuntimeEnvironmentOptions } &
125+
{ secureAccounts: SecureAccountsOptions }
126+
export const hardhatBaseConfig: HardhatBaseConfig = {
122127
solidity: solidityUserConfig,
123128
paths: projectPathsUserConfig,
124129
secureAccounts: {

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
}

0 commit comments

Comments
 (0)