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: Add CreateValidator access control feature #406

Merged
merged 21 commits into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from 14 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* (x/wasm) [\#358] (https://github.com/line/lbm-sdk/pull/358) change wasm metrics method to using prometheus directly
* (x/feegrant) [\#380] (https://github.com/line/lbm-sdk/pull/380) Feegrant module
* (x/wasm) [\#395] (https://github.com/line/lbm-sdk/pull/395) Add the instantiate_permission in the CodeInfoResponse
* (x/consortium) [\#406] (https://github.com/line/lbm-sdk/pull/406) Add CreateValidator access control feature

### Improvements
* (slashing) [\#347](https://github.com/line/lbm-sdk/pull/347) Introduce VoterSetCounter
Expand Down
1 change: 1 addition & 0 deletions client/docs/statik/statik.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

284 changes: 284 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,28 @@
- [GenesisOwners](#lbm.capability.v1.GenesisOwners)
- [GenesisState](#lbm.capability.v1.GenesisState)

- [lbm/consortium/v1/consortium.proto](#lbm/consortium/v1/consortium.proto)
- [Params](#lbm.consortium.v1.Params)
- [UpdateConsortiumParamsProposal](#lbm.consortium.v1.UpdateConsortiumParamsProposal)
- [UpdateValidatorAuthsProposal](#lbm.consortium.v1.UpdateValidatorAuthsProposal)
- [ValidatorAuth](#lbm.consortium.v1.ValidatorAuth)

- [lbm/consortium/v1/event.proto](#lbm/consortium/v1/event.proto)
- [EventUpdateValidatorAuth](#lbm.consortium.v1.EventUpdateValidatorAuth)

- [lbm/consortium/v1/genesis.proto](#lbm/consortium/v1/genesis.proto)
- [GenesisState](#lbm.consortium.v1.GenesisState)

- [lbm/consortium/v1/query.proto](#lbm/consortium/v1/query.proto)
- [QueryParamsRequest](#lbm.consortium.v1.QueryParamsRequest)
- [QueryParamsResponse](#lbm.consortium.v1.QueryParamsResponse)
- [QueryValidatorAuthRequest](#lbm.consortium.v1.QueryValidatorAuthRequest)
- [QueryValidatorAuthResponse](#lbm.consortium.v1.QueryValidatorAuthResponse)
- [QueryValidatorAuthsRequest](#lbm.consortium.v1.QueryValidatorAuthsRequest)
- [QueryValidatorAuthsResponse](#lbm.consortium.v1.QueryValidatorAuthsResponse)

- [Query](#lbm.consortium.v1.Query)

- [lbm/crisis/v1/genesis.proto](#lbm/crisis/v1/genesis.proto)
- [GenesisState](#lbm.crisis.v1.GenesisState)

Expand Down Expand Up @@ -5779,6 +5801,268 @@ GenesisState defines the capability module's genesis state.



<a name="lbm/consortium/v1/consortium.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/consortium/v1/consortium.proto



<a name="lbm.consortium.v1.Params"></a>

### Params
Params defines the parameters for the consortium module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `enabled` | [bool](#bool) | | |






<a name="lbm.consortium.v1.UpdateConsortiumParamsProposal"></a>

### UpdateConsortiumParamsProposal
UpdateConsortiumParamsProposal details a proposal to update params of cosortium module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `params` | [Params](#lbm.consortium.v1.Params) | | |






<a name="lbm.consortium.v1.UpdateValidatorAuthsProposal"></a>

### UpdateValidatorAuthsProposal
UpdateValidatorAuthsProposal details a proposal to update validator auths on consortium.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `title` | [string](#string) | | |
| `description` | [string](#string) | | |
| `auths` | [ValidatorAuth](#lbm.consortium.v1.ValidatorAuth) | repeated | |






<a name="lbm.consortium.v1.ValidatorAuth"></a>

### ValidatorAuth
ValidatorAuth defines authorization info of a validator.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `operator_address` | [string](#string) | | |
| `creation_allowed` | [bool](#bool) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/consortium/v1/event.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/consortium/v1/event.proto



<a name="lbm.consortium.v1.EventUpdateValidatorAuth"></a>

### EventUpdateValidatorAuth
EventUpdateValidatorAuth is emitted after updating validator auth info.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `operator_address` | [string](#string) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/consortium/v1/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/consortium/v1/genesis.proto



<a name="lbm.consortium.v1.GenesisState"></a>

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


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#lbm.consortium.v1.Params) | | params defines the module parameters at genesis. |
| `validator_auths` | [ValidatorAuth](#lbm.consortium.v1.ValidatorAuth) | repeated | allowed_validators defines the allowed validator addresses at genesis. provided empty, the module gathers information from staking module. |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/consortium/v1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/consortium/v1/query.proto



<a name="lbm.consortium.v1.QueryParamsRequest"></a>

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






<a name="lbm.consortium.v1.QueryParamsResponse"></a>

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


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#lbm.consortium.v1.Params) | | |






<a name="lbm.consortium.v1.QueryValidatorAuthRequest"></a>

### QueryValidatorAuthRequest
QueryValidatorAuthRequest is the request type for the
Query/ValidatorAuth RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `validator_address` | [string](#string) | | validator_address defines the validator address to query for. |






<a name="lbm.consortium.v1.QueryValidatorAuthResponse"></a>

### QueryValidatorAuthResponse
QueryValidatorAuthResponse is the request type for the
Query/ValidatorAuth RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `auth` | [ValidatorAuth](#lbm.consortium.v1.ValidatorAuth) | | |






<a name="lbm.consortium.v1.QueryValidatorAuthsRequest"></a>

### QueryValidatorAuthsRequest
QueryValidatorAuthsRequest is the request type for the
Query/ValidatorAuths RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [lbm.base.query.v1.PageRequest](#lbm.base.query.v1.PageRequest) | | pagination defines an optional pagination for the request. |






<a name="lbm.consortium.v1.QueryValidatorAuthsResponse"></a>

### QueryValidatorAuthsResponse
QueryValidatorAuthsResponse is the response type for the
Query/ValidatorAuths RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `auths` | [ValidatorAuth](#lbm.consortium.v1.ValidatorAuth) | repeated | |
| `pagination` | [lbm.base.query.v1.PageResponse](#lbm.base.query.v1.PageResponse) | | pagination defines the pagination in the response. |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="lbm.consortium.v1.Query"></a>

### Query
Query defines the gRPC querier service for consortium module.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#lbm.consortium.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.consortium.v1.QueryParamsResponse) | Params queries the module params. | GET|/lbm/consortium/v1/params|
| `ValidatorAuths` | [QueryValidatorAuthsRequest](#lbm.consortium.v1.QueryValidatorAuthsRequest) | [QueryValidatorAuthsResponse](#lbm.consortium.v1.QueryValidatorAuthsResponse) | ValidatorAuths queries authorization infos of validators. | GET|/lbm/consortium/v1/validators|
| `ValidatorAuth` | [QueryValidatorAuthRequest](#lbm.consortium.v1.QueryValidatorAuthRequest) | [QueryValidatorAuthResponse](#lbm.consortium.v1.QueryValidatorAuthResponse) | ValidatorAuth queries authorization info of a validator. | GET|/lbm/consortium/v1/validators/{validator_address}|

<!-- end services -->



<a name="lbm/crisis/v1/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
40 changes: 40 additions & 0 deletions proto/lbm/consortium/v1/consortium.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";
package lbm.consortium.v1;

option go_package = "github.com/line/lbm-sdk/x/consortium/types";
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";

// Params defines the parameters for the consortium module.
message Params {
bool enabled = 1 [(gogoproto.moretags) = "yaml:\"enabled\""];
}

// ValidatorAuth defines authorization info of a validator.
message ValidatorAuth {
string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""];
bool creation_allowed = 2 [(gogoproto.moretags) = "yaml:\"creation_allowed\""];
}
Comment on lines +14 to +18
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will simplify the structure if the requirement of the consortium chain is fixed and no further details are added.


// UpdateConsortiumParamsProposal details a proposal to update params of cosortium module.
message UpdateConsortiumParamsProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1;
string description = 2;
Params params = 3;
}

// UpdateValidatorAuthsProposal details a proposal to update validator auths on consortium.
message UpdateValidatorAuthsProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1;
string description = 2;
repeated ValidatorAuth auths = 3 [(gogoproto.moretags) = "yaml:\"auths\""];
}
9 changes: 9 additions & 0 deletions proto/lbm/consortium/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package lbm.consortium.v1;

option go_package = "github.com/line/lbm-sdk/x/consortium/types";

// EventUpdateValidatorAuth is emitted after updating validator auth info.
message EventUpdateValidatorAuth {
string operator_address = 1;
}
21 changes: 21 additions & 0 deletions proto/lbm/consortium/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";
package lbm.consortium.v1;

option go_package = "github.com/line/lbm-sdk/x/consortium/types";
option (gogoproto.equal_all) = true;

import "gogoproto/gogo.proto";
import "lbm/consortium/v1/consortium.proto";

// GenesisState defines the consortium module's genesis state.
message GenesisState {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// params defines the module parameters at genesis.
Params params = 1 [(gogoproto.moretags) = "yaml:\"params\""];

// allowed_validators defines the allowed validator addresses at genesis.
// provided empty, the module gathers information from staking module.
repeated ValidatorAuth validator_auths = 2 [(gogoproto.moretags) = "yaml:\"validator_auths\""];
}
Loading