Skip to content

Commit

Permalink
feat: cosmos v0.50 upgrade (#3357)
Browse files Browse the repository at this point in the history
* bump versions and fix imports

* update blockers methods and log imports

* fixes

* rpc fixes

* proto changes

* fixes

* generate

* mocks

* fix testutils keepers

* fixes

* sims fixes

* parse genesis fixes

* fixes for start cmd

* bump ethermint

* config fixes

* fixes e2e tests working

* bump ethermint

* fmt

* CI fixes

* CI fixes

* lint ci fixes

* unit tests fixes

* unit tests fixes

* fix parse gen tests

* fix upgrade test light

* remove redundant replace

* fix invalid bond denom in sim tests

* bump ethermint

* add autocli opts and fixes after merge
  • Loading branch information
skosito authored Jan 24, 2025
1 parent 9e57a3f commit 367e4aa
Show file tree
Hide file tree
Showing 355 changed files with 14,856 additions and 11,182 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fmt:
### Generation commands ###
###############################################################################

protoVer=0.13.0
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace --user $(shell id -u):$(shell id -g) $(protoImageName)

Expand Down
4 changes: 2 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"runtime/debug"

errorsmod "cosmossdk.io/errors"
tmlog "github.com/cometbft/cometbft/libs/log"
tmlog "cosmossdk.io/log"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -177,7 +177,7 @@ func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool {
*observertypes.MsgVoteBlockHeader,
*observertypes.MsgVoteTSS,
*observertypes.MsgVoteBlame:
signers := innerMsg.GetSigners()
signers := innerMsg.(sdk.LegacyMsg).GetSigners()
if len(signers) == 1 {
return isAuthorizedSigner(signers[0].String())
}
Expand Down
13 changes: 7 additions & 6 deletions app/ante/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"math/big"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -108,7 +109,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(
}
}

reductionRate := sdk.MustNewDecFromStr(GasPriceReductionRate)
reductionRate := sdkmath.LegacyMustNewDecFromStr(GasPriceReductionRate)
minGasPrice = minGasPrice.Mul(reductionRate) // discounts min gas price for system tx

evmParams := mpd.evmKeeper.GetParams(ctx)
Expand All @@ -127,7 +128,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(gas))
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(gas))

for _, gp := range minGasPrices {
fee := gp.Amount.Mul(gasLimit).Ceil().RoundInt()
Expand Down Expand Up @@ -196,10 +197,10 @@ func (empd EthMinGasPriceDecorator) AnteHandle(
feeAmt = ethMsg.GetEffectiveFee(baseFee)
}

gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))

requiredFee := minGasPrice.Mul(gasLimit)
fee := sdk.NewDecFromBigInt(feeAmt)
fee := sdkmath.LegacyNewDecFromBigInt(feeAmt)

if fee.LT(requiredFee) {
return ctx, errorsmod.Wrapf(
Expand Down Expand Up @@ -250,8 +251,8 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(
)
}

fee := sdk.NewDecFromBigInt(ethMsg.GetFee())
gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
fee := sdkmath.LegacyNewDecFromBigInt(ethMsg.GetFee())
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
requiredFee := minGasPrice.Mul(gasLimit)

if fee.LT(requiredFee) {
Expand Down
16 changes: 7 additions & 9 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
"fmt"

cosmoserrors "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
txsigning "cosmossdk.io/x/tx/signing"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ethante "github.com/zeta-chain/ethermint/app/ante"
ethermint "github.com/zeta-chain/ethermint/types"
evmtypes "github.com/zeta-chain/ethermint/x/evm/types"
Expand All @@ -43,8 +43,8 @@ type HandlerOptions struct {
FeeMarketKeeper FeeMarketKeeper
EvmKeeper EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
SignModeHandler authsigning.SignModeHandler
SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
SignModeHandler *txsigning.HandlerMap
SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
MaxTxGasWanted uint64
ExtensionOptionChecker ante.ExtensionOptionChecker
TxFeeChecker ante.TxFeeChecker
Expand Down Expand Up @@ -165,8 +165,6 @@ func newCosmosAnteHandlerForSystemTx(options HandlerOptions) sdk.AnteHandler {
)
}

var _ GasTx = (*legacytx.StdTx)(nil) // assert StdTx implements GasTx

// GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator
type GasTx interface {
sdk.Tx
Expand Down Expand Up @@ -209,7 +207,7 @@ func (sud SetUpContextDecorator) AnteHandle(
defer func() {
if r := recover(); r != nil {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
case storetypes.ErrorOutOfGas:
log := fmt.Sprintf(
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, gasTx.GetGas(), newCtx.GasMeter().GasConsumed())
Expand Down
Loading

0 comments on commit 367e4aa

Please sign in to comment.