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

Use gasPrice when this field is present (eth_estimateGas) #1636

Merged
merged 10 commits into from
Dec 7, 2020

Conversation

matkt
Copy link
Contributor

@matkt matkt commented Nov 30, 2020

Signed-off-by: Karim TAAM karim.t2am@gmail.com

PR description

This PR changes several things related to the eth_estimateGas endpoint

  • There is a new notion of strict check which allows or not to take into account the balance of the sender (by default not strict)

    • If strict mode == false (default). We do not check the account balance for value transfert or to pay transaction fees.
    • If strict mode == true. We check the account balance for value transfert or to pay transaction fees.

Note : If strict mode is disabled we put the maximum value of a long in the balance of the sender's account to allow all transactions to be done

{
   "jsonrpc":"2.0",
   "method":"eth_estimateGas",
   "params":[
      {
         "gasPrice":"10000",
         "from":"fe3b557e8fb62b89f4916b721be55ceb828dbd74",
         "to":"0x43D1F9096674B5722D359B6402381816d5B22F28",
         "data":"0x3fb5c1cb000000000000000000000000000000000000000000000000000000000000000c",
         "strict":"true"
      },
      "latest"
   ],
   "id":1
}
  • It is no longer possible to use the gasPrice if we are using 1559 transaction (gasPrice cannot be used with baseFee or feeCap)

  • The gasPrice is respected if it is put in the request (by default 0 if not present)

  • JsonCallParameter and CallParameter have been split because there is a difference between the two objects (the strict field)

Test performed

  • Call with and without strict mode (eth_estimateGas)
  • Call (legacy and eip1559) with and without gasPrice (eth_estimateGas, eth_call)
  • Call with and without empty balance account
  • Tested with simple value transfert, simple contract and contract that revert with gasPrice == 0

Changelog

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need docs changed to update the json rpc parameters.

@shemnon shemnon added the doc-change-required Indicates an issue or PR that requires doc to be updated label Dec 4, 2020
@matkt matkt merged commit 54326fd into hyperledger:master Dec 7, 2020
@matkt matkt deleted the fix_eth_estimate_with_gas_price branch April 13, 2021 11:24
@bgravenorst bgravenorst removed the doc-change-required Indicates an issue or PR that requires doc to be updated label Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants