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

fix(network): out of gas issue when approving many request #3114

Merged
merged 8 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

### Fixes


- [#3114](https://github.com/ignite/cli/pull/3114) Fix out of gas issue when approving many requests
- [#3068](https://github.com/ignite/cli/pull/3068) Fix REST codegen method casing bug
- [#3031](https://github.com/ignite/cli/pull/3031) Move keeper hooks to after all keepers initialized in `app.go`
template.
Expand Down
1 change: 1 addition & 0 deletions ignite/cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func getNetworkCosmosClient(cmd *cobra.Command) (cosmosclient.Client, error) {
cosmosclient.WithUseFaucet(spnFaucetAddress, networktypes.SPNDenom, 5),
cosmosclient.WithKeyringServiceName(cosmosaccount.KeyringServiceName),
cosmosclient.WithKeyringDir(getKeyringDir(cmd)),
cosmosclient.WithGas(cosmosclient.GasAuto),
}

keyringBackend := getKeyringBackend(cmd)
Expand Down
7 changes: 5 additions & 2 deletions ignite/pkg/cosmosclient/cosmosclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ var (
)

const (
// GasAuto allows to calculate gas automatically when sending transaction
GasAuto = "auto"

defaultNodeAddress = "http://localhost:26657"
defaultGasAdjustment = 1.0
defaultGasLimit = 300000
Expand Down Expand Up @@ -560,7 +563,7 @@ func (c Client) CreateTx(goCtx context.Context, account cosmosaccount.Account, m
}

var gas uint64
if c.gas != "" && c.gas != "auto" {
if c.gas != "" && c.gas != GasAuto {
gas, err = strconv.ParseUint(c.gas, 10, 64)
if err != nil {
return TxService{}, errors.WithStack(err)
Expand All @@ -571,7 +574,7 @@ func (c Client) CreateTx(goCtx context.Context, account cosmosaccount.Account, m
return TxService{}, errors.WithStack(err)
}
// the simulated gas can vary from the actual gas needed for a real transaction
// we add an additional amount to ensure sufficient gas is provided
// we add an amount to ensure sufficient gas is provided
gas += 20000
aljo242 marked this conversation as resolved.
Show resolved Hide resolved
}
txf = txf.WithGas(gas)
Expand Down