celestiaorg / celestia-app

Celestia consensus node
https://celestiaorg.github.io/celestia-app/
Apache License 2.0
336 stars 275 forks source link

Create an offline general purpose gas simulator #2708

Open evan-forbes opened 11 months ago

evan-forbes commented 11 months ago

It would be really nice to be able to estimate gas offline without having to waste gas submitting a tx that is destined to fail or having to simulate the tx against an rpc endpoint. This simulator doesn't have to perfectly cover all cases, but being configurable for different environments or users would be ideal. For example, if I'm signing from a multisig, being able to estimate the gas cost with a specific set of sigantures or if I'm submitting using feegranter account for the extra gas costs there. It would also be nice to not have to sign a transaction to know the estimated gas cost.

cmwaters commented 11 months ago

It's not possible to create a fully offline gas estimator as there are at least two variables that are governance parameters that could change over time. Since they are not likely to change we can assume they are constant but may occasionally require the user to update those values when/if the parameters change

evan-forbes commented 11 months ago

It's not possible to create a fully offline gas estimator as there are at least two variables that are governance parameters that could change over time

ahh I should clarify that this is mainly targeted at general purpose cosmos-sdk transactions and not PFBs. The estimation here also would be pretty far from perfect, as the only way to actually know would require a copy of the latest state.

This issue stemmed from creating a massive multi-delegate tx, where we didn't even know where to start to guage gas price.