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

Discrepancy in estimateGas between Bor and Erigon Nodes #1460

Open
pgtodoroff opened this issue Feb 22, 2025 · 1 comment
Open

Discrepancy in estimateGas between Bor and Erigon Nodes #1460

pgtodoroff opened this issue Feb 22, 2025 · 1 comment
Assignees

Comments

@pgtodoroff
Copy link

Overview of the problem

Sometimes there is a discrepancy when using eth_estimateGas for an ERC-20 token transfer on Matic Amoy. This happens rarely, although it has been reproducible.

The expected gas estimate should be 45415, but sometimes our response returns 45252 instead. This issue appears to be specific to Bor, as the estimate provided by Erigon is more accurate (since the related eth_call needs 45252 gas).

System information

Bor client version: 0xpolygon/bor:1.5.5

Environment: Polygon Amoy

Additional Information: Observed small differences in gas estimates from Bor vs. Erigon

Reproduction Steps

  • Use the following curl request to reproduce the issue:
curl -X POST https://polygon-amoy.g.alchemy.com/v2/api_key \
  -H "Content-Type: application/json" \
  -d '{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
      {
        "from": "0xfc7c61e4dbe1e83cdcc47e2544f5202c31261495",
        "to": "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
        "value": "0x0",
        "data": "0xa9059cbb000000000000000000000000d17f20ed92ab8f402d05e3c9476208a91782c76d0000000000000000000000000000000000000000000000000000000000000001"
      },
      "finalized"
    ]
  }'
  • Observe the returned gas estimate.

  • Compare with an Erigon node and verify the difference.

@lucca30
Copy link
Contributor

lucca30 commented Feb 22, 2025

Hi @pgtodoroff
Thanks for the detailed report! I’d like to clarify a few points:

  1. The report mentions an expected gas estimate of 45415, but also says Erigon is more accurate since the related eth_call needs 45252 gas. Could you please confirm whether the intended expected gas is 45415 or if 45252 is what you’re expecting?
    • Do you have a pushed transaction that shows the actual expected gas? This would help confirm which value is correct.
    • I tried to find similar transactions, and they appear to have consumed 45035 gas. Here are the transaction links for reference:

Thanks again for the report, and let me know if you have any further details or insights!

@lucca30 lucca30 self-assigned this Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants