Skip to content

Commit

Permalink
test: disable interval mining in hardhat network
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Nov 27, 2023
1 parent 149635b commit e00c6f9
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 31 deletions.
4 changes: 0 additions & 4 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ const config: HardhatUserConfig = {
accounts: {
mnemonic: DEFAULT_TEST_MNEMONIC,
},
mining: {
auto: false,
interval: 13000,
},
hardfork: 'london',
},
localhost: {
Expand Down
10 changes: 0 additions & 10 deletions tasks/deployment/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ task('migrate', 'Migrate contracts')
.setAction(async (taskArgs, hre) => {
const graph = hre.graph(taskArgs)

// Set automine before deploying protocol
// Not all local nodes support it though
if (isGraphChainL1Localhost(graph.chainId)) {
try {
await helpers.setAutoMine(true)
} catch (error) {
console.error('Could not set automine to true, node might not support it')
}
}

await deployGraphNetwork(
taskArgs.addressBook,
taskArgs.graphConfig,
Expand Down
2 changes: 0 additions & 2 deletions test/epochs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe('EpochManager', () => {
const epochLength: BigNumber = toBN('3')

before(async function () {
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)
;[me, governor] = await graph.getTestAccounts()
;({ governor } = await graph.getNamedAccounts())
})
Expand Down
3 changes: 0 additions & 3 deletions test/governance/governed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ describe('Governed', () => {
beforeEach(async function () {
;[me, governor] = await graph.getTestAccounts()

await helpers.setAutoMine(true)
await helpers.setIntervalMining(0)

const factory = await ethers.getContractFactory('GovernedMock')
governed = (await factory.connect(governor).deploy()) as unknown as Governed
})
Expand Down
2 changes: 0 additions & 2 deletions test/l2/l2GraphToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ describe('L2GraphToken', () => {
let grt: L2GraphToken

before(async function () {
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)
;[mockL1GRT, mockL2Gateway, user] = await graph.getTestAccounts()
;({ governor } = await graph.getNamedAccounts())
fixture = new NetworkFixture(graph.provider)
Expand Down
7 changes: 1 addition & 6 deletions test/lib/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ import { LibExponential } from '../../build/types/LibExponential'
import {
DeployType,
GraphNetworkContracts,
acceptOwnership,
deploy,
deployGraphNetwork,
helpers,
isGraphL1ChainId,
loadGraphNetworkContracts,
toBN,
toGRT,
} from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

Expand Down Expand Up @@ -78,6 +74,7 @@ export class NetworkFixture {
constructor(public provider: providers.Provider) {}

async load(deployer: SignerWithAddress, l2Deploy?: boolean): Promise<GraphNetworkContracts> {
// Ensure we are auto mining
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)

Expand Down Expand Up @@ -206,8 +203,6 @@ export class NetworkFixture {

async setUp(): Promise<void> {
this.lastSnapshot = await helpers.takeSnapshot()
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)
}

async tearDown(): Promise<void> {
Expand Down
2 changes: 0 additions & 2 deletions test/lib/graphTokenTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export function grtTests(isL2: boolean): void {
}

before(async function () {
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)
;({ governor } = await graph.getNamedAccounts())
me = new ethers.Wallet(mePrivateKey, graph.provider)
other = new ethers.Wallet(otherPrivateKey, graph.provider)
Expand Down
2 changes: 0 additions & 2 deletions test/staking/rebate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ describe('Staking:rebates', () => {
}

before(async function () {
await helpers.setIntervalMining(0)
await helpers.setAutoMine(true)
;({ governor } = await graph.getNamedAccounts())
fixture = new NetworkFixture(graph.provider)
await fixture.load(governor)
Expand Down

0 comments on commit e00c6f9

Please sign in to comment.