Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
paths:
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/test/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
Expand All @@ -18,7 +18,7 @@ on:
paths:
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/test/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ Scenarios are defined by an optional script and a test file:
- Optional ts script
- The objective of this script is to perform actions on the protocol to advance it's state to the desired one.
- Should follow hardhat script convention.
- Should be named e2e/scenarios/{scenario-name}.ts.
- Should be named test/e2e/scenarios/{scenario-name}.ts.
- They run before the test file.
- Test file
- Should be named e2e/scenarios/{scenario-name}.test.ts.
- Should be named test/e2e/scenarios/{scenario-name}.test.ts.
- Standard chai/mocha/hardhat/ethers test file.
2 changes: 1 addition & 1 deletion packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const DEFAULT_L2_TEST_MNEMONIC =
const config: HardhatUserConfig = {
paths: {
sources: './contracts',
tests: './test',
tests: './test/unit',
artifacts: './build/contracts',
},
solidity: {
Expand Down
14 changes: 7 additions & 7 deletions packages/contracts/tasks/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { runScriptWithHardhat } from 'hardhat/internal/util/scripts-runner'
import { isGraphL1ChainId } from '@graphprotocol/sdk'
import { GRE_TASK_PARAMS } from '@graphprotocol/sdk/gre'

const CONFIG_TESTS = 'e2e/deployment/config/**/*.test.ts'
const INIT_TESTS = 'e2e/deployment/init/**/*.test.ts'
const CONFIG_TESTS = 'test/e2e/deployment/config/**/*.test.ts'
const INIT_TESTS = 'test/e2e/deployment/init/**/*.test.ts'

// Built-in test & run tasks don't support GRE arguments
// so we pass them by overriding GRE config object
Expand Down Expand Up @@ -47,7 +47,7 @@ task('e2e', 'Run all e2e tests')
]

if (args.skipBridge) {
testFiles = testFiles.filter((file) => !['l1', 'l2'].includes(file.split('/')[3]))
testFiles = testFiles.filter((file) => !/l1|l2/.test(file))
}

// Disable secure accounts, we don't need them for this task
Expand Down Expand Up @@ -104,8 +104,8 @@ task('e2e:scenario', 'Run scenario scripts and e2e tests')
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
setGraphConfig(args, hre)

const script = `e2e/scenarios/${args.scenario}.ts`
const test = `e2e/scenarios/${args.scenario}.test.ts`
const script = `test/e2e/scenarios/${args.scenario}.ts`
const test = `test/e2e/scenarios/${args.scenario}.test.ts`

console.log(`> Running scenario: ${args.scenario}`)
console.log(`- script file: ${script}`)
Expand Down Expand Up @@ -149,8 +149,8 @@ task('e2e:upgrade', 'Run upgrade tests')
})

async function runUpgrade(args: any, hre: HardhatRuntimeEnvironment, type: 'pre' | 'post') {
const script = `e2e/upgrades/${args.upgrade}/${type}-upgrade.ts`
const test = `e2e/upgrades/${args.upgrade}/${type}-upgrade.test.ts`
const script = `test/e2e/upgrades/${args.upgrade}/${type}-upgrade.ts`
const test = `test/e2e/upgrades/${args.upgrade}/${type}-upgrade.test.ts`

console.log(`> Running ${type}-upgrade: ${args.upgrade}`)
console.log(`- script file: ${script}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// npx hardhat e2e:scenario send-grt-to-l2 --network <network> --graph-config config/graph.<network>.yml

import hre from 'hardhat'
import { TASK_BRIDGE_TO_L2 } from '../../tasks/bridge/to-l2'
import { TASK_BRIDGE_TO_L2 } from '../../../tasks/bridge/to-l2'
import { getBridgeFixture } from './fixtures/bridge'
import { getGREOptsFromArgv } from '@graphprotocol/sdk/gre'
import { ethers } from 'ethers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import hre from 'hardhat'
import { constants } from 'ethers'
import { expect } from 'chai'

import { DisputeManager } from '../../build/types/DisputeManager'
import { DisputeManager } from '../../../build/types/DisputeManager'

import { NetworkFixture } from '../lib/fixtures'
import { GraphNetworkContracts, toBN } from '@graphprotocol/sdk'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { utils } from 'ethers'

import { DisputeManager } from '../../build/types/DisputeManager'
import { EpochManager } from '../../build/types/EpochManager'
import { GraphToken } from '../../build/types/GraphToken'
import { IStaking } from '../../build/types/IStaking'
import { DisputeManager } from '../../../build/types/DisputeManager'
import { EpochManager } from '../../../build/types/EpochManager'
import { GraphToken } from '../../../build/types/GraphToken'
import { IStaking } from '../../../build/types/IStaking'

import { NetworkFixture } from '../lib/fixtures'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { expect } from 'chai'
import { constants } from 'ethers'
import { createAttestation, Receipt } from '@graphprotocol/common-ts'

import { DisputeManager } from '../../build/types/DisputeManager'
import { EpochManager } from '../../build/types/EpochManager'
import { GraphToken } from '../../build/types/GraphToken'
import { IStaking } from '../../build/types/IStaking'
import { DisputeManager } from '../../../build/types/DisputeManager'
import { EpochManager } from '../../../build/types/EpochManager'
import { GraphToken } from '../../../build/types/GraphToken'
import { IStaking } from '../../../build/types/IStaking'

import { NetworkFixture } from '../lib/fixtures'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { BigNumber } from 'ethers'

import { EpochManager } from '../build/types/EpochManager'
import { EpochManager } from '../../build/types/EpochManager'

import { DeployType, deploy, helpers, toBN } from '@graphprotocol/sdk'
import type { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { BigNumber } from 'ethers'

import { GraphToken } from '../../build/types/GraphToken'
import { BridgeEscrow } from '../../build/types/BridgeEscrow'
import { GraphToken } from '../../../build/types/GraphToken'
import { BridgeEscrow } from '../../../build/types/BridgeEscrow'

import { NetworkFixture } from '../lib/fixtures'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { constants, Signer, utils } from 'ethers'

import { GraphToken } from '../../build/types/GraphToken'
import { BridgeMock } from '../../build/types/BridgeMock'
import { InboxMock } from '../../build/types/InboxMock'
import { OutboxMock } from '../../build/types/OutboxMock'
import { L1GraphTokenGateway } from '../../build/types/L1GraphTokenGateway'
import { GraphToken } from '../../../build/types/GraphToken'
import { BridgeMock } from '../../../build/types/BridgeMock'
import { InboxMock } from '../../../build/types/InboxMock'
import { OutboxMock } from '../../../build/types/OutboxMock'
import { L1GraphTokenGateway } from '../../../build/types/L1GraphTokenGateway'

import { NetworkFixture, ArbitrumL1Mocks, L1FixtureContracts } from '../lib/fixtures'

import { BridgeEscrow } from '../../build/types/BridgeEscrow'
import { BridgeEscrow } from '../../../build/types/BridgeEscrow'
import { helpers, applyL1ToL2Alias, toBN, toGRT, GraphNetworkContracts } from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { ethers, ContractTransaction, BigNumber, Event } from 'ethers'
import { defaultAbiCoder } from 'ethers/lib/utils'
import { SubgraphDeploymentID, formatGRT } from '@graphprotocol/common-ts'

import { LegacyGNSMock } from '../build/types/LegacyGNSMock'
import { GraphToken } from '../build/types/GraphToken'
import { Curation } from '../build/types/Curation'
import { LegacyGNSMock } from '../../build/types/LegacyGNSMock'
import { GraphToken } from '../../build/types/GraphToken'
import { Curation } from '../../build/types/Curation'

import { ArbitrumL1Mocks, NetworkFixture } from './lib/fixtures'
import { Controller } from '../build/types/Controller'
import { GraphProxyAdmin } from '../build/types/GraphProxyAdmin'
import { L1GNS } from '../build/types/L1GNS'
import { L1GraphTokenGateway } from '../build/types/L1GraphTokenGateway'
import { Controller } from '../../build/types/Controller'
import { GraphProxyAdmin } from '../../build/types/GraphProxyAdmin'
import { L1GNS } from '../../build/types/L1GNS'
import { L1GraphTokenGateway } from '../../build/types/L1GraphTokenGateway'
import {
AccountDefaultName,
createDefaultName,
Expand All @@ -37,7 +37,7 @@ import {
loadContractAt,
} from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
import { SubgraphNFT } from '../build/types'
import { SubgraphNFT } from '../../build/types'

const { AddressZero, HashZero } = ethers.constants

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { constants, utils } from 'ethers'

import { Controller } from '../../build/types/Controller'
import { EpochManager } from '../../build/types/EpochManager'
import { Controller } from '../../../build/types/Controller'
import { EpochManager } from '../../../build/types/EpochManager'

import { NetworkFixture } from '../lib/fixtures'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai'
import hre from 'hardhat'
import '@nomiclabs/hardhat-ethers'

import { Governed } from '../../build/types/Governed'
import { Governed } from '../../../build/types/Governed'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

const { ethers } = hre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { constants } from 'ethers'

import { Controller } from '../../build/types/Controller'
import { IStaking } from '../../build/types/IStaking'
import { Controller } from '../../../build/types/Controller'
import { IStaking } from '../../../build/types/IStaking'

import { NetworkFixture } from '../lib/fixtures'
import { GraphNetworkContracts, toGRT } from '@graphprotocol/sdk'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import hre from 'hardhat'
import { expect } from 'chai'
import { utils, BigNumber, Event, Signer, constants } from 'ethers'

import { L2Curation } from '../../build/types/L2Curation'
import { GraphToken } from '../../build/types/GraphToken'
import { Controller } from '../../build/types/Controller'
import { L2Curation } from '../../../build/types/L2Curation'
import { GraphToken } from '../../../build/types/GraphToken'
import { Controller } from '../../../build/types/Controller'

import { NetworkFixture } from '../lib/fixtures'
import { GNS } from '../../build/types/GNS'
import { GNS } from '../../../build/types/GNS'
import { parseEther } from 'ethers/lib/utils'
import {
formatGRT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { defaultAbiCoder, parseEther } from 'ethers/lib/utils'

import { L2FixtureContracts, NetworkFixture } from '../lib/fixtures'

import { L2GNS } from '../../build/types/L2GNS'
import { L2GraphTokenGateway } from '../../build/types/L2GraphTokenGateway'
import { L2GNS } from '../../../build/types/L2GNS'
import { L2GraphTokenGateway } from '../../../build/types/L2GraphTokenGateway'
import {
burnSignal,
DEFAULT_RESERVE_RATIO,
Expand All @@ -15,8 +15,8 @@ import {
publishNewSubgraph,
publishNewVersion,
} from '../lib/gnsUtils'
import { L2Curation } from '../../build/types/L2Curation'
import { GraphToken } from '../../build/types/GraphToken'
import { L2Curation } from '../../../build/types/L2Curation'
import { GraphToken } from '../../../build/types/GraphToken'
import {
buildSubgraph,
buildSubgraphId,
Expand All @@ -30,7 +30,7 @@ import {
toGRT,
} from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
import { IL2Staking } from '../../build/types/IL2Staking'
import { IL2Staking } from '../../../build/types/IL2Staking'

const { HashZero } = ethers.constants

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import hre from 'hardhat'
import { expect } from 'chai'

import { L2GraphToken } from '../../build/types/L2GraphToken'
import { L2GraphToken } from '../../../build/types/L2GraphToken'

import { grtTests } from '../lib/graphTokenTests'
import { NetworkFixture } from '../lib/fixtures'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import hre from 'hardhat'
import { expect, use } from 'chai'
import { constants, ContractTransaction, Signer, utils } from 'ethers'

import { L2GraphToken } from '../../build/types/L2GraphToken'
import { L2GraphTokenGateway } from '../../build/types/L2GraphTokenGateway'
import { CallhookReceiverMock } from '../../build/types/CallhookReceiverMock'
import { L2GraphToken } from '../../../build/types/L2GraphToken'
import { L2GraphTokenGateway } from '../../../build/types/L2GraphTokenGateway'
import { CallhookReceiverMock } from '../../../build/types/CallhookReceiverMock'

import { L2FixtureContracts, NetworkFixture } from '../lib/fixtures'

import { FakeContract, smock } from '@defi-wonderland/smock'

use(smock.matchers)

import { RewardsManager } from '../../build/types/RewardsManager'
import { RewardsManager } from '../../../build/types/RewardsManager'
import { DeployType, GraphNetworkContracts, deploy, helpers, toBN, toGRT } from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { defaultAbiCoder, parseEther } from 'ethers/lib/utils'

import { NetworkFixture } from '../lib/fixtures'

import { IL2Staking } from '../../build/types/IL2Staking'
import { L2GraphTokenGateway } from '../../build/types/L2GraphTokenGateway'
import { GraphToken } from '../../build/types/GraphToken'
import { IL2Staking } from '../../../build/types/IL2Staking'
import { L2GraphTokenGateway } from '../../../build/types/L2GraphTokenGateway'
import { GraphToken } from '../../../build/types/GraphToken'
import {
GraphNetworkContracts,
deriveChannelKey,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Signer, providers } from 'ethers'

import { BridgeMock } from '../../build/types/BridgeMock'
import { InboxMock } from '../../build/types/InboxMock'
import { OutboxMock } from '../../build/types/OutboxMock'
import { Controller } from '../../build/types/Controller'
import { DisputeManager } from '../../build/types/DisputeManager'
import { EpochManager } from '../../build/types/EpochManager'
import { GraphToken } from '../../build/types/GraphToken'
import { Curation } from '../../build/types/Curation'
import { L2Curation } from '../../build/types/L2Curation'
import { L1GNS } from '../../build/types/L1GNS'
import { L2GNS } from '../../build/types/L2GNS'
import { IL1Staking } from '../../build/types/IL1Staking'
import { IL2Staking } from '../../build/types/IL2Staking'
import { RewardsManager } from '../../build/types/RewardsManager'
import { ServiceRegistry } from '../../build/types/ServiceRegistry'
import { GraphProxyAdmin } from '../../build/types/GraphProxyAdmin'
import { L1GraphTokenGateway } from '../../build/types/L1GraphTokenGateway'
import { BridgeEscrow } from '../../build/types/BridgeEscrow'
import { L2GraphTokenGateway } from '../../build/types/L2GraphTokenGateway'
import { L2GraphToken } from '../../build/types/L2GraphToken'
import { LibExponential } from '../../build/types/LibExponential'
import { BridgeMock } from '../../../build/types/BridgeMock'
import { InboxMock } from '../../../build/types/InboxMock'
import { OutboxMock } from '../../../build/types/OutboxMock'
import { Controller } from '../../../build/types/Controller'
import { DisputeManager } from '../../../build/types/DisputeManager'
import { EpochManager } from '../../../build/types/EpochManager'
import { GraphToken } from '../../../build/types/GraphToken'
import { Curation } from '../../../build/types/Curation'
import { L2Curation } from '../../../build/types/L2Curation'
import { L1GNS } from '../../../build/types/L1GNS'
import { L2GNS } from '../../../build/types/L2GNS'
import { IL1Staking } from '../../../build/types/IL1Staking'
import { IL2Staking } from '../../../build/types/IL2Staking'
import { RewardsManager } from '../../../build/types/RewardsManager'
import { ServiceRegistry } from '../../../build/types/ServiceRegistry'
import { GraphProxyAdmin } from '../../../build/types/GraphProxyAdmin'
import { L1GraphTokenGateway } from '../../../build/types/L1GraphTokenGateway'
import { BridgeEscrow } from '../../../build/types/BridgeEscrow'
import { L2GraphTokenGateway } from '../../../build/types/L2GraphTokenGateway'
import { L2GraphToken } from '../../../build/types/L2GraphToken'
import { LibExponential } from '../../../build/types/LibExponential'
import {
DeployType,
GraphNetworkContracts,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BigNumber, ContractTransaction } from 'ethers'
import { namehash } from 'ethers/lib/utils'
import { Curation } from '../../build/types/Curation'
import { L1GNS } from '../../build/types/L1GNS'
import { L2GNS } from '../../build/types/L2GNS'
import { Curation } from '../../../build/types/Curation'
import { L1GNS } from '../../../build/types/L1GNS'
import { L2GNS } from '../../../build/types/L2GNS'
import { expect } from 'chai'
import { L2Curation } from '../../build/types/L2Curation'
import { GraphToken } from '../../build/types/GraphToken'
import { L2GraphToken } from '../../build/types/L2GraphToken'
import { L2Curation } from '../../../build/types/L2Curation'
import { GraphToken } from '../../../build/types/GraphToken'
import { L2GraphToken } from '../../../build/types/L2GraphToken'
import { PublishSubgraph, Subgraph, buildSubgraphId, toBN } from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

Expand Down
Loading