Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import (
upgrades "github.com/firmachain/firmachain/app/upgrades"
v4 "github.com/firmachain/firmachain/app/upgrades/v4"
v5 "github.com/firmachain/firmachain/app/upgrades/v5"
v5_1 "github.com/firmachain/firmachain/app/upgrades/v5.1"
"github.com/firmachain/firmachain/client/docs"

ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
Expand Down Expand Up @@ -171,7 +172,7 @@ import (
)

var (
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v5_1.Upgrade}
)

func getGovProposalHandlers() []govclient.ProposalHandler {
Expand Down Expand Up @@ -1040,8 +1041,12 @@ func (app *App) updateValidatorMinCommision(ctx sdk.Context) {
panic(err)
}
// call the before-modification hook since we're about to update the commission
staking.Hooks().BeforeValidatorModified(ctx, valBs)
staking.SetValidator(ctx, v)
if err := staking.Hooks().BeforeValidatorModified(ctx, valBs); err != nil {
panic(err)
}
if err := staking.SetValidator(ctx, v); err != nil {
panic(err)
}
}
}
}
Expand All @@ -1057,7 +1062,9 @@ func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}
app.AppKeepers.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
if err := app.AppKeepers.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()); err != nil {
return nil, err
}
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down
2 changes: 1 addition & 1 deletion app/apptesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func genesisStateWithValSet(
bondAmt := sdk.DefaultPowerReduction

for _, val := range valSet.Validators {
pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey)
require.NoError(t, err)
pkAny, err := codectypes.NewAnyWithValue(pk)
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
contracttypes "github.com/firmachain/firmachain/x/contract/types"
nfttypes "github.com/firmachain/firmachain/x/nft/types"
tokentypes "github.com/firmachain/firmachain/x/token/types"

header "cosmossdk.io/core/header"
)

type AddressWithKeys struct {
Expand Down Expand Up @@ -159,7 +157,7 @@ func (s *TestSuite) ConfirmUpgradeSucceeded(upgradeName string, upgradeHeight in

s.Ctx = s.Ctx.WithBlockHeight(upgradeHeight)

s.Ctx = s.Ctx.WithHeaderInfo(header.Info{Height: upgradeHeight, Time: s.Ctx.BlockTime().Add(time.Second)}).WithBlockHeight(upgradeHeight)
s.Ctx = s.Ctx.WithHeaderInfo(coreheader.Info{Height: upgradeHeight, Time: s.Ctx.BlockTime().Add(time.Second)}).WithBlockHeight(upgradeHeight)

res, err := s.App.PreBlocker(s.Ctx, nil)
_ = res
Expand Down Expand Up @@ -209,7 +207,9 @@ func (s *TestSuite) MakeAndSingTx(
msgs := make([]sdk.Msg, 0, 1)
msgs = append(msgs, msg)
builder := cfg.NewTxBuilder()
builder.SetMsgs(msgs...)
if err := builder.SetMsgs(msgs...); err != nil {
s.NoError(err)
}
builder.SetMemo(memo)
builder.SetGasLimit(gasLimit)
builder.SetFeeAmount(feeAmount)
Expand Down
18 changes: 12 additions & 6 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,24 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str
/* Handle staking state. */

// iterate through redelegations, reset creation height
app.AppKeepers.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
_ = app.AppKeepers.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
for i := range red.Entries {
red.Entries[i].CreationHeight = 0
}
app.AppKeepers.StakingKeeper.SetRedelegation(ctx, red)
if err := app.AppKeepers.StakingKeeper.SetRedelegation(ctx, red); err != nil {
panic(err)
}
return false
})

// iterate through unbonding delegations, reset creation height
app.AppKeepers.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
_ = app.AppKeepers.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
for i := range ubd.Entries {
ubd.Entries[i].CreationHeight = 0
}
app.AppKeepers.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
if err := app.AppKeepers.StakingKeeper.SetUnbondingDelegation(ctx, ubd); err != nil {
panic(err)
}
return false
})

Expand Down Expand Up @@ -232,11 +236,13 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str
/* Handle slashing state. */

// reset start height on signing infos
app.AppKeepers.SlashingKeeper.IterateValidatorSigningInfos(
_ = app.AppKeepers.SlashingKeeper.IterateValidatorSigningInfos(
ctx,
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
info.StartHeight = 0
app.AppKeepers.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
if err := app.AppKeepers.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info); err != nil {
panic(err)
}
return false
},
)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewPV() PV {

// GetPubKey implements PrivValidator interface
func (pv PV) GetPubKey() (crypto.PubKey, error) {
return cryptocodec.ToTmPubKeyInterface(pv.PrivKey.PubKey())
return cryptocodec.ToCmtPubKeyInterface(pv.PrivKey.PubKey())
}

// SignVote implements PrivValidator interface
Expand Down
15 changes: 15 additions & 0 deletions app/upgrades/v5.1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v5_1

import (
store "cosmossdk.io/store/types"
upgrades "github.com/firmachain/firmachain/app/upgrades"
)

// UpgradeName defines the on-chain upgrade name for the upgrade.
const UpgradeName = "v0.5.1"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateV0_5_1UpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}
24 changes: 24 additions & 0 deletions app/upgrades/v5.1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package v5_1

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/firmachain/firmachain/app/keepers"
)

func CreateV0_5_1UpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
_ *keepers.AppKeepers,
_ *codec.ProtoCodec,
) upgradetypes.UpgradeHandler {
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(c)
return mm.RunMigrations(ctx, cfg, vm)
}
}
4 changes: 3 additions & 1 deletion app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ func CreateV0_5_0UpgradeHandler(
newGovParams.MinInitialDepositRatio = "0.500000000000000000"
newGovParams.ProposalCancelRatio = "0.500000000000000000"
newGovParams.ProposalCancelDest = "firma1kvlelvv6u7h4jasqlpu956czt4543xqzc37h2v"
keepers.GovKeeper.Params.Set(ctx, newGovParams)
if err := keepers.GovKeeper.Params.Set(ctx, newGovParams); err != nil {
return nil, err
}
logger.Info("gov: GovKeeper params set")

keepers.IBCKeeper.ClientKeeper.SetParams(ctx, newIBCCoreParams)
Expand Down
3 changes: 3 additions & 0 deletions cmd/firmachaind/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return fmt.Errorf("failed to get address from Keyring: %w", err)
}
addr, err = info.GetAddress()
if err != nil {
return err
}
}

coins, err := sdk.ParseCoinsNormalized(args[1])
Expand Down
Loading
Loading