Skip to content

Commit

Permalink
Remove legacy marker gov proposal handlers (#1961)
Browse files Browse the repository at this point in the history
* remove handler test file

* remove increase/decrease supply legacy proposals, add decrease supply proposal msg, refactor proposal msgs

* add SetAdministratorProposal msg and logic

* add remove admin address proposal msg

* add change status proposal

* add escrow withdrawl gov proposal msg

* make set denom metadata msg

* rename with prefix handler

* remove old proposal handler items, add validate basic for MsgSupplyDecreaseProposal

* add validate basic for MsgSetAdministratorProposalRequest

* add validate basic for MsgChangeStatusProposalRequest

* add validate basic for MsgChangeStatusProposalRequest

* add validate basic for WithdrawEscrowProposal

* add validate basic for SetDenomMetadataProposalRequest

* add msg server test for SetAdministratorProposal

* add msg server test for supply increase and decrease proposals

* add all msg server tests

* start proposal hander tests

* update proto docs

* fix validate basic for increase supply prop

* add increase and decrease supply proposal clis

* add command

* add set administor proposal

* add remove admin proposal cli

* add change status proposal

* add withdraw escrow proposal

* add set denom metadata proposal cmd

* add method comments

* add back codec for deprecated propopsals, fix error messages in msgfees to match

* fix error wrapping

* add change log

* complete handler tests

* update msg tests, update all msgs with proposal msgs
  • Loading branch information
nullpointer0x00 authored May 17, 2024
1 parent ef6b255 commit 7bffaa8
Show file tree
Hide file tree
Showing 24 changed files with 8,656 additions and 4,888 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* IbcHooks module param migration [#1939](https://github.com/provenance-io/provenance/pull/1939).
* Bank module param migration [#1967](https://github.com/provenance-io/provenance/pull/1967).
* Remove `msgfees` legacy gov proposals [#1953](https://github.com/provenance-io/provenance/pull/1953).
* Remove `marker` legacy gov proposals [#1961](https://github.com/provenance-io/provenance/pull/1961).
* Restore the hold module [#1930](https://github.com/provenance-io/provenance/pull/1930).
* Restore gov-prop cli commands and fix next key decoding [#1930](https://github.com/provenance-io/provenance/pull/1930).
* Switch to InputOutputCoinsProv for exchange transfers [#1930](https://github.com/provenance-io/provenance/pull/1930).
Expand Down
3 changes: 1 addition & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,7 @@ func New(
// register the proposal types
govRouter := govtypesv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(markertypes.ModuleName, marker.NewProposalHandler(app.MarkerKeeper))
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper))
govKeeper := govkeeper.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper,
app.StakingKeeper, app.DistrKeeper, app.BaseApp.MsgServiceRouter(), govtypes.Config{MaxMetadataLen: 10000}, govAuthority,
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106856,6 +106856,11 @@ definitions:
provenance.marker.v1.MsgCancelResponse:
type: object
title: MsgCancelResponse defines the Msg/Cancel response type
provenance.marker.v1.MsgChangeStatusProposalResponse:
type: object
title: >-
MsgChangeStatusProposalResponse defines the Msg/ChangeStatusProposal
response type
provenance.marker.v1.MsgDeleteAccessResponse:
type: object
title: MsgDeleteAccessResponse defines the Msg/DeleteAccess response type
Expand All @@ -106876,12 +106881,32 @@ definitions:
provenance.marker.v1.MsgMintResponse:
type: object
title: MsgMintResponse defines the Msg/Mint response type
provenance.marker.v1.MsgRemoveAdministratorProposalResponse:
type: object
title: >-
MsgRemoveAdministratorProposalResponse defines the
Msg/RemoveAdministratorProposal response type
provenance.marker.v1.MsgSetAccountDataResponse:
type: object
title: MsgSetAccountDataResponse defines the Msg/SetAccountData response type
provenance.marker.v1.MsgSetAdministratorProposalResponse:
type: object
title: >-
MsgSetAdministratorProposalResponse defines the
Msg/SetAdministratorProposal response type
provenance.marker.v1.MsgSetDenomMetadataProposalResponse:
type: object
title: >-
MsgSetDenomMetadataProposalResponse defines the
Msg/SetDenomMetadataProposal response type
provenance.marker.v1.MsgSetDenomMetadataResponse:
type: object
title: MsgSetDenomMetadataResponse defines the Msg/SetDenomMetadata response type
provenance.marker.v1.MsgSupplyDecreaseProposalResponse:
type: object
title: >-
MsgSupplyIncreaseProposalResponse defines the Msg/SupplyDecreaseProposal
response type
provenance.marker.v1.MsgSupplyIncreaseProposalResponse:
type: object
title: >-
Expand All @@ -106905,6 +106930,11 @@ definitions:
title: >-
MsgUpdateSendDenyListResponse defines the Msg/UpdateSendDenyList response
type
provenance.marker.v1.MsgWithdrawEscrowProposalResponse:
type: object
title: >-
MsgWithdrawEscrowProposalResponse defines the Msg/WithdrawEscrowProposal
response type
provenance.marker.v1.MsgWithdrawResponse:
type: object
title: MsgWithdrawResponse defines the Msg/Withdraw response type
Expand Down
44 changes: 29 additions & 15 deletions proto/provenance/marker/v1/proposals.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ option java_multiple_files = true;
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgAddMarkerRequest in a governance proposal.
message AddMarkerProposal {
option deprecated = true;
option (gogoproto.equal) = true;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -35,9 +34,11 @@ message AddMarkerProposal {

// SupplyIncreaseProposal defines a governance proposal to administer a marker and increase total supply of the marker
// through minting coin and placing it within the marker or assigning it directly to an account
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgSupplyIncreaseProposalRequest in a governance proposal.
message SupplyIncreaseProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -47,9 +48,11 @@ message SupplyIncreaseProposal {

// SupplyDecreaseProposal defines a governance proposal to administer a marker and decrease the total supply through
// burning coin held within the marker
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgSupplyDecreaseProposalRequest in a governance proposal.
message SupplyDecreaseProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -58,9 +61,11 @@ message SupplyDecreaseProposal {

// SetAdministratorProposal defines a governance proposal to administer a marker and set administrators with specific
// access on the marker
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgSetAdministratorProposalRequest in a governance proposal.
message SetAdministratorProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -70,9 +75,11 @@ message SetAdministratorProposal {

// RemoveAdministratorProposal defines a governance proposal to administer a marker and remove all permissions for a
// given address
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgRemoveAdministratorProposalRequest in a governance proposal.
message RemoveAdministratorProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -81,9 +88,11 @@ message RemoveAdministratorProposal {
}

// ChangeStatusProposal defines a governance proposal to administer a marker to change its status
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgChangeStatusProposalRequest in a governance proposal.
message ChangeStatusProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -92,9 +101,11 @@ message ChangeStatusProposal {
}

// WithdrawEscrowProposal defines a governance proposal to withdraw escrow coins from a marker
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgWithdrawEscrowProposalRequest in a governance proposal.
message WithdrawEscrowProposal {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand All @@ -109,8 +120,11 @@ message WithdrawEscrowProposal {
}

// SetDenomMetadataProposal defines a governance proposal to set the metadata for a denom
// Deprecated: This message is no longer usable. It is only still included for
// backwards compatibility (e.g. looking up old governance proposals).
// It is replaced by providing a MsgSetDenomMetadataProposalRequest in a governance proposal.
message SetDenomMetadataProposal {
option (gogoproto.goproto_stringer) = false;
option deprecated = true;

string title = 1;
string description = 2;
Expand Down
97 changes: 97 additions & 0 deletions proto/provenance/marker/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ service Msg {
rpc AddFinalizeActivateMarker(MsgAddFinalizeActivateMarkerRequest) returns (MsgAddFinalizeActivateMarkerResponse);
// SupplyIncreaseProposal can only be called via gov proposal
rpc SupplyIncreaseProposal(MsgSupplyIncreaseProposalRequest) returns (MsgSupplyIncreaseProposalResponse);
// SupplyDecreaseProposal can only be called via gov proposal
rpc SupplyDecreaseProposal(MsgSupplyDecreaseProposalRequest) returns (MsgSupplyDecreaseProposalResponse);
// UpdateRequiredAttributes will only succeed if signer has transfer authority
rpc UpdateRequiredAttributes(MsgUpdateRequiredAttributesRequest) returns (MsgUpdateRequiredAttributesResponse);
// UpdateForcedTransfer updates the allow_forced_transfer field of a marker via governance proposal.
Expand All @@ -63,6 +65,17 @@ service Msg {
rpc UpdateSendDenyList(MsgUpdateSendDenyListRequest) returns (MsgUpdateSendDenyListResponse);
// AddNetAssetValues set the net asset value for a marker
rpc AddNetAssetValues(MsgAddNetAssetValuesRequest) returns (MsgAddNetAssetValuesResponse);
// SetAdministratorProposal sets administrators with specific access on the marker
rpc SetAdministratorProposal(MsgSetAdministratorProposalRequest) returns (MsgSetAdministratorProposalResponse);
// RemoveAdministratorProposal removes administrators with specific access on the marker
rpc RemoveAdministratorProposal(MsgRemoveAdministratorProposalRequest)
returns (MsgRemoveAdministratorProposalResponse);
// ChangeStatusProposal is a governance proposal change marker status
rpc ChangeStatusProposal(MsgChangeStatusProposalRequest) returns (MsgChangeStatusProposalResponse);
// WithdrawEscrowProposal is a governance proposal to withdraw escrow coins from a marker
rpc WithdrawEscrowProposal(MsgWithdrawEscrowProposalRequest) returns (MsgWithdrawEscrowProposalResponse);
// SetDenomMetadataProposal is a governance proposal to set marker metadata
rpc SetDenomMetadataProposal(MsgSetDenomMetadataProposalRequest) returns (MsgSetDenomMetadataProposalResponse);
}

// MsgGrantAllowanceRequest validates permission to create a fee grant based on marker admin access. If
Expand Down Expand Up @@ -280,6 +293,19 @@ message MsgSupplyIncreaseProposalRequest {
// MsgSupplyIncreaseProposalResponse defines the Msg/SupplyIncreaseProposal response type
message MsgSupplyIncreaseProposalResponse {}

// MsgSupplyDecreaseProposalRequest defines a governance proposal to decrease total supply of the marker
message MsgSupplyDecreaseProposalRequest {
option (gogoproto.equal) = true;
option (cosmos.msg.v1.signer) = "authority";

cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin"];
string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // signer of the proposal
}

// MsgSupplyIncreaseProposalResponse defines the Msg/SupplyDecreaseProposal response type
message MsgSupplyDecreaseProposalResponse {}

// MsgUpdateRequiredAttributesRequest defines a msg to update/add/remove required attributes from a resticted marker
// signer must have transfer authority to change attributes, to update attribute add current to remove list and new to
// add list
Expand Down Expand Up @@ -364,3 +390,74 @@ message MsgAddNetAssetValuesRequest {

// MsgAddNetAssetValuesResponse defines the Msg/AddNetAssetValue response type
message MsgAddNetAssetValuesResponse {}

// MsgSetAdministratorProposalRequest defines the Msg/SetAdministratorProposal request type
message MsgSetAdministratorProposalRequest {
option (gogoproto.equal) = true;
option (cosmos.msg.v1.signer) = "authority";

string denom = 1;
repeated AccessGrant access = 2 [(gogoproto.nullable) = false];
// The signer of the message. Must have admin authority to marker or be governance module account address.
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgSetAdministratorProposalResponse defines the Msg/SetAdministratorProposal response type
message MsgSetAdministratorProposalResponse {}

// MsgRemoveAdministratorProposalRequest defines the Msg/RemoveAdministratorProposal request type
message MsgRemoveAdministratorProposalRequest {
option (gogoproto.equal) = true;
option (cosmos.msg.v1.signer) = "authority";

string denom = 1;
repeated string removed_address = 2;
// The signer of the message. Must have admin authority to marker or be governance module account address.
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgRemoveAdministratorProposalResponse defines the Msg/RemoveAdministratorProposal response type
message MsgRemoveAdministratorProposalResponse {}

// MsgChangeStatusProposalRequest defines the Msg/ChangeStatusProposal request type
message MsgChangeStatusProposalRequest {
option (gogoproto.equal) = true;
option (cosmos.msg.v1.signer) = "authority";

string denom = 1;
MarkerStatus new_status = 2;
// The signer of the message. Must have admin authority to marker or be governance module account address.
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgChangeStatusProposalResponse defines the Msg/ChangeStatusProposal response type
message MsgChangeStatusProposalResponse {}

// MsgWithdrawEscrowProposalRequest defines the Msg/WithdrawEscrowProposal request type
message MsgWithdrawEscrowProposalRequest {
option (gogoproto.equal) = true;
option (cosmos.msg.v1.signer) = "authority";

string denom = 1;
repeated cosmos.base.v1beta1.Coin amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string target_address = 3;
// The signer of the message. Must have admin authority to marker or be governance module account address.
string authority = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgWithdrawEscrowProposalResponse defines the Msg/WithdrawEscrowProposal response type
message MsgWithdrawEscrowProposalResponse {}

// MsgSetDenomMetadataProposalRequest defines the Msg/SetDenomMetadataProposal request type
message MsgSetDenomMetadataProposalRequest {
option (cosmos.msg.v1.signer) = "authority";

cosmos.bank.v1beta1.Metadata metadata = 1
[(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/x/bank/types.Metadata"];
// The signer of the message. Must have admin authority to marker or be governance module account address.
string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgSetDenomMetadataProposalResponse defines the Msg/SetDenomMetadataProposal response type
message MsgSetDenomMetadataProposalResponse {}
Loading

0 comments on commit 7bffaa8

Please sign in to comment.