Skip to content
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 call fails in optimism network. #2518

Closed
Kankan-0 opened this issue Jan 10, 2022 · 5 comments
Closed

estimateGas call fails in optimism network. #2518

Kankan-0 opened this issue Jan 10, 2022 · 5 comments
Labels
investigate Under investigation and may be a bug.

Comments

@Kankan-0
Copy link

Kankan-0 commented Jan 10, 2022

Description : estimateGas call fails if I try optimism rpc endpoints, with others it's successfully returning the result.

I'm using "ethers": "^5.5.3" version in my project, and while trying the following code I get the error: Error: gas required exceeds allowance

const ethers = require('ethers')
async function test() {
  let url
  url = 'https://kovan.optimism.io'
  // url = 'https://polygon-rpc.com'
  // url ="https://kovan.poa.network"
  // url = 'https://rinkeby.arbitrum.io/rpc'
  // url = 'https://mainnet.optimism.io'
  
  
  let provider=  new ethers.providers.JsonRpcProvider(url)
  const gasPrice =await provider.getGasPrice();
  const tx = {
    to: '0xb4DE0833771eae55040b698aF5eB06d59E142C82',     
    value: '0x1',
  }
  const estimatedGas = await provider.estimateGas(tx);
  
  console.log(gasPrice.toString())
  console.log(estimatedGas.toString())
}

test()

Here's the full error that I am getting.
image

All the other endpoints works fine except the optimism ones.
Can anyone suggest if I am doing something wrong?

Thanks.

@Kankan-0 Kankan-0 added the investigate Under investigation and may be a bug. label Jan 10, 2022
@smartcontracts
Copy link

I think this is probably an issue with some quirk in the Optimism node and unlikely to be an Ethers issue.

@RobbingBlocks
Copy link

RobbingBlocks commented Feb 17, 2022

I think this is probably an issue with some quirk in the Optimism node and unlikely to be an Ethers issue.

I don't think so. I have actually noticed there being some issues in the Logging specifically around this method as well. It might be spread to other things too - haven't looked too deep yet. However I think ethers might have some pretty serious bugs in the logger when it comes to less common errors, and less common use cases.

For instance, I just discovered a way to crash my app by breaking something in the logger - meanwhile my entire implementation of ethers is wrapped in a try/catch to see if I can gracefully fail...

@zemse
Copy link
Collaborator

zemse commented Feb 28, 2022

@Kankan-0 I just tried this example, and it seems to work.

ethers-repl> test()
Promise { <pending> }
10000
21000

Not really sure why it'd be failing when the issue was created, but since the transaction involves value: '0x1, and the node would consider Zero address by default as the caller when a from is not specified in estimateGas, hence the Zero address must possess at least 0x1 balance, which it now does.

@smartcontracts
Copy link

smartcontracts commented Mar 1, 2022

We (the Optimism team) did additional research and found that this was an issue over at QuickNode, the RPC provider behind both mainnet.optimism.io and kovan.optimism.io. QuickNode upgraded its infrastructure over the last few days and it seems that this problem has been fixed along with that upgrade. This can safely be closed as it's not an issue with ethers.js and it's also been fixed.

@Kankan-0
Copy link
Author

Kankan-0 commented Mar 3, 2022

Closing this issue since it's now fixed as per smartcontracts comment.

@Kankan-0 Kankan-0 closed this as completed Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug.
Projects
None yet
Development

No branches or pull requests

4 participants