Commit 467d6cb6 authored by smartcontracts's avatar smartcontracts Committed by GitHub

test[integration-tests]: add an integration test for contract deployments that...

test[integration-tests]: add an integration test for contract deployments that run out of gas (#939)

* test: add deploy OOG test and improve OOG error message

* chore: add changeset
Co-authored-by: default avatarGeorgios Konstantopoulos <me@gakonst.com>
parent ef2fba12
---
'@eth-optimism/integration-tests': patch
'@eth-optimism/l2geth': patch
---
Adds a test for contract deployments that run out of gas
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
contract TestOOG {
constructor() {
bytes32 h;
for (uint256 i = 0; i < 100000; i++) {
h = keccak256(abi.encodePacked(h));
}
}
}
......@@ -121,6 +121,14 @@ describe('Basic RPC tests', () => {
'invalid transaction: insufficient funds for gas * price + value'
)
})
it('should correctly report OOG for contract creations', async () => {
const factory = await ethers.getContractFactory('TestOOG')
await expect(factory.connect(wallet).deploy()).to.be.rejectedWith(
'gas required exceeds allowance'
)
})
})
describe('eth_call', () => {
......
......@@ -1131,7 +1131,7 @@ func legacyDoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrO
}
return 0, err
}
return 0, fmt.Errorf("gas required exceeds allowance (%d) or always failing transaction", cap)
return 0, fmt.Errorf("gas required exceeds allowance (%d)", cap)
}
}
return hexutil.Uint64(hi), nil
......
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