Skip to content

Commit

Permalink
integration-tests: Facilitate actor tests on nightly (ethereum-optimi…
Browse files Browse the repository at this point in the history
…sm#2518)

The nightly testnet environment must override the Optimism contracts addresses on L1.
Otherwise, it defaults to the prod contracts deployed on goerli which
isn't compatible with the nightly setup.
  • Loading branch information
Inphi authored May 2, 2022
1 parent 102bee7 commit 53fac1d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-singers-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/integration-tests': patch
---

Facilitate actor testing on nightly
5 changes: 5 additions & 0 deletions integration-tests/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ PRIVATE_KEY=
L1_URL=
L2_URL=
ADDRESS_MANAGER=
L1_CROSS_DOMAIN_MESSENGER=
L1_STANDARD_BRIDGE=
STATE_COMMITMENT_CHAIN=
CANONICAL_TRANSACTION_CHAIN=
BOND_MANAGER=
L2_CHAINID=
DTL_ENQUEUE_CONFIRMATIONS=
OVMCONTEXT_SPEC_NUM_TXS=1
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/test/shared/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ export class OptimismEnv {
l1SignerOrProvider: l1Wallet,
l2SignerOrProvider: l2Wallet,
l1ChainId: network.chainId,
contracts: {
l1: {
AddressManager: envConfig.ADDRESS_MANAGER,
L1CrossDomainMessenger: envConfig.L1_CROSS_DOMAIN_MESSENGER,
L1StandardBridge: envConfig.L1_STANDARD_BRIDGE,
StateCommitmentChain: envConfig.STATE_COMMITMENT_CHAIN,
CanonicalTransactionChain: envConfig.CANONICAL_TRANSACTION_CHAIN,
BondManager: envConfig.BOND_MANAGER,
}
}
})

// fund the user if needed
Expand Down
25 changes: 25 additions & 0 deletions integration-tests/test/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ const gasPriceValidator = makeValidator((gasPrice) => {
return num()._parse(gasPrice).toString()
})

const addressValidator = makeValidator((addr) => {
if (!addr) { return '' }
else if (utils.isAddress(addr)) { return addr }
else { throw new Error('Expected an address') }
})

const procEnv = cleanEnv(process.env, {
L1_GAS_PRICE: gasPriceValidator({
default: '0',
Expand Down Expand Up @@ -105,6 +111,25 @@ const procEnv = cleanEnv(process.env, {
BATCH_SUBMITTER_SEQUENCER_BATCH_TYPE: str({
default: 'zlib',
}),

ADDRESS_MANAGER: addressValidator({
default: '',
}),
L1_CROSS_DOMAIN_MESSENGER: addressValidator({
default: '',
}),
L1_STANDARD_BRIDGE: addressValidator({
default: '',
}),
STATE_COMMITMENT_CHAIN: addressValidator({
default: '',
}),
CANONICAL_TRANSACTION_CHAIN: addressValidator({
default: '',
}),
BOND_MANAGER: addressValidator({
default: '',
}),
})

export const envConfig = procEnv
Expand Down

0 comments on commit 53fac1d

Please sign in to comment.