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

eth_estimateGas fails on empty address #2804

Closed
kuegi opened this issue Jan 27, 2024 · 12 comments · Fixed by #2808
Closed

eth_estimateGas fails on empty address #2804

kuegi opened this issue Jan 27, 2024 · 12 comments · Fixed by #2808
Labels

Comments

@kuegi
Copy link
Contributor

kuegi commented Jan 27, 2024

Summary

eth_estimateGas returns Custom error: gas required exceeds allowance 0 if the address has no DFI on it. But it should return the estimated gas.

@kuegi kuegi added the bug label Jan 27, 2024
@sieniven
Copy link
Member

This is the correct behaviour. Estimate gas RPC aligns with geth, and you will see the exact same behaviour on Ethereum. If the from address has no DFI, and it is trying to make a transaction, the RPC will propagate this error since you cant make transactions without any DFI. If you would like to create a state override setting to test a specfic context, please pass the state override set with the address-to-state mapping in the optional parameter in the eth_estimateGas RPC.

@kuegi
Copy link
Contributor Author

kuegi commented Jan 29, 2024

thx. @sieniven it might be according to geth. but reality for exchanges is different it seems.
doing the call for any ethereum rpc on https://ethereumnodes.com/ with the address that is also empty on ETH, it always returns the estimated gas.
So this difference makes it harder for anyone to reuse existing eth tools.

@sieniven
Copy link
Member

sieniven commented Jan 29, 2024

@kuegi that is not true. Please verify again on your end that you are directly interacting with an ethereum node. With any ethereum node, the default behaviour returns an invalid response: "error": { "code": -32000, "message": "insufficient funds for transfer" }. Often times these public endpoints, for example Alchemy, may provide an additional layer on top of nodes which differ from node behaviours. We choose to align ourselves as much as we can to geth, and implement behaviours that make sense in our context.

In addition, as mentioned above, please note that our node supports the addition state override set customization in our eth calls RPC. In this specific context, it does not make sense to return a default gas transfer used in this RPC when the address is zero. That would actually make the RPC faulty and unreliable. Please pass the state override if you would like to set a defined context on your RPC call.

@LXHLeaner
Copy link

LXHLeaner commented Jan 29, 2024

@sieniven Account DFI amount is not enough will also report an error?
image

@kuegi
Copy link
Contributor Author

kuegi commented Jan 29, 2024

@kuegi that is not true. Please verify again on your end that you are directly interacting with an ethereum node. With any ethereum node, the default behaviour returns an invalid response: "error": { "code": -32000, "message": "insufficient funds for transfer" }. Often times these public endpoints, for example Alchemy, may provide an additional layer on top of nodes which differ from node behaviours. We choose to align ourselves as much as we can to geth, and implement behaviours that make sense in our context.

In addition, as mentioned above, please note that our node supports the addition state override set customization in our eth calls RPC. In this specific context, it does not make sense to return a default gas transfer used in this RPC when the address is zero. That would actually make the RPC faulty and unreliable. Please pass the state override if you would like to set a defined context on your RPC call.

thx for the reply. In the end, the issue is that we make it really hard for externals right now to integrate DMC as it behaves different. If its not an issue on the node itself, its an issue on the blockscouts?

What can we do, to make it easier for exchanges to integrate DMC?

If I do the same call on any public eth rpc that I find, I get a valid result. So its a bit hard to believe that this should not be the standard.

@sieniven
Copy link
Member

@LXHLeaner Yup. https://www.quicknode.com/docs/ethereum/eth_estimateGas - you can check out the optional state override parameter that our node supports.

@sieniven
Copy link
Member

sieniven commented Jan 29, 2024

@kuegi

If I do the same call on any public eth rpc that I find, I get a valid result. So its a bit hard to believe that this should not be the standard.

https://ethereum-sepolia.publicnode.com public RPC endpoint behaviour aligns exactly the same as our node.

What can we do, to make it easier for exchanges to integrate DMC?

We have been making multiple PRs and fixes to fix all endpoints to align ourselves as much as we can with geth. geth is the most largest client with the most widespread user base. Actually the node has been making active steps to stability and full integration (PRs #2633, #2736, #2784, #2788, etc), more to come. Would be really helpful if the community could continue pointing out any integration issues with external web3 applications :)

@kuegi
Copy link
Contributor Author

kuegi commented Jan 29, 2024

@kuegi

If I do the same call on any public eth rpc that I find, I get a valid result. So its a bit hard to believe that this should not be the standard.

https://ethereum-sepolia.publicnode.com public RPC endpoint behaviour aligns exactly the same as our node.

Does this call return something else on your side? If I call it, it returns a valid gas estimate:

curl  https://ethereum-sepolia.publicnode.com \
-H 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0","method":"eth_estimateGas",
    "params":[
        {
            "from":"0x4790b73359B393a10D4201371563795001f17977",
            "to":"0x347D48fB3907B71089945Aee7cafEe75d5F30EBc",
            "data":"0xa9059cbb000000000000000000000000dac0ebb0b5ed7ffd9441509acb40f06a529500000000000000000000000000000000000000000000000107ad8f556c6c0000"
        }],
        "id":1
}' 

returns {"jsonrpc":"2.0","id":1,"result":"0x5512"}

Would be really helpful if the community could continue pointing out any integration issues with external web3 applications :)

Thats what I am trying to do here.

@sieniven
Copy link
Member

sieniven commented Jan 29, 2024

@kuegi Thanks for providing the context. This is much more useful, and this is indeed a bug when calling eth_estimateGas with a populated data field in the call context. Will be re-opening this issue.

@sieniven sieniven reopened this Jan 29, 2024
@Stonygan
Copy link

https://ethereum-sepolia.publicnode.com public RPC endpoint behaviour aligns exactly the same as our node.

I run a public BSC Node without some additional layers and Version: instance=Geth/v1.3.8-c6aeee20-20240123/linux-amd64/go1.21.6
Have the same behavior, Request works and result is the estimate Gas as expected, only Defichainnode returns an incorrect result.

@LXHLeaner
Copy link

LXHLeaner commented Jan 29, 2024

@sieniven @Stonygan @ldenman @kuegi When will this Defichainnode problem be solved?

@sieniven sieniven linked a pull request Jan 29, 2024 that will close this issue
9 tasks
@sieniven
Copy link
Member

sieniven commented Jan 29, 2024

This issue will be resolved once the PR #2808 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants