Skip to content

Commit

Permalink
Problem: invariant bank total supply broken when create validator (#463)
Browse files Browse the repository at this point in the history
* Problem: invariant bank total supply broken when create validator

* update doc
  • Loading branch information
mmsqe authored Apr 11, 2024
1 parent 25da222 commit 07565aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (feemarket) [#433](https://github.com/crypto-org-chain/ethermint/pull/433) Fix sdk int conversion panic with baseFee.
* (rpc) [#434](https://github.com/crypto-org-chain/ethermint/pull/434) No need gasPrice when patch gasUsed for `eth_getTransactionReceipt`.
* (rpc) [#439](https://github.com/crypto-org-chain/ethermint/pull/439), [#441](https://github.com/crypto-org-chain/ethermint/pull/441) Align trace response for failed tx with go-ethereum.
* (evm) [#463](https://github.com/crypto-org-chain/ethermint/pull/463) Avoid broken bank total supply when creates a validator.

### Improvements

Expand Down
9 changes: 4 additions & 5 deletions x/evm/keeper/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,10 @@ func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc sdk.AccountI,
if !fees.IsValid() {
return errorsmod.Wrapf(errortypes.ErrInsufficientFee, "invalid fee amount: %s", fees)
}

err := bankKeeper.SendCoinsFromAccountToModuleVirtual(ctx, acc.GetAddress(), authtypes.FeeCollectorName, fees)
if err != nil {
return errorsmod.Wrapf(errortypes.ErrInsufficientFunds, err.Error())
if ctx.BlockHeight() > 0 {
if err := bankKeeper.SendCoinsFromAccountToModuleVirtual(ctx, acc.GetAddress(), authtypes.FeeCollectorName, fees); err != nil {
return errorsmod.Wrapf(errortypes.ErrInsufficientFunds, err.Error())
}
}

return nil
}

0 comments on commit 07565aa

Please sign in to comment.