Skip to content

Commit

Permalink
Problem: simulate gas is less than require with feegrants
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Dec 18, 2023
1 parent f1c9956 commit a3936d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* [\#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.
* [\#11](https://github.com/crypto-org-chain/relayer/pull/11) Fix gasFeeCap and gasPrice when new evm tx.
* [\#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 @@ -671,16 +671,6 @@ func (cc *CosmosProvider) getTxFactoryAndBuilder(
txf = txf.WithSequence(sequence)
}

adjusted := gas

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

if err != nil {
return nil, nil, err
}
}

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

adjusted := gas

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

if err != nil {
return nil, nil, err
}
}

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

Expand Down

0 comments on commit a3936d9

Please sign in to comment.