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

feat: Adding x/authority module #915

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
460e0e6
adding x/authority proto files
spoo-bar Oct 19, 2023
155d57f
adding basic authority features
spoo-bar Oct 19, 2023
e0607a8
adding params proto
spoo-bar Oct 19, 2023
4a20842
adding params
spoo-bar Oct 19, 2023
cc225c7
adding params and query
spoo-bar Oct 20, 2023
c6d8518
adding genesis
spoo-bar Nov 2, 2023
753446d
implement init/export genesis
spoo-bar Nov 2, 2023
4eba701
cleaning up unused code
spoo-bar Nov 2, 2023
09af932
adding MsgUpdateParams
spoo-bar Nov 3, 2023
868994a
lint fix
spoo-bar Nov 3, 2023
604dc96
adding spec
spoo-bar Nov 3, 2023
28eeb59
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar Nov 3, 2023
1fa126b
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar Feb 9, 2024
3167ef5
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar Feb 16, 2024
54d88ee
Merge branch 'feature/sdk-v050' into spoorthi/new-authority-module
spoo-bar Feb 23, 2024
582ca81
regenerate proto
spoo-bar Feb 23, 2024
2aa3a86
proto cleanup
spoo-bar Feb 23, 2024
96b6a2b
adding upgrade handler
spoo-bar Feb 23, 2024
d73004d
Update interchaintest.yml
spoo-bar Feb 23, 2024
6a7125b
Update upgrades.go
spoo-bar Mar 1, 2024
a7da6b8
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar Apr 19, 2024
0b311a7
moving authority keeper to new keeper file
spoo-bar Apr 19, 2024
6a59329
moving the authority module to v14
spoo-bar Apr 19, 2024
be02e08
linting 🧹
spoo-bar Apr 19, 2024
de9bfc0
linting 🧹
spoo-bar Apr 19, 2024
85f69a5
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar May 10, 2024
dc3e639
Merge branch 'main' into spoorthi/new-authority-module
spoo-bar Jun 4, 2024
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
19 changes: 19 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ import (
allocmoduletypes "github.com/public-awesome/stargaze/v14/x/alloc/types"
allocwasm "github.com/public-awesome/stargaze/v14/x/alloc/wasm"

authoritymodule "github.com/public-awesome/stargaze/v14/x/authority"
authoritykeeper "github.com/public-awesome/stargaze/v14/x/authority/keeper"
authoritytypes "github.com/public-awesome/stargaze/v14/x/authority/types"

cronmodule "github.com/public-awesome/stargaze/v14/x/cron"
cronmodulekeeper "github.com/public-awesome/stargaze/v14/x/cron/keeper"
cronmoduletypes "github.com/public-awesome/stargaze/v14/x/cron/types"
Expand Down Expand Up @@ -220,6 +224,7 @@ var (
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
allocmodule.AppModuleBasic{},
authoritymodule.AppModuleBasic{},
cronmodule.AppModuleBasic{},
globalfeemodule.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
Expand All @@ -242,6 +247,7 @@ var (
allocmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
allocmoduletypes.FairburnPoolName: nil,
allocmoduletypes.SupplementPoolName: nil,
authoritytypes.ModuleName: {authtypes.Burner},
wasmtypes.ModuleName: {authtypes.Burner},
icatypes.ModuleName: nil,
cronmoduletypes.ModuleName: nil,
Expand Down Expand Up @@ -334,6 +340,7 @@ func NewStargazeApp(
govtypes.StoreKey, consensusparamtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
allocmoduletypes.StoreKey,
authoritytypes.StoreKey,
authzkeeper.StoreKey,
wasmtypes.StoreKey,
cronmoduletypes.StoreKey,
Expand Down Expand Up @@ -635,6 +642,14 @@ func NewStargazeApp(
)
// If evidence needs to be handled for the app, set routes in router here and seal
app.Keepers.EvidenceKeeper = *evidenceKeeper
app.Keepers.AuthorityKeeper = authoritykeeper.NewKeeper(
appCodec,
keys[authoritytypes.StoreKey],
app.GetSubspace(authoritytypes.ModuleName),
bApp.MsgServiceRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
authoritymodule := authoritymodule.NewAppModule(appCodec, app.Keepers.AuthorityKeeper)

// IBC Wasm Client
wasmDir := filepath.Join(homePath, "wasm")
Expand Down Expand Up @@ -790,6 +805,7 @@ func NewStargazeApp(
params.NewAppModule(app.Keepers.ParamsKeeper),
transfer.NewAppModule(app.Keepers.TransferKeeper),
allocModule,
authoritymodule,
wasm.NewAppModule(appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
cronModule,
globalfeeModule,
Expand Down Expand Up @@ -834,6 +850,7 @@ func NewStargazeApp(
authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName,
authz.ModuleName, feegrant.ModuleName,
paramstypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName,
authoritytypes.ModuleName,
wasmtypes.ModuleName,
cronmoduletypes.ModuleName,
globalfeemoduletypes.ModuleName,
Expand All @@ -853,6 +870,7 @@ func NewStargazeApp(
ibcexported.ModuleName, ibctransfertypes.ModuleName,
icatypes.ModuleName,
allocmoduletypes.ModuleName,
authoritytypes.ModuleName,
wasmtypes.ModuleName,
cronmoduletypes.ModuleName,
globalfeemoduletypes.ModuleName,
Expand Down Expand Up @@ -886,6 +904,7 @@ func NewStargazeApp(
authz.ModuleName,
paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
authoritytypes.ModuleName,
allocmoduletypes.ModuleName,
tokenfactorytypes.ModuleName,
// wasm after ibc transfer
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
allocmodulekeeper "github.com/public-awesome/stargaze/v14/x/alloc/keeper"
authoritykeeper "github.com/public-awesome/stargaze/v14/x/authority/keeper"
cronmodulekeeper "github.com/public-awesome/stargaze/v14/x/cron/keeper"
globalfeemodulekeeper "github.com/public-awesome/stargaze/v14/x/globalfee/keeper"
mintkeeper "github.com/public-awesome/stargaze/v14/x/mint/keeper"
Expand Down Expand Up @@ -75,4 +76,5 @@ type StargazeKeepers struct {
GlobalFeeKeeper globalfeemodulekeeper.Keeper
MintKeeper mintkeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
AuthorityKeeper authoritykeeper.Keeper
}
7 changes: 7 additions & 0 deletions app/upgrades/v14/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
wasmlctypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
"github.com/public-awesome/stargaze/v14/app/keepers"
"github.com/public-awesome/stargaze/v14/app/upgrades"
authoritytypes "github.com/public-awesome/stargaze/v14/x/authority/types"
)

// next upgrade name
Expand All @@ -29,12 +30,18 @@ var Upgrade = upgrades.Upgrade{
params := keepers.IBCKeeper.ClientKeeper.GetParams(wctx)
params.AllowedClients = append(params.AllowedClients, wasmlctypes.Wasm)
keepers.IBCKeeper.ClientKeeper.SetParams(wctx, params)

err = keepers.AuthorityKeeper.SetParams(sdk.UnwrapSDKContext(ctx), authoritytypes.DefaultParams())
if err != nil {
return nil, err
}
return migrations, nil
}
},
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{
wasmlctypes.ModuleName,
authoritytypes.ModuleName,
},
},
}
231 changes: 231 additions & 0 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@

- [Msg](#publicawesome.stargaze.alloc.v1beta1.Msg)

- [publicawesome/stargaze/authority/v1/authority.proto](#publicawesome/stargaze/authority/v1/authority.proto)
- [Authorization](#publicawesome.stargaze.authority.v1.Authorization)
- [Params](#publicawesome.stargaze.authority.v1.Params)

- [publicawesome/stargaze/authority/v1/genesis.proto](#publicawesome/stargaze/authority/v1/genesis.proto)
- [GenesisState](#publicawesome.stargaze.authority.v1.GenesisState)

- [publicawesome/stargaze/authority/v1/query.proto](#publicawesome/stargaze/authority/v1/query.proto)
- [QueryParamsRequest](#publicawesome.stargaze.authority.v1.QueryParamsRequest)
- [QueryParamsResponse](#publicawesome.stargaze.authority.v1.QueryParamsResponse)

- [Query](#publicawesome.stargaze.authority.v1.Query)

- [publicawesome/stargaze/authority/v1/tx.proto](#publicawesome/stargaze/authority/v1/tx.proto)
- [MsgExecuteProposal](#publicawesome.stargaze.authority.v1.MsgExecuteProposal)
- [MsgExecuteProposalResponse](#publicawesome.stargaze.authority.v1.MsgExecuteProposalResponse)
- [MsgUpdateParams](#publicawesome.stargaze.authority.v1.MsgUpdateParams)
- [MsgUpdateParamsResponse](#publicawesome.stargaze.authority.v1.MsgUpdateParamsResponse)

- [Msg](#publicawesome.stargaze.authority.v1.Msg)

- [publicawesome/stargaze/cron/v1/cron.proto](#publicawesome/stargaze/cron/v1/cron.proto)
- [Params](#publicawesome.stargaze.cron.v1.Params)

Expand Down Expand Up @@ -853,6 +874,216 @@ Msg defines the alloc Msg service.



<a name="publicawesome/stargaze/authority/v1/authority.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## publicawesome/stargaze/authority/v1/authority.proto



<a name="publicawesome.stargaze.authority.v1.Authorization"></a>

### Authorization
Authorization is a struct that holds the addresses that are allowed to
execute a proposal


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `msg_type_url` | [string](#string) | | msgTypeUrl is the type url of a proposal sdk.Msg |
| `addresses` | [string](#string) | repeated | addresses is a list of addresses that are allowed to execute the proposal |






<a name="publicawesome.stargaze.authority.v1.Params"></a>

### Params
Params holds parameters for the authority module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authorizations` | [Authorization](#publicawesome.stargaze.authority.v1.Authorization) | repeated | authorizations is a list of authorizations that are allowed to execute a proposal |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="publicawesome/stargaze/authority/v1/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## publicawesome/stargaze/authority/v1/genesis.proto



<a name="publicawesome.stargaze.authority.v1.GenesisState"></a>

### GenesisState
GenesisState defines the authority module's genesis state.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#publicawesome.stargaze.authority.v1.Params) | | params defines all the parameters of the module. |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="publicawesome/stargaze/authority/v1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## publicawesome/stargaze/authority/v1/query.proto



<a name="publicawesome.stargaze.authority.v1.QueryParamsRequest"></a>

### QueryParamsRequest
QueryParamsRequest is the request type for the Query/Params RPC method.






<a name="publicawesome.stargaze.authority.v1.QueryParamsResponse"></a>

### QueryParamsResponse
QueryParamsResponse is the response type for the Query/Params RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#publicawesome.stargaze.authority.v1.Params) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="publicawesome.stargaze.authority.v1.Query"></a>

### Query
Query defines the gRPC querier service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#publicawesome.stargaze.authority.v1.QueryParamsRequest) | [QueryParamsResponse](#publicawesome.stargaze.authority.v1.QueryParamsResponse) | Params queries the parameters of the authority module. | GET|/stargaze/authority/v1/params|

<!-- end services -->



<a name="publicawesome/stargaze/authority/v1/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## publicawesome/stargaze/authority/v1/tx.proto



<a name="publicawesome.stargaze.authority.v1.MsgExecuteProposal"></a>

### MsgExecuteProposal
MsgExecuteProposal defines an sdk.Msg type that supports submitting arbitrary
proposal Content.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the account authorized to execute the proposal. |
| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is the list of messages to execute. |






<a name="publicawesome.stargaze.authority.v1.MsgExecuteProposalResponse"></a>

### MsgExecuteProposalResponse
MsgExecuteProposalResponse defines the Msg/ExecuteProposal response type.






<a name="publicawesome.stargaze.authority.v1.MsgUpdateParams"></a>

### MsgUpdateParams
MsgUpdateParams defines an sdk.Msg type that supports updating the authority


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | Authority is the address of the governance account. |
| `params` | [Params](#publicawesome.stargaze.authority.v1.Params) | | NOTE: All parameters must be supplied. |






<a name="publicawesome.stargaze.authority.v1.MsgUpdateParamsResponse"></a>

### MsgUpdateParamsResponse
MsgUpdateParamsResponse defines the Msg/UpdateParams response type.





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="publicawesome.stargaze.authority.v1.Msg"></a>

### Msg
Msg defines the authority Msg service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `ExecuteProposal` | [MsgExecuteProposal](#publicawesome.stargaze.authority.v1.MsgExecuteProposal) | [MsgExecuteProposalResponse](#publicawesome.stargaze.authority.v1.MsgExecuteProposalResponse) | ExecuteProposal defines a method to execute a proposal. | |
| `UpdateParams` | [MsgUpdateParams](#publicawesome.stargaze.authority.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#publicawesome.stargaze.authority.v1.MsgUpdateParamsResponse) | UpdateParams defines a method to update the authority parameters. | |

<!-- end services -->



<a name="publicawesome/stargaze/cron/v1/cron.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
Loading
Loading