Commit 36a91c30 authored by Murphy Law's avatar Murphy Law Committed by GitHub

integration-tests: Fix various actor tests (#2517)

Several tests were failing with out of gas errors because they began executing before their
wallets were adequately funded.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 1bcee8f1
---
'@eth-optimism/integration-tests': patch
---
Fix various actor tests
......@@ -49,10 +49,11 @@ actor('Value sender', () => {
setupRun(async () => {
const wallet = Wallet.createRandom()
await env.l2Wallet.sendTransaction({
const tx = await env.l2Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('0.01'),
})
await tx.wait()
return {
wallet: wallet.connect(env.l2Wallet.provider),
}
......@@ -61,10 +62,11 @@ actor('Value sender', () => {
run(async (b, ctx: Context) => {
const randWallet = Wallet.createRandom().connect(env.l2Wallet.provider)
await b.bench('send funds', async () => {
await ctx.wallet.sendTransaction({
const tx = await ctx.wallet.sendTransaction({
to: randWallet.address,
value: 0x42,
})
await tx.wait()
})
expect(await randWallet.getBalance()).to.deep.equal(BigNumber.from(0x42))
})
......
......@@ -21,10 +21,11 @@ actor('Funds depositor', () => {
setupRun(async () => {
const wallet = Wallet.createRandom()
await env.l1Wallet.sendTransaction({
const tx = await env.l1Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('0.01'),
})
await tx.wait()
return {
l1Wallet: wallet.connect(env.l1Wallet.provider),
l2Wallet: wallet.connect(env.l2Wallet.provider),
......@@ -36,7 +37,7 @@ actor('Funds depositor', () => {
const balBefore = await l2Wallet.getBalance()
await b.bench('deposit', async () => {
await env.waitForXDomainTransaction(
env.l1Bridge
env.messenger.contracts.l1.L1StandardBridge
.connect(l1Wallet)
.depositETH(DEFAULT_TEST_GAS_L2, '0xFFFF', {
value: 0x42,
......@@ -44,8 +45,10 @@ actor('Funds depositor', () => {
})
)
})
expect((await l2Wallet.getBalance()).sub(balBefore)).to.deep.equal(
BigNumber.from(0x42)
// Converting BigNumber to hex string prevents chai from incorrectly considering inherited properties
// for strict equality - https://github.com/chaijs/chai/issues/948
expect((await l2Wallet.getBalance()).sub(balBefore).toString()).to.deep.equal(
BigNumber.from(0x42).toString()
)
})
})
......@@ -22,10 +22,11 @@ actor('NFT claimer', () => {
setupRun(async () => {
const wallet = Wallet.createRandom().connect(env.l2Wallet.provider)
await env.l2Wallet.sendTransaction({
const tx = await env.l2Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('0.01'),
})
await tx.wait()
return {
wallet,
contract: contract.connect(wallet),
......
......@@ -17,10 +17,11 @@ actor('Value sender', () => {
setupRun(async () => {
const wallet = Wallet.createRandom()
await env.l2Wallet.sendTransaction({
const tx = await env.l2Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('0.01'),
})
await tx.wait()
return {
wallet: wallet.connect(env.l2Wallet.provider),
}
......@@ -29,10 +30,11 @@ actor('Value sender', () => {
run(async (b, ctx: Context) => {
const randWallet = Wallet.createRandom().connect(env.l2Wallet.provider)
await b.bench('send funds', async () => {
await ctx.wallet.sendTransaction({
const tx = await ctx.wallet.sendTransaction({
to: randWallet.address,
value: 0x42,
})
await tx.wait()
})
expect((await randWallet.getBalance()).toString()).to.deep.equal('66')
})
......
......@@ -24,10 +24,11 @@ actor('Trie DoS accounts', () => {
setupRun(async () => {
const wallet = Wallet.createRandom()
await env.l2Wallet.sendTransaction({
const tx = await env.l2Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('1'),
})
await tx.wait()
return {
wallet: wallet.connect(env.l2Wallet.provider),
}
......
......@@ -50,10 +50,11 @@ actor('Uniswap swapper', () => {
setupRun(async () => {
const wallet = Wallet.createRandom().connect(env.l2Provider)
await env.l2Wallet.sendTransaction({
const sendTx = await env.l2Wallet.sendTransaction({
to: wallet.address,
value: utils.parseEther('0.1'),
})
await sendTx.wait()
for (const token of tokens) {
let tx = await token.transfer(wallet.address, 1000000)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment