Skip to content

Commit 3d8c658

Browse files
committed
fix: disable secure accounts on e2e scenario tests
Signed-off-by: Tomás Migone <[email protected]>
1 parent 674f2fd commit 3d8c658

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

e2e/scenarios/lib/helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
export function getGraphOptsFromArgv(): {
22
graphConfig: string | undefined
33
addressBook: string | undefined
4+
disableSecureAccounts?: boolean | undefined
45
} {
56
const argv = process.argv.slice(2)
67

7-
const getArgv = (index: number) =>
8+
const getArgv: any = (index: number) =>
89
argv[index] && argv[index] !== 'undefined' ? argv[index] : undefined
910

1011
return {
1112
graphConfig: getArgv(0),
1213
addressBook: getArgv(1),
14+
disableSecureAccounts: getArgv(2),
1315
}
1416
}

gre/gre.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ extendEnvironment((hre: HardhatRuntimeEnvironment) => {
4545
logDebug('*** Initializing Graph Runtime Environment (GRE) ***')
4646
logDebug(`Main network: ${hre.network.name}`)
4747

48-
const secureAccounts = !(opts.disableSecureAccounts ?? false)
48+
const secureAccounts = !(
49+
opts.disableSecureAccounts ??
50+
hre.config.graph.disableSecureAccounts ??
51+
false
52+
)
4953
logDebug(`Secure accounts: ${secureAccounts ? 'enabled' : 'disabled'}`)
5054

5155
const { l1ChainId, l2ChainId, isHHL1 } = getChains(hre.network.config.chainId)

tasks/e2e/e2e.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TASK_TEST } from 'hardhat/builtin-tasks/task-names'
44
import glob from 'glob'
55
import { cliOpts } from '../../cli/defaults'
66
import fs from 'fs'
7-
import { isL1 } from '../../gre/helpers/network'
7+
import { isL1 } from '../../gre/helpers/chain'
88
import { runScriptWithHardhat } from 'hardhat/internal/util/scripts-runner'
99

1010
const CONFIG_TESTS = 'e2e/deployment/config/**/*.test.ts'
@@ -13,7 +13,13 @@ const INIT_TESTS = 'e2e/deployment/init/**/*.test.ts'
1313
// Built-in test & run tasks don't support GRE arguments
1414
// so we pass them by overriding GRE config object
1515
const setGraphConfig = async (args: TaskArguments, hre: HardhatRuntimeEnvironment) => {
16-
const greArgs = ['graphConfig', 'l1GraphConfig', 'l2GraphConfig', 'addressBook']
16+
const greArgs = [
17+
'graphConfig',
18+
'l1GraphConfig',
19+
'l2GraphConfig',
20+
'addressBook',
21+
'disableSecureAccounts',
22+
]
1723

1824
for (const arg of greArgs) {
1925
if (args[arg]) {
@@ -44,6 +50,7 @@ task('e2e', 'Run all e2e tests')
4450
})
4551

4652
task('e2e:config', 'Run deployment configuration e2e tests')
53+
.addFlag('disableSecureAccounts', 'Disable secure accounts on GRE')
4754
.addOptionalParam('graphConfig', cliOpts.graphConfig.description)
4855
.addOptionalParam('addressBook', cliOpts.addressBook.description)
4956
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
@@ -55,6 +62,7 @@ task('e2e:config', 'Run deployment configuration e2e tests')
5562
})
5663

5764
task('e2e:init', 'Run deployment initialization e2e tests')
65+
.addFlag('disableSecureAccounts', 'Disable secure accounts on GRE')
5866
.addOptionalParam('graphConfig', cliOpts.graphConfig.description)
5967
.addOptionalParam('addressBook', cliOpts.addressBook.description)
6068
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
@@ -67,6 +75,7 @@ task('e2e:init', 'Run deployment initialization e2e tests')
6775

6876
task('e2e:scenario', 'Run scenario scripts and e2e tests')
6977
.addPositionalParam('scenario', 'Name of the scenario to run')
78+
.addFlag('disableSecureAccounts', 'Disable secure accounts on GRE')
7079
.addOptionalParam('graphConfig', cliOpts.graphConfig.description)
7180
.addOptionalParam('addressBook', cliOpts.addressBook.description)
7281
.addFlag('skipScript', "Don't run scenario script")
@@ -85,6 +94,7 @@ task('e2e:scenario', 'Run scenario scripts and e2e tests')
8594
await runScriptWithHardhat(hre.hardhatArguments, script, [
8695
args.graphConfig,
8796
args.addressBook,
97+
args.disableSecureAccounts,
8898
])
8999
} else {
90100
console.log(`No script found for scenario ${args.scenario}`)

0 commit comments

Comments
 (0)