fix: set gas adjustment before calc #4250
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In
CreateTx
inpkg/cosmosclient/cosmosclient.go
if gas is set to auto the function will calculate gas using the gasometer.The gas adjustment is used in this calculation (at least in the cosmos sdk implementation)
https://github.com/cosmos/cosmos-sdk/blob/10465a6aabdfc9119ff187ac3ef229f33c06ab45/client/tx/tx.go#L149-L166
As the
txf.WithGasAdjustment
is set after the calculation the function will use the default value.This PR moves the assignment to before the calculation so that the gas adjustment is correctly applied in the gasometer estimation.