Skip to content

Commit b2f0b44

Browse files
committed
Fix the L2 gasPrice to 1 gwei
1 parent 01282eb commit b2f0b44

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/optimism/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
export * from '@chainlink/optimism-utils'
2+
3+
// TODO: Fix ERROR { "reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT" }
4+
export const TX_OVERRIDES_BUG: any = {
5+
gasLimit: 8_999_999,
6+
}

test/helpers/optimism/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import * as dotenv from 'dotenv'
22
import { Wallet, providers, utils } from 'ethers'
33
import { optimism } from '../../../src'
44

5-
// TODO: Fix ERROR { "reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT" }
6-
export const TX_OVERRIDES_OE_BUG: any = {
7-
gasPrice: utils.parseUnits('1', 'gwei'),
8-
gasLimit: 8_999_999,
9-
}
10-
115
export const loadEnv = async (envName: string = 'local'): Promise<optimism.env.OptimismEnv> => {
126
// Load env configuration by name
137
dotenv.config({ path: __dirname + `/../../../env/.env.${envName}` })
@@ -24,6 +18,8 @@ export const loadEnv = async (envName: string = 'local'): Promise<optimism.env.O
2418

2519
const l1Provider = new providers.JsonRpcProvider(process.env.L1_WEB3_URL)
2620
const l2Provider = new providers.JsonRpcProvider(process.env.L2_WEB3_URL)
21+
// Fix L2 gasPrice to 1 gwei
22+
l2Provider.getGasPrice = () => Promise.resolve(utils.parseUnits('1', 'gwei'))
2723

2824
l1Provider.pollingInterval = 10
2925
l2Provider.pollingInterval = 10

test/v0.7/bridge/token/LinkTokenChild.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe(`LinkTokenChild ${Versions.v0_7}`, () => {
188188
})
189189

190190
it('can NOT mint without access (gateway role)', async () => {
191-
const mintTx = await l2Token.mint(oe.l2Wallet.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
191+
const mintTx = await l2Token.mint(oe.l2Wallet.address, 100, optimism.TX_OVERRIDES_BUG)
192192
// TODO: fetch revert reason
193193
// revert: 'No access'
194194
await h.txRevert(mintTx.wait())
@@ -201,7 +201,7 @@ describe(`LinkTokenChild ${Versions.v0_7}`, () => {
201201
const addAccessTx1 = await l2Token.addAccess(owner.address)
202202
await addAccessTx1.wait()
203203
// Mint some tokens as owner/gateway
204-
const mintTx1 = await l2Token.mint(owner.address, 100)
204+
const mintTx1 = await l2Token.mint(owner.address, 100, optimism.TX_OVERRIDES_BUG)
205205
await mintTx1.wait()
206206
// Assert state
207207
expect(await l2Token.balanceOf(owner.address)).to.be.equal(100)
@@ -219,7 +219,7 @@ describe(`LinkTokenChild ${Versions.v0_7}`, () => {
219219
const removeAccessTx = await l2Token.removeAccess(owner.address)
220220
await removeAccessTx.wait()
221221
// Owner mint fails
222-
const mintTx = await l2Token.mint(owner.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
222+
const mintTx = await l2Token.mint(owner.address, 100, optimism.TX_OVERRIDES_BUG)
223223
// TODO: fetch revert reason
224224
// revert: 'No access'
225225
await h.txRevert(mintTx.wait())

0 commit comments

Comments
 (0)