Skip to content

Commit

Permalink
code changes to handle update params workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mankenavenkatesh committed Jul 18, 2024
1 parent 3cdce6e commit c24d4cc
Show file tree
Hide file tree
Showing 11 changed files with 735 additions and 193 deletions.
46 changes: 46 additions & 0 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
- [Query](#osmosis.meshsecurity.v1beta1.Query)

- [osmosis/meshsecurity/v1beta1/scheduler.proto](#osmosis/meshsecurity/v1beta1/scheduler.proto)
- [ScheduledWork](#osmosis.meshsecurity.v1beta1.ScheduledWork)
- [ValidatorAddress](#osmosis.meshsecurity.v1beta1.ValidatorAddress)

- [osmosis/meshsecurity/v1beta1/tx.proto](#osmosis/meshsecurity/v1beta1/tx.proto)
- [MsgSetVirtualStakingMaxCap](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCap)
- [MsgSetVirtualStakingMaxCapResponse](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCapResponse)
- [MsgUpdateParams](#osmosis.meshsecurity.v1beta1.MsgUpdateParams)
- [MsgUpdateParamsResponse](#osmosis.meshsecurity.v1beta1.MsgUpdateParamsResponse)

- [Msg](#osmosis.meshsecurity.v1beta1.Msg)

Expand Down Expand Up @@ -238,6 +241,21 @@ Query provides defines the gRPC querier service



<a name="osmosis.meshsecurity.v1beta1.ScheduledWork"></a>

### ScheduledWork



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






<a name="osmosis.meshsecurity.v1beta1.ValidatorAddress"></a>

### ValidatorAddress
Expand Down Expand Up @@ -296,6 +314,33 @@ MsgSetVirtualStakingMaxCap returns result data.




<a name="osmosis.meshsecurity.v1beta1.MsgUpdateParams"></a>

### MsgUpdateParams
MsgUpdateParams defines a Msg for updating the x/inflation module parameters.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `authority` | [string](#string) | | authority is the address of the governance account. |
| `params` | [Params](#osmosis.meshsecurity.v1beta1.Params) | | params defines the x/inflation parameters to update. NOTE: All parameters must be supplied. |






<a name="osmosis.meshsecurity.v1beta1.MsgUpdateParamsResponse"></a>

### MsgUpdateParamsResponse
MsgUpdateParamsResponse defines the response structure for executing a
MsgUpdateParams message.





<!-- end messages -->

<!-- end enums -->
Expand All @@ -311,6 +356,7 @@ Msg defines the wasm Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `SetVirtualStakingMaxCap` | [MsgSetVirtualStakingMaxCap](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCap) | [MsgSetVirtualStakingMaxCapResponse](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCapResponse) | SetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual staking coins | |
| `UpdateParams` | [MsgUpdateParams](#osmosis.meshsecurity.v1beta1.MsgUpdateParams) | [MsgUpdateParamsResponse](#osmosis.meshsecurity.v1beta1.MsgUpdateParamsResponse) | | |

<!-- end services -->

Expand Down
19 changes: 19 additions & 0 deletions proto/osmosis/meshsecurity/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "osmosis/meshsecurity/v1beta1/meshsecurity.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/types";
option (gogoproto.goproto_getters_all) = false;
Expand All @@ -15,6 +17,8 @@ service Msg {
// staking coins
rpc SetVirtualStakingMaxCap(MsgSetVirtualStakingMaxCap)
returns (MsgSetVirtualStakingMaxCapResponse);

rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgSetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual
Expand All @@ -37,3 +41,18 @@ message MsgSetVirtualStakingMaxCap {

// MsgSetVirtualStakingMaxCap returns result data.
message MsgSetVirtualStakingMaxCapResponse {}


// MsgUpdateParams defines a Msg for updating the x/inflation module parameters.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the x/inflation parameters to update.
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}
14 changes: 14 additions & 0 deletions x/meshsecurity/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ func (m msgServer) SetVirtualStakingMaxCap(goCtx context.Context, req *types.Msg
}
return &types.MsgSetVirtualStakingMaxCapResponse{}, nil
}

// UpdateParams defines a method for updating inflation params
func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if m.k.authority != req.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", m.k.authority, req.Authority)
}

ctx := sdk.UnwrapSDKContext(goCtx)
if err := m.k.SetParams(ctx, req.Params); err != nil {
return nil, errorsmod.Wrapf(err, "error setting params")
}

return &types.MsgUpdateParamsResponse{}, nil
}
2 changes: 2 additions & 0 deletions x/meshsecurity/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import (
// RegisterLegacyAminoCodec register types with legacy amino
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgSetVirtualStakingMaxCap{}, "meshsecurity/MsgSetVirtualStakingMaxCap", nil)
cdc.RegisterConcrete(&MsgUpdateParams{}, "meshsecurity/MsgUpdateParams", nil)
}

// RegisterInterfaces register types with interface registry
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgSetVirtualStakingMaxCap{},
&MsgUpdateParams{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
Expand Down
25 changes: 6 additions & 19 deletions x/meshsecurity/types/genesis.pb.go

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

32 changes: 6 additions & 26 deletions x/meshsecurity/types/meshsecurity.pb.go

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

Loading

0 comments on commit c24d4cc

Please sign in to comment.