Skip to content

Commit

Permalink
chore(app): move initialization logic outside of the app and into kee…
Browse files Browse the repository at this point in the history
…pers package (#975)
  • Loading branch information
zale144 authored Jul 15, 2024
1 parent 1f3b48f commit 90104b6
Show file tree
Hide file tree
Showing 18 changed files with 1,092 additions and 876 deletions.
867 changes: 33 additions & 834 deletions app/app.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/dymensionxyz/dymension/v3/app/keepers"
"github.com/dymensionxyz/dymension/v3/app/params"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -37,8 +38,8 @@ func MakeEncodingConfig() params.EncodingConfig {
RegisterLegacyAminoCodec(encodingConfig.Amino)
RegisterInterfaces(encodingConfig.InterfaceRegistry)

ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
keepers.ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
keepers.ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}

Expand Down
2 changes: 1 addition & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str

// Iterate through validators by power descending, reset bond heights, and
// update bond intra-tx counters.
store := ctx.KVStore(app.keys[stakingtypes.StoreKey])
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)

Expand Down
4 changes: 3 additions & 1 deletion app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"

"github.com/cosmos/cosmos-sdk/codec"

"github.com/dymensionxyz/dymension/v3/app/keepers"
)

// The genesis state of the blockchain is represented here as a map of raw json
Expand All @@ -17,6 +19,6 @@ type GenesisState map[string]json.RawMessage

// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
defaultGenesisState := ModuleBasics.DefaultGenesis(cdc)
defaultGenesisState := keepers.ModuleBasics.DefaultGenesis(cdc)
return defaultGenesisState
}
Loading

0 comments on commit 90104b6

Please sign in to comment.