Skip to content

Commit d3bcc15

Browse files
technicallytyblushimergify[bot]
authored
x/feegrant API Audit changes (#9194)
* -add comments to proto fields -add comments to msg and query server -remove decorator from docs -add coments to msgs.go -remove decorator from godoc * Update x/feegrant/spec/04_events.md Co-authored-by: Marie Gauthier <[email protected]> * refactor and add to docs *refactor proto msg names and functions *add docs pertaining to auth's ante handler for deducted fees * lint * update comment * gofmt Co-authored-by: technicallyty <[email protected]> Co-authored-by: Marie Gauthier <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 711976e commit d3bcc15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1008
-991
lines changed

docs/core/proto-docs.md

+67-67
Original file line numberDiff line numberDiff line change
@@ -307,29 +307,29 @@
307307
- [Msg](#cosmos.evidence.v1beta1.Msg)
308308

309309
- [cosmos/feegrant/v1beta1/feegrant.proto](#cosmos/feegrant/v1beta1/feegrant.proto)
310-
- [AllowedMsgFeeAllowance](#cosmos.feegrant.v1beta1.AllowedMsgFeeAllowance)
311-
- [BasicFeeAllowance](#cosmos.feegrant.v1beta1.BasicFeeAllowance)
310+
- [AllowedMsgAllowance](#cosmos.feegrant.v1beta1.AllowedMsgAllowance)
311+
- [BasicAllowance](#cosmos.feegrant.v1beta1.BasicAllowance)
312312
- [Duration](#cosmos.feegrant.v1beta1.Duration)
313313
- [ExpiresAt](#cosmos.feegrant.v1beta1.ExpiresAt)
314-
- [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant)
315-
- [PeriodicFeeAllowance](#cosmos.feegrant.v1beta1.PeriodicFeeAllowance)
314+
- [Grant](#cosmos.feegrant.v1beta1.Grant)
315+
- [PeriodicAllowance](#cosmos.feegrant.v1beta1.PeriodicAllowance)
316316

317317
- [cosmos/feegrant/v1beta1/genesis.proto](#cosmos/feegrant/v1beta1/genesis.proto)
318318
- [GenesisState](#cosmos.feegrant.v1beta1.GenesisState)
319319

320320
- [cosmos/feegrant/v1beta1/query.proto](#cosmos/feegrant/v1beta1/query.proto)
321-
- [QueryFeeAllowanceRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowanceRequest)
322-
- [QueryFeeAllowanceResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowanceResponse)
323-
- [QueryFeeAllowancesRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowancesRequest)
324-
- [QueryFeeAllowancesResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowancesResponse)
321+
- [QueryAllowanceRequest](#cosmos.feegrant.v1beta1.QueryAllowanceRequest)
322+
- [QueryAllowanceResponse](#cosmos.feegrant.v1beta1.QueryAllowanceResponse)
323+
- [QueryAllowancesRequest](#cosmos.feegrant.v1beta1.QueryAllowancesRequest)
324+
- [QueryAllowancesResponse](#cosmos.feegrant.v1beta1.QueryAllowancesResponse)
325325

326326
- [Query](#cosmos.feegrant.v1beta1.Query)
327327

328328
- [cosmos/feegrant/v1beta1/tx.proto](#cosmos/feegrant/v1beta1/tx.proto)
329-
- [MsgGrantFeeAllowance](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowance)
330-
- [MsgGrantFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowanceResponse)
331-
- [MsgRevokeFeeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowance)
332-
- [MsgRevokeFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowanceResponse)
329+
- [MsgGrantAllowance](#cosmos.feegrant.v1beta1.MsgGrantAllowance)
330+
- [MsgGrantAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse)
331+
- [MsgRevokeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeAllowance)
332+
- [MsgRevokeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse)
333333

334334
- [Msg](#cosmos.feegrant.v1beta1.Msg)
335335

@@ -4545,10 +4545,10 @@ Msg defines the evidence Msg service.
45454545

45464546

45474547

4548-
<a name="cosmos.feegrant.v1beta1.AllowedMsgFeeAllowance"></a>
4548+
<a name="cosmos.feegrant.v1beta1.AllowedMsgAllowance"></a>
45494549

4550-
### AllowedMsgFeeAllowance
4551-
AllowedMsgFeeAllowance creates allowance only for specified message types.
4550+
### AllowedMsgAllowance
4551+
AllowedMsgAllowance creates allowance only for specified message types.
45524552

45534553

45544554
| Field | Type | Label | Description |
@@ -4561,11 +4561,11 @@ AllowedMsgFeeAllowance creates allowance only for specified message types.
45614561

45624562

45634563

4564-
<a name="cosmos.feegrant.v1beta1.BasicFeeAllowance"></a>
4564+
<a name="cosmos.feegrant.v1beta1.BasicAllowance"></a>
45654565

4566-
### BasicFeeAllowance
4567-
BasicFeeAllowance implements FeeAllowance with a one-time grant of tokens
4568-
that optionally expires. The delegatee can use up to SpendLimit to cover fees.
4566+
### BasicAllowance
4567+
BasicAllowance implements Allowance with a one-time grant of tokens
4568+
that optionally expires. The grantee can use up to SpendLimit to cover fees.
45694569

45704570

45714571
| Field | Type | Label | Description |
@@ -4612,33 +4612,33 @@ It may be *either* block time or block height
46124612

46134613

46144614

4615-
<a name="cosmos.feegrant.v1beta1.FeeAllowanceGrant"></a>
4615+
<a name="cosmos.feegrant.v1beta1.Grant"></a>
46164616

4617-
### FeeAllowanceGrant
4618-
FeeAllowanceGrant is stored in the KVStore to record a grant with full context
4617+
### Grant
4618+
Grant is stored in the KVStore to record a grant with full context
46194619

46204620

46214621
| Field | Type | Label | Description |
46224622
| ----- | ---- | ----- | ----------- |
4623-
| `granter` | [string](#string) | | |
4624-
| `grantee` | [string](#string) | | |
4625-
| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | |
4623+
| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. |
4624+
| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. |
4625+
| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | allowance can be any of basic and filtered fee allowance. |
46264626

46274627

46284628

46294629

46304630

46314631

4632-
<a name="cosmos.feegrant.v1beta1.PeriodicFeeAllowance"></a>
4632+
<a name="cosmos.feegrant.v1beta1.PeriodicAllowance"></a>
46334633

4634-
### PeriodicFeeAllowance
4635-
PeriodicFeeAllowance extends FeeAllowance to allow for both a maximum cap,
4634+
### PeriodicAllowance
4635+
PeriodicAllowance extends Allowance to allow for both a maximum cap,
46364636
as well as a limit per time period.
46374637

46384638

46394639
| Field | Type | Label | Description |
46404640
| ----- | ---- | ----- | ----------- |
4641-
| `basic` | [BasicFeeAllowance](#cosmos.feegrant.v1beta1.BasicFeeAllowance) | | basic specifies a struct of `BasicFeeAllowance` |
4641+
| `basic` | [BasicAllowance](#cosmos.feegrant.v1beta1.BasicAllowance) | | basic specifies a struct of `BasicAllowance` |
46424642
| `period` | [Duration](#cosmos.feegrant.v1beta1.Duration) | | period specifies the time duration in which period_spend_limit coins can be spent before that allowance is reset |
46434643
| `period_spend_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | period_spend_limit specifies the maximum number of coins that can be spent in the period |
46444644
| `period_can_spend` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | period_can_spend is the number of coins left to be spent before the period_reset time |
@@ -4673,7 +4673,7 @@ GenesisState contains a set of fee allowances, persisted from the store
46734673

46744674
| Field | Type | Label | Description |
46754675
| ----- | ---- | ----- | ----------- |
4676-
| `fee_allowances` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | repeated | |
4676+
| `allowances` | [Grant](#cosmos.feegrant.v1beta1.Grant) | repeated | |
46774677

46784678

46794679

@@ -4696,41 +4696,41 @@ GenesisState contains a set of fee allowances, persisted from the store
46964696

46974697

46984698

4699-
<a name="cosmos.feegrant.v1beta1.QueryFeeAllowanceRequest"></a>
4699+
<a name="cosmos.feegrant.v1beta1.QueryAllowanceRequest"></a>
47004700

4701-
### QueryFeeAllowanceRequest
4702-
QueryFeeAllowanceRequest is the request type for the Query/FeeAllowance RPC method.
4701+
### QueryAllowanceRequest
4702+
QueryAllowanceRequest is the request type for the Query/Allowance RPC method.
47034703

47044704

47054705
| Field | Type | Label | Description |
47064706
| ----- | ---- | ----- | ----------- |
4707-
| `granter` | [string](#string) | | |
4708-
| `grantee` | [string](#string) | | |
4707+
| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. |
4708+
| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. |
47094709

47104710

47114711

47124712

47134713

47144714

4715-
<a name="cosmos.feegrant.v1beta1.QueryFeeAllowanceResponse"></a>
4715+
<a name="cosmos.feegrant.v1beta1.QueryAllowanceResponse"></a>
47164716

4717-
### QueryFeeAllowanceResponse
4718-
QueryFeeAllowanceResponse is the response type for the Query/FeeAllowance RPC method.
4717+
### QueryAllowanceResponse
4718+
QueryAllowanceResponse is the response type for the Query/Allowance RPC method.
47194719

47204720

47214721
| Field | Type | Label | Description |
47224722
| ----- | ---- | ----- | ----------- |
4723-
| `fee_allowance` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | | fee_allowance is a fee_allowance granted for grantee by granter. |
4723+
| `allowance` | [Grant](#cosmos.feegrant.v1beta1.Grant) | | allowance is a allowance granted for grantee by granter. |
47244724

47254725

47264726

47274727

47284728

47294729

4730-
<a name="cosmos.feegrant.v1beta1.QueryFeeAllowancesRequest"></a>
4730+
<a name="cosmos.feegrant.v1beta1.QueryAllowancesRequest"></a>
47314731

4732-
### QueryFeeAllowancesRequest
4733-
QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC method.
4732+
### QueryAllowancesRequest
4733+
QueryAllowancesRequest is the request type for the Query/Allowances RPC method.
47344734

47354735

47364736
| Field | Type | Label | Description |
@@ -4743,15 +4743,15 @@ QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC me
47434743

47444744

47454745

4746-
<a name="cosmos.feegrant.v1beta1.QueryFeeAllowancesResponse"></a>
4746+
<a name="cosmos.feegrant.v1beta1.QueryAllowancesResponse"></a>
47474747

4748-
### QueryFeeAllowancesResponse
4749-
QueryFeeAllowancesResponse is the response type for the Query/FeeAllowances RPC method.
4748+
### QueryAllowancesResponse
4749+
QueryAllowancesResponse is the response type for the Query/Allowances RPC method.
47504750

47514751

47524752
| Field | Type | Label | Description |
47534753
| ----- | ---- | ----- | ----------- |
4754-
| `fee_allowances` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | repeated | fee_allowances are fee_allowance's granted for grantee by granter. |
4754+
| `allowances` | [Grant](#cosmos.feegrant.v1beta1.Grant) | repeated | allowances are allowance's granted for grantee by granter. |
47554755
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. |
47564756

47574757

@@ -4772,8 +4772,8 @@ Query defines the gRPC querier service.
47724772

47734773
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
47744774
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
4775-
| `FeeAllowance` | [QueryFeeAllowanceRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowanceRequest) | [QueryFeeAllowanceResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowanceResponse) | FeeAllowance returns fee granted to the grantee by the granter. | GET|/cosmos/feegrant/v1beta1/fee_allowance/{granter}/{grantee}|
4776-
| `FeeAllowances` | [QueryFeeAllowancesRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowancesRequest) | [QueryFeeAllowancesResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowancesResponse) | FeeAllowances returns all the grants for address. | GET|/cosmos/feegrant/v1beta1/fee_allowances/{grantee}|
4775+
| `Allowance` | [QueryAllowanceRequest](#cosmos.feegrant.v1beta1.QueryAllowanceRequest) | [QueryAllowanceResponse](#cosmos.feegrant.v1beta1.QueryAllowanceResponse) | Allowance returns fee granted to the grantee by the granter. | GET|/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}|
4776+
| `Allowances` | [QueryAllowancesRequest](#cosmos.feegrant.v1beta1.QueryAllowancesRequest) | [QueryAllowancesResponse](#cosmos.feegrant.v1beta1.QueryAllowancesResponse) | Allowances returns all the grants for address. | GET|/cosmos/feegrant/v1beta1/allowances/{grantee}|
47774777

47784778
<!-- end services -->
47794779

@@ -4786,54 +4786,54 @@ Query defines the gRPC querier service.
47864786

47874787

47884788

4789-
<a name="cosmos.feegrant.v1beta1.MsgGrantFeeAllowance"></a>
4789+
<a name="cosmos.feegrant.v1beta1.MsgGrantAllowance"></a>
47904790

4791-
### MsgGrantFeeAllowance
4792-
MsgGrantFeeAllowance adds permission for Grantee to spend up to Allowance
4791+
### MsgGrantAllowance
4792+
MsgGrantAllowance adds permission for Grantee to spend up to Allowance
47934793
of fees from the account of Granter.
47944794

47954795

47964796
| Field | Type | Label | Description |
47974797
| ----- | ---- | ----- | ----------- |
4798-
| `granter` | [string](#string) | | |
4799-
| `grantee` | [string](#string) | | |
4800-
| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | |
4798+
| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. |
4799+
| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. |
4800+
| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | allowance can be any of basic and filtered fee allowance. |
48014801

48024802

48034803

48044804

48054805

48064806

4807-
<a name="cosmos.feegrant.v1beta1.MsgGrantFeeAllowanceResponse"></a>
4807+
<a name="cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse"></a>
48084808

4809-
### MsgGrantFeeAllowanceResponse
4810-
MsgGrantFeeAllowanceResponse defines the Msg/GrantFeeAllowanceResponse response type.
4809+
### MsgGrantAllowanceResponse
4810+
MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type.
48114811

48124812

48134813

48144814

48154815

48164816

4817-
<a name="cosmos.feegrant.v1beta1.MsgRevokeFeeAllowance"></a>
4817+
<a name="cosmos.feegrant.v1beta1.MsgRevokeAllowance"></a>
48184818

4819-
### MsgRevokeFeeAllowance
4820-
MsgRevokeFeeAllowance removes any existing FeeAllowance from Granter to Grantee.
4819+
### MsgRevokeAllowance
4820+
MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.
48214821

48224822

48234823
| Field | Type | Label | Description |
48244824
| ----- | ---- | ----- | ----------- |
4825-
| `granter` | [string](#string) | | |
4826-
| `grantee` | [string](#string) | | |
4825+
| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. |
4826+
| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. |
48274827

48284828

48294829

48304830

48314831

48324832

4833-
<a name="cosmos.feegrant.v1beta1.MsgRevokeFeeAllowanceResponse"></a>
4833+
<a name="cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse"></a>
48344834

4835-
### MsgRevokeFeeAllowanceResponse
4836-
MsgRevokeFeeAllowanceResponse defines the Msg/RevokeFeeAllowanceResponse response type.
4835+
### MsgRevokeAllowanceResponse
4836+
MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.
48374837

48384838

48394839

@@ -4853,8 +4853,8 @@ Msg defines the feegrant msg service.
48534853

48544854
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
48554855
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
4856-
| `GrantFeeAllowance` | [MsgGrantFeeAllowance](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowance) | [MsgGrantFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowanceResponse) | GrantFeeAllowance grants fee allowance to the grantee on the granter's account with the provided expiration time. | |
4857-
| `RevokeFeeAllowance` | [MsgRevokeFeeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowance) | [MsgRevokeFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowanceResponse) | RevokeFeeAllowance revokes any fee allowance of granter's account that has been granted to the grantee. | |
4856+
| `GrantAllowance` | [MsgGrantAllowance](#cosmos.feegrant.v1beta1.MsgGrantAllowance) | [MsgGrantAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse) | GrantAllowance grants fee allowance to the grantee on the granter's account with the provided expiration time. | |
4857+
| `RevokeAllowance` | [MsgRevokeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeAllowance) | [MsgRevokeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse) | RevokeAllowance revokes any fee allowance of granter's account that has been granted to the grantee. | |
48584858

48594859
<!-- end services -->
48604860

proto/cosmos/feegrant/v1beta1/feegrant.proto

+16-12
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import "google/protobuf/duration.proto";
1010

1111
option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types";
1212

13-
// BasicFeeAllowance implements FeeAllowance with a one-time grant of tokens
14-
// that optionally expires. The delegatee can use up to SpendLimit to cover fees.
15-
message BasicFeeAllowance {
13+
// BasicAllowance implements Allowance with a one-time grant of tokens
14+
// that optionally expires. The grantee can use up to SpendLimit to cover fees.
15+
message BasicAllowance {
1616
option (cosmos_proto.implements_interface) = "FeeAllowanceI";
1717

1818
// spend_limit specifies the maximum amount of tokens that can be spent
@@ -25,13 +25,13 @@ message BasicFeeAllowance {
2525
ExpiresAt expiration = 2 [(gogoproto.nullable) = false];
2626
}
2727

28-
// PeriodicFeeAllowance extends FeeAllowance to allow for both a maximum cap,
28+
// PeriodicAllowance extends Allowance to allow for both a maximum cap,
2929
// as well as a limit per time period.
30-
message PeriodicFeeAllowance {
30+
message PeriodicAllowance {
3131
option (cosmos_proto.implements_interface) = "FeeAllowanceI";
3232

33-
// basic specifies a struct of `BasicFeeAllowance`
34-
BasicFeeAllowance basic = 1 [(gogoproto.nullable) = false];
33+
// basic specifies a struct of `BasicAllowance`
34+
BasicAllowance basic = 1 [(gogoproto.nullable) = false];
3535

3636
// period specifies the time duration in which period_spend_limit coins can
3737
// be spent before that allowance is reset
@@ -52,8 +52,8 @@ message PeriodicFeeAllowance {
5252
ExpiresAt period_reset = 5 [(gogoproto.nullable) = false];
5353
}
5454

55-
// AllowedMsgFeeAllowance creates allowance only for specified message types.
56-
message AllowedMsgFeeAllowance {
55+
// AllowedMsgAllowance creates allowance only for specified message types.
56+
message AllowedMsgAllowance {
5757
option (gogoproto.goproto_getters) = false;
5858
option (cosmos_proto.implements_interface) = "FeeAllowanceI";
5959

@@ -84,10 +84,14 @@ message ExpiresAt {
8484
}
8585
}
8686

87-
// FeeAllowanceGrant is stored in the KVStore to record a grant with full context
88-
message FeeAllowanceGrant {
89-
87+
// Grant is stored in the KVStore to record a grant with full context
88+
message Grant {
89+
// granter is the address of the user granting an allowance of their funds.
9090
string granter = 1;
91+
92+
// grantee is the address of the user being granted an allowance of another user's funds.
9193
string grantee = 2;
94+
95+
// allowance can be any of basic and filtered fee allowance.
9296
google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"];
9397
}

proto/cosmos/feegrant/v1beta1/genesis.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types";
88

99
// GenesisState contains a set of fee allowances, persisted from the store
1010
message GenesisState {
11-
repeated FeeAllowanceGrant fee_allowances = 1 [(gogoproto.nullable) = false];
11+
repeated Grant allowances = 1 [(gogoproto.nullable) = false];
1212
}

0 commit comments

Comments
 (0)