Change gas simulation logic to a separate flag/parameter to improve the UX
As discussed with @faboweb, it's not clear from a UX perspective that you would expect to run a gas simulation by setting --gas=0. Proposed designs follow:
--estimate-gas=<true/false> flag (on CLI) and parameter (on gaia-lite) to change the logic from https://github.com/cosmos/cosmos-sdk/pull/2047, which currently has to set --gas=0 to run the gas simulation--gas flag and parameter can only take positive values--estimate-gas=true and --gas =$AMOUNT > 0, it runs the simulation--gas flag accept a conventional string value, e.g. simulate/auto/estimate that would trigger tx simulation and set the gas according to the gas estimate returned by the simulation.--gas flag values to be checked against a string conventional value/parsed into int64.Rationale:
--gas--gas=$AMOUNT and --estimate-gas? Such a command line would be misleading and ambiguous, i.e. what should the expected behaviour be when the user sets a gas allocation and switches gas simulation on? Which flag should take precedence?--estimate-gas=<true/false> flag (on CLI) and parameter (on gaia-lite) (as above)--estimate-gas=true and --gas=$AMOUNT are supplied.Once we make simulation default, I don't see why this is an issue? I'd expect setting gas to not have it be simulated (or at least only warning me if I gave an insufficient amount), and to have it be simulated by default.
Currently its not default due to it depending on the private key, which causes weird ledger UX + has sidechannel leakage concerns.
iff we do decide to have two flags, the command/endpoint should halt immediately and gracefully with a warning stating that both cannot be provided.
Simulation will be default now @ValarDragon ?
@alexanderbez I've put your suggestion up among the other proposals
With the newly updated proposals, Proposal B looks great to me!
Let's vote:
Proposal A ๐
Proposal B ๐
Proposal C ๐
/cc @jackzampolin @jaekwon @cwgoes
We already have a ton of flags so adding another one will confuse matters. I voted for B because we could default to something sane (i.e. --gas=estimate) and advanced users can put in their own value for gas if they need to (i.e. --gas=100000). Seems user-friendly and understandable.
Proposal B looks sound to me. Parsing and validating can easily be done with string constants within a switch case and handling integers as the default.
Most helpful comment
Let's vote:
Proposal A ๐
Proposal B ๐
Proposal C ๐