Skip to content

Commit

Permalink
feat: add arbitrum localhost config and split e2e tests into l1/l2/co…
Browse files Browse the repository at this point in the history
…mmon

Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Aug 1, 2022
1 parent 64c1b58 commit 510040c
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 13 deletions.
8 changes: 5 additions & 3 deletions cli/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { SubgraphNFT } from '../build/types/SubgraphNFT'
import { GraphCurationToken } from '../build/types/GraphCurationToken'
import { SubgraphNFTDescriptor } from '../build/types/SubgraphNFTDescriptor'
import { L1Reservoir } from '../build/types/L1Reservoir'
import { L2Reservoir } from '../build/types/L2Reservoir'

export interface NetworkContracts {
EpochManager: EpochManager
Expand All @@ -43,14 +44,15 @@ export interface NetworkContracts {
IENS: IENS
GraphGovernance: GraphGovernance
AllocationExchange: AllocationExchange
SubgraphNFT: SubgraphNFT
SubgraphNFTDescriptor: SubgraphNFTDescriptor
GraphCurationToken: GraphCurationToken
L1GraphTokenGateway: L1GraphTokenGateway
L1Reservoir: L1Reservoir
BridgeEscrow: BridgeEscrow
L2GraphToken: L2GraphToken
L2GraphTokenGateway: L2GraphTokenGateway
SubgraphNFT: SubgraphNFT
SubgraphNFTDescriptor: SubgraphNFTDescriptor
GraphCurationToken: GraphCurationToken
L2Reservoir: L2Reservoir
}

export const loadAddressBookContract = (
Expand Down
143 changes: 143 additions & 0 deletions config/graph.arbitrum-localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
general:
arbitrator: &arbitrator "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0" # Arbitration Council
governor: &governor "0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b" # Graph Council
authority: &authority "0xE11BA2b4D45Eaed5996Cd0823791E0C93114882d" # Authority that signs payment vouchers
availabilityOracle: &availabilityOracle "0xd03ea8624C8C5987235048901fB614fDcA89b117" # Subgraph Availability Oracle
pauseGuardian: &pauseGuardian "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC" # Protocol pause guardian
allocationExchangeOwner: &allocationExchangeOwner "0x3E5e9111Ae8eB78Fe1CC3bb8915d5D461F3Ef9A9" # Allocation Exchange owner

contracts:
Controller:
calls:
- fn: "setContractProxy"
id: "0xe6876326c1291dfcbbd3864a6816d698cd591defc7aa2153d7f9c4c04016c89f" # keccak256('Curation')
contractAddress: "${{Curation.address}}"
- fn: "setContractProxy"
id: "0x39605a6c26a173774ca666c67ef70cf491880e5d3d6d0ca66ec0a31034f15ea3" # keccak256('GNS')
contractAddress: "${{GNS.address}}"
- fn: "setContractProxy"
id: "0xf942813d07d17b56de9a9afc8de0ced6e8c053bbfdcc87b7badea4ddcf27c307" # keccak256('DisputeManager')
contractAddress: "${{DisputeManager.address}}"
- fn: "setContractProxy"
id: "0xc713c3df6d14cdf946460395d09af88993ee2b948b1a808161494e32c5f67063" # keccak256('EpochManager')
contractAddress: "${{EpochManager.address}}"
- fn: "setContractProxy"
id: "0x966f1e8d8d8014e05f6ec4a57138da9be1f7c5a7f802928a18072f7c53180761" # keccak256('RewardsManager')
contractAddress: "${{RewardsManager.address}}"
- fn: "setContractProxy"
id: "0x1df41cd916959d1163dc8f0671a666ea8a3e434c13e40faef527133b5d167034" # keccak256('Staking')
contractAddress: "${{Staking.address}}"
- fn: "setContractProxy"
id: "0x45fc200c7e4544e457d3c5709bfe0d520442c30bbcbdaede89e8d4a4bbc19247" # keccak256('GraphToken')
contractAddress: "${{L2GraphToken.address}}"
- fn: "setContractProxy"
id: "0xd362cac9cb75c10d67bcc0b7eeb0b1ef48bb5420b556c092d4fd7f758816fcf0" # keccak256('GraphTokenGateway')
contractAddress: "${{L2GraphTokenGateway.address}}"
- fn: "setContractProxy"
id: "0x96ba401694892957e25e29c7a1e4171ae9945b5ee36339de79b199a530436e9e" # keccak256('Reservoir')
contractAddress: "${{L2Reservoir.address}}"
- fn: "setPauseGuardian"
pauseGuardian: *pauseGuardian
- fn: "transferOwnership"
owner: *governor
GraphProxyAdmin:
calls:
- fn: "transferOwnership"
owner: *governor
ServiceRegistry:
proxy: true
init:
controller: "${{Controller.address}}"
EpochManager:
proxy: true
init:
controller: "${{Controller.address}}"
lengthInBlocks: 554 # length in hours = lengthInBlocks*13/60/60 (~13 second blocks)
L2GraphToken:
proxy: true
init:
owner: *governor
Curation:
proxy: true
init:
controller: "${{Controller.address}}"
bondingCurve: "${{BancorFormula.address}}"
curationTokenMaster: "${{GraphCurationToken.address}}"
reserveRatio: 500000 # in parts per million
curationTaxPercentage: 10000 # in parts per million
minimumCurationDeposit: "1000000000000000000" # in wei
DisputeManager:
proxy: true
init:
controller: "${{Controller.address}}"
arbitrator: *arbitrator
minimumDeposit: "10000000000000000000000" # in wei
fishermanRewardPercentage: 500000 # in parts per million
idxSlashingPercentage: 25000 # in parts per million
qrySlashingPercentage: 25000 # in parts per million
GNS:
proxy: true
init:
controller: "${{Controller.address}}"
bondingCurve: "${{BancorFormula.address}}"
subgraphNFT: "${{SubgraphNFT.address}}"
calls:
- fn: "approveAll"
SubgraphNFT:
init:
governor: "${{Env.deployer}}"
calls:
- fn: "setTokenDescriptor"
tokenDescriptor: "${{SubgraphNFTDescriptor.address}}"
- fn: "setMinter"
minter: "${{GNS.address}}"
- fn: "transferOwnership"
owner: *governor
Staking:
proxy: true
init:
controller: "${{Controller.address}}"
minimumIndexerStake: "100000000000000000000000" # in wei
thawingPeriod: 6646 # in blocks
protocolPercentage: 10000 # in parts per million
curationPercentage: 100000 # in parts per million
channelDisputeEpochs: 2 # in epochs
maxAllocationEpochs: 4 # in epochs
delegationUnbondingPeriod: 12 # in epochs
delegationRatio: 16 # delegated stake to indexer stake multiplier
rebateAlphaNumerator: 77 # rebateAlphaNumerator / rebateAlphaDenominator
rebateAlphaDenominator: 100 # rebateAlphaNumerator / rebateAlphaDenominator
calls:
- fn: "setDelegationTaxPercentage"
delegationTaxPercentage: 5000 # parts per million
- fn: "setSlasher"
slasher: "${{DisputeManager.address}}"
allowed: true
- fn: "setAssetHolder"
assetHolder: "${{AllocationExchange.address}}"
allowed: true
RewardsManager:
proxy: true
init:
controller: "${{Controller.address}}"
calls:
- fn: "setSubgraphAvailabilityOracle"
subgraphAvailabilityOracle: *availabilityOracle
AllocationExchange:
init:
graphToken: "${{GraphToken.address}}"
staking: "${{Staking.address}}"
governor: *allocationExchangeOwner
authority: *authority
calls:
- fn: "approveAll"
L2GraphTokenGateway:
proxy: true
init:
controller: "${{Controller.address}}"
L2Reservoir:
proxy: true
init:
controller: "${{Controller.address}}"
calls:
- fn: "approveRewardsManager"
7 changes: 1 addition & 6 deletions e2e/deployment/config/graphToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NamedAccounts } from '../../../tasks/type-extensions'
describe('GraphToken configuration', () => {
const {
getNamedAccounts,
contracts: { GraphToken, RewardsManager, L1Reservoir },
contracts: { GraphToken, RewardsManager },
getDeployer,
} = hre.graph()

Expand All @@ -30,9 +30,4 @@ describe('GraphToken configuration', () => {
const deployerIsMinter = await GraphToken.isMinter(RewardsManager.address)
expect(deployerIsMinter).eq(false)
})

it('L1Reservoir should be a minter', async function () {
const deployerIsMinter = await GraphToken.isMinter(L1Reservoir.address)
expect(deployerIsMinter).eq(true)
})
})
File renamed without changes.
13 changes: 13 additions & 0 deletions e2e/deployment/config/l1/graphToken.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect } from 'chai'
import hre from 'hardhat'

describe('GraphToken configuration', () => {
const {
contracts: { GraphToken, L1Reservoir },
} = hre.graph()

it('L1Reservoir should be a minter', async function () {
const deployerIsMinter = await GraphToken.isMinter(L1Reservoir.address)
expect(deployerIsMinter).eq(true)
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import hre from 'hardhat'
import { getItemValue } from '../../../cli/config'
import { getItemValue } from '../../../../cli/config'

describe('L1Reservoir configuration', () => {
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import hre from 'hardhat'
import { getItemValue } from '../../../cli/config'
import { getItemValue } from '../../../../cli/config'

describe('GraphToken initialization', () => {
const {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"deploy-localhost": "yarn deploy --force --network localhost --graph-config config/graph.localhost.yml",
"deploy-rinkeby": "yarn deploy --force --network rinkeby --graph-config config/graph.rinkeby.yml",
"deploy-goerli": "yarn deploy --force --network goerli --graph-config config/graph.goerli.yml",
"deploy-arbitrum-goerli": "yarn deploy --force --network arbitrum-goerli --graph-config config/graph.arbitrum-goerli.yml",
"predeploy": "scripts/predeploy",
"test": "scripts/test",
"test:e2e": "scripts/e2e",
Expand Down
4 changes: 2 additions & 2 deletions tasks/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { cliOpts } from '../../cli/defaults'
import fs from 'fs'
import path from 'path'

const CONFIG_TESTS = 'e2e/deployment/config/*.test.ts'
const INIT_TESTS = 'e2e/deployment/init/*.test.ts'
const CONFIG_TESTS = 'e2e/deployment/config/**/*.test.ts'
const INIT_TESTS = 'e2e/deployment/init/**/*.test.ts'
const SCENARIOS = 'e2e/scenarios/*[!.test].ts'

// Built-in test & run tasks don't support our arguments
Expand Down

0 comments on commit 510040c

Please sign in to comment.