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

Implement a simulate-only CLI flag/field for REST endpoints #2110

Closed
4 tasks done
alessio opened this issue Aug 21, 2018 · 2 comments
Closed
4 tasks done

Implement a simulate-only CLI flag/field for REST endpoints #2110

alessio opened this issue Aug 21, 2018 · 2 comments
Assignees
Labels

Comments

@alessio
Copy link
Contributor

alessio commented Aug 21, 2018

Forked from #1246

Summary

Add an extra simulate flag support to both CLI tx commands and RESTful endpoints to trigger the simulation of an unsigned transaction. The command and REST endpoints should return a rough estimate of the gas consumption.

As a CLI/REST user
I want to simulate the execution of a transaction
So that I can review the estimate of the gas consumption.

Problem Definition

Given an unsigned transaction
When it is executed via its respective CLI command with the --dry-run flag
Then the client simulates the transaction and the estimate of the gas consumption is printed out.

Given an unsigned transaction
When it is submitted through its respective RESTful endpoint and the simulate field is set to true
Then the client simulates the execution of the transaction and the estimate of the gas consumption is printed out.

Proposal

Whilst CLI should support a new --dry-run flag, the REST clients should support a simulate field in the request payload to disable the broadcasting of the tx.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@cwgoes
Copy link
Contributor

cwgoes commented Aug 21, 2018

cc @fedekunze for context on what we need Voyager-side

@alessio alessio self-assigned this Aug 28, 2018
alessio added a commit that referenced this issue Aug 29, 2018
alessio added a commit that referenced this issue Aug 30, 2018
Add a simulate only flag '--dry-run' to both CLI tx commands
and RESTful endpoints to trigger the simulation of unsigned
transactions.

* Turning --dry-run on causes the --gas flag to be ignored.
  The simulation will return the estimate of the gas required
  to actually run the transaction.
* Adjustment is no longer required. It now defaults to 1.0.
* In some test cases accounts retrieved from the state do not
  come with a PubKey. In such cases, a fake secp256k1 key is
  generated and gas consumption calculated accordingly.

Closes: #2110
@alessio
Copy link
Contributor Author

alessio commented Aug 31, 2018

@cwgoes please approve if you are happy with the changes, PR #2165 depends on this

alessio added a commit that referenced this issue Aug 31, 2018
Add a simulate only flag '--dry-run' to both CLI tx commands
and RESTful endpoints to trigger the simulation of unsigned
transactions.

* Turning --dry-run on causes the --gas flag to be ignored.
  The simulation will return the estimate of the gas required
  to actually run the transaction.
* Adjustment is no longer required. It now defaults to 1.0.
* In some test cases accounts retrieved from the state do not
  come with a PubKey. In such cases, a fake secp256k1 key is
  generated and gas consumption calculated accordingly.

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

No branches or pull requests

2 participants