Skip to content

Commit

Permalink
Merge pull request #151 from xpladev/refactor/gov-v1
Browse files Browse the repository at this point in the history
feat: x/volunteer use v1 proposal
  • Loading branch information
JoowonYun authored Sep 6, 2024
2 parents bb718ae + 38c1c65 commit 1b19a1f
Show file tree
Hide file tree
Showing 24 changed files with 1,792 additions and 546 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# docker run --rm -it --env-file=path/to/.env --name xpla-localnet xpladev/xpla

### BUILD
FROM golang:1.20-alpine3.17 AS build
FROM golang:1.21-alpine3.17 AS build

# Create appuser.
RUN adduser -D -g '' valiuser
Expand Down
6 changes: 2 additions & 4 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import (
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

Expand Down Expand Up @@ -271,6 +270,7 @@ func NewAppKeeper(
appCodec,
appKeepers.StakingKeeper,
appKeepers.DistrKeeper,
govModAddress,
)

// register the staking hooks
Expand Down Expand Up @@ -369,10 +369,8 @@ func NewAppKeeper(
govRouter := govv1betatypes.NewRouter()
govRouter.
AddRoute(govtypes.RouterKey, govv1betatypes.ProposalHandler).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)).
AddRoute(erc20types.RouterKey, erc20.NewErc20ProposalHandler(&appKeepers.Erc20Keeper)).
AddRoute(volunteertypes.RouterKey, volunteerkeeper.NewVolunteerValidatorProposalHandler(appKeepers.VolunteerKeeper))
AddRoute(erc20types.RouterKey, erc20.NewErc20ProposalHandler(&appKeepers.Erc20Keeper))

govConfig := govtypes.DefaultConfig()
// set the MaxMetadataLen for proposals to the same value as it was pre-sdk v0.47.x
Expand Down
10 changes: 2 additions & 8 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
Expand Down Expand Up @@ -67,7 +66,6 @@ import (
rewardtypes "github.com/xpladev/xpla/x/reward/types"
xplastaking "github.com/xpladev/xpla/x/staking"
"github.com/xpladev/xpla/x/volunteer"
volunteerclient "github.com/xpladev/xpla/x/volunteer/client"
volunteertypes "github.com/xpladev/xpla/x/volunteer/types"
)

Expand All @@ -89,17 +87,13 @@ var maccPerms = map[string][]string{
}

func getGovProposalHandlers() []govclient.ProposalHandler {
govProposalHandlers := volunteerclient.ProposalHandler

return append(govProposalHandlers, []govclient.ProposalHandler{
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
return []govclient.ProposalHandler{
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
erc20client.RegisterCoinProposalHandler,
erc20client.RegisterERC20ProposalHandler,
erc20client.ToggleTokenConversionProposalHandler,
}...)
}
}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
Expand Down
95 changes: 95 additions & 0 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@

- [Query](#xpla.volunteer.v1beta1.Query)

- [xpla/volunteer/v1beta1/tx.proto](#xpla/volunteer/v1beta1/tx.proto)
- [MsgRegisterVolunteerValidator](#xpla.volunteer.v1beta1.MsgRegisterVolunteerValidator)
- [MsgRegisterVolunteerValidatorResponse](#xpla.volunteer.v1beta1.MsgRegisterVolunteerValidatorResponse)
- [MsgUnregisterVolunteerValidator](#xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidator)
- [MsgUnregisterVolunteerValidatorResponse](#xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidatorResponse)

- [Msg](#xpla.volunteer.v1beta1.Msg)

- [Scalar Value Types](#scalar-value-types)


Expand Down Expand Up @@ -484,6 +492,93 @@ Query defines the gRPC querier service for volunteer module.



<a name="xpla/volunteer/v1beta1/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## xpla/volunteer/v1beta1/tx.proto



<a name="xpla.volunteer.v1beta1.MsgRegisterVolunteerValidator"></a>

### MsgRegisterVolunteerValidator
MsgRegisterVolunteerValidator defines a message to register a new volunteer
validator.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the governance account. |
| `validator_description` | [cosmos.staking.v1beta1.Description](#cosmos.staking.v1beta1.Description) | | |
| `delegator_address` | [string](#string) | | |
| `validator_address` | [string](#string) | | |
| `pubkey` | [google.protobuf.Any](#google.protobuf.Any) | | |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |






<a name="xpla.volunteer.v1beta1.MsgRegisterVolunteerValidatorResponse"></a>

### MsgRegisterVolunteerValidatorResponse
MsgRegisterVolunteerValidatorResponse defines the RegisterVolunteerValidator
response.






<a name="xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidator"></a>

### MsgUnregisterVolunteerValidator
MsgUnregisterVolunteerValidator defines a message to unregister a volunteer
validator.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the governance account. |
| `validator_address` | [string](#string) | | |






<a name="xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidatorResponse"></a>

### MsgUnregisterVolunteerValidatorResponse
MsgUnregisterVolunteerValidatorResponse defines the
UnregisterVolunteerValidator response.





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="xpla.volunteer.v1beta1.Msg"></a>

### Msg
Msg defines the volunteer Msg service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `RegisterVolunteerValidator` | [MsgRegisterVolunteerValidator](#xpla.volunteer.v1beta1.MsgRegisterVolunteerValidator) | [MsgRegisterVolunteerValidatorResponse](#xpla.volunteer.v1beta1.MsgRegisterVolunteerValidatorResponse) | RegisterVolunteerValidator defines a method to register a new volunteer validator. | |
| `UnregisterVolunteerValidator` | [MsgUnregisterVolunteerValidator](#xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidator) | [MsgUnregisterVolunteerValidatorResponse](#xpla.volunteer.v1beta1.MsgUnregisterVolunteerValidatorResponse) | UnregisterVolunteerValidator defines a method to unregister a volunteer | |

<!-- end services -->



## Scalar Value Types

| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
Expand Down
4 changes: 4 additions & 0 deletions proto/xpla/volunteer/v1beta1/proposal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option go_package = "github.com/xpladev/xpla/x/volunteer/types";

// RegisterVolunteerValidatorProposal
message RegisterVolunteerValidatorProposal {
option deprecated = true;
option (amino.name) = "xpladev/RegisterVolunteerValidatorProposal";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand All @@ -32,6 +33,7 @@ message RegisterVolunteerValidatorProposal {

// RegisterVolunteerValidatorProposalWithDeposit
message RegisterVolunteerValidatorProposalWithDeposit {
option deprecated = true;
option (amino.name) = "xpladev/RegisterVolunteerValidatorProposalWithDeposit";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand All @@ -53,6 +55,7 @@ message RegisterVolunteerValidatorProposalWithDeposit {

// UnregisterVolunteerValidatorProposal
message UnregisterVolunteerValidatorProposal {
option deprecated = true;
option (amino.name) = "xpladev/UnregisterVolunteerValidatorProposal";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand All @@ -65,6 +68,7 @@ message UnregisterVolunteerValidatorProposal {

// UnregisterVolunteerValidatorProposalWithDeposit
message UnregisterVolunteerValidatorProposalWithDeposit {
option deprecated = true;
option (amino.name) =
"xpladev/UnregisterVolunteerValidatorProposalWithDeposit";
option (gogoproto.equal) = false;
Expand Down
63 changes: 63 additions & 0 deletions proto/xpla/volunteer/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
syntax = "proto3";
package xpla.volunteer.v1beta1;

option go_package = "github.com/xpladev/xpla/x/volunteer/types";

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "amino/amino.proto";
import "cosmos/msg/v1/msg.proto";

// Msg defines the volunteer Msg service.
service Msg {
// RegisterVolunteerValidator defines a method to register a new volunteer
// validator.
rpc RegisterVolunteerValidator(MsgRegisterVolunteerValidator)
returns (MsgRegisterVolunteerValidatorResponse);

// UnregisterVolunteerValidator defines a method to unregister a volunteer
rpc UnregisterVolunteerValidator(MsgUnregisterVolunteerValidator)
returns (MsgUnregisterVolunteerValidatorResponse);
}

// MsgRegisterVolunteerValidator defines a message to register a new volunteer
// validator.
message MsgRegisterVolunteerValidator {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "xpla/volunteer/MsgRegisterVolunteerValidator";

// authority is the address of the governance account.
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
cosmos.staking.v1beta1.Description validator_description = 2
[ (gogoproto.nullable) = false ];
string delegator_address = 3
[ (gogoproto.moretags) = "yaml:\"delegator_address\"" ];
string validator_address = 4
[ (gogoproto.moretags) = "yaml:\"validator_address\"" ];
google.protobuf.Any pubkey = 5
[ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" ];
cosmos.base.v1beta1.Coin amount = 6 [ (gogoproto.nullable) = false ];
}

// MsgRegisterVolunteerValidatorResponse defines the RegisterVolunteerValidator
// response.
message MsgRegisterVolunteerValidatorResponse {}

// MsgUnregisterVolunteerValidator defines a message to unregister a volunteer
// validator.
message MsgUnregisterVolunteerValidator {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "xpla/volunteer/MsgUnregisterVolunteerValidator";

// authority is the address of the governance account.
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
string validator_address = 2
[ (gogoproto.moretags) = "yaml:\"validator_address\"" ];
}

// MsgUnregisterVolunteerValidatorResponse defines the
// UnregisterVolunteerValidator response.
message MsgUnregisterVolunteerValidatorResponse {}
Loading

0 comments on commit 1b19a1f

Please sign in to comment.