Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/tss-migration-cctx' into tss-mig…
Browse files Browse the repository at this point in the history
…ration-cctx
  • Loading branch information
kingpinXD committed Oct 16, 2023
2 parents 65e75aa + 33a5f19 commit 7c1b408
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,13 @@ func (k Keeper) FundGasStabilityPoolFromRemainingFees(ctx sdk.Context, outboundT
gasLimit := outboundTxParams.OutboundTxEffectiveGasLimit
gasPrice := math.NewUintFromBigInt(outboundTxParams.OutboundTxEffectiveGasPrice.BigInt())

if gasLimit == gasUsed {
return nil
}

// We skip gas stability pool funding if one of the params is zero
if gasLimit > 0 && gasUsed > 0 && !gasPrice.IsZero() {
if gasLimit >= gasUsed {
if gasLimit > gasUsed {
remainingGas := gasLimit - gasUsed
remainingFees := math.NewUint(remainingGas).Mul(gasPrice).BigInt()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ func TestKeeper_FundGasStabilityPoolFromRemainingFees(t *testing.T) {
fundStabilityPoolExpectedRemainingFee *big.Int
isError bool
}{
{
name: "no call if gasLimit is equal to gasUsed",
effectiveGasLimit: 42,
gasUsed: 42,
effectiveGasPrice: math.NewInt(42),
expectFundStabilityPoolCall: false,
},
{
name: "no call if gasLimit is 0",
effectiveGasLimit: 0,
Expand Down

0 comments on commit 7c1b408

Please sign in to comment.