diff --git a/.github/mergify.yml b/.github/mergify.yml index ae0329af67..e939a6856c 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -27,6 +27,8 @@ pull_request_rules: - release/v0.24.x - release/v0.25.x - release/v0.26.x + - release/v0.26.x-iavl-v1 + - release/v0.27.x - name: Backport patches to the release/v0.17.x branch conditions: @@ -99,3 +101,21 @@ pull_request_rules: backport: branches: - release/v0.26.x + + - name: Backport patches to the release/v0.26.x-iavl-v1 branch + conditions: + - base=master + - label=A:backport/v0.26.x-iavl-v1 + actions: + backport: + branches: + - release/v0.26.x-iavl-v1 + + - name: Backport patches to the release/v0.27.x branch + conditions: + - base=master + - label=A:backport/v0.27.x + actions: + backport: + branches: + - release/v0.27.x diff --git a/app/upgrades.go b/app/upgrades.go index 5a67acf10c..cd882b9f25 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -3,6 +3,7 @@ package app import ( "fmt" + errorsmod "cosmossdk.io/errors" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -10,19 +11,19 @@ import ( ) const ( - UpgradeName_Mainnet = "v0.27.0" - UpgradeName_Testnet = "v0.27.0-alpha.0" + UpgradeNameMainnet = "v0.27.0" + UpgradeNameTestnet = "v0.27.0-alpha.0" ) // RegisterUpgradeHandlers registers the upgrade handlers for the app. func (app App) RegisterUpgradeHandlers() { app.upgradeKeeper.SetUpgradeHandler( - UpgradeName_Mainnet, - upgradeHandler(app, UpgradeName_Mainnet), + UpgradeNameMainnet, + upgradeHandler(app, UpgradeNameMainnet), ) app.upgradeKeeper.SetUpgradeHandler( - UpgradeName_Testnet, - upgradeHandler(app, UpgradeName_Testnet), + UpgradeNameTestnet, + upgradeHandler(app, UpgradeNameTestnet), ) upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() @@ -30,8 +31,8 @@ func (app App) RegisterUpgradeHandlers() { panic(err) } - doUpgrade := upgradeInfo.Name == UpgradeName_Mainnet || - upgradeInfo.Name == UpgradeName_Testnet + doUpgrade := upgradeInfo.Name == UpgradeNameMainnet || + upgradeInfo.Name == UpgradeNameTestnet if doUpgrade && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{} @@ -57,7 +58,7 @@ func upgradeHandler( // run migrations for all modules and return new consensus version map versionMap, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) if err != nil { - return nil, err + return nil, errorsmod.Wrap(err, "failed to run migrations") } logger.Info("completed store migrations") diff --git a/tests/util/addresses.go b/tests/util/addresses.go index c00638281a..dac3181c17 100644 --- a/tests/util/addresses.go +++ b/tests/util/addresses.go @@ -7,6 +7,10 @@ import ( "github.com/ethereum/go-ethereum/common" ) +const ( + MnemonicEntropyBits = 128 +) + func SdkToEvmAddress(addr sdk.AccAddress) common.Address { return common.BytesToAddress(addr.Bytes()) } @@ -17,9 +21,13 @@ func EvmToSdkAddress(addr common.Address) sdk.AccAddress { // RandomMnemonic generates a random BIP39 mnemonic from 128 bits of entropy func RandomMnemonic() (string, error) { - entropy, err := bip39.NewEntropy(128) + entropy, err := bip39.NewEntropy(MnemonicEntropyBits) if err != nil { return "", errorsmod.Wrap(err, "failed to generate entropy for new mnemonic") } - return bip39.NewMnemonic(entropy) + mnemonic, err := bip39.NewMnemonic(entropy) + if err != nil { + return mnemonic, errorsmod.Wrap(err, "failed to create mnemonic") + } + return mnemonic, nil } diff --git a/tests/util/evmsigner.go b/tests/util/evmsigner.go index 9bb4fd8039..8e2b568023 100644 --- a/tests/util/evmsigner.go +++ b/tests/util/evmsigner.go @@ -18,6 +18,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/evmos/ethermint/crypto/ethsecp256k1" + etherminttypes "github.com/evmos/ethermint/types" ) var ( @@ -81,8 +82,8 @@ func NewEvmSigner( }, nil } -func NewEvmSignerFromMnemonic(evmClient *ethclient.Client, evmChainId *big.Int, mnemonic string) (*EvmSigner, error) { - hdPath := hd.CreateHDPath(60, 0, 0) +func NewEvmSignerFromMnemonic(evmClient *ethclient.Client, evmChainID *big.Int, mnemonic string) (*EvmSigner, error) { + hdPath := hd.CreateHDPath(etherminttypes.Bip44CoinType, 0, 0) privKeyBytes, err := hd.Secp256k1.Derive()(mnemonic, "", hdPath.String()) if err != nil { return nil, errorsmod.Wrap(err, "failed to derive private key from mnemonic") @@ -90,10 +91,10 @@ func NewEvmSignerFromMnemonic(evmClient *ethclient.Client, evmChainId *big.Int, privKey := ðsecp256k1.PrivKey{Key: privKeyBytes} ecdsaPrivKey, err := crypto.HexToECDSA(hex.EncodeToString(privKey.Bytes())) if err != nil { - return nil, err + return nil, errorsmod.Wrap(err, "failed to convert hex to ECDSA") } - return NewEvmSigner(evmClient, ecdsaPrivKey, evmChainId) + return NewEvmSigner(evmClient, ecdsaPrivKey, evmChainID) } func (s *EvmSigner) Run(requests <-chan EvmTxRequest) <-chan EvmTxResponse { diff --git a/x/hard/keeper/borrow_test.go b/x/hard/keeper/borrow_test.go index 9f9c8f5d7a..2bdeaaad86 100644 --- a/x/hard/keeper/borrow_test.go +++ b/x/hard/keeper/borrow_test.go @@ -1,10 +1,9 @@ +//nolint:lll // these tests have some long lines :D package keeper_test import ( "time" - "github.com/kava-labs/kava/x/hard/keeper" - sdkmath "cosmossdk.io/math" "github.com/cometbft/cometbft/crypto" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -12,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/hard" + "github.com/kava-labs/kava/x/hard/keeper" "github.com/kava-labs/kava/x/hard/types" pricefeedtypes "github.com/kava-labs/kava/x/pricefeed/types" )