Skip to content

Commit

Permalink
feat: wire x/time-upgrade module (#125)
Browse files Browse the repository at this point in the history
Co-authored-by: Faulty Tolly <@faulttolerance.net>
  • Loading branch information
faultytolly authored Sep 30, 2024
1 parent d6e15ba commit b333cb8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 30 deletions.
59 changes: 38 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ import (
hubgenkeeper "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/keeper"
hubgentypes "github.com/dymensionxyz/dymension-rdk/x/hub-genesis/types"

"github.com/dymensionxyz/dymension-rdk/x/timeupgrade"
timeupgradekeeper "github.com/dymensionxyz/dymension-rdk/x/timeupgrade/keeper"
timeupgradetypes "github.com/dymensionxyz/dymension-rdk/x/timeupgrade/types"

ibctransfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
Expand Down Expand Up @@ -164,6 +168,7 @@ var (
hubtypes.StoreKey,
callbackTypes.StoreKey,
cwerrorsTypes.StoreKey,
timeupgradetypes.StoreKey,
rollappparamstypes.StoreKey,
}
)
Expand Down Expand Up @@ -211,6 +216,7 @@ var (
hubgenesis.AppModuleBasic{},
wasm.AppModuleBasic{},
hub.AppModuleBasic{},
timeupgrade.AppModuleBasic{},
callback.AppModuleBasic{},
cwerrors.AppModuleBasic{},
rollappparams.AppModuleBasic{},
Expand Down Expand Up @@ -272,26 +278,27 @@ type App struct {
memKeys map[string]*storetypes.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SequencersKeeper seqkeeper.Keeper
MintKeeper mintkeeper.Keeper
EpochsKeeper epochskeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
HubGenesisKeeper hubgenkeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasmkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
GaslessKeeper gaslesskeeper.Keeper
CallbackKeeper callbackKeeper.Keeper
CWErrorsKeeper cwerrorsKeeper.Keeper
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SequencersKeeper seqkeeper.Keeper
MintKeeper mintkeeper.Keeper
EpochsKeeper epochskeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
HubGenesisKeeper hubgenkeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasmkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
GaslessKeeper gaslesskeeper.Keeper
CallbackKeeper callbackKeeper.Keeper
CWErrorsKeeper cwerrorsKeeper.Keeper
TimeUpgradeKeeper timeupgradekeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -562,6 +569,12 @@ func NewRollapp(
app.BankKeeper,
)

app.TimeUpgradeKeeper = timeupgradekeeper.NewKeeper(
appCodec,
keys[timeupgradetypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand Down Expand Up @@ -643,7 +656,7 @@ func NewRollapp(
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, app.BankKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
sequencers.NewAppModule(appCodec, app.SequencersKeeper),
sequencers.NewAppModule(app.SequencersKeeper),
epochs.NewAppModule(appCodec, app.EpochsKeeper),
params.NewAppModule(app.ParamsKeeper),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
Expand All @@ -652,6 +665,7 @@ func NewRollapp(
upgrade.NewAppModule(app.UpgradeKeeper),
hubgenesis.NewAppModule(appCodec, app.HubGenesisKeeper),
hub.NewAppModule(appCodec, app.HubKeeper),
timeupgrade.NewAppModule(app.TimeUpgradeKeeper, app.UpgradeKeeper),
callback.NewAppModule(app.appCodec, app.CallbackKeeper, app.WasmKeeper, app.CWErrorsKeeper),
cwerrors.NewAppModule(app.appCodec, app.CWErrorsKeeper, app.WasmKeeper),
rollappparams.NewAppModule(appCodec, app.RollappParamsKeeper),
Expand All @@ -666,6 +680,7 @@ func NewRollapp(
// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
beginBlockersList := []string{
upgradetypes.ModuleName,
timeupgradetypes.ModuleName,
capabilitytypes.ModuleName,
minttypes.ModuleName,
distrtypes.ModuleName,
Expand Down Expand Up @@ -709,6 +724,7 @@ func NewRollapp(
epochstypes.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
timeupgradetypes.ModuleName,
ibchost.ModuleName,
ibctransfertypes.ModuleName,
hubgentypes.ModuleName,
Expand Down Expand Up @@ -742,6 +758,7 @@ func NewRollapp(
genutiltypes.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
timeupgradetypes.ModuleName,
ibctransfertypes.ModuleName,
feegrant.ModuleName,
gaslesstypes.ModuleName,
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.4

require (
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.10.0
cosmossdk.io/core v0.12.0
cosmossdk.io/errors v1.0.1
github.com/CosmWasm/wasmd v0.33.0
github.com/CosmWasm/wasmvm v1.3.0
Expand All @@ -15,7 +15,7 @@ require (
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/ibc-go/v6 v6.3.0
github.com/dvsekhvalnov/jose2go v1.5.0
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240916194645-3fe31b2db4b2
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240930130421-82c4d5f8c093
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20240919105350-66f9b353655d
github.com/ethereum/go-ethereum v1.12.0
github.com/evmos/evmos/v12 v12.1.6
Expand Down Expand Up @@ -118,7 +118,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 // indirect
github.com/dymensionxyz/gerr-cosmos v1.0.0 // indirect
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240905104639-19dc09f5c6f5 // indirect
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240909101947-e1b483ada9c8 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ cosmossdk.io/api v0.7.0 h1:QsEMIWuv9xWDbF2HZnW4Lpu1/SejCztPu0LQx7t6MN4=
cosmossdk.io/api v0.7.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M=
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
cosmossdk.io/core v0.10.0 h1:NP28Ol9YyRODmZLJg2ko/mUl40hMegeMzhJnG+XPkcY=
cosmossdk.io/core v0.10.0/go.mod h1:MygXNld9DvMgYY4yE76DM/mdZpgfeyRjy6FPjEEehlY=
cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU=
cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w=
cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc=
cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU=
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
Expand Down Expand Up @@ -570,8 +570,8 @@ github.com/dymensionxyz/cometbft v0.34.29-0.20240906143736-1e3959c2826e h1:A5FIv
github.com/dymensionxyz/cometbft v0.34.29-0.20240906143736-1e3959c2826e/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw=
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 h1:u5yeve5jZR6TdRjjR+vYT/8PWKbhwCZxUmAu+/Tnxyg=
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13/go.mod h1:jabDQYXrccscSE0fXkh7eQFYPWJCRiuWKonFGObVq6s=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240916194645-3fe31b2db4b2 h1:Qex0iUhBenRhOIMwrv2eYPWNIySlWVJDZ9D70iLd9eQ=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240916194645-3fe31b2db4b2/go.mod h1:/4liuSPJFSyxlLg19KLngisZynYpa3clYuPuB460des=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240930130421-82c4d5f8c093 h1:qIEM9vKVBPfBkNTDEI0aKXzNdJ/LC9m0P5jiNM7SqU4=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20240930130421-82c4d5f8c093/go.mod h1:lMDz6B2DeH5SJeUAtFwxNeD8g1sj0cJGiDJf4rOz5tg=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20240919105350-66f9b353655d h1:YZ49Dd17SA//VBTKVncav7DhV5VE6M9n4a9Slm/hQeM=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20240919105350-66f9b353655d/go.mod h1:eEUBqDHi7EiO3CK1Fqct5joa5UeNzcEDJnXzvXuP5oA=
github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2 h1:aVP3off7u2vsvRH7lHAUPTLdf9/AfnzC/rvvi0wC/co=
Expand All @@ -582,8 +582,8 @@ github.com/dymensionxyz/go-libp2p-pubsub v0.0.0-20240513081713-3ecd83c19ea2 h1:5
github.com/dymensionxyz/go-libp2p-pubsub v0.0.0-20240513081713-3ecd83c19ea2/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw=
github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs=
github.com/dymensionxyz/rpc v1.3.1/go.mod h1:f+WpX8ysy8wt95iGc6auYlHcnHj2bUkhiRVkkKNys8c=
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240905104639-19dc09f5c6f5 h1:o6Jh8D4QZ7yifvOWV7/uoIugLZE0mTSOdz05ScaNNdU=
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240905104639-19dc09f5c6f5/go.mod h1:5fmenxP75quS5D1gPynbmh5qE6vla64Kks2O/hM+gi4=
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240909101947-e1b483ada9c8 h1:J7MH912xEkmYKEg1VxDZ4RARZ/ku1OO7VOoUZQQqWEU=
github.com/dymensionxyz/sdk-utils v0.1.2-0.20240909101947-e1b483ada9c8/go.mod h1:5fmenxP75quS5D1gPynbmh5qE6vla64Kks2O/hM+gi4=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
Expand Down

0 comments on commit b333cb8

Please sign in to comment.