-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
estimateGas
reverts, but the transaction succeeds with a hardcoded gasLimit
#664
Comments
Hasn't there been an issue up for this for a while? |
@platocrat The expected behavior listed here isn't actually right. Chainlink is getting |
@K-Ho I've noticed that txs always succeed with a static gas limit actually... Here's a reproduction branch: https://github.com/Rari-Capital/nova/tree/gasLimitNoRevertRepro |
@K-Ho just to confirm that this really is the same issue that we see for contract calls that revert, here are the full error messages for the 2 Waffle-based tests that fail with this error: I highlighted the NOTE: I can confirm that specifying the gas limit to |
cannot estimate gas
errorestimateGas
reverts, but the transaction succeeds with a hardcoded gasLimit
This is not a duplicate of #474. That issue describes “estimateGas does not provide the revert reason” and this issue describes: “estimateGas reverts, but the transaction succeeds with a hardcoded gasLimit” |
I believe the problem is with |
@tynes @snario I re-ran the integration test for the hardhat example in the monorepo and get an odd type error. The error is below:
The error points to @K-Ho From this new error shown above, I believe ethereum-optimism/optimism/pull/721 should warrant a separate GH issue to document this error in
|
@platocrat this error you got is because there is no |
I'm confirming that this issue is fixed by ethereum-optimism/optimism/pull/721!! |
What's the exact fix by 721? Do you get proper revert messages? |
The fix appears to be that we no longer need to specify a hardcoded |
This is the result of the fix
The problem was that the interface between userland and the system contracts was not defined.
|
@K-Ho @tynes @snario The tests that are supposed to revert still revert with the same
I also confirmed that adding a hardcoded gasLimit of Update
What's odd about point 3 is that only 3/7 tests pass, and of those that pass, they involve contract calls that revert, which is the opposite of what was happening previously. |
@platocrat - are you still seeing this |
|
@K-Ho @snario Repro case:
|
@platocrat I'll take a look at this in an hour or so. |
I was able to reproduce on |
You need to comment out line 8 in |
The above ChainLink test failure seems unrelated to what this Github issue was created for. ChainLink is seeing #474 (reference) I believe — revert reasons not propagating up correctly. |
I was able to fix this problem by using
it('can NOT deposit without access (gateway role)', async () => {
- const depositTx = await l2Token.deposit(oe.l2Wallet.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
- // TODO: fetch revert reason
- // revert: LinkTokenChild: missing role
- await h.txRevert(depositTx.wait())
+ await expect(
+ l2Token.deposit(oe.l2Wallet.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
+ ).to.be.revertedWith('No access')
})
it('owner can migrate to a new gateway', async () => {
@@ -221,10 +220,11 @@ describe(`LinkTokenChild ${Versions.v0_7}`, () => {
const removeAccessTx = await l2Token.removeAccess(owner.address)
await removeAccessTx.wait()
// Owner deposit fails
- const depositTx = await l2Token.deposit(owner.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
// TODO: fetch revert reason
// revert: LinkTokenChild: missing role
- await h.txRevert(depositTx.wait())
+ await expect(
+ l2Token.deposit(owner.address, 100, h.optimism.TX_OVERRIDES_OE_BUG)
+ ).to.be.revertedWith('No access')
// TODO: owner renounce ownership
}) |
I'm going to close this issue. If something from the above conversation is still unclear, let's open a new issue. |
Of note, Kelvin's approach above is the correct way to do it in JS. The way the tests were written before, they'd fail even in EVM mode because you're awaiting a failing transaction with an overridden gas limit. |
re-opening this issue - here's Chainlink still seeing this issue appear: |
I was able to repro smartcontractkit/LinkToken#37 locally. |
I resolved the it('can NOT deposit without access (gateway role)', async () => {
- const mintTx = await l2Token.mint(oe.l2Wallet.address, 100, optimism.TX_OVERRIDES_BUG)
- // TODO: fetch revert reason
- // revert: 'No access'
- await h.txRevert(mintTx.wait())
+ const mintTx = l2Token.mint(oe.l2Wallet.address, 100, optimism.TX_OVERRIDES_BUG)
+ await expect(mintTx).to.be.revertedWith('No access')
})
it('owner can migrate to a new gateway', async () => {
- const mintTx = await l2Token.mint(owner.address, 100, optimism.TX_OVERRIDES_BUG)
- // TODO: fetch revert reason
- // revert: 'No access'
- await h.txRevert(mintTx.wait())
+ const mintTx = l2Token.mint(owner.address, 100, optimism.TX_OVERRIDES_BUG)
+ await expect(mintTx).to.be.revertedWith('No access')
}) Note |
As @gakonst mentioned, it looks like the test was just written incorrectly. |
Describe the bug
In ChainLink's LinkToken integration tests, 3/7 tests fail. Those that do fail involve contract calls that should revert. However, instead of a revert message being returned, the familiar
cannot estimate gas
error is thrown.To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/smartcontractkit/LinkToken.git
git checkout feature/ovm-integration-upstream-changes
optimism/ops
to start a local OE networkyarn && yarn setup && yarn test:integration../test/v0.7/bridge/optimism/OVM_L2ERC20Gateway.test.ts
Expected behavior
A transaction that fails
estimateGas
should not succeed with a hardcodedgasLimit
Related issues
#474
#543
The text was updated successfully, but these errors were encountered: