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

Problem: simulate gas is less than required with feegrants #1364

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* [\#1324](https://github.com/cosmos/relayer/pull/1324) Add log-level in global config.
* [\#1325](https://github.com/cosmos/relayer/pull/1325) Ignore only file not exist error when loadConfigFile.
* [\#1326](https://github.com/cosmos/relayer/pull/1326) Avoid sending channel close confirm message after channel get closed successfully.
* [\#1364](https://github.com/cosmos/relayer/pull/1364) Include feegrant message when calculate gas.

## v0.9.3

Expand Down
20 changes: 10 additions & 10 deletions relayer/chains/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,16 +621,6 @@ func (cc *CosmosProvider) buildMessages(
txf = txf.WithSequence(sequence)
}

adjusted := gas

if gas == 0 {
_, adjusted, err = cc.CalculateGas(ctx, txf, txSignerKey, cMsgs...)

if err != nil {
return nil, 0, sdk.Coins{}, err
}
}

//Cannot feegrant your own TX
if txSignerKey != feegranterKey && feegranterKey != "" {
granterAddr, err := cc.GetKeyAddressForKey(feegranterKey)
Expand All @@ -641,6 +631,16 @@ func (cc *CosmosProvider) buildMessages(
txf = txf.WithFeeGranter(granterAddr)
}

adjusted := gas

if gas == 0 {
_, adjusted, err = cc.CalculateGas(ctx, txf, txSignerKey, cMsgs...)

if err != nil {
return nil, 0, sdk.Coins{}, err
}
}

// Set the gas amount on the transaction factory
txf = txf.WithGas(adjusted)

Expand Down
Loading