Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing authz module #150

Merged
merged 8 commits into from
Nov 17, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
# TODO there is some unused stuff we need to fix or remove
# make all-in-docker
run: |
cargo r --bin chain_upgrade
go test ./...
cargo r --bin onomyd_only
cargo r --bin ics_cdd
cargo r --bin chain_upgrade
cargo r --bin clean

rustfmt:
Expand Down
24 changes: 22 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -103,6 +106,7 @@ import (
v1_0_3_5 "github.com/onomyprotocol/onomy/app/upgrades/v1.0.3.5"
v1_1_1 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.1"
v1_1_2 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.2"
v1_1_4 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.4"
"github.com/onomyprotocol/onomy/docs"
"github.com/onomyprotocol/onomy/x/dao"
daoclient "github.com/onomyprotocol/onomy/x/dao/client"
Expand Down Expand Up @@ -157,6 +161,7 @@ var (
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
authzmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
Expand Down Expand Up @@ -241,6 +246,7 @@ type OnomyApp struct {
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
ProviderKeeper ibcproviderkeeper.Keeper

// make scoped keepers public for test purposes
Expand Down Expand Up @@ -284,7 +290,7 @@ func New( // nolint:funlen // app new cosmos func
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey,
providertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -323,6 +329,11 @@ func New( // nolint:funlen // app new cosmos func
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(),
)
app.AuthzKeeper = authzkeeper.NewKeeper(
keys[authzkeeper.StoreKey],
appCodec,
app.BaseApp.MsgServiceRouter(),
)
stakingKeeper := stakingkeeper.NewKeeper(
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
)
Expand Down Expand Up @@ -470,6 +481,7 @@ func New( // nolint:funlen // app new cosmos func
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
transferModule,
dao.NewAppModule(appCodec, app.DaoKeeper),
providerModule,
Expand All @@ -494,6 +506,7 @@ func New( // nolint:funlen // app new cosmos func
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
crisistypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
feegrant.ModuleName,
Expand All @@ -515,6 +528,7 @@ func New( // nolint:funlen // app new cosmos func
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
crisistypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
feegrant.ModuleName,
Expand All @@ -540,6 +554,7 @@ func New( // nolint:funlen // app new cosmos func
ibchost.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
ibctransfertypes.ModuleName,
crisistypes.ModuleName,
paramstypes.ModuleName,
Expand Down Expand Up @@ -570,6 +585,7 @@ func New( // nolint:funlen // app new cosmos func
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
params.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
dao.NewAppModule(appCodec, app.DaoKeeper),
Expand Down Expand Up @@ -802,6 +818,7 @@ func (app *OnomyApp) setupUpgradeHandlers() {
},
)
app.UpgradeKeeper.SetUpgradeHandler(v1_1_2.Name, v1_1_2.UpgradeHandler)
app.UpgradeKeeper.SetUpgradeHandler(v1_1_4.Name, v1_1_4.UpgradeHandler)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand All @@ -818,9 +835,12 @@ func (app *OnomyApp) setupUpgradeHandlers() {
switch upgradeInfo.Name {
case v1_1_1.Name:
storeUpgrades = &storetypes.StoreUpgrades{
// TODO not sure if we need the StoreKey
Added: []string{providertypes.ModuleName, providertypes.StoreKey},
}
case v1_1_4.Name:
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{authz.ModuleName, authzkeeper.StoreKey},
}
default:
// no store upgrades
}
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This folder contains sub-folders for every chain upgrade.

## Version History

- v1.1.4 - Add missing authz module
- v1.1.2 - Fix that the treasury is actually subtracted from the staking supply
- v1.1.1 - Removal of Gravity module and addition of provider module
- v1.0.3.5 - OIP 6 Patch Subtract DAO Treasury from Staking Supply
Expand Down
16 changes: 16 additions & 0 deletions app/upgrades/v1.1.4/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Package v1_1_4 is contains chain upgrade of the corresponding version.
package v1_1_4 //nolint:revive,stylecheck // app version

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// Name is migration name.
const Name = "v1.1.4"

// UpgradeHandler is an x/upgrade handler.
func UpgradeHandler(_ sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return vm, nil
}
Loading
Loading