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

Migrate msgfees gov props v1 #1627

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7d4b004
Add new proto proposal interfaces
nullpointer0x00 Jul 11, 2023
9ad48fc
add authority
nullpointer0x00 Jul 11, 2023
aa3d743
add msg server impls
nullpointer0x00 Jul 11, 2023
70f2afe
add msg impls, add codec, add tests
nullpointer0x00 Jul 12, 2023
579cbe4
refactor codec
nullpointer0x00 Jul 12, 2023
1efb66c
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
nullpointer0x00 Jul 20, 2023
ed8fd4d
run lint-fix
nullpointer0x00 Jul 20, 2023
55c3312
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
nullpointer0x00 Aug 1, 2023
a8069b8
add msg server test suite, add AddMsgFeeProposal test
nullpointer0x00 Aug 1, 2023
ed209c7
add UpdateMsgFeeProposal test
nullpointer0x00 Aug 1, 2023
a88f259
add RemoveMsgFeeProposal test
nullpointer0x00 Aug 1, 2023
105fa45
add UpdateNhashPerUsdMilProposal test
nullpointer0x00 Aug 1, 2023
d4a41af
add UpdateConversionFeeDenomProposal test
nullpointer0x00 Aug 1, 2023
6cbff60
add change log entry
nullpointer0x00 Aug 1, 2023
392421d
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
iramiller Aug 11, 2023
17b5316
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
nullpointer0x00 Aug 11, 2023
8cf2753
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
iramiller Aug 11, 2023
f0ce1c0
add named fields to tests
nullpointer0x00 Aug 11, 2023
7253b45
fix tests
nullpointer0x00 Aug 11, 2023
602db42
run make proto-all
nullpointer0x00 Aug 11, 2023
d026706
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
iramiller Aug 11, 2023
da7d7ab
Merge branch 'main' into nullpointer0x00/1328-migrate-msgfees-gov-pro…
iramiller Aug 11, 2023
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 @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* Update ibcnet ports so they don't conflict with host machine. [#1622](https://github.com/provenance-io/provenance/issues/1622)
* Replace custom ibc-go v6.1.1 fork with official module. [#1616](https://github.com/provenance-io/provenance/issues/1616)
* Migrate `msgfees` gov proposals to v1. [#1328](https://github.com/provenance-io/provenance/issues/1328)
* Updated metadata queries to optionally include the request and id info [#1443](https://github.com/provenance-io/provenance/issues/1443).
The request is now omitted by default, but will be included if `include_request` is `true`.
The id info is still included by default, but will be excluded if `exclude_id_info` is `true`.
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func New(
)

app.MsgFeesKeeper = msgfeeskeeper.NewKeeper(
appCodec, keys[msgfeestypes.StoreKey], app.GetSubspace(msgfeestypes.ModuleName), authtypes.FeeCollectorName, pioconfig.GetProvenanceConfig().FeeDenom, app.Simulate, encodingConfig.TxConfig.TxDecoder())
appCodec, keys[msgfeestypes.StoreKey], app.GetSubspace(msgfeestypes.ModuleName), authtypes.FeeCollectorName, pioconfig.GetProvenanceConfig().FeeDenom, app.Simulate, encodingConfig.TxConfig.TxDecoder(), interfaceRegistry)

pioMsgFeesRouter := app.MsgServiceRouter().(*piohandlers.PioMsgServiceRouter)
pioMsgFeesRouter.SetMsgFeesKeeper(app.MsgFeesKeeper)
Expand Down
151 changes: 151 additions & 0 deletions docs/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,18 @@
- [Query](#provenance.msgfees.v1.Query)

- [provenance/msgfees/v1/tx.proto](#provenance/msgfees/v1/tx.proto)
- [MsgAddMsgFeeProposalRequest](#provenance.msgfees.v1.MsgAddMsgFeeProposalRequest)
- [MsgAddMsgFeeProposalResponse](#provenance.msgfees.v1.MsgAddMsgFeeProposalResponse)
- [MsgAssessCustomMsgFeeRequest](#provenance.msgfees.v1.MsgAssessCustomMsgFeeRequest)
- [MsgAssessCustomMsgFeeResponse](#provenance.msgfees.v1.MsgAssessCustomMsgFeeResponse)
- [MsgRemoveMsgFeeProposalRequest](#provenance.msgfees.v1.MsgRemoveMsgFeeProposalRequest)
- [MsgRemoveMsgFeeProposalResponse](#provenance.msgfees.v1.MsgRemoveMsgFeeProposalResponse)
- [MsgUpdateConversionFeeDenomProposalRequest](#provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalRequest)
- [MsgUpdateConversionFeeDenomProposalResponse](#provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalResponse)
- [MsgUpdateMsgFeeProposalRequest](#provenance.msgfees.v1.MsgUpdateMsgFeeProposalRequest)
- [MsgUpdateMsgFeeProposalResponse](#provenance.msgfees.v1.MsgUpdateMsgFeeProposalResponse)
- [MsgUpdateNhashPerUsdMilProposalRequest](#provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalRequest)
- [MsgUpdateNhashPerUsdMilProposalResponse](#provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalResponse)

- [Msg](#provenance.msgfees.v1.Msg)

Expand Down Expand Up @@ -6268,6 +6278,35 @@ Query defines the gRPC querier service for marker module.



<a name="provenance.msgfees.v1.MsgAddMsgFeeProposalRequest"></a>

### MsgAddMsgFeeProposalRequest
AddMsgFeeProposal defines a governance proposal to add additional msg based fee


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `msg_type_url` | [string](#string) | | type url of msg to add fee |
| `additional_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | additional fee for msg type |
| `recipient` | [string](#string) | | optional recipient to receive basis points |
| `recipient_basis_points` | [string](#string) | | basis points to use when recipient is present (1 - 10,000) |
| `authority` | [string](#string) | | the signing authority for the proposal |






<a name="provenance.msgfees.v1.MsgAddMsgFeeProposalResponse"></a>

### MsgAddMsgFeeProposalResponse
MsgAddMsgFeeProposalResponse defines the Msg/AddMsgFeeProposal response type






<a name="provenance.msgfees.v1.MsgAssessCustomMsgFeeRequest"></a>

### MsgAssessCustomMsgFeeRequest
Expand Down Expand Up @@ -6296,6 +6335,113 @@ MsgAssessCustomMsgFeeResponse defines the Msg/AssessCustomMsgFeee response type.




<a name="provenance.msgfees.v1.MsgRemoveMsgFeeProposalRequest"></a>

### MsgRemoveMsgFeeProposalRequest
RemoveMsgFeeProposal defines a governance proposal to delete a current msg based fee


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `msg_type_url` | [string](#string) | | type url of msg fee to remove |
| `authority` | [string](#string) | | the signing authority for the proposal |






<a name="provenance.msgfees.v1.MsgRemoveMsgFeeProposalResponse"></a>

### MsgRemoveMsgFeeProposalResponse
MsgRemoveMsgFeeProposalResponse defines the Msg/RemoveMsgFeeProposal response type






<a name="provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalRequest"></a>

### MsgUpdateConversionFeeDenomProposalRequest
UpdateConversionFeeDenomProposal defines a governance proposal to update the msg fee conversion denom


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `conversion_fee_denom` | [string](#string) | | conversion_fee_denom is the denom that usd will be converted to |
| `authority` | [string](#string) | | the signing authority for the proposal |






<a name="provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalResponse"></a>

### MsgUpdateConversionFeeDenomProposalResponse
MsgUpdateConversionFeeDenomProposalResponse defines the Msg/UpdateConversionFeeDenomProposal response type






<a name="provenance.msgfees.v1.MsgUpdateMsgFeeProposalRequest"></a>

### MsgUpdateMsgFeeProposalRequest
UpdateMsgFeeProposal defines a governance proposal to update a current msg based fee


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `msg_type_url` | [string](#string) | | type url of msg to update fee |
| `additional_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | additional fee for msg type |
| `recipient` | [string](#string) | | optional recipient to recieve basis points |
| `recipient_basis_points` | [string](#string) | | basis points to use when recipient is present (1 - 10,000) |
| `authority` | [string](#string) | | the signing authority for the proposal |






<a name="provenance.msgfees.v1.MsgUpdateMsgFeeProposalResponse"></a>

### MsgUpdateMsgFeeProposalResponse
MsgUpdateMsgFeeProposalResponse defines the Msg/RemoveMsgFeeProposal response type






<a name="provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalRequest"></a>

### MsgUpdateNhashPerUsdMilProposalRequest
UpdateNhashPerUsdMilProposal defines a governance proposal to update the nhash per usd mil param


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `nhash_per_usd_mil` | [uint64](#uint64) | | nhash_per_usd_mil is number of nhash per usd mil |
| `authority` | [string](#string) | | the signing authority for the proposal |






<a name="provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalResponse"></a>

### MsgUpdateNhashPerUsdMilProposalResponse
MsgUpdateNhashPerUsdMilProposalResponse defines the Msg/UpdateNhashPerUsdMilProposal response type





<!-- end messages -->

<!-- end enums -->
Expand All @@ -6311,6 +6457,11 @@ Msg defines the msgfees Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `AssessCustomMsgFee` | [MsgAssessCustomMsgFeeRequest](#provenance.msgfees.v1.MsgAssessCustomMsgFeeRequest) | [MsgAssessCustomMsgFeeResponse](#provenance.msgfees.v1.MsgAssessCustomMsgFeeResponse) | AssessCustomMsgFee endpoint executes the additional fee charges. This will only emit the event and not persist it to the keeper. Fees are handled with the custom msg fee handlers Use Case: smart contracts will be able to charge additional fees and direct partial funds to specified recipient for executing contracts | |
| `AddMsgFeeProposal` | [MsgAddMsgFeeProposalRequest](#provenance.msgfees.v1.MsgAddMsgFeeProposalRequest) | [MsgAddMsgFeeProposalResponse](#provenance.msgfees.v1.MsgAddMsgFeeProposalResponse) | AddMsgFeeProposal defines a governance proposal to add additional msg based fee | |
| `UpdateMsgFeeProposal` | [MsgUpdateMsgFeeProposalRequest](#provenance.msgfees.v1.MsgUpdateMsgFeeProposalRequest) | [MsgUpdateMsgFeeProposalResponse](#provenance.msgfees.v1.MsgUpdateMsgFeeProposalResponse) | UpdateMsgFeeProposal defines a governance proposal to update a current msg based fee | |
| `RemoveMsgFeeProposal` | [MsgRemoveMsgFeeProposalRequest](#provenance.msgfees.v1.MsgRemoveMsgFeeProposalRequest) | [MsgRemoveMsgFeeProposalResponse](#provenance.msgfees.v1.MsgRemoveMsgFeeProposalResponse) | RemoveMsgFeeProposal defines a governance proposal to delete a current msg based fee | |
| `UpdateNhashPerUsdMilProposal` | [MsgUpdateNhashPerUsdMilProposalRequest](#provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalRequest) | [MsgUpdateNhashPerUsdMilProposalResponse](#provenance.msgfees.v1.MsgUpdateNhashPerUsdMilProposalResponse) | UpdateNhashPerUsdMilProposal defines a governance proposal to update the nhash per usd mil param | |
| `UpdateConversionFeeDenomProposal` | [MsgUpdateConversionFeeDenomProposalRequest](#provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalRequest) | [MsgUpdateConversionFeeDenomProposalResponse](#provenance.msgfees.v1.MsgUpdateConversionFeeDenomProposalResponse) | UpdateConversionFeeDenomProposal defines a governance proposal to update the msg fee conversion denom | |

<!-- end services -->

Expand Down
2 changes: 1 addition & 1 deletion proto/provenance/metadata/v1/specification.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ message ContractSpecification {
// the address of a record on chain that represents this contract
bytes resource_id = 5 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
(gogoproto.moretags) = "yaml:\"resource_id\""
(gogoproto.moretags) = "yaml:\"resource_id\""
];
// the hash of contract binary (off-chain instance)
string hash = 6;
Expand Down
111 changes: 110 additions & 1 deletion proto/provenance/msgfees/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ syntax = "proto3";
package provenance.msgfees.v1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";

option go_package = "github.com/provenance-io/provenance/x/msgfees/types";

Expand All @@ -16,6 +18,23 @@ service Msg {
// Use Case: smart contracts will be able to charge additional fees and direct partial funds to specified recipient
// for executing contracts
rpc AssessCustomMsgFee(MsgAssessCustomMsgFeeRequest) returns (MsgAssessCustomMsgFeeResponse);

// AddMsgFeeProposal defines a governance proposal to add additional msg based fee
rpc AddMsgFeeProposal(MsgAddMsgFeeProposalRequest) returns (MsgAddMsgFeeProposalResponse);

// UpdateMsgFeeProposal defines a governance proposal to update a current msg based fee
rpc UpdateMsgFeeProposal(MsgUpdateMsgFeeProposalRequest) returns (MsgUpdateMsgFeeProposalResponse);

// RemoveMsgFeeProposal defines a governance proposal to delete a current msg based fee
rpc RemoveMsgFeeProposal(MsgRemoveMsgFeeProposalRequest) returns (MsgRemoveMsgFeeProposalResponse);

// UpdateNhashPerUsdMilProposal defines a governance proposal to update the nhash per usd mil param
rpc UpdateNhashPerUsdMilProposal(MsgUpdateNhashPerUsdMilProposalRequest)
returns (MsgUpdateNhashPerUsdMilProposalResponse);

// UpdateConversionFeeDenomProposal defines a governance proposal to update the msg fee conversion denom
rpc UpdateConversionFeeDenomProposal(MsgUpdateConversionFeeDenomProposalRequest)
returns (MsgUpdateConversionFeeDenomProposalResponse);
}

// MsgAssessCustomMsgFeeRequest defines an sdk.Msg type
Expand All @@ -32,4 +51,94 @@ message MsgAssessCustomMsgFeeRequest {
}

// MsgAssessCustomMsgFeeResponse defines the Msg/AssessCustomMsgFeee response type.
message MsgAssessCustomMsgFeeResponse {}
message MsgAssessCustomMsgFeeResponse {}

// AddMsgFeeProposal defines a governance proposal to add additional msg based fee
message MsgAddMsgFeeProposalRequest {
option (gogoproto.goproto_stringer) = true;
option (cosmos.msg.v1.signer) = "authority";

// type url of msg to add fee
string msg_type_url = 1;

// additional fee for msg type
cosmos.base.v1beta1.Coin additional_fee = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"additional_fee\""
];

// optional recipient to receive basis points
string recipient = 3;
// basis points to use when recipient is present (1 - 10,000)
string recipient_basis_points = 4;
// the signing authority for the proposal
string authority = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgAddMsgFeeProposalResponse defines the Msg/AddMsgFeeProposal response type
message MsgAddMsgFeeProposalResponse {}

// UpdateMsgFeeProposal defines a governance proposal to update a current msg based fee
message MsgUpdateMsgFeeProposalRequest {
option (gogoproto.goproto_stringer) = true;
option (cosmos.msg.v1.signer) = "authority";

// type url of msg to update fee
string msg_type_url = 1;

// additional fee for msg type
cosmos.base.v1beta1.Coin additional_fee = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
// optional recipient to recieve basis points
string recipient = 3;
// basis points to use when recipient is present (1 - 10,000)
string recipient_basis_points = 4;
// the signing authority for the proposal
string authority = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgUpdateMsgFeeProposalResponse defines the Msg/RemoveMsgFeeProposal response type
message MsgUpdateMsgFeeProposalResponse {}

// RemoveMsgFeeProposal defines a governance proposal to delete a current msg based fee
message MsgRemoveMsgFeeProposalRequest {
option (gogoproto.goproto_stringer) = true;
option (cosmos.msg.v1.signer) = "authority";

// type url of msg fee to remove
string msg_type_url = 1;
// the signing authority for the proposal
string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; //
}

// MsgRemoveMsgFeeProposalResponse defines the Msg/RemoveMsgFeeProposal response type
message MsgRemoveMsgFeeProposalResponse {}

// UpdateNhashPerUsdMilProposal defines a governance proposal to update the nhash per usd mil param
message MsgUpdateNhashPerUsdMilProposalRequest {
option (gogoproto.goproto_stringer) = true;
option (cosmos.msg.v1.signer) = "authority";

// nhash_per_usd_mil is number of nhash per usd mil
uint64 nhash_per_usd_mil = 1;
// the signing authority for the proposal
string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; //
}

// MsgUpdateNhashPerUsdMilProposalResponse defines the Msg/UpdateNhashPerUsdMilProposal response type
message MsgUpdateNhashPerUsdMilProposalResponse {}

// UpdateConversionFeeDenomProposal defines a governance proposal to update the msg fee conversion denom
message MsgUpdateConversionFeeDenomProposalRequest {
option (gogoproto.goproto_stringer) = true;
option (cosmos.msg.v1.signer) = "authority";

// conversion_fee_denom is the denom that usd will be converted to
string conversion_fee_denom = 1;
// the signing authority for the proposal
string authority = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; //
}

// MsgUpdateConversionFeeDenomProposalResponse defines the Msg/UpdateConversionFeeDenomProposal response type
message MsgUpdateConversionFeeDenomProposalResponse {}
4 changes: 2 additions & 2 deletions x/msgfees/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func NewProposalHandler(k keeper.Keeper, registry cdctypes.InterfaceRegistry) go
case *types.RemoveMsgFeeProposal:
return keeper.HandleRemoveMsgFeeProposal(ctx, k, c, registry)
case *types.UpdateNhashPerUsdMilProposal:
return keeper.HandleUpdateNhashPerUsdMilProposal(ctx, k, c, registry)
return keeper.HandleUpdateNhashPerUsdMilProposal(ctx, k, c)
case *types.UpdateConversionFeeDenomProposal:
return keeper.HandleUpdateConversionFeeDenomProposal(ctx, k, c, registry)
return keeper.HandleUpdateConversionFeeDenomProposal(ctx, k, c)
default:
return sdkerrors.ErrUnknownRequest.Wrapf("unrecognized marker proposal content type: %T", c)
}
Expand Down
12 changes: 12 additions & 0 deletions x/msgfees/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (
"github.com/tendermint/tendermint/libs/log"

"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
cosmosauthtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

"github.com/provenance-io/provenance/x/msgfees/types"
Expand All @@ -31,6 +33,8 @@ type Keeper struct {
defaultFeeDenom string
simulateFunc baseAppSimulateFunc
txDecoder sdk.TxDecoder
registry cdctypes.InterfaceRegistry
authority string
}

// NewKeeper returns a AdditionalFeeKeeper. It handles:
Expand All @@ -43,6 +47,7 @@ func NewKeeper(
defaultFeeDenom string,
simulateFunc baseAppSimulateFunc,
txDecoder sdk.TxDecoder,
registry cdctypes.InterfaceRegistry,
) Keeper {
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
Expand All @@ -56,9 +61,16 @@ func NewKeeper(
defaultFeeDenom: defaultFeeDenom,
simulateFunc: simulateFunc,
txDecoder: txDecoder,
authority: cosmosauthtypes.NewModuleAddress(govtypes.ModuleName).String(),
registry: registry,
}
}

// GetAuthority is signer of the proposal
func (k Keeper) GetAuthority() string {
return k.authority
}

// Logger returns a module-specific logger.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+types.ModuleName)
Expand Down
Loading
Loading