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

Problem: authz module is risky #1274

Merged
merged 8 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

- [#1258](https:/crypto-org-chain/cronos/pull/1258) Support hard-fork style upgrades.
- [#1272](https:/crypto-org-chain/cronos/pull/1272) Update ethermint to develop, cosmos-sdk to `v0.47.7`.
- [#1273](https:/crypto-org-chain/cronos/pull/1273) Enable push0 opcode in integration test
- [#1273](https:/crypto-org-chain/cronos/pull/1273) Enable push0 opcode in integration test.
- [#1274](https:/crypto-org-chain/cronos/pull/1274) Remove authz module.

*December 11, 2023*

Expand Down
12 changes: 1 addition & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ 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 @@ -251,7 +248,6 @@ func GenModuleBasics() module.BasicManager {
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
authzmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
transfer.AppModuleBasic{},
Expand Down Expand Up @@ -279,7 +275,7 @@ func StoreKeys(skipGravity bool) (
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, crisistypes.StoreKey,
feegrant.StoreKey, crisistypes.StoreKey,
// ibc keys
ibcexported.StoreKey, ibctransfertypes.StoreKey,
ibcfeetypes.StoreKey,
Expand Down Expand Up @@ -344,7 +340,6 @@ type App struct {
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper

// make scoped keepers public for test purposes
Expand Down Expand Up @@ -467,7 +462,6 @@ func New(
app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper)
// set the governance module account as the authority for conducting upgrades
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authAddr)
app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), app.AccountKeeper)

// ... other modules keepers

Expand Down Expand Up @@ -703,7 +697,6 @@ func New(
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
params.NewAppModule(app.ParamsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
Expand Down Expand Up @@ -735,7 +728,6 @@ func New(
govtypes.ModuleName,
crisistypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
Expand All @@ -758,7 +750,6 @@ func New(
minttypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
Expand Down Expand Up @@ -792,7 +783,6 @@ func New(
ibcfeetypes.ModuleName,
icatypes.ModuleName,
icaauthtypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
Expand Down
11 changes: 11 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
Expand Down Expand Up @@ -145,6 +146,16 @@
icacontrollertypes.StoreKey,
icaauthtypes.StoreKey,
},
Deleted: []string{
authzkeeper.StoreKey,
},
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))

Check warning on line 153 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L149-L153

Added lines #L149 - L153 were not covered by tests
} else if upgradeInfo.Name == testnetPlanName {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{
authzkeeper.StoreKey,
},

Check warning on line 158 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L155-L158

Added lines #L155 - L158 were not covered by tests
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
Expand Down
Loading