question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suppress pre-flight check

See original GitHub issue

I am trying to mimic a web3 batched transaction with ethers, and having some trouble with what I presume are pre-flight checks that are being made on ethers side?

I am basically running two transactions consecutively, with the second depending on the first. When I do this with a web3 batched transaction, using metamask as the provider, there are two permission modals that pop up, the first for an ERC20 approval, the second for the transaction that depends on the ERC20 approval. With a web3 batched transaction, the permission modal for the second transaction warns that the EVM has reverted code, but I can still send that transaction.

When I attempt the same with ethers, the second transaction throws with a Revert EVM error 0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015746f6b656e207472616e73666572206661696c65640000000000000000000000

This I believe is a token transfer error, something that our code requires. It seems as though ethers is running a .call on the transaction first, and if this fails, it throws an exception. We are trying to make that approval first, then the second tx but mined in the same block with different nonces (a batched transaction).

Question, is there any way to suppress this check and send the transaction that may well revert?

toby

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Jun 23, 2020

Are you setting a gasLimit? If there is no gasLimit set, ethers will use estimateGas, which can throw a CALL_EXCEPTION if the call would fail, which in this case it would.

Try adding a gasLimit override or including the "gas" key in the ABI (or @ directive for human-readable ABI)?

0reactions
ricmoocommented, Oct 7, 2020

I think this is stale now (and therefore probably resolved 😉), so I’m going to close it. If you are still having problems though, please re-open.

Thanks! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is an OPTIONS request sent and can I disable it?
This pre-flight request is made by some browsers as a safety measure to ensure that the request being done is trusted by the...
Read more >
4 Ways to Reduce CORS Preflight Time in Web Apps
Whenever the browser makes a Preflight request, it first checks in the Preflight cache to see if there is a response to that...
Read more >
Techniques for bypassing CORS Preflight Requests to ...
Strategy 1: Caching​​ One mechanism you can use to ensure repeat CORS Preflight requests aren't a bottleneck is to apply a Access-Control-Max-Age ...
Read more >
Avoiding pre-flight OPTIONS calls on CORS requests - Medium
The right thing to do would be to route the requests to your App server(the one which serves up your built app and...
Read more >
[CAPD] disable preflight checks · Issue #2790 - GitHub
i'd recommend to disable individual preflight checks instead of --ignore-preflight-errors=all .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found