From d3bcc15b11561c66e55d026fba4950b867d721de Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+technicallyty@users.noreply.github.com> Date: Mon, 3 May 2021 05:34:48 -0700 Subject: [PATCH] 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 * 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 <48813565+tytech3@users.noreply.github.com> Co-authored-by: Marie Gauthier Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- docs/core/proto-docs.md | 134 +++---- proto/cosmos/feegrant/v1beta1/feegrant.proto | 28 +- proto/cosmos/feegrant/v1beta1/genesis.proto | 2 +- proto/cosmos/feegrant/v1beta1/query.proto | 40 +- proto/cosmos/feegrant/v1beta1/tx.proto | 32 +- x/auth/ante/feegrant_test.go | 4 +- x/feegrant/client/cli/query.go | 10 +- x/feegrant/client/cli/tx.go | 14 +- x/feegrant/client/testutil/suite.go | 34 +- x/feegrant/doc.go | 6 - x/feegrant/genesis.go | 12 +- x/feegrant/genesis_test.go | 16 +- x/feegrant/keeper/grpc_query.go | 19 +- x/feegrant/keeper/grpc_query_test.go | 58 +-- x/feegrant/keeper/keeper.go | 38 +- x/feegrant/keeper/keeper_test.go | 54 +-- x/feegrant/keeper/msg_server.go | 16 +- x/feegrant/keeper/msg_server_test.go | 68 ++-- x/feegrant/simulation/decoder.go | 2 +- x/feegrant/simulation/decoder_test.go | 2 +- x/feegrant/simulation/genesis.go | 18 +- x/feegrant/simulation/genesis_test.go | 2 +- x/feegrant/simulation/operations.go | 16 +- x/feegrant/simulation/operations_test.go | 8 +- x/feegrant/spec/01_concepts.md | 5 +- x/feegrant/spec/04_events.md | 4 +- x/feegrant/spec/README.md | 2 +- x/feegrant/types/basic_fee.go | 10 +- x/feegrant/types/basic_fee_test.go | 40 +- x/feegrant/types/codec.go | 10 +- x/feegrant/types/feegrant.pb.go | 303 +++++++-------- x/feegrant/types/filtered_fee.go | 24 +- x/feegrant/types/genesis.go | 10 +- x/feegrant/types/genesis.pb.go | 41 +-- x/feegrant/types/grant.go | 40 +- x/feegrant/types/grant_test.go | 4 +- x/feegrant/types/msgs.go | 29 +- x/feegrant/types/msgs_test.go | 12 +- x/feegrant/types/periodic_fee.go | 14 +- x/feegrant/types/periodic_fee_test.go | 72 ++-- x/feegrant/types/query.pb.go | 367 +++++++++---------- x/feegrant/types/query.pb.gw.go | 62 ++-- x/feegrant/types/tx.pb.go | 313 ++++++++-------- 43 files changed, 1006 insertions(+), 989 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 92887dc081..1e7ce1136d 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -307,29 +307,29 @@ - [Msg](#cosmos.evidence.v1beta1.Msg) - [cosmos/feegrant/v1beta1/feegrant.proto](#cosmos/feegrant/v1beta1/feegrant.proto) - - [AllowedMsgFeeAllowance](#cosmos.feegrant.v1beta1.AllowedMsgFeeAllowance) - - [BasicFeeAllowance](#cosmos.feegrant.v1beta1.BasicFeeAllowance) + - [AllowedMsgAllowance](#cosmos.feegrant.v1beta1.AllowedMsgAllowance) + - [BasicAllowance](#cosmos.feegrant.v1beta1.BasicAllowance) - [Duration](#cosmos.feegrant.v1beta1.Duration) - [ExpiresAt](#cosmos.feegrant.v1beta1.ExpiresAt) - - [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) - - [PeriodicFeeAllowance](#cosmos.feegrant.v1beta1.PeriodicFeeAllowance) + - [Grant](#cosmos.feegrant.v1beta1.Grant) + - [PeriodicAllowance](#cosmos.feegrant.v1beta1.PeriodicAllowance) - [cosmos/feegrant/v1beta1/genesis.proto](#cosmos/feegrant/v1beta1/genesis.proto) - [GenesisState](#cosmos.feegrant.v1beta1.GenesisState) - [cosmos/feegrant/v1beta1/query.proto](#cosmos/feegrant/v1beta1/query.proto) - - [QueryFeeAllowanceRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowanceRequest) - - [QueryFeeAllowanceResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowanceResponse) - - [QueryFeeAllowancesRequest](#cosmos.feegrant.v1beta1.QueryFeeAllowancesRequest) - - [QueryFeeAllowancesResponse](#cosmos.feegrant.v1beta1.QueryFeeAllowancesResponse) + - [QueryAllowanceRequest](#cosmos.feegrant.v1beta1.QueryAllowanceRequest) + - [QueryAllowanceResponse](#cosmos.feegrant.v1beta1.QueryAllowanceResponse) + - [QueryAllowancesRequest](#cosmos.feegrant.v1beta1.QueryAllowancesRequest) + - [QueryAllowancesResponse](#cosmos.feegrant.v1beta1.QueryAllowancesResponse) - [Query](#cosmos.feegrant.v1beta1.Query) - [cosmos/feegrant/v1beta1/tx.proto](#cosmos/feegrant/v1beta1/tx.proto) - - [MsgGrantFeeAllowance](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowance) - - [MsgGrantFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantFeeAllowanceResponse) - - [MsgRevokeFeeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowance) - - [MsgRevokeFeeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeFeeAllowanceResponse) + - [MsgGrantAllowance](#cosmos.feegrant.v1beta1.MsgGrantAllowance) + - [MsgGrantAllowanceResponse](#cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse) + - [MsgRevokeAllowance](#cosmos.feegrant.v1beta1.MsgRevokeAllowance) + - [MsgRevokeAllowanceResponse](#cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse) - [Msg](#cosmos.feegrant.v1beta1.Msg) @@ -4545,10 +4545,10 @@ Msg defines the evidence Msg service. - + -### AllowedMsgFeeAllowance -AllowedMsgFeeAllowance creates allowance only for specified message types. +### AllowedMsgAllowance +AllowedMsgAllowance creates allowance only for specified message types. | Field | Type | Label | Description | @@ -4561,11 +4561,11 @@ AllowedMsgFeeAllowance creates allowance only for specified message types. - + -### BasicFeeAllowance -BasicFeeAllowance implements FeeAllowance with a one-time grant of tokens -that optionally expires. The delegatee can use up to SpendLimit to cover fees. +### BasicAllowance +BasicAllowance implements Allowance with a one-time grant of tokens +that optionally expires. The grantee can use up to SpendLimit to cover fees. | Field | Type | Label | Description | @@ -4612,33 +4612,33 @@ It may be *either* block time or block height - + -### FeeAllowanceGrant -FeeAllowanceGrant is stored in the KVStore to record a grant with full context +### Grant +Grant is stored in the KVStore to record a grant with full context | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `granter` | [string](#string) | | | -| `grantee` | [string](#string) | | | -| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | | +| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. | +| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. | +| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | allowance can be any of basic and filtered fee allowance. | - + -### PeriodicFeeAllowance -PeriodicFeeAllowance extends FeeAllowance to allow for both a maximum cap, +### PeriodicAllowance +PeriodicAllowance extends Allowance to allow for both a maximum cap, as well as a limit per time period. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `basic` | [BasicFeeAllowance](#cosmos.feegrant.v1beta1.BasicFeeAllowance) | | basic specifies a struct of `BasicFeeAllowance` | +| `basic` | [BasicAllowance](#cosmos.feegrant.v1beta1.BasicAllowance) | | basic specifies a struct of `BasicAllowance` | | `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 | | `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 | | `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 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `fee_allowances` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | repeated | | +| `allowances` | [Grant](#cosmos.feegrant.v1beta1.Grant) | repeated | | @@ -4696,41 +4696,41 @@ GenesisState contains a set of fee allowances, persisted from the store - + -### QueryFeeAllowanceRequest -QueryFeeAllowanceRequest is the request type for the Query/FeeAllowance RPC method. +### QueryAllowanceRequest +QueryAllowanceRequest is the request type for the Query/Allowance RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `granter` | [string](#string) | | | -| `grantee` | [string](#string) | | | +| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. | +| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. | - + -### QueryFeeAllowanceResponse -QueryFeeAllowanceResponse is the response type for the Query/FeeAllowance RPC method. +### QueryAllowanceResponse +QueryAllowanceResponse is the response type for the Query/Allowance RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `fee_allowance` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | | fee_allowance is a fee_allowance granted for grantee by granter. | +| `allowance` | [Grant](#cosmos.feegrant.v1beta1.Grant) | | allowance is a allowance granted for grantee by granter. | - + -### QueryFeeAllowancesRequest -QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC method. +### QueryAllowancesRequest +QueryAllowancesRequest is the request type for the Query/Allowances RPC method. | Field | Type | Label | Description | @@ -4743,15 +4743,15 @@ QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC me - + -### QueryFeeAllowancesResponse -QueryFeeAllowancesResponse is the response type for the Query/FeeAllowances RPC method. +### QueryAllowancesResponse +QueryAllowancesResponse is the response type for the Query/Allowances RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `fee_allowances` | [FeeAllowanceGrant](#cosmos.feegrant.v1beta1.FeeAllowanceGrant) | repeated | fee_allowances are fee_allowance's granted for grantee by granter. | +| `allowances` | [Grant](#cosmos.feegrant.v1beta1.Grant) | repeated | allowances are allowance's granted for grantee by granter. | | `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. | @@ -4772,8 +4772,8 @@ Query defines the gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `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}| -| `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}| +| `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}| +| `Allowances` | [QueryAllowancesRequest](#cosmos.feegrant.v1beta1.QueryAllowancesRequest) | [QueryAllowancesResponse](#cosmos.feegrant.v1beta1.QueryAllowancesResponse) | Allowances returns all the grants for address. | GET|/cosmos/feegrant/v1beta1/allowances/{grantee}| @@ -4786,54 +4786,54 @@ Query defines the gRPC querier service. - + -### MsgGrantFeeAllowance -MsgGrantFeeAllowance adds permission for Grantee to spend up to Allowance +### MsgGrantAllowance +MsgGrantAllowance adds permission for Grantee to spend up to Allowance of fees from the account of Granter. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `granter` | [string](#string) | | | -| `grantee` | [string](#string) | | | -| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | | +| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. | +| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. | +| `allowance` | [google.protobuf.Any](#google.protobuf.Any) | | allowance can be any of basic and filtered fee allowance. | - + -### MsgGrantFeeAllowanceResponse -MsgGrantFeeAllowanceResponse defines the Msg/GrantFeeAllowanceResponse response type. +### MsgGrantAllowanceResponse +MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. - + -### MsgRevokeFeeAllowance -MsgRevokeFeeAllowance removes any existing FeeAllowance from Granter to Grantee. +### MsgRevokeAllowance +MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `granter` | [string](#string) | | | -| `grantee` | [string](#string) | | | +| `granter` | [string](#string) | | granter is the address of the user granting an allowance of their funds. | +| `grantee` | [string](#string) | | grantee is the address of the user being granted an allowance of another user's funds. | - + -### MsgRevokeFeeAllowanceResponse -MsgRevokeFeeAllowanceResponse defines the Msg/RevokeFeeAllowanceResponse response type. +### MsgRevokeAllowanceResponse +MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. @@ -4853,8 +4853,8 @@ Msg defines the feegrant msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `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. | | -| `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. | | +| `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. | | +| `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. | | diff --git a/proto/cosmos/feegrant/v1beta1/feegrant.proto b/proto/cosmos/feegrant/v1beta1/feegrant.proto index 15382e56e3..9ecec0d66a 100644 --- a/proto/cosmos/feegrant/v1beta1/feegrant.proto +++ b/proto/cosmos/feegrant/v1beta1/feegrant.proto @@ -10,9 +10,9 @@ import "google/protobuf/duration.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types"; -// BasicFeeAllowance implements FeeAllowance with a one-time grant of tokens -// that optionally expires. The delegatee can use up to SpendLimit to cover fees. -message BasicFeeAllowance { +// BasicAllowance implements Allowance with a one-time grant of tokens +// that optionally expires. The grantee can use up to SpendLimit to cover fees. +message BasicAllowance { option (cosmos_proto.implements_interface) = "FeeAllowanceI"; // spend_limit specifies the maximum amount of tokens that can be spent @@ -25,13 +25,13 @@ message BasicFeeAllowance { ExpiresAt expiration = 2 [(gogoproto.nullable) = false]; } -// PeriodicFeeAllowance extends FeeAllowance to allow for both a maximum cap, +// PeriodicAllowance extends Allowance to allow for both a maximum cap, // as well as a limit per time period. -message PeriodicFeeAllowance { +message PeriodicAllowance { option (cosmos_proto.implements_interface) = "FeeAllowanceI"; - // basic specifies a struct of `BasicFeeAllowance` - BasicFeeAllowance basic = 1 [(gogoproto.nullable) = false]; + // basic specifies a struct of `BasicAllowance` + BasicAllowance basic = 1 [(gogoproto.nullable) = false]; // period specifies the time duration in which period_spend_limit coins can // be spent before that allowance is reset @@ -52,8 +52,8 @@ message PeriodicFeeAllowance { ExpiresAt period_reset = 5 [(gogoproto.nullable) = false]; } -// AllowedMsgFeeAllowance creates allowance only for specified message types. -message AllowedMsgFeeAllowance { +// AllowedMsgAllowance creates allowance only for specified message types. +message AllowedMsgAllowance { option (gogoproto.goproto_getters) = false; option (cosmos_proto.implements_interface) = "FeeAllowanceI"; @@ -84,10 +84,14 @@ message ExpiresAt { } } -// FeeAllowanceGrant is stored in the KVStore to record a grant with full context -message FeeAllowanceGrant { - +// Grant is stored in the KVStore to record a grant with full context +message Grant { + // granter is the address of the user granting an allowance of their funds. string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. string grantee = 2; + + // allowance can be any of basic and filtered fee allowance. google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; } diff --git a/proto/cosmos/feegrant/v1beta1/genesis.proto b/proto/cosmos/feegrant/v1beta1/genesis.proto index a021ea61df..67d9098d33 100644 --- a/proto/cosmos/feegrant/v1beta1/genesis.proto +++ b/proto/cosmos/feegrant/v1beta1/genesis.proto @@ -8,5 +8,5 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types"; // GenesisState contains a set of fee allowances, persisted from the store message GenesisState { - repeated FeeAllowanceGrant fee_allowances = 1 [(gogoproto.nullable) = false]; + repeated Grant allowances = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/cosmos/feegrant/v1beta1/query.proto b/proto/cosmos/feegrant/v1beta1/query.proto index 42d5f30200..59d390bd1d 100644 --- a/proto/cosmos/feegrant/v1beta1/query.proto +++ b/proto/cosmos/feegrant/v1beta1/query.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package cosmos.feegrant.v1beta1; -import "gogoproto/gogo.proto"; import "cosmos/feegrant/v1beta1/feegrant.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; @@ -11,41 +10,44 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types"; // Query defines the gRPC querier service. service Query { - // FeeAllowance returns fee granted to the grantee by the granter. - rpc FeeAllowance(QueryFeeAllowanceRequest) returns (QueryFeeAllowanceResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/fee_allowance/{granter}/{grantee}"; + // Allowance returns fee granted to the grantee by the granter. + rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) { + option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}"; } - // FeeAllowances returns all the grants for address. - rpc FeeAllowances(QueryFeeAllowancesRequest) returns (QueryFeeAllowancesResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/fee_allowances/{grantee}"; + // Allowances returns all the grants for address. + rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { + option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; } } -// QueryFeeAllowanceRequest is the request type for the Query/FeeAllowance RPC method. -message QueryFeeAllowanceRequest { +// QueryAllowanceRequest is the request type for the Query/Allowance RPC method. +message QueryAllowanceRequest { + // granter is the address of the user granting an allowance of their funds. string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. string grantee = 2; } -// QueryFeeAllowanceResponse is the response type for the Query/FeeAllowance RPC method. -message QueryFeeAllowanceResponse { - // fee_allowance is a fee_allowance granted for grantee by granter. - cosmos.feegrant.v1beta1.FeeAllowanceGrant fee_allowance = 1; +// QueryAllowanceResponse is the response type for the Query/Allowance RPC method. +message QueryAllowanceResponse { + // allowance is a allowance granted for grantee by granter. + cosmos.feegrant.v1beta1.Grant allowance = 1; } -// QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC method. -message QueryFeeAllowancesRequest { +// QueryAllowancesRequest is the request type for the Query/Allowances RPC method. +message QueryAllowancesRequest { string grantee = 1; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryFeeAllowancesResponse is the response type for the Query/FeeAllowances RPC method. -message QueryFeeAllowancesResponse { - // fee_allowances are fee_allowance's granted for grantee by granter. - repeated cosmos.feegrant.v1beta1.FeeAllowanceGrant fee_allowances = 1; +// QueryAllowancesResponse is the response type for the Query/Allowances RPC method. +message QueryAllowancesResponse { + // allowances are allowance's granted for grantee by granter. + repeated cosmos.feegrant.v1beta1.Grant allowances = 1; // pagination defines an pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/proto/cosmos/feegrant/v1beta1/tx.proto b/proto/cosmos/feegrant/v1beta1/tx.proto index a36f358f25..a9678d0c3c 100644 --- a/proto/cosmos/feegrant/v1beta1/tx.proto +++ b/proto/cosmos/feegrant/v1beta1/tx.proto @@ -10,31 +10,39 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant/types"; // Msg defines the feegrant msg service. service Msg { - // GrantFeeAllowance grants fee allowance to the grantee on the granter's + // GrantAllowance grants fee allowance to the grantee on the granter's // account with the provided expiration time. - rpc GrantFeeAllowance(MsgGrantFeeAllowance) returns (MsgGrantFeeAllowanceResponse); + rpc GrantAllowance(MsgGrantAllowance) returns (MsgGrantAllowanceResponse); - // RevokeFeeAllowance revokes any fee allowance of granter's account that + // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. - rpc RevokeFeeAllowance(MsgRevokeFeeAllowance) returns (MsgRevokeFeeAllowanceResponse); + rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); } -// MsgGrantFeeAllowance adds permission for Grantee to spend up to Allowance +// MsgGrantAllowance adds permission for Grantee to spend up to Allowance // of fees from the account of Granter. -message MsgGrantFeeAllowance { +message MsgGrantAllowance { + // granter is the address of the user granting an allowance of their funds. string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. string grantee = 2; + + // allowance can be any of basic and filtered fee allowance. google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; } -// MsgGrantFeeAllowanceResponse defines the Msg/GrantFeeAllowanceResponse response type. -message MsgGrantFeeAllowanceResponse {} +// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. +message MsgGrantAllowanceResponse {} -// MsgRevokeFeeAllowance removes any existing FeeAllowance from Granter to Grantee. -message MsgRevokeFeeAllowance { +// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. +message MsgRevokeAllowance { + // granter is the address of the user granting an allowance of their funds. string granter = 1; + + // grantee is the address of the user being granted an allowance of another user's funds. string grantee = 2; } -// MsgRevokeFeeAllowanceResponse defines the Msg/RevokeFeeAllowanceResponse response type. -message MsgRevokeFeeAllowanceResponse {} +// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. +message MsgRevokeAllowanceResponse {} diff --git a/x/auth/ante/feegrant_test.go b/x/auth/ante/feegrant_test.go index 76ed106ec3..4ef728c4bd 100644 --- a/x/auth/ante/feegrant_test.go +++ b/x/auth/ante/feegrant_test.go @@ -54,13 +54,13 @@ func (suite *AnteTestSuite) TestDeductFeesNoDelegation() { suite.Require().NoError(err) // grant fee allowance from `addr2` to `addr3` (plenty to pay) - err = app.FeeGrantKeeper.GrantFeeAllowance(ctx, addr2, addr3, &types.BasicFeeAllowance{ + err = app.FeeGrantKeeper.GrantAllowance(ctx, addr2, addr3, &types.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewInt64Coin("atom", 500)), }) suite.Require().NoError(err) // grant low fee allowance (20atom), to check the tx requesting more than allowed. - err = app.FeeGrantKeeper.GrantFeeAllowance(ctx, addr2, addr4, &types.BasicFeeAllowance{ + err = app.FeeGrantKeeper.GrantAllowance(ctx, addr2, addr4, &types.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewInt64Coin("atom", 20)), }) suite.Require().NoError(err) diff --git a/x/feegrant/client/cli/query.go b/x/feegrant/client/cli/query.go index 5fd10cd1be..a03ec59c6d 100644 --- a/x/feegrant/client/cli/query.go +++ b/x/feegrant/client/cli/query.go @@ -59,9 +59,9 @@ $ %s query feegrant grant [granter] [grantee] return err } - res, err := queryClient.FeeAllowance( + res, err := queryClient.Allowance( cmd.Context(), - &types.QueryFeeAllowanceRequest{ + &types.QueryAllowanceRequest{ Granter: granterAddr.String(), Grantee: granteeAddr.String(), }, @@ -71,7 +71,7 @@ $ %s query feegrant grant [granter] [grantee] return err } - return clientCtx.PrintProto(res.FeeAllowance) + return clientCtx.PrintProto(res.Allowance) }, } @@ -107,9 +107,9 @@ $ %s query feegrant grants [grantee] return err } - res, err := queryClient.FeeAllowances( + res, err := queryClient.Allowances( cmd.Context(), - &types.QueryFeeAllowancesRequest{ + &types.QueryAllowancesRequest{ Grantee: granteeAddr.String(), Pagination: pageReq, }, diff --git a/x/feegrant/client/cli/tx.go b/x/feegrant/client/cli/tx.go index e909a46999..6c7ebc1c9d 100644 --- a/x/feegrant/client/cli/tx.go +++ b/x/feegrant/client/cli/tx.go @@ -97,7 +97,7 @@ Examples: return err } - basic := types.BasicFeeAllowance{ + basic := types.BasicAllowance{ SpendLimit: limit, } @@ -136,7 +136,7 @@ Examples: return fmt.Errorf("period(%d) cannot reset after expiration(%v)", periodClock, exp) } - periodic := types.PeriodicFeeAllowance{ + periodic := types.PeriodicAllowance{ Basic: basic, Period: types.ClockDuration(time.Duration(periodClock) * time.Second), PeriodReset: types.ExpiresAtTime(periodReset), @@ -157,20 +157,20 @@ Examples: } if len(allowedMsgs) > 0 { - grant, err = types.NewAllowedMsgFeeAllowance(grant, allowedMsgs) + grant, err = types.NewAllowedMsgAllowance(grant, allowedMsgs) if err != nil { return err } } - msg, err := types.NewMsgGrantFeeAllowance(grant, granter, grantee) + msg, err := types.NewMsgGrantAllowance(grant, granter, grantee) if err != nil { return err } svcMsgClientConn := &msgservice.ServiceMsgClientConn{} msgClient := types.NewMsgClient(svcMsgClientConn) - _, err = msgClient.GrantFeeAllowance(cmd.Context(), msg) + _, err = msgClient.GrantAllowance(cmd.Context(), msg) if err != nil { return err } @@ -215,10 +215,10 @@ Example: return err } - msg := types.NewMsgRevokeFeeAllowance(clientCtx.GetFromAddress(), grantee) + msg := types.NewMsgRevokeAllowance(clientCtx.GetFromAddress(), grantee) svcMsgClientConn := &msgservice.ServiceMsgClientConn{} msgClient := types.NewMsgClient(svcMsgClientConn) - _, err = msgClient.RevokeFeeAllowance(cmd.Context(), &msg) + _, err = msgClient.RevokeAllowance(cmd.Context(), &msg) if err != nil { return err } diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 7792bd8acf..44fb76761c 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -36,7 +36,7 @@ type IntegrationTestSuite struct { network *network.Network addedGranter sdk.AccAddress addedGrantee sdk.AccAddress - addedGrant types.FeeAllowanceGrant + addedGrant types.Grant } func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { @@ -89,7 +89,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.addedGranter = granter s.addedGrantee = grantee - grant, err := types.NewFeeAllowanceGrant(granter, grantee, &types.BasicFeeAllowance{ + grant, err := types.NewGrant(granter, grantee, &types.BasicAllowance{ SpendLimit: sdk.NewCoins(fee), }) s.Require().NoError(err) @@ -113,8 +113,8 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrant() { args []string expectErrMsg string expectErr bool - respType *types.FeeAllowanceGrant - resp *types.FeeAllowanceGrant + respType *types.Grant + resp *types.Grant }{ { "wrong granter", @@ -155,7 +155,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrant() { }, "", false, - &types.FeeAllowanceGrant{}, + &types.Grant{}, &s.addedGrant, }, } @@ -175,13 +175,13 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrant() { s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) s.Require().Equal(tc.respType.Grantee, tc.respType.Grantee) s.Require().Equal(tc.respType.Granter, tc.respType.Granter) - grant, err := tc.respType.GetFeeGrant() + grant, err := tc.respType.GetGrant() s.Require().NoError(err) - grant1, err1 := tc.resp.GetFeeGrant() + grant1, err1 := tc.resp.GetGrant() s.Require().NoError(err1) s.Require().Equal( - grant.(*types.BasicFeeAllowance).SpendLimit, - grant1.(*types.BasicFeeAllowance).SpendLimit, + grant.(*types.BasicAllowance).SpendLimit, + grant1.(*types.BasicAllowance).SpendLimit, ) } }) @@ -197,7 +197,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() { name string args []string expectErr bool - resp *types.QueryFeeAllowancesResponse + resp *types.QueryAllowancesResponse expectLength int }{ { @@ -214,7 +214,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() { "cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl", fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, - false, &types.QueryFeeAllowancesResponse{}, 0, + false, &types.QueryAllowancesResponse{}, 0, }, { "valid req", @@ -222,7 +222,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() { grantee.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, - false, &types.QueryFeeAllowancesResponse{}, 1, + false, &types.QueryAllowancesResponse{}, 1, }, } @@ -238,7 +238,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.resp), out.String()) - s.Require().Len(tc.resp.FeeAllowances, tc.expectLength) + s.Require().Len(tc.resp.Allowances, tc.expectLength) } }) } @@ -733,20 +733,20 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) - resp := &types.FeeAllowanceGrant{} + resp := &types.Grant{} s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), resp), out.String()) s.Require().Equal(resp.Grantee, resp.Grantee) s.Require().Equal(resp.Granter, resp.Granter) - grant, err := resp.GetFeeGrant() + grant, err := resp.GetGrant() s.Require().NoError(err) - filteredFeeGrant, err := grant.(*types.AllowedMsgFeeAllowance).GetAllowance() + filteredFeeGrant, err := grant.(*types.AllowedMsgAllowance).GetAllowance() s.Require().NoError(err) s.Require().Equal( - filteredFeeGrant.(*types.BasicFeeAllowance).SpendLimit.String(), + filteredFeeGrant.(*types.BasicAllowance).SpendLimit.String(), spendLimit.String(), ) diff --git a/x/feegrant/doc.go b/x/feegrant/doc.go index 4f190e3140..0407937917 100644 --- a/x/feegrant/doc.go +++ b/x/feegrant/doc.go @@ -19,11 +19,5 @@ pays the fees. The fee allowance that a grantee receives is specified by an implementation of the FeeAllowance interface. Two FeeAllowance implementations are provided in this package: BasicFeeAllowance and PeriodicFeeAllowance. - -In order to integrate this into an application, we must use the DeductGrantedFeeDecorator -ante handler from this package instead of the default DeductFeeDecorator from x/auth. - -To allow handling txs from empty accounts (with fees paid from an existing account), -we have to re-order the decorators as well. */ package feegrant diff --git a/x/feegrant/genesis.go b/x/feegrant/genesis.go index 22d4a20121..6adb987295 100644 --- a/x/feegrant/genesis.go +++ b/x/feegrant/genesis.go @@ -8,7 +8,7 @@ import ( // InitGenesis will initialize the keeper from a *previously validated* GenesisState func InitGenesis(ctx sdk.Context, k keeper.Keeper, data *types.GenesisState) error { - for _, f := range data.FeeAllowances { + for _, f := range data.Allowances { granter, err := sdk.AccAddressFromBech32(f.Granter) if err != nil { return err @@ -18,12 +18,12 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data *types.GenesisState) err return err } - grant, err := f.GetFeeGrant() + grant, err := f.GetGrant() if err != nil { return err } - err = k.GrantFeeAllowance(ctx, granter, grantee, grant) + err = k.GrantAllowance(ctx, granter, grantee, grant) if err != nil { return err } @@ -40,14 +40,14 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data *types.GenesisState) err // them to perform any changes needed prior to export. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) (*types.GenesisState, error) { time, height := ctx.BlockTime(), ctx.BlockHeight() - var grants []types.FeeAllowanceGrant + var grants []types.Grant - err := k.IterateAllFeeAllowances(ctx, func(grant types.FeeAllowanceGrant) bool { + err := k.IterateAllFeeAllowances(ctx, func(grant types.Grant) bool { grants = append(grants, grant.PrepareForExport(time, height)) return false }) return &types.GenesisState{ - FeeAllowances: grants, + Allowances: grants, }, err } diff --git a/x/feegrant/genesis_test.go b/x/feegrant/genesis_test.go index a2d3209dc3..7172f7e1db 100644 --- a/x/feegrant/genesis_test.go +++ b/x/feegrant/genesis_test.go @@ -41,14 +41,14 @@ func (suite *GenesisTestSuite) TestImportExportGenesis() { now := suite.ctx.BlockHeader().Time msgSrvr := keeper.NewMsgServerImpl(suite.keeper) - allowance := &types.BasicFeeAllowance{SpendLimit: coins, Expiration: types.ExpiresAtTime(now.AddDate(1, 0, 0))} - err := suite.keeper.GrantFeeAllowance(suite.ctx, granterAddr, granteeAddr, allowance) + allowance := &types.BasicAllowance{SpendLimit: coins, Expiration: types.ExpiresAtTime(now.AddDate(1, 0, 0))} + err := suite.keeper.GrantAllowance(suite.ctx, granterAddr, granteeAddr, allowance) suite.Require().NoError(err) genesis, err := feegrant.ExportGenesis(suite.ctx, suite.keeper) suite.Require().NoError(err) // revoke fee allowance - _, err = msgSrvr.RevokeFeeAllowance(sdk.WrapSDKContext(suite.ctx), &types.MsgRevokeFeeAllowance{ + _, err = msgSrvr.RevokeAllowance(sdk.WrapSDKContext(suite.ctx), &types.MsgRevokeAllowance{ Granter: granterAddr.String(), Grantee: granteeAddr.String(), }) @@ -67,11 +67,11 @@ func (suite *GenesisTestSuite) TestInitGenesis() { testCases := []struct { name string - feeAllowances []types.FeeAllowanceGrant + feeAllowances []types.Grant }{ { "invalid granter", - []types.FeeAllowanceGrant{ + []types.Grant{ { Granter: "invalid granter", Grantee: granteeAddr.String(), @@ -80,7 +80,7 @@ func (suite *GenesisTestSuite) TestInitGenesis() { }, { "invalid grantee", - []types.FeeAllowanceGrant{ + []types.Grant{ { Granter: granterAddr.String(), Grantee: "invalid grantee", @@ -89,7 +89,7 @@ func (suite *GenesisTestSuite) TestInitGenesis() { }, { "invalid allowance", - []types.FeeAllowanceGrant{ + []types.Grant{ { Granter: granterAddr.String(), Grantee: granteeAddr.String(), @@ -102,7 +102,7 @@ func (suite *GenesisTestSuite) TestInitGenesis() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - err := feegrant.InitGenesis(suite.ctx, suite.keeper, &types.GenesisState{FeeAllowances: tc.feeAllowances}) + err := feegrant.InitGenesis(suite.ctx, suite.keeper, &types.GenesisState{Allowances: tc.feeAllowances}) suite.Require().Error(err) }) } diff --git a/x/feegrant/keeper/grpc_query.go b/x/feegrant/keeper/grpc_query.go index b298ebdbae..2730c30327 100644 --- a/x/feegrant/keeper/grpc_query.go +++ b/x/feegrant/keeper/grpc_query.go @@ -16,8 +16,8 @@ import ( var _ types.QueryServer = Keeper{} -// FeeAllowance returns fee granted to the grantee by the granter. -func (q Keeper) FeeAllowance(c context.Context, req *types.QueryFeeAllowanceRequest) (*types.QueryFeeAllowanceResponse, error) { +// Allowance returns fee granted to the grantee by the granter. +func (q Keeper) Allowance(c context.Context, req *types.QueryAllowanceRequest) (*types.QueryAllowanceResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -34,7 +34,7 @@ func (q Keeper) FeeAllowance(c context.Context, req *types.QueryFeeAllowanceRequ ctx := sdk.UnwrapSDKContext(c) - feeAllowance, err := q.GetFeeAllowance(ctx, granterAddr, granteeAddr) + feeAllowance, err := q.GetAllowance(ctx, granterAddr, granteeAddr) if err != nil { return nil, status.Errorf(codes.Internal, err.Error()) } @@ -49,8 +49,8 @@ func (q Keeper) FeeAllowance(c context.Context, req *types.QueryFeeAllowanceRequ return nil, status.Errorf(codes.Internal, err.Error()) } - return &types.QueryFeeAllowanceResponse{ - FeeAllowance: &types.FeeAllowanceGrant{ + return &types.QueryAllowanceResponse{ + Allowance: &types.Grant{ Granter: granterAddr.String(), Grantee: granteeAddr.String(), Allowance: feeAllowanceAny, @@ -58,7 +58,8 @@ func (q Keeper) FeeAllowance(c context.Context, req *types.QueryFeeAllowanceRequ }, nil } -func (q Keeper) FeeAllowances(c context.Context, req *types.QueryFeeAllowancesRequest) (*types.QueryFeeAllowancesResponse, error) { +// Allowances queries all the allowances granted to the given grantee. +func (q Keeper) Allowances(c context.Context, req *types.QueryAllowancesRequest) (*types.QueryAllowancesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -70,13 +71,13 @@ func (q Keeper) FeeAllowances(c context.Context, req *types.QueryFeeAllowancesRe ctx := sdk.UnwrapSDKContext(c) - var grants []*types.FeeAllowanceGrant + var grants []*types.Grant store := ctx.KVStore(q.storeKey) grantsStore := prefix.NewStore(store, types.FeeAllowancePrefixByGrantee(granteeAddr)) pageRes, err := query.Paginate(grantsStore, req.Pagination, func(key []byte, value []byte) error { - var grant types.FeeAllowanceGrant + var grant types.Grant if err := q.cdc.Unmarshal(value, &grant); err != nil { return err @@ -90,5 +91,5 @@ func (q Keeper) FeeAllowances(c context.Context, req *types.QueryFeeAllowancesRe return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryFeeAllowancesResponse{FeeAllowances: grants, Pagination: pageRes}, nil + return &types.QueryAllowancesResponse{Allowances: grants, Pagination: pageRes}, nil } diff --git a/x/feegrant/keeper/grpc_query_test.go b/x/feegrant/keeper/grpc_query_test.go index 8e2385f019..6011c0152b 100644 --- a/x/feegrant/keeper/grpc_query_test.go +++ b/x/feegrant/keeper/grpc_query_test.go @@ -9,51 +9,51 @@ func (suite *KeeperTestSuite) TestFeeAllowance() { testCases := []struct { name string - req *types.QueryFeeAllowanceRequest + req *types.QueryAllowanceRequest expectErr bool preRun func() - postRun func(_ *types.QueryFeeAllowanceResponse) + postRun func(_ *types.QueryAllowanceResponse) }{ { "nil request", nil, true, func() {}, - func(*types.QueryFeeAllowanceResponse) {}, + func(*types.QueryAllowanceResponse) {}, }, { "fail: invalid granter", - &types.QueryFeeAllowanceRequest{ + &types.QueryAllowanceRequest{ Granter: "invalid_granter", Grantee: suite.addrs[0].String(), }, true, func() {}, - func(*types.QueryFeeAllowanceResponse) {}, + func(*types.QueryAllowanceResponse) {}, }, { "fail: invalid grantee", - &types.QueryFeeAllowanceRequest{ + &types.QueryAllowanceRequest{ Granter: suite.addrs[0].String(), Grantee: "invalid_grantee", }, true, func() {}, - func(*types.QueryFeeAllowanceResponse) {}, + func(*types.QueryAllowanceResponse) {}, }, { "fail: no grants", - &types.QueryFeeAllowanceRequest{ + &types.QueryAllowanceRequest{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }, true, func() {}, - func(*types.QueryFeeAllowanceResponse) {}, + func(*types.QueryAllowanceResponse) {}, }, { "valid query: expect single grant", - &types.QueryFeeAllowanceRequest{ + &types.QueryAllowanceRequest{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }, @@ -61,9 +61,9 @@ func (suite *KeeperTestSuite) TestFeeAllowance() { func() { grantFeeAllowance(suite) }, - func(allowance *types.QueryFeeAllowanceResponse) { - suite.Require().Equal(allowance.FeeAllowance.Granter, suite.addrs[0].String()) - suite.Require().Equal(allowance.FeeAllowance.Grantee, suite.addrs[1].String()) + func(response *types.QueryAllowanceResponse) { + suite.Require().Equal(response.Allowance.Granter, suite.addrs[0].String()) + suite.Require().Equal(response.Allowance.Grantee, suite.addrs[1].String()) }, }, } @@ -71,7 +71,7 @@ func (suite *KeeperTestSuite) TestFeeAllowance() { for _, tc := range testCases { suite.Run(tc.name, func() { tc.preRun() - resp, err := suite.keeper.FeeAllowance(suite.ctx, tc.req) + resp, err := suite.keeper.Allowance(suite.ctx, tc.req) if tc.expectErr { suite.Require().Error(err) } else { @@ -85,51 +85,51 @@ func (suite *KeeperTestSuite) TestFeeAllowance() { func (suite *KeeperTestSuite) TestFeeAllowances() { testCases := []struct { name string - req *types.QueryFeeAllowancesRequest + req *types.QueryAllowancesRequest expectErr bool preRun func() - postRun func(_ *types.QueryFeeAllowancesResponse) + postRun func(_ *types.QueryAllowancesResponse) }{ { "nil request", nil, true, func() {}, - func(*types.QueryFeeAllowancesResponse) {}, + func(*types.QueryAllowancesResponse) {}, }, { "fail: invalid grantee", - &types.QueryFeeAllowancesRequest{ + &types.QueryAllowancesRequest{ Grantee: "invalid_grantee", }, true, func() {}, - func(*types.QueryFeeAllowancesResponse) {}, + func(*types.QueryAllowancesResponse) {}, }, { "no grants", - &types.QueryFeeAllowancesRequest{ + &types.QueryAllowancesRequest{ Grantee: suite.addrs[1].String(), }, false, func() {}, - func(resp *types.QueryFeeAllowancesResponse) { - suite.Require().Equal(len(resp.FeeAllowances), 0) + func(resp *types.QueryAllowancesResponse) { + suite.Require().Equal(len(resp.Allowances), 0) }, }, { "valid query: expect single grant", - &types.QueryFeeAllowancesRequest{ + &types.QueryAllowancesRequest{ Grantee: suite.addrs[1].String(), }, false, func() { grantFeeAllowance(suite) }, - func(resp *types.QueryFeeAllowancesResponse) { - suite.Require().Equal(len(resp.FeeAllowances), 1) - suite.Require().Equal(resp.FeeAllowances[0].Granter, suite.addrs[0].String()) - suite.Require().Equal(resp.FeeAllowances[0].Grantee, suite.addrs[1].String()) + func(resp *types.QueryAllowancesResponse) { + suite.Require().Equal(len(resp.Allowances), 1) + suite.Require().Equal(resp.Allowances[0].Granter, suite.addrs[0].String()) + suite.Require().Equal(resp.Allowances[0].Grantee, suite.addrs[1].String()) }, }, } @@ -137,7 +137,7 @@ func (suite *KeeperTestSuite) TestFeeAllowances() { for _, tc := range testCases { suite.Run(tc.name, func() { tc.preRun() - resp, err := suite.keeper.FeeAllowances(suite.ctx, tc.req) + resp, err := suite.keeper.Allowances(suite.ctx, tc.req) if tc.expectErr { suite.Require().Error(err) } else { @@ -149,7 +149,7 @@ func (suite *KeeperTestSuite) TestFeeAllowances() { } func grantFeeAllowance(suite *KeeperTestSuite) { - err := suite.app.FeeGrantKeeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], &types.BasicFeeAllowance{ + err := suite.app.FeeGrantKeeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], &types.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewInt64Coin("atom", 555)), Expiration: types.ExpiresAtHeight(334455), }) diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index a67369142d..7054563122 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -36,8 +36,8 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// GrantFeeAllowance creates a new grant -func (k Keeper) GrantFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress, feeAllowance types.FeeAllowanceI) error { +// GrantAllowance creates a new grant +func (k Keeper) GrantAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress, feeAllowance types.FeeAllowanceI) error { // create the account if it is not in account state granteeAcc := k.authKeeper.GetAccount(ctx, grantee) @@ -48,7 +48,7 @@ func (k Keeper) GrantFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddre store := ctx.KVStore(k.storeKey) key := types.FeeAllowanceKey(granter, grantee) - grant, err := types.NewFeeAllowanceGrant(granter, grantee, feeAllowance) + grant, err := types.NewGrant(granter, grantee, feeAllowance) if err != nil { return err } @@ -71,9 +71,9 @@ func (k Keeper) GrantFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddre return nil } -// revokeFeeAllowance removes an existing grant -func (k Keeper) revokeFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) error { - _, err := k.getFeeGrant(ctx, granter, grantee) +// revokeAllowance removes an existing grant +func (k Keeper) revokeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) error { + _, err := k.getGrant(ctx, granter, grantee) if err != nil { return err } @@ -92,20 +92,20 @@ func (k Keeper) revokeFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddr return nil } -// GetFeeAllowance returns the allowance between the granter and grantee. +// GetAllowance returns the allowance between the granter and grantee. // If there is none, it returns nil, nil. // Returns an error on parsing issues -func (k Keeper) GetFeeAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) (types.FeeAllowanceI, error) { - grant, err := k.getFeeGrant(ctx, granter, grantee) +func (k Keeper) GetAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) (types.FeeAllowanceI, error) { + grant, err := k.getGrant(ctx, granter, grantee) if err != nil { return nil, err } - return grant.GetFeeGrant() + return grant.GetGrant() } -// getFeeGrant returns entire grant between both accounts -func (k Keeper) getFeeGrant(ctx sdk.Context, granter sdk.AccAddress, grantee sdk.AccAddress) (*types.FeeAllowanceGrant, error) { +// getGrant returns entire grant between both accounts +func (k Keeper) getGrant(ctx sdk.Context, granter sdk.AccAddress, grantee sdk.AccAddress) (*types.Grant, error) { store := ctx.KVStore(k.storeKey) key := types.FeeAllowanceKey(granter, grantee) bz := store.Get(key) @@ -113,7 +113,7 @@ func (k Keeper) getFeeGrant(ctx sdk.Context, granter sdk.AccAddress, grantee sdk return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "fee-grant not found") } - var feegrant types.FeeAllowanceGrant + var feegrant types.Grant if err := k.cdc.Unmarshal(bz, &feegrant); err != nil { return nil, err } @@ -124,7 +124,7 @@ func (k Keeper) getFeeGrant(ctx sdk.Context, granter sdk.AccAddress, grantee sdk // IterateAllFeeAllowances iterates over all the grants in the store. // Callback to get all data, returns true to stop, false to keep reading // Calling this without pagination is very expensive and only designed for export genesis -func (k Keeper) IterateAllFeeAllowances(ctx sdk.Context, cb func(types.FeeAllowanceGrant) bool) error { +func (k Keeper) IterateAllFeeAllowances(ctx sdk.Context, cb func(grant types.Grant) bool) error { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.FeeAllowanceKeyPrefix) defer iter.Close() @@ -132,7 +132,7 @@ func (k Keeper) IterateAllFeeAllowances(ctx sdk.Context, cb func(types.FeeAllowa stop := false for ; iter.Valid() && !stop; iter.Next() { bz := iter.Value() - var feeGrant types.FeeAllowanceGrant + var feeGrant types.Grant if err := k.cdc.Unmarshal(bz, &feeGrant); err != nil { return err } @@ -145,12 +145,12 @@ func (k Keeper) IterateAllFeeAllowances(ctx sdk.Context, cb func(types.FeeAllowa // UseGrantedFees will try to pay the given fee from the granter's account as requested by the grantee func (k Keeper) UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error { - f, err := k.getFeeGrant(ctx, granter, grantee) + f, err := k.getGrant(ctx, granter, grantee) if err != nil { return err } - grant, err := f.GetFeeGrant() + grant, err := f.GetGrant() if err != nil { return err } @@ -159,7 +159,7 @@ func (k Keeper) UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, if remove { // Ignoring the `revokeFeeAllowance` error, because the user has enough grants to perform this transaction. - k.revokeFeeAllowance(ctx, granter, grantee) + k.revokeAllowance(ctx, granter, grantee) if err != nil { return err } @@ -176,7 +176,7 @@ func (k Keeper) UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, emitUseGrantEvent(ctx, granter.String(), grantee.String()) // if fee allowance is accepted, store the updated state of the allowance - return k.GrantFeeAllowance(ctx, granter, grantee, grant) + return k.GrantAllowance(ctx, granter, grantee, grant) } func emitUseGrantEvent(ctx sdk.Context, granter, grantee string) { diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index 3dd2285605..63493ebd04 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -46,46 +46,46 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) TestKeeperCrud() { // some helpers eth := sdk.NewCoins(sdk.NewInt64Coin("eth", 123)) - basic := &types.BasicFeeAllowance{ + basic := &types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtHeight(334455), } - basic2 := &types.BasicFeeAllowance{ + basic2 := &types.BasicAllowance{ SpendLimit: eth, Expiration: types.ExpiresAtHeight(172436), } // let's set up some initial state here - err := suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], basic) + err := suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], basic) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[2], basic2) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[2], basic2) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[2], basic) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[2], basic) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[3], basic) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[3], basic) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[3], suite.addrs[0], basic2) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[3], suite.addrs[0], basic2) suite.Require().NoError(err) // remove some, overwrite other - _, err = suite.msgSrvr.RevokeFeeAllowance(suite.ctx, &types.MsgRevokeFeeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String()}) + _, err = suite.msgSrvr.RevokeAllowance(suite.ctx, &types.MsgRevokeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String()}) suite.Require().NoError(err) - _, err = suite.msgSrvr.RevokeFeeAllowance(suite.ctx, &types.MsgRevokeFeeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[2].String()}) + _, err = suite.msgSrvr.RevokeAllowance(suite.ctx, &types.MsgRevokeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[2].String()}) suite.Require().NoError(err) // revoke non-exist fee allowance - _, err = suite.msgSrvr.RevokeFeeAllowance(suite.ctx, &types.MsgRevokeFeeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[2].String()}) + _, err = suite.msgSrvr.RevokeAllowance(suite.ctx, &types.MsgRevokeAllowance{Granter: suite.addrs[0].String(), Grantee: suite.addrs[2].String()}) suite.Require().Error(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[2], basic) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[2], basic) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[2], basic2) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[1], suite.addrs[2], basic2) suite.Require().NoError(err) // end state: @@ -122,7 +122,7 @@ func (suite *KeeperTestSuite) TestKeeperCrud() { for name, tc := range cases { tc := tc suite.Run(name, func() { - allow, _ := suite.keeper.GetFeeAllowance(suite.sdkCtx, tc.granter, tc.grantee) + allow, _ := suite.keeper.GetAllowance(suite.sdkCtx, tc.granter, tc.grantee) if tc.allowance == nil { suite.Nil(allow) @@ -136,25 +136,25 @@ func (suite *KeeperTestSuite) TestKeeperCrud() { suite.Require().NoError(err) // let's grant and revoke authorization to non existing account - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[3], accAddr, basic2) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[3], accAddr, basic2) suite.Require().NoError(err) - _, err = suite.keeper.GetFeeAllowance(suite.sdkCtx, suite.addrs[3], accAddr) + _, err = suite.keeper.GetAllowance(suite.sdkCtx, suite.addrs[3], accAddr) suite.Require().NoError(err) - _, err = suite.msgSrvr.RevokeFeeAllowance(suite.ctx, &types.MsgRevokeFeeAllowance{Granter: suite.addrs[3].String(), Grantee: accAddr.String()}) + _, err = suite.msgSrvr.RevokeAllowance(suite.ctx, &types.MsgRevokeAllowance{Granter: suite.addrs[3].String(), Grantee: accAddr.String()}) suite.Require().NoError(err) } func (suite *KeeperTestSuite) TestUseGrantedFee() { eth := sdk.NewCoins(sdk.NewInt64Coin("eth", 123)) - future := &types.BasicFeeAllowance{ + future := &types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtHeight(5678), } - expired := &types.BasicFeeAllowance{ + expired := &types.BasicAllowance{ SpendLimit: eth, Expiration: types.ExpiresAtHeight(55), } @@ -164,7 +164,7 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { _ = hugeAtom smallAtom := sdk.NewCoins(sdk.NewInt64Coin("atom", 1)) _ = smallAtom - futureAfterSmall := &types.BasicFeeAllowance{ + futureAfterSmall := &types.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewInt64Coin("atom", 554)), Expiration: types.ExpiresAtHeight(5678), } @@ -214,10 +214,10 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { // addr -> addr2 (future) // addr -> addr3 (expired) - err := suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], future) + err := suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], future) suite.Require().NoError(err) - err = suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[3], expired) + err = suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[3], expired) suite.Require().NoError(err) err = suite.keeper.UseGrantedFees(suite.sdkCtx, tc.granter, tc.grantee, tc.fee, []sdk.Msg{}) @@ -227,7 +227,7 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { suite.Error(err) } - loaded, _ := suite.keeper.GetFeeAllowance(suite.sdkCtx, tc.granter, tc.grantee) + loaded, _ := suite.keeper.GetAllowance(suite.sdkCtx, tc.granter, tc.grantee) suite.Equal(tc.final, loaded) }) @@ -236,20 +236,20 @@ func (suite *KeeperTestSuite) TestUseGrantedFee() { func (suite *KeeperTestSuite) TestIterateGrants() { eth := sdk.NewCoins(sdk.NewInt64Coin("eth", 123)) - allowance := &types.BasicFeeAllowance{ + allowance := &types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtHeight(5678), } - allowance1 := &types.BasicFeeAllowance{ + allowance1 := &types.BasicAllowance{ SpendLimit: eth, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().Add(24 * time.Hour)), } - suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], allowance) - suite.keeper.GrantFeeAllowance(suite.sdkCtx, suite.addrs[2], suite.addrs[1], allowance1) + suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], allowance) + suite.keeper.GrantAllowance(suite.sdkCtx, suite.addrs[2], suite.addrs[1], allowance1) - suite.keeper.IterateAllFeeAllowances(suite.sdkCtx, func(grant types.FeeAllowanceGrant) bool { + suite.keeper.IterateAllFeeAllowances(suite.sdkCtx, func(grant types.Grant) bool { suite.Require().Equal(suite.addrs[1].String(), grant.Grantee) suite.Require().Contains([]string{suite.addrs[0].String(), suite.addrs[2].String()}, grant.Granter) return true diff --git a/x/feegrant/keeper/msg_server.go b/x/feegrant/keeper/msg_server.go index 2aace5fb6a..ea5ab277cc 100644 --- a/x/feegrant/keeper/msg_server.go +++ b/x/feegrant/keeper/msg_server.go @@ -23,7 +23,8 @@ func NewMsgServerImpl(k Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -func (k msgServer) GrantFeeAllowance(goCtx context.Context, msg *types.MsgGrantFeeAllowance) (*types.MsgGrantFeeAllowanceResponse, error) { +// GrantAllowance grants an allowance from the granter's funds to be used by the grantee. +func (k msgServer) GrantAllowance(goCtx context.Context, msg *types.MsgGrantAllowance) (*types.MsgGrantAllowanceResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) grantee, err := sdk.AccAddressFromBech32(msg.Grantee) @@ -37,7 +38,7 @@ func (k msgServer) GrantFeeAllowance(goCtx context.Context, msg *types.MsgGrantF } // Checking for duplicate entry - if f, _ := k.Keeper.GetFeeAllowance(ctx, granter, grantee); f != nil { + if f, _ := k.Keeper.GetAllowance(ctx, granter, grantee); f != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "fee allowance already exists") } @@ -46,15 +47,16 @@ func (k msgServer) GrantFeeAllowance(goCtx context.Context, msg *types.MsgGrantF return nil, err } - err = k.Keeper.GrantFeeAllowance(ctx, granter, grantee, allowance) + err = k.Keeper.GrantAllowance(ctx, granter, grantee, allowance) if err != nil { return nil, err } - return &types.MsgGrantFeeAllowanceResponse{}, nil + return &types.MsgGrantAllowanceResponse{}, nil } -func (k msgServer) RevokeFeeAllowance(goCtx context.Context, msg *types.MsgRevokeFeeAllowance) (*types.MsgRevokeFeeAllowanceResponse, error) { +// RevokeAllowance revokes a fee allowance between a granter and grantee. +func (k msgServer) RevokeAllowance(goCtx context.Context, msg *types.MsgRevokeAllowance) (*types.MsgRevokeAllowanceResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) grantee, err := sdk.AccAddressFromBech32(msg.Grantee) @@ -67,10 +69,10 @@ func (k msgServer) RevokeFeeAllowance(goCtx context.Context, msg *types.MsgRevok return nil, err } - err = k.Keeper.revokeFeeAllowance(ctx, granter, grantee) + err = k.Keeper.revokeAllowance(ctx, granter, grantee) if err != nil { return nil, err } - return &types.MsgRevokeFeeAllowanceResponse{}, nil + return &types.MsgRevokeAllowanceResponse{}, nil } diff --git a/x/feegrant/keeper/msg_server_test.go b/x/feegrant/keeper/msg_server_test.go index e12669d97a..05a2f6b8d9 100644 --- a/x/feegrant/keeper/msg_server_test.go +++ b/x/feegrant/keeper/msg_server_test.go @@ -9,16 +9,16 @@ import ( func (suite *KeeperTestSuite) TestGrantFeeAllowance() { testCases := []struct { name string - req func() *types.MsgGrantFeeAllowance + req func() *types.MsgGrantAllowance expectErr bool errMsg string }{ { "invalid granter address", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.BasicFeeAllowance{}) + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.BasicAllowance{}) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: "invalid-granter", Grantee: suite.addrs[1].String(), Allowance: any, @@ -29,10 +29,10 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { }, { "invalid grantee address", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.BasicFeeAllowance{}) + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.BasicAllowance{}) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: suite.addrs[0].String(), Grantee: "invalid-grantee", Allowance: any, @@ -43,13 +43,13 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { }, { "valid: basic fee allowance", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.BasicFeeAllowance{ + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().AddDate(1, 0, 0)), }) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), Allowance: any, @@ -60,13 +60,13 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { }, { "fail: fee allowance exists", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.BasicFeeAllowance{ + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().AddDate(1, 0, 0)), }) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), Allowance: any, @@ -77,15 +77,15 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { }, { "valid: periodic fee allowance", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().AddDate(1, 0, 0)), }, }) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: suite.addrs[1].String(), Grantee: suite.addrs[2].String(), Allowance: any, @@ -96,15 +96,15 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { }, { "error: fee allowance exists", - func() *types.MsgGrantFeeAllowance { - any, err := codectypes.NewAnyWithValue(&types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + func() *types.MsgGrantAllowance { + any, err := codectypes.NewAnyWithValue(&types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().AddDate(1, 0, 0)), }, }) suite.Require().NoError(err) - return &types.MsgGrantFeeAllowance{ + return &types.MsgGrantAllowance{ Granter: suite.addrs[1].String(), Grantee: suite.addrs[2].String(), Allowance: any, @@ -116,7 +116,7 @@ func (suite *KeeperTestSuite) TestGrantFeeAllowance() { } for _, tc := range testCases { suite.Run(tc.name, func() { - _, err := suite.msgSrvr.GrantFeeAllowance(suite.ctx, tc.req()) + _, err := suite.msgSrvr.GrantAllowance(suite.ctx, tc.req()) if tc.expectErr { suite.Require().Error(err) suite.Require().Contains(err.Error(), tc.errMsg) @@ -129,14 +129,14 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { testCases := []struct { name string - request *types.MsgRevokeFeeAllowance + request *types.MsgRevokeAllowance preRun func() expectErr bool errMsg string }{ { "error: invalid granter", - &types.MsgRevokeFeeAllowance{ + &types.MsgRevokeAllowance{ Granter: "invalid-granter", Grantee: suite.addrs[1].String(), }, @@ -146,7 +146,7 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { }, { "error: invalid grantee", - &types.MsgRevokeFeeAllowance{ + &types.MsgRevokeAllowance{ Granter: suite.addrs[0].String(), Grantee: "invalid-grantee", }, @@ -156,7 +156,7 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { }, { "error: fee allowance not found", - &types.MsgRevokeFeeAllowance{ + &types.MsgRevokeAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }, @@ -166,29 +166,29 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { }, { "success: revoke fee allowance", - &types.MsgRevokeFeeAllowance{ + &types.MsgRevokeAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }, func() { // removing fee allowance from previous tests if exists - suite.msgSrvr.RevokeFeeAllowance(suite.ctx, &types.MsgRevokeFeeAllowance{ + suite.msgSrvr.RevokeAllowance(suite.ctx, &types.MsgRevokeAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }) - any, err := codectypes.NewAnyWithValue(&types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + any, err := codectypes.NewAnyWithValue(&types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: suite.atom, Expiration: types.ExpiresAtTime(suite.sdkCtx.BlockTime().AddDate(1, 0, 0)), }, }) suite.Require().NoError(err) - req := &types.MsgGrantFeeAllowance{ + req := &types.MsgGrantAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), Allowance: any, } - _, err = suite.msgSrvr.GrantFeeAllowance(suite.ctx, req) + _, err = suite.msgSrvr.GrantAllowance(suite.ctx, req) suite.Require().NoError(err) }, false, @@ -196,7 +196,7 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { }, { "error: check fee allowance revoked", - &types.MsgRevokeFeeAllowance{ + &types.MsgRevokeAllowance{ Granter: suite.addrs[0].String(), Grantee: suite.addrs[1].String(), }, @@ -209,7 +209,7 @@ func (suite *KeeperTestSuite) TestRevokeFeeAllowance() { for _, tc := range testCases { suite.Run(tc.name, func() { tc.preRun() - _, err := suite.msgSrvr.RevokeFeeAllowance(suite.ctx, tc.request) + _, err := suite.msgSrvr.RevokeAllowance(suite.ctx, tc.request) if tc.expectErr { suite.Require().Error(err) suite.Require().Contains(err.Error(), tc.errMsg) diff --git a/x/feegrant/simulation/decoder.go b/x/feegrant/simulation/decoder.go index 1d8b58cb4f..5e09222899 100644 --- a/x/feegrant/simulation/decoder.go +++ b/x/feegrant/simulation/decoder.go @@ -15,7 +15,7 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { return func(kvA, kvB kv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], types.FeeAllowanceKeyPrefix): - var grantA, grantB types.FeeAllowanceGrant + var grantA, grantB types.Grant cdc.MustUnmarshal(kvA.Value, &grantA) cdc.MustUnmarshal(kvB.Value, &grantB) return fmt.Sprintf("%v\n%v", grantA, grantB) diff --git a/x/feegrant/simulation/decoder_test.go b/x/feegrant/simulation/decoder_test.go index 7a5c0ba3dc..74de5f77df 100644 --- a/x/feegrant/simulation/decoder_test.go +++ b/x/feegrant/simulation/decoder_test.go @@ -25,7 +25,7 @@ func TestDecodeStore(t *testing.T) { cdc := simapp.MakeTestEncodingConfig().Marshaler dec := simulation.NewDecodeStore(cdc) - grant, err := types.NewFeeAllowanceGrant(granterAddr, granteeAddr, &types.BasicFeeAllowance{ + grant, err := types.NewGrant(granterAddr, granteeAddr, &types.BasicAllowance{ SpendLimit: sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(100))), }) diff --git a/x/feegrant/simulation/genesis.go b/x/feegrant/simulation/genesis.go index 85fadcda41..b078a4abd9 100644 --- a/x/feegrant/simulation/genesis.go +++ b/x/feegrant/simulation/genesis.go @@ -15,8 +15,8 @@ import ( const feegrant = "feegrant" // genFeeGrants returns a slice of randomly generated allowances. -func genFeeGrants(r *rand.Rand, accounts []simtypes.Account) []types.FeeAllowanceGrant { - allowances := make([]types.FeeAllowanceGrant, len(accounts)-1) +func genFeeGrants(r *rand.Rand, accounts []simtypes.Account) []types.Grant { + allowances := make([]types.Grant, len(accounts)-1) for i := 0; i < len(accounts)-1; i++ { granter := accounts[i].Address grantee := accounts[i+1].Address @@ -25,22 +25,22 @@ func genFeeGrants(r *rand.Rand, accounts []simtypes.Account) []types.FeeAllowanc return allowances } -func generateRandomAllowances(granter, grantee sdk.AccAddress, r *rand.Rand) types.FeeAllowanceGrant { - allowances := make([]types.FeeAllowanceGrant, 3) +func generateRandomAllowances(granter, grantee sdk.AccAddress, r *rand.Rand) types.Grant { + allowances := make([]types.Grant, 3) spendLimit := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) periodSpendLimit := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10))) - basic := types.BasicFeeAllowance{ + basic := types.BasicAllowance{ SpendLimit: spendLimit, } - basicAllowance, err := types.NewFeeAllowanceGrant(granter, grantee, &basic) + basicAllowance, err := types.NewGrant(granter, grantee, &basic) if err != nil { panic(err) } allowances[0] = basicAllowance - periodicAllowance, err := types.NewFeeAllowanceGrant(granter, grantee, &types.PeriodicFeeAllowance{ + periodicAllowance, err := types.NewGrant(granter, grantee, &types.PeriodicAllowance{ Basic: basic, PeriodSpendLimit: periodSpendLimit, Period: types.ClockDuration(time.Hour), @@ -50,7 +50,7 @@ func generateRandomAllowances(granter, grantee sdk.AccAddress, r *rand.Rand) typ } allowances[1] = periodicAllowance - filteredAllowance, err := types.NewFeeAllowanceGrant(granter, grantee, &types.AllowedMsgFeeAllowance{ + filteredAllowance, err := types.NewGrant(granter, grantee, &types.AllowedMsgAllowance{ Allowance: basicAllowance.GetAllowance(), AllowedMessages: []string{"/cosmos.gov.v1beta1.MsgSubmitProposal"}, }) @@ -64,7 +64,7 @@ func generateRandomAllowances(granter, grantee sdk.AccAddress, r *rand.Rand) typ // RandomizedGenState generates a random GenesisState for feegrant func RandomizedGenState(simState *module.SimulationState) { - var feegrants []types.FeeAllowanceGrant + var feegrants []types.Grant simState.AppParams.GetOrGenerate( simState.Cdc, feegrant, &feegrants, simState.Rand, diff --git a/x/feegrant/simulation/genesis_test.go b/x/feegrant/simulation/genesis_test.go index 663bbd4393..06298e5782 100644 --- a/x/feegrant/simulation/genesis_test.go +++ b/x/feegrant/simulation/genesis_test.go @@ -36,5 +36,5 @@ func TestRandomizedGenState(t *testing.T) { var feegrantGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &feegrantGenesis) - require.Len(t, feegrantGenesis.FeeAllowances, len(accounts)-1) + require.Len(t, feegrantGenesis.Allowances, len(accounts)-1) } diff --git a/x/feegrant/simulation/operations.go b/x/feegrant/simulation/operations.go index b48ea9feb4..f15b98c455 100644 --- a/x/feegrant/simulation/operations.go +++ b/x/feegrant/simulation/operations.go @@ -24,8 +24,8 @@ const ( ) var ( - TypeMsgGrantFeeAllowance = sdk.MsgTypeURL(&types.MsgGrantFeeAllowance{}) - TypeMsgRevokeFeeAllowance = sdk.MsgTypeURL(&types.MsgRevokeFeeAllowance{}) + TypeMsgGrantFeeAllowance = sdk.MsgTypeURL(&types.MsgGrantAllowance{}) + TypeMsgRevokeFeeAllowance = sdk.MsgTypeURL(&types.MsgRevokeAllowance{}) ) func WeightedOperations( @@ -74,7 +74,7 @@ func SimulateMsgGrantFeeAllowance(ak types.AccountKeeper, bk types.BankKeeper, k return simtypes.NoOpMsg(types.ModuleName, TypeMsgGrantFeeAllowance, "grantee and granter cannot be same"), nil, nil } - if f, _ := k.GetFeeAllowance(ctx, granter.Address, grantee.Address); f != nil { + if f, _ := k.GetAllowance(ctx, granter.Address, grantee.Address); f != nil { return simtypes.NoOpMsg(types.ModuleName, TypeMsgGrantFeeAllowance, "fee allowance exists"), nil, nil } @@ -91,7 +91,7 @@ func SimulateMsgGrantFeeAllowance(ak types.AccountKeeper, bk types.BankKeeper, k return simtypes.NoOpMsg(types.ModuleName, TypeMsgGrantFeeAllowance, "unable to grant empty coins as SpendLimit"), nil, nil } - msg, err := types.NewMsgGrantFeeAllowance(&types.BasicFeeAllowance{ + msg, err := types.NewMsgGrantAllowance(&types.BasicAllowance{ SpendLimit: spendableCoins, Expiration: types.ExpiresAtTime(ctx.BlockTime().Add(30 * time.Hour)), }, granter.Address, grantee.Address) @@ -102,7 +102,7 @@ func SimulateMsgGrantFeeAllowance(ak types.AccountKeeper, bk types.BankKeeper, k txGen := simappparams.MakeTestEncodingConfig().TxConfig svcMsgClientConn := &msgservice.ServiceMsgClientConn{} feegrantMsgClient := types.NewMsgClient(svcMsgClientConn) - _, err = feegrantMsgClient.GrantFeeAllowance(context.Background(), msg) + _, err = feegrantMsgClient.GrantAllowance(context.Background(), msg) if err != nil { return simtypes.NoOpMsg(types.ModuleName, TypeMsgGrantFeeAllowance, err.Error()), nil, err } @@ -139,7 +139,7 @@ func SimulateMsgRevokeFeeAllowance(ak types.AccountKeeper, bk types.BankKeeper, hasGrant := false var granterAddr sdk.AccAddress var granteeAddr sdk.AccAddress - k.IterateAllFeeAllowances(ctx, func(grant types.FeeAllowanceGrant) bool { + k.IterateAllFeeAllowances(ctx, func(grant types.Grant) bool { granter, err := sdk.AccAddressFromBech32(grant.Granter) if err != nil { @@ -171,12 +171,12 @@ func SimulateMsgRevokeFeeAllowance(ak types.AccountKeeper, bk types.BankKeeper, return simtypes.NoOpMsg(types.ModuleName, TypeMsgRevokeFeeAllowance, err.Error()), nil, err } - msg := types.NewMsgRevokeFeeAllowance(granterAddr, granteeAddr) + msg := types.NewMsgRevokeAllowance(granterAddr, granteeAddr) txGen := simappparams.MakeTestEncodingConfig().TxConfig svcMsgClientConn := &msgservice.ServiceMsgClientConn{} feegrantMsgClient := types.NewMsgClient(svcMsgClientConn) - _, err = feegrantMsgClient.RevokeFeeAllowance(context.Background(), &msg) + _, err = feegrantMsgClient.RevokeAllowance(context.Background(), &msg) if err != nil { return simtypes.NoOpMsg(types.ModuleName, TypeMsgGrantFeeAllowance, err.Error()), nil, err } diff --git a/x/feegrant/simulation/operations_test.go b/x/feegrant/simulation/operations_test.go index 6f2a7f19ec..eff68b2eb5 100644 --- a/x/feegrant/simulation/operations_test.go +++ b/x/feegrant/simulation/operations_test.go @@ -114,7 +114,7 @@ func (suite *SimTestSuite) TestSimulateMsgGrantFeeAllowance() { operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(err) - var msg types.MsgGrantFeeAllowance + var msg types.MsgGrantAllowance suite.app.AppCodec().UnmarshalJSON(operationMsg.Msg, &msg) require.True(operationMsg.OK) @@ -139,11 +139,11 @@ func (suite *SimTestSuite) TestSimulateMsgRevokeFeeAllowance() { granter, grantee := accounts[0], accounts[1] - err := app.FeeGrantKeeper.GrantFeeAllowance( + err := app.FeeGrantKeeper.GrantAllowance( ctx, granter.Address, grantee.Address, - &types.BasicFeeAllowance{ + &types.BasicAllowance{ SpendLimit: feeCoins, Expiration: types.ExpiresAtTime(ctx.BlockTime().Add(30 * time.Hour)), }, @@ -155,7 +155,7 @@ func (suite *SimTestSuite) TestSimulateMsgRevokeFeeAllowance() { operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(err) - var msg types.MsgRevokeFeeAllowance + var msg types.MsgRevokeAllowance suite.app.AppCodec().UnmarshalJSON(operationMsg.Msg, &msg) require.True(operationMsg.OK) diff --git a/x/feegrant/spec/01_concepts.md b/x/feegrant/spec/01_concepts.md index afdd96d254..a209e8d674 100644 --- a/x/feegrant/spec/01_concepts.md +++ b/x/feegrant/spec/01_concepts.md @@ -64,9 +64,8 @@ Example cmd: ./simd tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --from validator-key --fee-account=cosmos1xh44hxt7spr67hqaa7nyx5gnutrz5fraw6grxn --chain-id=testnet --fees="10stake" ``` -## DeductGrantedFeeDecorator - -`feegrant` module also adds a `DeductGrantedFeeDecorator` ante handler. Whenever a transaction is being executed with `granter` field set, then this ante handler will check whether `payer` and `granter` have proper fee allowance grant in state. If it exists the fees will be deducted from the `granter`'s account address. If the `granter` field isn't set then this ante handler works as normal fee deductor. +## Granted Fee Deductions +Fees are deducted from grants in the `x/auth` ante handler. To learn more about how ante handlers work, read the [Auth Module AnteHandlers Guide](../../auth/spec/03_antehandlers.md). ## Gas In order to prevent DoS attacks, using a filtered `x/feegrant` incurs gas. The SDK must assure that the `grantee`'s transactions all conform to the filter set by the `granter`. The SDK does this by iterating over the allowed messages in the filter and charging 10 gas per filtered message. The SDK will then iterate over the messages being sent by the `grantee` to ensure the messages adhere to the filter, also charging 10 gas per message. The SDK will stop iterating and fail the transaction if it finds a message that does not conform to the filter. diff --git a/x/feegrant/spec/04_events.md b/x/feegrant/spec/04_events.md index 021142d390..39a0c7affc 100644 --- a/x/feegrant/spec/04_events.md +++ b/x/feegrant/spec/04_events.md @@ -6,7 +6,7 @@ order: 4 The feegrant module emits the following events: -# Handlers +# Msg Server ### MsgGrantFeeAllowance @@ -30,4 +30,4 @@ The feegrant module emits the following events: | -------- | ------------- | ------------------ | | message | action | use_feegrant | | message | granter | {granterAddress} | -| message | grantee | {granteeAddress} | \ No newline at end of file +| message | grantee | {granteeAddress} | diff --git a/x/feegrant/spec/README.md b/x/feegrant/spec/README.md index 26be4c49f5..5410731b1d 100644 --- a/x/feegrant/spec/README.md +++ b/x/feegrant/spec/README.md @@ -19,7 +19,7 @@ This module allows accounts to grant fee allowances and to use fees from their a - [BasicFeeAllowance](01_concepts.md#basicfeeallowance) - [PeriodicFeeAllowance](01_concepts.md#periodicfeeallowance) - [FeeAccount flag](01_concepts.md#feeaccount-flag) - - [DeductGrantedFeeDecorator](01_concepts.md#deductgrantedfeedecorator) + - [Granted Fee Deductions](01_concepts.md#granted-fee-deductions) - [Gas](01_concepts.md#gas) 2. **[State](02_state.md)** - [FeeAllowance](02_state.md#feeallowance) diff --git a/x/feegrant/types/basic_fee.go b/x/feegrant/types/basic_fee.go index 00054cb04b..0843f81183 100644 --- a/x/feegrant/types/basic_fee.go +++ b/x/feegrant/types/basic_fee.go @@ -7,7 +7,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ FeeAllowanceI = (*BasicFeeAllowance)(nil) +var _ FeeAllowanceI = (*BasicAllowance)(nil) // Accept can use fee payment requested as well as timestamp/height of the current block // to determine whether or not to process this. This is checked in @@ -19,7 +19,7 @@ var _ FeeAllowanceI = (*BasicFeeAllowance)(nil) // // If remove is true (regardless of the error), the FeeAllowance will be deleted from storage // (eg. when it is used up). (See call to RevokeFeeAllowance in Keeper.UseGrantedFees) -func (a *BasicFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { +func (a *BasicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { blockTime := ctx.BlockTime() blockHeight := ctx.BlockHeight() @@ -43,15 +43,15 @@ func (a *BasicFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) // PrepareForExport will adjust the expiration based on export time. In particular, // it will subtract the dumpHeight from any height-based expiration to ensure that // the elapsed number of blocks this allowance is valid for is fixed. -func (a *BasicFeeAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { - return &BasicFeeAllowance{ +func (a *BasicAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { + return &BasicAllowance{ SpendLimit: a.SpendLimit, Expiration: a.Expiration.PrepareForExport(dumpTime, dumpHeight), } } // ValidateBasic implements FeeAllowance and enforces basic sanity checks -func (a BasicFeeAllowance) ValidateBasic() error { +func (a BasicAllowance) ValidateBasic() error { if a.SpendLimit != nil { if !a.SpendLimit.IsValid() { return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "send amount is invalid: %s", a.SpendLimit) diff --git a/x/feegrant/types/basic_fee_test.go b/x/feegrant/types/basic_fee_test.go index 193ddb6638..e93e2e4d73 100644 --- a/x/feegrant/types/basic_fee_test.go +++ b/x/feegrant/types/basic_fee_test.go @@ -23,7 +23,7 @@ func TestBasicFeeValidAllow(t *testing.T) { leftAtom := sdk.NewCoins(sdk.NewInt64Coin("atom", 512)) cases := map[string]struct { - allowance *types.BasicFeeAllowance + allowance *types.BasicAllowance // all other checks are ignored if valid=false fee sdk.Coins blockHeight int64 @@ -32,11 +32,11 @@ func TestBasicFeeValidAllow(t *testing.T) { remains sdk.Coins }{ "empty": { - allowance: &types.BasicFeeAllowance{}, + allowance: &types.BasicAllowance{}, accept: true, }, "small fee without expire": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: atom, }, fee: smallAtom, @@ -45,7 +45,7 @@ func TestBasicFeeValidAllow(t *testing.T) { remains: leftAtom, }, "all fee without expire": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: smallAtom, }, fee: smallAtom, @@ -53,14 +53,14 @@ func TestBasicFeeValidAllow(t *testing.T) { remove: true, }, "wrong fee": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: smallAtom, }, fee: eth, accept: false, }, "non-expired": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -71,7 +71,7 @@ func TestBasicFeeValidAllow(t *testing.T) { remains: leftAtom, }, "expired": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -81,7 +81,7 @@ func TestBasicFeeValidAllow(t *testing.T) { remove: true, }, "fee more than allowed": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -90,7 +90,7 @@ func TestBasicFeeValidAllow(t *testing.T) { accept: false, }, "with out spend limit": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ Expiration: types.ExpiresAtHeight(100), }, fee: bigAtom, @@ -98,7 +98,7 @@ func TestBasicFeeValidAllow(t *testing.T) { accept: true, }, "expired no spend limit": { - allowance: &types.BasicFeeAllowance{ + allowance: &types.BasicAllowance{ Expiration: types.ExpiresAtHeight(100), }, fee: bigAtom, @@ -144,7 +144,7 @@ func TestBasicFeeAllowTime(t *testing.T) { oneHour := now.Add(1 * time.Hour) cases := map[string]struct { - allow *types.BasicFeeAllowance + allow *types.BasicAllowance // all other checks are ignored if valid=false fee sdk.Coins blockTime time.Time @@ -154,12 +154,12 @@ func TestBasicFeeAllowTime(t *testing.T) { remains sdk.Coins }{ "empty": { - allow: &types.BasicFeeAllowance{}, + allow: &types.BasicAllowance{}, valid: true, accept: true, }, "small fee without expire": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: atom, }, valid: true, @@ -169,7 +169,7 @@ func TestBasicFeeAllowTime(t *testing.T) { remains: leftAtom, }, "all fee without expire": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: smallAtom, }, valid: true, @@ -178,7 +178,7 @@ func TestBasicFeeAllowTime(t *testing.T) { remove: true, }, "wrong fee": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: smallAtom, }, valid: true, @@ -186,7 +186,7 @@ func TestBasicFeeAllowTime(t *testing.T) { accept: false, }, "non-expired": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(oneHour), }, @@ -198,7 +198,7 @@ func TestBasicFeeAllowTime(t *testing.T) { remains: leftAtom, }, "expired": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(now), }, @@ -209,7 +209,7 @@ func TestBasicFeeAllowTime(t *testing.T) { remove: true, }, "fee more than allowed": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(oneHour), }, @@ -219,7 +219,7 @@ func TestBasicFeeAllowTime(t *testing.T) { accept: false, }, "without spend limit": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ Expiration: types.ExpiresAtTime(oneHour), }, valid: true, @@ -228,7 +228,7 @@ func TestBasicFeeAllowTime(t *testing.T) { accept: true, }, "expired no spend limit": { - allow: &types.BasicFeeAllowance{ + allow: &types.BasicAllowance{ Expiration: types.ExpiresAtTime(now), }, valid: true, diff --git a/x/feegrant/types/codec.go b/x/feegrant/types/codec.go index a8a0adb695..7b354ffcbe 100644 --- a/x/feegrant/types/codec.go +++ b/x/feegrant/types/codec.go @@ -9,16 +9,16 @@ import ( // RegisterInterfaces registers the interfaces types with the interface registry func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgGrantFeeAllowance{}, - &MsgRevokeFeeAllowance{}, + &MsgGrantAllowance{}, + &MsgRevokeAllowance{}, ) registry.RegisterInterface( "cosmos.feegrant.v1beta1.FeeAllowanceI", (*FeeAllowanceI)(nil), - &BasicFeeAllowance{}, - &PeriodicFeeAllowance{}, - &AllowedMsgFeeAllowance{}, + &BasicAllowance{}, + &PeriodicAllowance{}, + &AllowedMsgAllowance{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/feegrant/types/feegrant.pb.go b/x/feegrant/types/feegrant.pb.go index f28e47d7ff..16e8d9cba3 100644 --- a/x/feegrant/types/feegrant.pb.go +++ b/x/feegrant/types/feegrant.pb.go @@ -32,9 +32,9 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// BasicFeeAllowance implements FeeAllowance with a one-time grant of tokens -// that optionally expires. The delegatee can use up to SpendLimit to cover fees. -type BasicFeeAllowance struct { +// BasicAllowance implements Allowance with a one-time grant of tokens +// that optionally expires. The grantee can use up to SpendLimit to cover fees. +type BasicAllowance struct { // spend_limit specifies the maximum amount of tokens that can be spent // by this allowance and will be updated as tokens are spent. If it is // empty, there is no spend limit and any amount of coins can be spent. @@ -43,18 +43,18 @@ type BasicFeeAllowance struct { Expiration ExpiresAt `protobuf:"bytes,2,opt,name=expiration,proto3" json:"expiration"` } -func (m *BasicFeeAllowance) Reset() { *m = BasicFeeAllowance{} } -func (m *BasicFeeAllowance) String() string { return proto.CompactTextString(m) } -func (*BasicFeeAllowance) ProtoMessage() {} -func (*BasicFeeAllowance) Descriptor() ([]byte, []int) { +func (m *BasicAllowance) Reset() { *m = BasicAllowance{} } +func (m *BasicAllowance) String() string { return proto.CompactTextString(m) } +func (*BasicAllowance) ProtoMessage() {} +func (*BasicAllowance) Descriptor() ([]byte, []int) { return fileDescriptor_7279582900c30aea, []int{0} } -func (m *BasicFeeAllowance) XXX_Unmarshal(b []byte) error { +func (m *BasicAllowance) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *BasicFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *BasicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_BasicFeeAllowance.Marshal(b, m, deterministic) + return xxx_messageInfo_BasicAllowance.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -64,37 +64,37 @@ func (m *BasicFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *BasicFeeAllowance) XXX_Merge(src proto.Message) { - xxx_messageInfo_BasicFeeAllowance.Merge(m, src) +func (m *BasicAllowance) XXX_Merge(src proto.Message) { + xxx_messageInfo_BasicAllowance.Merge(m, src) } -func (m *BasicFeeAllowance) XXX_Size() int { +func (m *BasicAllowance) XXX_Size() int { return m.Size() } -func (m *BasicFeeAllowance) XXX_DiscardUnknown() { - xxx_messageInfo_BasicFeeAllowance.DiscardUnknown(m) +func (m *BasicAllowance) XXX_DiscardUnknown() { + xxx_messageInfo_BasicAllowance.DiscardUnknown(m) } -var xxx_messageInfo_BasicFeeAllowance proto.InternalMessageInfo +var xxx_messageInfo_BasicAllowance proto.InternalMessageInfo -func (m *BasicFeeAllowance) GetSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *BasicAllowance) GetSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.SpendLimit } return nil } -func (m *BasicFeeAllowance) GetExpiration() ExpiresAt { +func (m *BasicAllowance) GetExpiration() ExpiresAt { if m != nil { return m.Expiration } return ExpiresAt{} } -// PeriodicFeeAllowance extends FeeAllowance to allow for both a maximum cap, +// PeriodicAllowance extends Allowance to allow for both a maximum cap, // as well as a limit per time period. -type PeriodicFeeAllowance struct { - // basic specifies a struct of `BasicFeeAllowance` - Basic BasicFeeAllowance `protobuf:"bytes,1,opt,name=basic,proto3" json:"basic"` +type PeriodicAllowance struct { + // basic specifies a struct of `BasicAllowance` + Basic BasicAllowance `protobuf:"bytes,1,opt,name=basic,proto3" json:"basic"` // period specifies the time duration in which period_spend_limit coins can // be spent before that allowance is reset Period Duration `protobuf:"bytes,2,opt,name=period,proto3" json:"period"` @@ -109,18 +109,18 @@ type PeriodicFeeAllowance struct { PeriodReset ExpiresAt `protobuf:"bytes,5,opt,name=period_reset,json=periodReset,proto3" json:"period_reset"` } -func (m *PeriodicFeeAllowance) Reset() { *m = PeriodicFeeAllowance{} } -func (m *PeriodicFeeAllowance) String() string { return proto.CompactTextString(m) } -func (*PeriodicFeeAllowance) ProtoMessage() {} -func (*PeriodicFeeAllowance) Descriptor() ([]byte, []int) { +func (m *PeriodicAllowance) Reset() { *m = PeriodicAllowance{} } +func (m *PeriodicAllowance) String() string { return proto.CompactTextString(m) } +func (*PeriodicAllowance) ProtoMessage() {} +func (*PeriodicAllowance) Descriptor() ([]byte, []int) { return fileDescriptor_7279582900c30aea, []int{1} } -func (m *PeriodicFeeAllowance) XXX_Unmarshal(b []byte) error { +func (m *PeriodicAllowance) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PeriodicFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PeriodicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PeriodicFeeAllowance.Marshal(b, m, deterministic) + return xxx_messageInfo_PeriodicAllowance.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -130,73 +130,73 @@ func (m *PeriodicFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *PeriodicFeeAllowance) XXX_Merge(src proto.Message) { - xxx_messageInfo_PeriodicFeeAllowance.Merge(m, src) +func (m *PeriodicAllowance) XXX_Merge(src proto.Message) { + xxx_messageInfo_PeriodicAllowance.Merge(m, src) } -func (m *PeriodicFeeAllowance) XXX_Size() int { +func (m *PeriodicAllowance) XXX_Size() int { return m.Size() } -func (m *PeriodicFeeAllowance) XXX_DiscardUnknown() { - xxx_messageInfo_PeriodicFeeAllowance.DiscardUnknown(m) +func (m *PeriodicAllowance) XXX_DiscardUnknown() { + xxx_messageInfo_PeriodicAllowance.DiscardUnknown(m) } -var xxx_messageInfo_PeriodicFeeAllowance proto.InternalMessageInfo +var xxx_messageInfo_PeriodicAllowance proto.InternalMessageInfo -func (m *PeriodicFeeAllowance) GetBasic() BasicFeeAllowance { +func (m *PeriodicAllowance) GetBasic() BasicAllowance { if m != nil { return m.Basic } - return BasicFeeAllowance{} + return BasicAllowance{} } -func (m *PeriodicFeeAllowance) GetPeriod() Duration { +func (m *PeriodicAllowance) GetPeriod() Duration { if m != nil { return m.Period } return Duration{} } -func (m *PeriodicFeeAllowance) GetPeriodSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *PeriodicAllowance) GetPeriodSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.PeriodSpendLimit } return nil } -func (m *PeriodicFeeAllowance) GetPeriodCanSpend() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *PeriodicAllowance) GetPeriodCanSpend() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.PeriodCanSpend } return nil } -func (m *PeriodicFeeAllowance) GetPeriodReset() ExpiresAt { +func (m *PeriodicAllowance) GetPeriodReset() ExpiresAt { if m != nil { return m.PeriodReset } return ExpiresAt{} } -// AllowedMsgFeeAllowance creates allowance only for specified message types. -type AllowedMsgFeeAllowance struct { +// AllowedMsgAllowance creates allowance only for specified message types. +type AllowedMsgAllowance struct { // allowance can be any of basic and filtered fee allowance. Allowance *types1.Any `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"` // allowed_messages are the messages for which the grantee has the access. AllowedMessages []string `protobuf:"bytes,2,rep,name=allowed_messages,json=allowedMessages,proto3" json:"allowed_messages,omitempty"` } -func (m *AllowedMsgFeeAllowance) Reset() { *m = AllowedMsgFeeAllowance{} } -func (m *AllowedMsgFeeAllowance) String() string { return proto.CompactTextString(m) } -func (*AllowedMsgFeeAllowance) ProtoMessage() {} -func (*AllowedMsgFeeAllowance) Descriptor() ([]byte, []int) { +func (m *AllowedMsgAllowance) Reset() { *m = AllowedMsgAllowance{} } +func (m *AllowedMsgAllowance) String() string { return proto.CompactTextString(m) } +func (*AllowedMsgAllowance) ProtoMessage() {} +func (*AllowedMsgAllowance) Descriptor() ([]byte, []int) { return fileDescriptor_7279582900c30aea, []int{2} } -func (m *AllowedMsgFeeAllowance) XXX_Unmarshal(b []byte) error { +func (m *AllowedMsgAllowance) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *AllowedMsgFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AllowedMsgAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_AllowedMsgFeeAllowance.Marshal(b, m, deterministic) + return xxx_messageInfo_AllowedMsgAllowance.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -206,17 +206,17 @@ func (m *AllowedMsgFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *AllowedMsgFeeAllowance) XXX_Merge(src proto.Message) { - xxx_messageInfo_AllowedMsgFeeAllowance.Merge(m, src) +func (m *AllowedMsgAllowance) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllowedMsgAllowance.Merge(m, src) } -func (m *AllowedMsgFeeAllowance) XXX_Size() int { +func (m *AllowedMsgAllowance) XXX_Size() int { return m.Size() } -func (m *AllowedMsgFeeAllowance) XXX_DiscardUnknown() { - xxx_messageInfo_AllowedMsgFeeAllowance.DiscardUnknown(m) +func (m *AllowedMsgAllowance) XXX_DiscardUnknown() { + xxx_messageInfo_AllowedMsgAllowance.DiscardUnknown(m) } -var xxx_messageInfo_AllowedMsgFeeAllowance proto.InternalMessageInfo +var xxx_messageInfo_AllowedMsgAllowance proto.InternalMessageInfo // Duration is a span of a clock time or number of blocks. // This is designed to be added to an ExpiresAt struct. @@ -396,25 +396,28 @@ func (*ExpiresAt) XXX_OneofWrappers() []interface{} { } } -// FeeAllowanceGrant is stored in the KVStore to record a grant with full context -type FeeAllowanceGrant struct { - Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` - Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` +// Grant is stored in the KVStore to record a grant with full context +type Grant struct { + // granter is the address of the user granting an allowance of their funds. + Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` + // grantee is the address of the user being granted an allowance of another user's funds. + Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` + // allowance can be any of basic and filtered fee allowance. Allowance *types1.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"` } -func (m *FeeAllowanceGrant) Reset() { *m = FeeAllowanceGrant{} } -func (m *FeeAllowanceGrant) String() string { return proto.CompactTextString(m) } -func (*FeeAllowanceGrant) ProtoMessage() {} -func (*FeeAllowanceGrant) Descriptor() ([]byte, []int) { +func (m *Grant) Reset() { *m = Grant{} } +func (m *Grant) String() string { return proto.CompactTextString(m) } +func (*Grant) ProtoMessage() {} +func (*Grant) Descriptor() ([]byte, []int) { return fileDescriptor_7279582900c30aea, []int{5} } -func (m *FeeAllowanceGrant) XXX_Unmarshal(b []byte) error { +func (m *Grant) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *FeeAllowanceGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_FeeAllowanceGrant.Marshal(b, m, deterministic) + return xxx_messageInfo_Grant.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -424,33 +427,33 @@ func (m *FeeAllowanceGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *FeeAllowanceGrant) XXX_Merge(src proto.Message) { - xxx_messageInfo_FeeAllowanceGrant.Merge(m, src) +func (m *Grant) XXX_Merge(src proto.Message) { + xxx_messageInfo_Grant.Merge(m, src) } -func (m *FeeAllowanceGrant) XXX_Size() int { +func (m *Grant) XXX_Size() int { return m.Size() } -func (m *FeeAllowanceGrant) XXX_DiscardUnknown() { - xxx_messageInfo_FeeAllowanceGrant.DiscardUnknown(m) +func (m *Grant) XXX_DiscardUnknown() { + xxx_messageInfo_Grant.DiscardUnknown(m) } -var xxx_messageInfo_FeeAllowanceGrant proto.InternalMessageInfo +var xxx_messageInfo_Grant proto.InternalMessageInfo -func (m *FeeAllowanceGrant) GetGranter() string { +func (m *Grant) GetGranter() string { if m != nil { return m.Granter } return "" } -func (m *FeeAllowanceGrant) GetGrantee() string { +func (m *Grant) GetGrantee() string { if m != nil { return m.Grantee } return "" } -func (m *FeeAllowanceGrant) GetAllowance() *types1.Any { +func (m *Grant) GetAllowance() *types1.Any { if m != nil { return m.Allowance } @@ -458,12 +461,12 @@ func (m *FeeAllowanceGrant) GetAllowance() *types1.Any { } func init() { - proto.RegisterType((*BasicFeeAllowance)(nil), "cosmos.feegrant.v1beta1.BasicFeeAllowance") - proto.RegisterType((*PeriodicFeeAllowance)(nil), "cosmos.feegrant.v1beta1.PeriodicFeeAllowance") - proto.RegisterType((*AllowedMsgFeeAllowance)(nil), "cosmos.feegrant.v1beta1.AllowedMsgFeeAllowance") + proto.RegisterType((*BasicAllowance)(nil), "cosmos.feegrant.v1beta1.BasicAllowance") + proto.RegisterType((*PeriodicAllowance)(nil), "cosmos.feegrant.v1beta1.PeriodicAllowance") + proto.RegisterType((*AllowedMsgAllowance)(nil), "cosmos.feegrant.v1beta1.AllowedMsgAllowance") proto.RegisterType((*Duration)(nil), "cosmos.feegrant.v1beta1.Duration") proto.RegisterType((*ExpiresAt)(nil), "cosmos.feegrant.v1beta1.ExpiresAt") - proto.RegisterType((*FeeAllowanceGrant)(nil), "cosmos.feegrant.v1beta1.FeeAllowanceGrant") + proto.RegisterType((*Grant)(nil), "cosmos.feegrant.v1beta1.Grant") } func init() { @@ -471,51 +474,51 @@ func init() { } var fileDescriptor_7279582900c30aea = []byte{ - // 650 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xc7, 0x93, 0xa5, 0x1b, 0xab, 0xcb, 0xcb, 0x6a, 0x0d, 0xc8, 0x76, 0x48, 0x47, 0x0f, 0xa8, - 0x20, 0x2d, 0x61, 0x43, 0xe2, 0x30, 0x09, 0xa1, 0x65, 0xec, 0x05, 0xc1, 0x24, 0x14, 0x38, 0x71, - 0xa9, 0x9c, 0xc4, 0x4b, 0xc3, 0x92, 0x38, 0x8a, 0x5d, 0x58, 0xbf, 0x01, 0x27, 0xb4, 0x23, 0x47, - 0xb8, 0x72, 0xe6, 0x43, 0x4c, 0x9c, 0x26, 0x4e, 0x9c, 0x36, 0xd4, 0x7e, 0x02, 0xbe, 0x01, 0x8a,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0x34, 0x7c, 0xfb, 0xf9, 0x29, 0x76, 0xe7, 0x38, 0xf4, 0xfe, 0xaf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xfc, 0x05, 0xa9, 0xc7, 0x1b, 0x06, 0x00, 0x00, + // 645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xb6, 0xeb, 0xa4, 0x34, 0x17, 0x28, 0xed, 0x51, 0x84, 0xdb, 0xc1, 0x29, 0x19, 0x20, 0x0c, + 0xb5, 0x69, 0x91, 0x18, 0x2a, 0x21, 0x54, 0x97, 0xd2, 0x22, 0xa8, 0x84, 0x0c, 0x13, 0x4b, 0x74, + 0xb6, 0xaf, 0xae, 0xa9, 0xed, 0xb3, 0x7c, 0x17, 0x68, 0x56, 0x26, 0xc6, 0x8e, 0x4c, 0x88, 0x99, + 0x99, 0x3f, 0xa2, 0x62, 0xaa, 0x98, 0x90, 0x90, 0x28, 0x6a, 0x46, 0xfe, 0x09, 0xe4, 0xbb, 0xb3, + 0x1d, 0x12, 0x82, 0x04, 0xea, 0x64, 0xbf, 0x7b, 0xef, 0xfb, 0xbe, 0xf7, 0xeb, 0x0e, 0xdc, 0xf0, + 0x08, 0x8d, 0x09, 0xb5, 0xf6, 0x30, 0x0e, 0x32, 0x94, 0x30, 0xeb, 0xd5, 0xaa, 0x8b, 0x19, 0x5a, + 0x2d, 0x0f, 0xcc, 0x34, 0x23, 0x8c, 0xc0, 0x6b, 0x22, 0xce, 0x2c, 0x8f, 0x65, 0xdc, 0xd2, 0x42, + 0x40, 0x02, 0xc2, 0x63, 0xac, 0xfc, 0x4f, 0x84, 0x2f, 0x2d, 0x06, 0x84, 0x04, 0x11, 0xb6, 0xb8, + 0xe5, 0xf6, 0xf6, 0x2c, 0x94, 0xf4, 0x0b, 0x97, 0x60, 0xea, 0x0a, 0x8c, 0x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 0xeb, 0x40, 0xa3, 0xbd, 0xb8, 0xed, 0x83, + 0x46, 0xd9, 0x3f, 0x78, 0x17, 0xd4, 0xf2, 0x87, 0x41, 0x0a, 0x2d, 0x8d, 0x09, 0x3d, 0x2f, 0x5e, + 0x0d, 0xbb, 0x76, 0x24, 0x94, 0x78, 0x7c, 0xae, 0xb2, 0x8f, 0xc3, 0x60, 0x9f, 0x71, 0x15, 0x2d, + 0x57, 0x11, 0x76, 0xa1, 0xf2, 0x46, 0x05, 0xf5, 0xed, 0x7c, 0x68, 0x50, 0x07, 0x17, 0xf8, 0xf4, + 0x70, 0xc6, 0x55, 0x1a, 0x4e, 0x61, 0x56, 0x1e, 0xcc, 0x59, 0x4a, 0xcf, 0xc8, 0x60, 0xb4, 0xff, + 0x1d, 0x8c, 0xbd, 0x7d, 0x7c, 0x66, 0xa8, 0x27, 0x67, 0x86, 0xfa, 0xe3, 0xcc, 0x50, 0x8f, 0x06, + 0x86, 0x72, 0x32, 0x30, 0x94, 0xaf, 0x03, 0x43, 0x79, 0xb1, 0xf2, 0xd7, 0x5d, 0x3d, 0xac, 0xde, + 0x78, 0xbe, 0xb6, 0xee, 0x34, 0x17, 0xbd, 0xf3, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x4c, 0xb0, + 0x35, 0x03, 0x06, 0x00, 0x00, } -func (m *BasicFeeAllowance) Marshal() (dAtA []byte, err error) { +func (m *BasicAllowance) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -525,12 +528,12 @@ func (m *BasicFeeAllowance) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BasicFeeAllowance) MarshalTo(dAtA []byte) (int, error) { +func (m *BasicAllowance) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BasicFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *BasicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -562,7 +565,7 @@ func (m *BasicFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PeriodicFeeAllowance) Marshal() (dAtA []byte, err error) { +func (m *PeriodicAllowance) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -572,12 +575,12 @@ func (m *PeriodicFeeAllowance) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PeriodicFeeAllowance) MarshalTo(dAtA []byte) (int, error) { +func (m *PeriodicAllowance) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PeriodicFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PeriodicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -643,7 +646,7 @@ func (m *PeriodicFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AllowedMsgFeeAllowance) Marshal() (dAtA []byte, err error) { +func (m *AllowedMsgAllowance) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -653,12 +656,12 @@ func (m *AllowedMsgFeeAllowance) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AllowedMsgFeeAllowance) MarshalTo(dAtA []byte) (int, error) { +func (m *AllowedMsgAllowance) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AllowedMsgFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AllowedMsgAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -813,7 +816,7 @@ func (m *ExpiresAt_Height) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 return len(dAtA) - i, nil } -func (m *FeeAllowanceGrant) Marshal() (dAtA []byte, err error) { +func (m *Grant) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -823,12 +826,12 @@ func (m *FeeAllowanceGrant) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *FeeAllowanceGrant) MarshalTo(dAtA []byte) (int, error) { +func (m *Grant) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *FeeAllowanceGrant) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -873,7 +876,7 @@ func encodeVarintFeegrant(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *BasicFeeAllowance) Size() (n int) { +func (m *BasicAllowance) Size() (n int) { if m == nil { return 0 } @@ -890,7 +893,7 @@ func (m *BasicFeeAllowance) Size() (n int) { return n } -func (m *PeriodicFeeAllowance) Size() (n int) { +func (m *PeriodicAllowance) Size() (n int) { if m == nil { return 0 } @@ -917,7 +920,7 @@ func (m *PeriodicFeeAllowance) Size() (n int) { return n } -func (m *AllowedMsgFeeAllowance) Size() (n int) { +func (m *AllowedMsgAllowance) Size() (n int) { if m == nil { return 0 } @@ -1002,7 +1005,7 @@ func (m *ExpiresAt_Height) Size() (n int) { n += 1 + sovFeegrant(uint64(m.Height)) return n } -func (m *FeeAllowanceGrant) Size() (n int) { +func (m *Grant) Size() (n int) { if m == nil { return 0 } @@ -1029,7 +1032,7 @@ func sovFeegrant(x uint64) (n int) { func sozFeegrant(x uint64) (n int) { return sovFeegrant(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *BasicFeeAllowance) Unmarshal(dAtA []byte) error { +func (m *BasicAllowance) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1052,10 +1055,10 @@ func (m *BasicFeeAllowance) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BasicFeeAllowance: wiretype end group for non-group") + return fmt.Errorf("proto: BasicAllowance: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BasicFeeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BasicAllowance: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1146,7 +1149,7 @@ func (m *BasicFeeAllowance) Unmarshal(dAtA []byte) error { } return nil } -func (m *PeriodicFeeAllowance) Unmarshal(dAtA []byte) error { +func (m *PeriodicAllowance) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1169,10 +1172,10 @@ func (m *PeriodicFeeAllowance) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PeriodicFeeAllowance: wiretype end group for non-group") + return fmt.Errorf("proto: PeriodicAllowance: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PeriodicFeeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PeriodicAllowance: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1363,7 +1366,7 @@ func (m *PeriodicFeeAllowance) Unmarshal(dAtA []byte) error { } return nil } -func (m *AllowedMsgFeeAllowance) Unmarshal(dAtA []byte) error { +func (m *AllowedMsgAllowance) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1386,10 +1389,10 @@ func (m *AllowedMsgFeeAllowance) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AllowedMsgFeeAllowance: wiretype end group for non-group") + return fmt.Errorf("proto: AllowedMsgAllowance: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AllowedMsgFeeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AllowedMsgAllowance: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1691,7 +1694,7 @@ func (m *ExpiresAt) Unmarshal(dAtA []byte) error { } return nil } -func (m *FeeAllowanceGrant) Unmarshal(dAtA []byte) error { +func (m *Grant) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1714,10 +1717,10 @@ func (m *FeeAllowanceGrant) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FeeAllowanceGrant: wiretype end group for non-group") + return fmt.Errorf("proto: Grant: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FeeAllowanceGrant: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Grant: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/feegrant/types/filtered_fee.go b/x/feegrant/types/filtered_fee.go index 3cef6d2408..02de763928 100644 --- a/x/feegrant/types/filtered_fee.go +++ b/x/feegrant/types/filtered_fee.go @@ -15,17 +15,17 @@ const ( gasCostPerIteration = uint64(10) ) -var _ FeeAllowanceI = (*AllowedMsgFeeAllowance)(nil) -var _ types.UnpackInterfacesMessage = (*AllowedMsgFeeAllowance)(nil) +var _ FeeAllowanceI = (*AllowedMsgAllowance)(nil) +var _ types.UnpackInterfacesMessage = (*AllowedMsgAllowance)(nil) // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (a *AllowedMsgFeeAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(a.Allowance, &allowance) } // NewAllowedMsgFeeAllowance creates new filtered fee allowance. -func NewAllowedMsgFeeAllowance(allowance FeeAllowanceI, allowedMsgs []string) (*AllowedMsgFeeAllowance, error) { +func NewAllowedMsgAllowance(allowance FeeAllowanceI, allowedMsgs []string) (*AllowedMsgAllowance, error) { msg, ok := allowance.(proto.Message) if !ok { return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", msg) @@ -35,14 +35,14 @@ func NewAllowedMsgFeeAllowance(allowance FeeAllowanceI, allowedMsgs []string) (* return nil, err } - return &AllowedMsgFeeAllowance{ + return &AllowedMsgAllowance{ Allowance: any, AllowedMessages: allowedMsgs, }, nil } // GetAllowance returns allowed fee allowance. -func (a *AllowedMsgFeeAllowance) GetAllowance() (FeeAllowanceI, error) { +func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error) { allowance, ok := a.Allowance.GetCachedValue().(FeeAllowanceI) if !ok { return nil, sdkerrors.Wrap(ErrNoAllowance, "failed to get allowance") @@ -52,7 +52,7 @@ func (a *AllowedMsgFeeAllowance) GetAllowance() (FeeAllowanceI, error) { } // Accept method checks for the filtered messages has valid expiry -func (a *AllowedMsgFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error) { +func (a *AllowedMsgAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error) { if !a.allMsgTypesAllowed(ctx, msgs) { return false, sdkerrors.Wrap(ErrMessageNotAllowed, "message does not exist in allowed messages") } @@ -65,7 +65,7 @@ func (a *AllowedMsgFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []s return allowance.Accept(ctx, fee, msgs) } -func (a *AllowedMsgFeeAllowance) allowedMsgsToMap(ctx sdk.Context) map[string]bool { +func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx sdk.Context) map[string]bool { msgsMap := make(map[string]bool, len(a.AllowedMessages)) for _, msg := range a.AllowedMessages { ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") @@ -75,7 +75,7 @@ func (a *AllowedMsgFeeAllowance) allowedMsgsToMap(ctx sdk.Context) map[string]bo return msgsMap } -func (a *AllowedMsgFeeAllowance) allMsgTypesAllowed(ctx sdk.Context, msgs []sdk.Msg) bool { +func (a *AllowedMsgAllowance) allMsgTypesAllowed(ctx sdk.Context, msgs []sdk.Msg) bool { msgsMap := a.allowedMsgsToMap(ctx) for _, msg := range msgs { @@ -91,13 +91,13 @@ func (a *AllowedMsgFeeAllowance) allMsgTypesAllowed(ctx sdk.Context, msgs []sdk. // PrepareForExport will adjust the expiration based on export time. In particular, // it will subtract the dumpHeight from any height-based expiration to ensure that // the elapsed number of blocks this allowance is valid for is fixed. -func (a *AllowedMsgFeeAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { +func (a *AllowedMsgAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { allowance, err := a.GetAllowance() if err != nil { panic("failed to get allowance") } - f, err := NewAllowedMsgFeeAllowance(allowance.PrepareForExport(dumpTime, dumpHeight), a.AllowedMessages) + f, err := NewAllowedMsgAllowance(allowance.PrepareForExport(dumpTime, dumpHeight), a.AllowedMessages) if err != nil { panic("failed to export filtered fee allowance") } @@ -106,7 +106,7 @@ func (a *AllowedMsgFeeAllowance) PrepareForExport(dumpTime time.Time, dumpHeight } // ValidateBasic implements FeeAllowance and enforces basic sanity checks -func (a *AllowedMsgFeeAllowance) ValidateBasic() error { +func (a *AllowedMsgAllowance) ValidateBasic() error { if a.Allowance == nil { return sdkerrors.Wrap(ErrNoAllowance, "allowance should not be empty") } diff --git a/x/feegrant/types/genesis.go b/x/feegrant/types/genesis.go index 0d72dc8b18..78472b90a9 100644 --- a/x/feegrant/types/genesis.go +++ b/x/feegrant/types/genesis.go @@ -5,16 +5,16 @@ import "github.com/cosmos/cosmos-sdk/codec/types" var _ types.UnpackInterfacesMessage = GenesisState{} // NewGenesisState creates new GenesisState object -func NewGenesisState(entries []FeeAllowanceGrant) *GenesisState { +func NewGenesisState(entries []Grant) *GenesisState { return &GenesisState{ - FeeAllowances: entries, + Allowances: entries, } } // ValidateGenesis ensures all grants in the genesis state are valid func ValidateGenesis(data GenesisState) error { - for _, f := range data.FeeAllowances { - grant, err := f.GetFeeGrant() + for _, f := range data.Allowances { + grant, err := f.GetGrant() if err != nil { return err } @@ -33,7 +33,7 @@ func DefaultGenesisState() *GenesisState { // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, f := range data.FeeAllowances { + for _, f := range data.Allowances { err := f.UnpackInterfaces(unpacker) if err != nil { return err diff --git a/x/feegrant/types/genesis.pb.go b/x/feegrant/types/genesis.pb.go index 499f57d626..3a9a991024 100644 --- a/x/feegrant/types/genesis.pb.go +++ b/x/feegrant/types/genesis.pb.go @@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState contains a set of fee allowances, persisted from the store type GenesisState struct { - FeeAllowances []FeeAllowanceGrant `protobuf:"bytes,1,rep,name=fee_allowances,json=feeAllowances,proto3" json:"fee_allowances"` + Allowances []Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -61,9 +61,9 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetFeeAllowances() []FeeAllowanceGrant { +func (m *GenesisState) GetAllowances() []Grant { if m != nil { - return m.FeeAllowances + return m.Allowances } return nil } @@ -77,21 +77,20 @@ func init() { } var fileDescriptor_ac719d2d0954d1bf = []byte{ - // 221 bytes of a gzipped FileDescriptorProto + // 208 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xce, 0x2f, 0xce, 0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41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0xe1, 0xc6, 0x80, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x53, 0x6e, 0xc5, 0x38, 0x01, 0x00, 0x00, + 0xa7, 0x14, 0xc2, 0xc5, 0xe3, 0x0e, 0xb1, 0x27, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x85, 0x8b, + 0x2b, 0x31, 0x27, 0x27, 0xbf, 0x3c, 0x31, 0x2f, 0x39, 0xb5, 0x58, 0x82, 0x51, 0x81, 0x59, 0x83, + 0xdb, 0x48, 0x4e, 0x0f, 0x87, 0xdd, 0x7a, 0xee, 0x20, 0x9e, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, + 0x41, 0x48, 0xfa, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, + 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, + 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xea, 0x44, 0x08, 0xa5, + 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x81, 0x70, 0x6f, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, + 0x95, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xe8, 0xa0, 0x07, 0x25, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -114,10 +113,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FeeAllowances) > 0 { - for iNdEx := len(m.FeeAllowances) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Allowances) > 0 { + for iNdEx := len(m.Allowances) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.FeeAllowances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Allowances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -148,8 +147,8 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - if len(m.FeeAllowances) > 0 { - for _, e := range m.FeeAllowances { + if len(m.Allowances) > 0 { + for _, e := range m.Allowances { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -194,7 +193,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeAllowances", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Allowances", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -221,8 +220,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FeeAllowances = append(m.FeeAllowances, FeeAllowanceGrant{}) - if err := m.FeeAllowances[len(m.FeeAllowances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Allowances = append(m.Allowances, Grant{}) + if err := m.Allowances[len(m.Allowances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/feegrant/types/grant.go b/x/feegrant/types/grant.go index 1c92080be3..3834ba5df5 100644 --- a/x/feegrant/types/grant.go +++ b/x/feegrant/types/grant.go @@ -3,7 +3,7 @@ package types import ( "time" - proto "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,23 +11,23 @@ import ( ) var ( - _ types.UnpackInterfacesMessage = &FeeAllowanceGrant{} + _ types.UnpackInterfacesMessage = &Grant{} ) -// NewFeeAllowanceGrant creates a new FeeAllowanceGrant. +// NewGrant creates a new FeeAllowanceGrant. //nolint:interfacer -func NewFeeAllowanceGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllowanceI) (FeeAllowanceGrant, error) { +func NewGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllowanceI) (Grant, error) { msg, ok := feeAllowance.(proto.Message) if !ok { - return FeeAllowanceGrant{}, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", feeAllowance) + return Grant{}, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", feeAllowance) } any, err := types.NewAnyWithValue(msg) if err != nil { - return FeeAllowanceGrant{}, err + return Grant{}, err } - return FeeAllowanceGrant{ + return Grant{ Granter: granter.String(), Grantee: grantee.String(), Allowance: any, @@ -36,7 +36,7 @@ func NewFeeAllowanceGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllow // ValidateBasic performs basic validation on // FeeAllowanceGrant -func (a FeeAllowanceGrant) ValidateBasic() error { +func (a Grant) ValidateBasic() error { if a.Granter == "" { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing granter address") } @@ -47,7 +47,7 @@ func (a FeeAllowanceGrant) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "cannot self-grant fee authorization") } - f, err := a.GetFeeGrant() + f, err := a.GetGrant() if err != nil { return err } @@ -55,8 +55,8 @@ func (a FeeAllowanceGrant) ValidateBasic() error { return f.ValidateBasic() } -// GetFeeGrant unpacks allowance -func (a FeeAllowanceGrant) GetFeeGrant() (FeeAllowanceI, error) { +// GetGrant unpacks allowance +func (a Grant) GetGrant() (FeeAllowanceI, error) { allowance, ok := a.Allowance.GetCachedValue().(FeeAllowanceI) if !ok { return nil, sdkerrors.Wrap(ErrNoAllowance, "failed to get allowance") @@ -66,37 +66,37 @@ func (a FeeAllowanceGrant) GetFeeGrant() (FeeAllowanceI, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (a FeeAllowanceGrant) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (a Grant) UnpackInterfaces(unpacker types.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(a.Allowance, &allowance) } // PrepareForExport will make all needed changes to the allowance to prepare to be // re-imported at height 0, and return a copy of this grant. -func (a FeeAllowanceGrant) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceGrant { - f, err := a.GetFeeGrant() +func (a Grant) PrepareForExport(dumpTime time.Time, dumpHeight int64) Grant { + f, err := a.GetGrant() if err != nil { - return FeeAllowanceGrant{} + return Grant{} } feegrant := f.PrepareForExport(dumpTime, dumpHeight) if feegrant == nil { - return FeeAllowanceGrant{} + return Grant{} } granter, err := sdk.AccAddressFromBech32(a.Granter) if err != nil { - return FeeAllowanceGrant{} + return Grant{} } grantee, err := sdk.AccAddressFromBech32(a.Grantee) if err != nil { - return FeeAllowanceGrant{} + return Grant{} } - grant, err := NewFeeAllowanceGrant(granter, grantee, feegrant) + grant, err := NewGrant(granter, grantee, feegrant) if err != nil { - return FeeAllowanceGrant{} + return Grant{} } return grant diff --git a/x/feegrant/types/grant_test.go b/x/feegrant/types/grant_test.go index 769f762896..a0b630aa4f 100644 --- a/x/feegrant/types/grant_test.go +++ b/x/feegrant/types/grant_test.go @@ -75,7 +75,7 @@ func TestGrant(t *testing.T) { for name, tc := range cases { tc := tc t.Run(name, func(t *testing.T) { - grant, err := types.NewFeeAllowanceGrant(tc.granter, tc.grantee, &types.BasicFeeAllowance{ + grant, err := types.NewGrant(tc.granter, tc.grantee, &types.BasicAllowance{ SpendLimit: tc.limit, Expiration: tc.expires, }) @@ -91,7 +91,7 @@ func TestGrant(t *testing.T) { // if it is valid, let's try to serialize, deserialize, and make sure it matches bz, err := cdc.Marshal(&grant) require.NoError(t, err) - var loaded types.FeeAllowanceGrant + var loaded types.Grant err = cdc.Unmarshal(bz, &loaded) require.NoError(t, err) diff --git a/x/feegrant/types/msgs.go b/x/feegrant/types/msgs.go index 9fb80cff85..6beb201544 100644 --- a/x/feegrant/types/msgs.go +++ b/x/feegrant/types/msgs.go @@ -9,13 +9,13 @@ import ( ) var ( - _, _ sdk.Msg = &MsgGrantFeeAllowance{}, &MsgRevokeFeeAllowance{} - _ types.UnpackInterfacesMessage = &MsgGrantFeeAllowance{} + _, _ sdk.Msg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} + _ types.UnpackInterfacesMessage = &MsgGrantAllowance{} ) -// NewMsgGrantFeeAllowance creates a new MsgGrantFeeAllowance. +// NewMsgGrantAllowance creates a new MsgGrantFeeAllowance. //nolint:interfacer -func NewMsgGrantFeeAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.AccAddress) (*MsgGrantFeeAllowance, error) { +func NewMsgGrantAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.AccAddress) (*MsgGrantAllowance, error) { msg, ok := feeAllowance.(proto.Message) if !ok { return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", msg) @@ -25,7 +25,7 @@ func NewMsgGrantFeeAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.Ac return nil, err } - return &MsgGrantFeeAllowance{ + return &MsgGrantAllowance{ Granter: granter.String(), Grantee: grantee.String(), Allowance: any, @@ -33,7 +33,7 @@ func NewMsgGrantFeeAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.Ac } // ValidateBasic implements the sdk.Msg interface. -func (msg MsgGrantFeeAllowance) ValidateBasic() error { +func (msg MsgGrantAllowance) ValidateBasic() error { if msg.Granter == "" { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing granter address") } @@ -53,7 +53,7 @@ func (msg MsgGrantFeeAllowance) ValidateBasic() error { } // GetSigners gets the granter account associated with an allowance -func (msg MsgGrantFeeAllowance) GetSigners() []sdk.AccAddress { +func (msg MsgGrantAllowance) GetSigners() []sdk.AccAddress { granter, err := sdk.AccAddressFromBech32(msg.Granter) if err != nil { panic(err) @@ -62,7 +62,7 @@ func (msg MsgGrantFeeAllowance) GetSigners() []sdk.AccAddress { } // GetFeeAllowanceI returns unpacked FeeAllowance -func (msg MsgGrantFeeAllowance) GetFeeAllowanceI() (FeeAllowanceI, error) { +func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error) { allowance, ok := msg.Allowance.GetCachedValue().(FeeAllowanceI) if !ok { return nil, sdkerrors.Wrap(ErrNoAllowance, "failed to get allowance") @@ -72,19 +72,20 @@ func (msg MsgGrantFeeAllowance) GetFeeAllowanceI() (FeeAllowanceI, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgGrantFeeAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(msg.Allowance, &allowance) } -// NewMsgRevokeFeeAllowance returns a message to revoke a fee allowance for a given +// NewMsgRevokeAllowance returns a message to revoke a fee allowance for a given // granter and grantee //nolint:interfacer -func NewMsgRevokeFeeAllowance(granter sdk.AccAddress, grantee sdk.AccAddress) MsgRevokeFeeAllowance { - return MsgRevokeFeeAllowance{Granter: granter.String(), Grantee: grantee.String()} +func NewMsgRevokeAllowance(granter sdk.AccAddress, grantee sdk.AccAddress) MsgRevokeAllowance { + return MsgRevokeAllowance{Granter: granter.String(), Grantee: grantee.String()} } -func (msg MsgRevokeFeeAllowance) ValidateBasic() error { +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgRevokeAllowance) ValidateBasic() error { if msg.Granter == "" { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing granter address") } @@ -100,7 +101,7 @@ func (msg MsgRevokeFeeAllowance) ValidateBasic() error { // GetSigners gets the granter address associated with an Allowance // to revoke. -func (msg MsgRevokeFeeAllowance) GetSigners() []sdk.AccAddress { +func (msg MsgRevokeAllowance) GetSigners() []sdk.AccAddress { granter, err := sdk.AccAddressFromBech32(msg.Granter) if err != nil { panic(err) diff --git a/x/feegrant/types/msgs_test.go b/x/feegrant/types/msgs_test.go index 57d103fc2e..05ac101f94 100644 --- a/x/feegrant/types/msgs_test.go +++ b/x/feegrant/types/msgs_test.go @@ -15,14 +15,14 @@ func TestMsgGrantFeeAllowance(t *testing.T) { addr, _ := sdk.AccAddressFromBech32("cosmos1aeuqja06474dfrj7uqsvukm6rael982kk89mqr") addr2, _ := sdk.AccAddressFromBech32("cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl") atom := sdk.NewCoins(sdk.NewInt64Coin("atom", 555)) - basic := &types.BasicFeeAllowance{ + basic := &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(time.Now().Add(3 * time.Hour)), } cases := map[string]struct { grantee sdk.AccAddress granter sdk.AccAddress - grant *types.BasicFeeAllowance + grant *types.BasicAllowance valid bool }{ "valid":{ @@ -52,7 +52,7 @@ func TestMsgGrantFeeAllowance(t *testing.T) { } for _,tc := range cases { - msg, err := types.NewMsgGrantFeeAllowance(tc.grant, tc.granter, tc.grantee) + msg, err := types.NewMsgGrantAllowance(tc.grant, tc.granter, tc.grantee) require.NoError(t, err) err = msg.ValidateBasic() @@ -78,14 +78,14 @@ func TestMsgRevokeFeeAllowance(t *testing.T) { addr, _ := sdk.AccAddressFromBech32("cosmos1aeuqja06474dfrj7uqsvukm6rael982kk89mqr") addr2, _ := sdk.AccAddressFromBech32("cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl") atom := sdk.NewCoins(sdk.NewInt64Coin("atom", 555)) - basic := &types.BasicFeeAllowance{ + basic := &types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(time.Now().Add(3 * time.Hour)), } cases := map[string]struct { grantee sdk.AccAddress granter sdk.AccAddress - grant *types.BasicFeeAllowance + grant *types.BasicAllowance valid bool }{ "valid":{ @@ -115,7 +115,7 @@ func TestMsgRevokeFeeAllowance(t *testing.T) { } for _,tc := range cases { - msg := types.NewMsgRevokeFeeAllowance(tc.granter, tc.grantee) + msg := types.NewMsgRevokeAllowance(tc.granter, tc.grantee) err := msg.ValidateBasic() if tc.valid { require.NoError(t, err) diff --git a/x/feegrant/types/periodic_fee.go b/x/feegrant/types/periodic_fee.go index b20eeae5f0..b62127ef98 100644 --- a/x/feegrant/types/periodic_fee.go +++ b/x/feegrant/types/periodic_fee.go @@ -7,7 +7,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ FeeAllowanceI = (*PeriodicFeeAllowance)(nil) +var _ FeeAllowanceI = (*PeriodicAllowance)(nil) // Accept can use fee payment requested as well as timestamp/height of the current block // to determine whether or not to process this. This is checked in @@ -19,7 +19,7 @@ var _ FeeAllowanceI = (*PeriodicFeeAllowance)(nil) // // If remove is true (regardless of the error), the FeeAllowance will be deleted from storage // (eg. when it is used up). (See call to RevokeFeeAllowance in Keeper.UseGrantedFees) -func (a *PeriodicFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { +func (a *PeriodicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { blockTime := ctx.BlockTime() blockHeight := ctx.BlockHeight() @@ -54,7 +54,7 @@ func (a *PeriodicFeeAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Ms // It will also update the PeriodReset. If we are within one Period, it will update from the // last PeriodReset (eg. if you always do one tx per day, it will always reset the same time) // If we are more then one period out (eg. no activity in a week), reset is one Period from the execution of this method -func (a *PeriodicFeeAllowance) tryResetPeriod(blockTime time.Time, blockHeight int64) { +func (a *PeriodicAllowance) tryResetPeriod(blockTime time.Time, blockHeight int64) { if !a.PeriodReset.Undefined() && !a.PeriodReset.IsExpired(&blockTime, blockHeight) { return } @@ -77,9 +77,9 @@ func (a *PeriodicFeeAllowance) tryResetPeriod(blockTime time.Time, blockHeight i // it will subtract the dumpHeight from any height-based expiration to ensure that // the elapsed number of blocks this allowance is valid for is fixed. // (For PeriodReset and Basic.Expiration) -func (a *PeriodicFeeAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { - return &PeriodicFeeAllowance{ - Basic: BasicFeeAllowance{ +func (a *PeriodicAllowance) PrepareForExport(dumpTime time.Time, dumpHeight int64) FeeAllowanceI { + return &PeriodicAllowance{ + Basic: BasicAllowance{ SpendLimit: a.Basic.SpendLimit, Expiration: a.Basic.Expiration.PrepareForExport(dumpTime, dumpHeight), }, @@ -91,7 +91,7 @@ func (a *PeriodicFeeAllowance) PrepareForExport(dumpTime time.Time, dumpHeight i } // ValidateBasic implements FeeAllowance and enforces basic sanity checks -func (a PeriodicFeeAllowance) ValidateBasic() error { +func (a PeriodicAllowance) ValidateBasic() error { if err := a.Basic.ValidateBasic(); err != nil { return err } diff --git a/x/feegrant/types/periodic_fee_test.go b/x/feegrant/types/periodic_fee_test.go index 9c5659dd2e..5b0e60f6f8 100644 --- a/x/feegrant/types/periodic_fee_test.go +++ b/x/feegrant/types/periodic_fee_test.go @@ -22,7 +22,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) { eth := sdk.NewCoins(sdk.NewInt64Coin("eth", 1)) cases := map[string]struct { - allowance types.PeriodicFeeAllowance + allowance types.PeriodicAllowance // all other checks are ignored if valid=false fee sdk.Coins blockHeight int64 @@ -34,12 +34,12 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset types.ExpiresAt }{ "empty": { - allowance: types.PeriodicFeeAllowance{}, + allowance: types.PeriodicAllowance{}, valid: false, }, "only basic": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -47,7 +47,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) { valid: false, }, "empty basic": { - allowance: types.PeriodicFeeAllowance{ + allowance: types.PeriodicAllowance{ Period: types.BlockDuration(10), PeriodSpendLimit: smallAtom, PeriodReset: types.ExpiresAtHeight(70), @@ -59,8 +59,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset: types.ExpiresAtHeight(80), }, "mismatched currencies": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -70,8 +70,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { valid: false, }, "first time": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -88,8 +88,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset: types.ExpiresAtHeight(85), }, "same period": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -108,8 +108,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset: types.ExpiresAtHeight(80), }, "step one period": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -127,8 +127,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset: types.ExpiresAtHeight(80), // one step from last reset, not now }, "step limited by global allowance": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: smallAtom, Expiration: types.ExpiresAtHeight(100), }, @@ -146,8 +146,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { periodReset: types.ExpiresAtHeight(80), // one step from last reset, not now }, "expired": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -161,8 +161,8 @@ func TestPeriodicFeeValidAllow(t *testing.T) { remove: true, }, "over period limit": { - allowance: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allowance: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, @@ -220,7 +220,7 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { oneHour := now.Add(1 * time.Hour) cases := map[string]struct { - allow types.PeriodicFeeAllowance + allow types.PeriodicAllowance // all other checks are ignored if valid=false fee sdk.Coins blockTime time.Time @@ -232,12 +232,12 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { periodReset types.ExpiresAt }{ "empty": { - allow: types.PeriodicFeeAllowance{}, + allow: types.PeriodicAllowance{}, valid: false, }, "only basic": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(oneHour), }, @@ -245,7 +245,7 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { valid: false, }, "empty basic": { - allow: types.PeriodicFeeAllowance{ + allow: types.PeriodicAllowance{ Period: types.ClockDuration(time.Duration(10) * time.Minute), PeriodSpendLimit: smallAtom, PeriodReset: types.ExpiresAtTime(now.Add(30 * time.Minute)), @@ -257,8 +257,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { periodReset: types.ExpiresAtTime(now.Add(30 * time.Minute)), }, "mismatched currencies": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(oneHour), }, @@ -268,8 +268,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { valid: false, }, "same period": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(now.Add(2 * time.Hour)), }, @@ -288,8 +288,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { periodReset: types.ExpiresAtTime(now.Add(1 * time.Hour)), }, "step one period": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(now.Add(2 * time.Hour)), }, @@ -307,8 +307,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { periodReset: types.ExpiresAtTime(oneHour.Add(10 * time.Minute)), // one step from last reset, not now }, "step limited by global allowance": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: smallAtom, Expiration: types.ExpiresAtTime(now.Add(2 * time.Hour)), }, @@ -326,8 +326,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { periodReset: types.ExpiresAtTime(oneHour.Add(10 * time.Minute)), // one step from last reset, not now }, "expired": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtTime(now), }, @@ -341,8 +341,8 @@ func TestPeriodicFeeValidAllowTime(t *testing.T) { remove: true, }, "over period limit": { - allow: types.PeriodicFeeAllowance{ - Basic: types.BasicFeeAllowance{ + allow: types.PeriodicAllowance{ + Basic: types.BasicAllowance{ SpendLimit: atom, Expiration: types.ExpiresAtHeight(100), }, diff --git a/x/feegrant/types/query.pb.go b/x/feegrant/types/query.pb.go index e2597c3bc8..874226e365 100644 --- a/x/feegrant/types/query.pb.go +++ b/x/feegrant/types/query.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -30,24 +29,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryFeeAllowanceRequest is the request type for the Query/FeeAllowance RPC method. -type QueryFeeAllowanceRequest struct { +// QueryAllowanceRequest is the request type for the Query/Allowance RPC method. +type QueryAllowanceRequest struct { + // granter is the address of the user granting an allowance of their funds. Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` + // grantee is the address of the user being granted an allowance of another user's funds. Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` } -func (m *QueryFeeAllowanceRequest) Reset() { *m = QueryFeeAllowanceRequest{} } -func (m *QueryFeeAllowanceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeeAllowanceRequest) ProtoMessage() {} -func (*QueryFeeAllowanceRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllowanceRequest) Reset() { *m = QueryAllowanceRequest{} } +func (m *QueryAllowanceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllowanceRequest) ProtoMessage() {} +func (*QueryAllowanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_59efc303945de53f, []int{0} } -func (m *QueryFeeAllowanceRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllowanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFeeAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFeeAllowanceRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllowanceRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -57,50 +58,50 @@ func (m *QueryFeeAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryFeeAllowanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeeAllowanceRequest.Merge(m, src) +func (m *QueryAllowanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowanceRequest.Merge(m, src) } -func (m *QueryFeeAllowanceRequest) XXX_Size() int { +func (m *QueryAllowanceRequest) XXX_Size() int { return m.Size() } -func (m *QueryFeeAllowanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeeAllowanceRequest.DiscardUnknown(m) +func (m *QueryAllowanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowanceRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryFeeAllowanceRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllowanceRequest proto.InternalMessageInfo -func (m *QueryFeeAllowanceRequest) GetGranter() string { +func (m *QueryAllowanceRequest) GetGranter() string { if m != nil { return m.Granter } return "" } -func (m *QueryFeeAllowanceRequest) GetGrantee() string { +func (m *QueryAllowanceRequest) GetGrantee() string { if m != nil { return m.Grantee } return "" } -// QueryFeeAllowanceResponse is the response type for the Query/FeeAllowance RPC method. -type QueryFeeAllowanceResponse struct { - // fee_allowance is a fee_allowance granted for grantee by granter. - FeeAllowance *FeeAllowanceGrant `protobuf:"bytes,1,opt,name=fee_allowance,json=feeAllowance,proto3" json:"fee_allowance,omitempty"` +// QueryAllowanceResponse is the response type for the Query/Allowance RPC method. +type QueryAllowanceResponse struct { + // allowance is a allowance granted for grantee by granter. + Allowance *Grant `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"` } -func (m *QueryFeeAllowanceResponse) Reset() { *m = QueryFeeAllowanceResponse{} } -func (m *QueryFeeAllowanceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeeAllowanceResponse) ProtoMessage() {} -func (*QueryFeeAllowanceResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllowanceResponse) Reset() { *m = QueryAllowanceResponse{} } +func (m *QueryAllowanceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllowanceResponse) ProtoMessage() {} +func (*QueryAllowanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_59efc303945de53f, []int{1} } -func (m *QueryFeeAllowanceResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllowanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFeeAllowanceResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllowanceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -110,44 +111,44 @@ func (m *QueryFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryFeeAllowanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeeAllowanceResponse.Merge(m, src) +func (m *QueryAllowanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowanceResponse.Merge(m, src) } -func (m *QueryFeeAllowanceResponse) XXX_Size() int { +func (m *QueryAllowanceResponse) XXX_Size() int { return m.Size() } -func (m *QueryFeeAllowanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeeAllowanceResponse.DiscardUnknown(m) +func (m *QueryAllowanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowanceResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryFeeAllowanceResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllowanceResponse proto.InternalMessageInfo -func (m *QueryFeeAllowanceResponse) GetFeeAllowance() *FeeAllowanceGrant { +func (m *QueryAllowanceResponse) GetAllowance() *Grant { if m != nil { - return m.FeeAllowance + return m.Allowance } return nil } -// QueryFeeAllowancesRequest is the request type for the Query/FeeAllowances RPC method. -type QueryFeeAllowancesRequest struct { +// QueryAllowancesRequest is the request type for the Query/Allowances RPC method. +type QueryAllowancesRequest struct { Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"` // pagination defines an pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryFeeAllowancesRequest) Reset() { *m = QueryFeeAllowancesRequest{} } -func (m *QueryFeeAllowancesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeeAllowancesRequest) ProtoMessage() {} -func (*QueryFeeAllowancesRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllowancesRequest) Reset() { *m = QueryAllowancesRequest{} } +func (m *QueryAllowancesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllowancesRequest) ProtoMessage() {} +func (*QueryAllowancesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_59efc303945de53f, []int{2} } -func (m *QueryFeeAllowancesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllowancesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFeeAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFeeAllowancesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllowancesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -157,52 +158,52 @@ func (m *QueryFeeAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryFeeAllowancesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeeAllowancesRequest.Merge(m, src) +func (m *QueryAllowancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowancesRequest.Merge(m, src) } -func (m *QueryFeeAllowancesRequest) XXX_Size() int { +func (m *QueryAllowancesRequest) XXX_Size() int { return m.Size() } -func (m *QueryFeeAllowancesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeeAllowancesRequest.DiscardUnknown(m) +func (m *QueryAllowancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowancesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryFeeAllowancesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllowancesRequest proto.InternalMessageInfo -func (m *QueryFeeAllowancesRequest) GetGrantee() string { +func (m *QueryAllowancesRequest) GetGrantee() string { if m != nil { return m.Grantee } return "" } -func (m *QueryFeeAllowancesRequest) GetPagination() *query.PageRequest { +func (m *QueryAllowancesRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryFeeAllowancesResponse is the response type for the Query/FeeAllowances RPC method. -type QueryFeeAllowancesResponse struct { - // fee_allowances are fee_allowance's granted for grantee by granter. - FeeAllowances []*FeeAllowanceGrant `protobuf:"bytes,1,rep,name=fee_allowances,json=feeAllowances,proto3" json:"fee_allowances,omitempty"` +// QueryAllowancesResponse is the response type for the Query/Allowances RPC method. +type QueryAllowancesResponse struct { + // allowances are allowance's granted for grantee by granter. + Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"` // pagination defines an pagination for the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryFeeAllowancesResponse) Reset() { *m = QueryFeeAllowancesResponse{} } -func (m *QueryFeeAllowancesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeeAllowancesResponse) ProtoMessage() {} -func (*QueryFeeAllowancesResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllowancesResponse) Reset() { *m = QueryAllowancesResponse{} } +func (m *QueryAllowancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllowancesResponse) ProtoMessage() {} +func (*QueryAllowancesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_59efc303945de53f, []int{3} } -func (m *QueryFeeAllowancesResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllowancesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFeeAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFeeAllowancesResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllowancesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -212,26 +213,26 @@ func (m *QueryFeeAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryFeeAllowancesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeeAllowancesResponse.Merge(m, src) +func (m *QueryAllowancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowancesResponse.Merge(m, src) } -func (m *QueryFeeAllowancesResponse) XXX_Size() int { +func (m *QueryAllowancesResponse) XXX_Size() int { return m.Size() } -func (m *QueryFeeAllowancesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeeAllowancesResponse.DiscardUnknown(m) +func (m *QueryAllowancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowancesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryFeeAllowancesResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllowancesResponse proto.InternalMessageInfo -func (m *QueryFeeAllowancesResponse) GetFeeAllowances() []*FeeAllowanceGrant { +func (m *QueryAllowancesResponse) GetAllowances() []*Grant { if m != nil { - return m.FeeAllowances + return m.Allowances } return nil } -func (m *QueryFeeAllowancesResponse) GetPagination() *query.PageResponse { +func (m *QueryAllowancesResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -239,10 +240,10 @@ func (m *QueryFeeAllowancesResponse) GetPagination() *query.PageResponse { } func init() { - proto.RegisterType((*QueryFeeAllowanceRequest)(nil), "cosmos.feegrant.v1beta1.QueryFeeAllowanceRequest") - proto.RegisterType((*QueryFeeAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.QueryFeeAllowanceResponse") - proto.RegisterType((*QueryFeeAllowancesRequest)(nil), "cosmos.feegrant.v1beta1.QueryFeeAllowancesRequest") - proto.RegisterType((*QueryFeeAllowancesResponse)(nil), "cosmos.feegrant.v1beta1.QueryFeeAllowancesResponse") + proto.RegisterType((*QueryAllowanceRequest)(nil), "cosmos.feegrant.v1beta1.QueryAllowanceRequest") + proto.RegisterType((*QueryAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.QueryAllowanceResponse") + proto.RegisterType((*QueryAllowancesRequest)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesRequest") + proto.RegisterType((*QueryAllowancesResponse)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesResponse") } func init() { @@ -250,36 +251,34 @@ func init() { } var fileDescriptor_59efc303945de53f = []byte{ - // 455 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x31, 0x8f, 0xd3, 0x30, - 0x14, 0xc7, 0xeb, 0x22, 0x40, 0xf8, 0xae, 0x0c, 0x16, 0x12, 0x21, 0x42, 0xd1, 0x29, 0x48, 0x07, - 0x3a, 0xe9, 0x62, 0x35, 0x9d, 0x40, 0x2c, 0xdc, 0x70, 0xdd, 0x80, 0xcb, 0xc8, 0x82, 0x9c, 0xf2, - 0x6a, 0x22, 0x72, 0x71, 0x2e, 0x76, 0x81, 0x13, 0xea, 0xc2, 0x27, 0x40, 0xe2, 0xa3, 0xb0, 0xc0, - 0x37, 0x60, 0x3c, 0x89, 0x85, 0x11, 0xb5, 0x7c, 0x09, 0x36, 0x14, 0x3b, 0x6e, 0x52, 0x91, 0x00, - 0x99, 0xe2, 0xe4, 0xfd, 0xdf, 0x7b, 0xbf, 0xf7, 0xcf, 0x33, 0xbe, 0x33, 0x13, 0xf2, 0x54, 0x48, - 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7f, 0x9a, 0x58, 0x16, 0xa0, 0xcf, + 0xc6, 0x7f, 0x36, 0x0e, 0x5a, 0x6f, 0x1c, 0x74, 0xb6, 0x71, 0xd0, 0xf7, 0xad, 0xd3, 0x58, 0x6f, + 0x9d, 0xc6, 0xbf, 0xad, 0xd3, 0x78, 0xd3, 0x0f, 0x42, 0xf5, 0x7e, 0xe1, 0xd3, 0x89, 0x98, 0x19, + 0xcb, 0xf4, 0xd1, 0x97, 0x6f, 0x3f, 0xb0, 0xcf, 0x85, 0xbf, 0x5a, 0xc6, 0x20, 0xfd, 0x6b, 0xfa, + 0xbf, 0x7b, 0x70, 0x11, 0x00, 0x00, 0xff, 0xff, 0x86, 0xb1, 0x57, 0xa8, 0x29, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -294,10 +293,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // FeeAllowance returns fee granted to the grantee by the granter. - FeeAllowance(ctx context.Context, in *QueryFeeAllowanceRequest, opts ...grpc.CallOption) (*QueryFeeAllowanceResponse, error) - // FeeAllowances returns all the grants for address. - FeeAllowances(ctx context.Context, in *QueryFeeAllowancesRequest, opts ...grpc.CallOption) (*QueryFeeAllowancesResponse, error) + // Allowance returns fee granted to the grantee by the granter. + Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error) + // Allowances returns all the grants for address. + Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error) } type queryClient struct { @@ -308,18 +307,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) FeeAllowance(ctx context.Context, in *QueryFeeAllowanceRequest, opts ...grpc.CallOption) (*QueryFeeAllowanceResponse, error) { - out := new(QueryFeeAllowanceResponse) - err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/FeeAllowance", in, out, opts...) +func (c *queryClient) Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error) { + out := new(QueryAllowanceResponse) + err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/Allowance", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) FeeAllowances(ctx context.Context, in *QueryFeeAllowancesRequest, opts ...grpc.CallOption) (*QueryFeeAllowancesResponse, error) { - out := new(QueryFeeAllowancesResponse) - err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/FeeAllowances", in, out, opts...) +func (c *queryClient) Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error) { + out := new(QueryAllowancesResponse) + err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/Allowances", in, out, opts...) if err != nil { return nil, err } @@ -328,59 +327,59 @@ func (c *queryClient) FeeAllowances(ctx context.Context, in *QueryFeeAllowancesR // QueryServer is the server API for Query service. type QueryServer interface { - // FeeAllowance returns fee granted to the grantee by the granter. - FeeAllowance(context.Context, *QueryFeeAllowanceRequest) (*QueryFeeAllowanceResponse, error) - // FeeAllowances returns all the grants for address. - FeeAllowances(context.Context, *QueryFeeAllowancesRequest) (*QueryFeeAllowancesResponse, error) + // Allowance returns fee granted to the grantee by the granter. + Allowance(context.Context, *QueryAllowanceRequest) (*QueryAllowanceResponse, error) + // Allowances returns all the grants for address. + Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) FeeAllowance(ctx context.Context, req *QueryFeeAllowanceRequest) (*QueryFeeAllowanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FeeAllowance not implemented") +func (*UnimplementedQueryServer) Allowance(ctx context.Context, req *QueryAllowanceRequest) (*QueryAllowanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Allowance not implemented") } -func (*UnimplementedQueryServer) FeeAllowances(ctx context.Context, req *QueryFeeAllowancesRequest) (*QueryFeeAllowancesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FeeAllowances not implemented") +func (*UnimplementedQueryServer) Allowances(ctx context.Context, req *QueryAllowancesRequest) (*QueryAllowancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Allowances not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_FeeAllowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeeAllowanceRequest) +func _Query_Allowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllowanceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).FeeAllowance(ctx, in) + return srv.(QueryServer).Allowance(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.feegrant.v1beta1.Query/FeeAllowance", + FullMethod: "/cosmos.feegrant.v1beta1.Query/Allowance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FeeAllowance(ctx, req.(*QueryFeeAllowanceRequest)) + return srv.(QueryServer).Allowance(ctx, req.(*QueryAllowanceRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_FeeAllowances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeeAllowancesRequest) +func _Query_Allowances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllowancesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).FeeAllowances(ctx, in) + return srv.(QueryServer).Allowances(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.feegrant.v1beta1.Query/FeeAllowances", + FullMethod: "/cosmos.feegrant.v1beta1.Query/Allowances", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FeeAllowances(ctx, req.(*QueryFeeAllowancesRequest)) + return srv.(QueryServer).Allowances(ctx, req.(*QueryAllowancesRequest)) } return interceptor(ctx, in, info, handler) } @@ -390,19 +389,19 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "FeeAllowance", - Handler: _Query_FeeAllowance_Handler, + MethodName: "Allowance", + Handler: _Query_Allowance_Handler, }, { - MethodName: "FeeAllowances", - Handler: _Query_FeeAllowances_Handler, + MethodName: "Allowances", + Handler: _Query_Allowances_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/feegrant/v1beta1/query.proto", } -func (m *QueryFeeAllowanceRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllowanceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -412,12 +411,12 @@ func (m *QueryFeeAllowanceRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFeeAllowanceRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllowanceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFeeAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -439,7 +438,7 @@ func (m *QueryFeeAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllowanceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -449,19 +448,19 @@ func (m *QueryFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFeeAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.FeeAllowance != nil { + if m.Allowance != nil { { - size, err := m.FeeAllowance.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Allowance.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -474,7 +473,7 @@ func (m *QueryFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryFeeAllowancesRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllowancesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -484,12 +483,12 @@ func (m *QueryFeeAllowancesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFeeAllowancesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllowancesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFeeAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -516,7 +515,7 @@ func (m *QueryFeeAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryFeeAllowancesResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllowancesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -526,12 +525,12 @@ func (m *QueryFeeAllowancesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFeeAllowancesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllowancesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFeeAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -548,10 +547,10 @@ func (m *QueryFeeAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x12 } - if len(m.FeeAllowances) > 0 { - for iNdEx := len(m.FeeAllowances) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Allowances) > 0 { + for iNdEx := len(m.Allowances) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.FeeAllowances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Allowances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -576,7 +575,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryFeeAllowanceRequest) Size() (n int) { +func (m *QueryAllowanceRequest) Size() (n int) { if m == nil { return 0 } @@ -593,20 +592,20 @@ func (m *QueryFeeAllowanceRequest) Size() (n int) { return n } -func (m *QueryFeeAllowanceResponse) Size() (n int) { +func (m *QueryAllowanceResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.FeeAllowance != nil { - l = m.FeeAllowance.Size() + if m.Allowance != nil { + l = m.Allowance.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryFeeAllowancesRequest) Size() (n int) { +func (m *QueryAllowancesRequest) Size() (n int) { if m == nil { return 0 } @@ -623,14 +622,14 @@ func (m *QueryFeeAllowancesRequest) Size() (n int) { return n } -func (m *QueryFeeAllowancesResponse) Size() (n int) { +func (m *QueryAllowancesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.FeeAllowances) > 0 { - for _, e := range m.FeeAllowances { + if len(m.Allowances) > 0 { + for _, e := range m.Allowances { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -648,7 +647,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryFeeAllowanceRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllowanceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -671,10 +670,10 @@ func (m *QueryFeeAllowanceRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFeeAllowanceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllowanceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeeAllowanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllowanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -762,7 +761,7 @@ func (m *QueryFeeAllowanceRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFeeAllowanceResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllowanceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -785,15 +784,15 @@ func (m *QueryFeeAllowanceResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFeeAllowanceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllowanceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeeAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeAllowance", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Allowance", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -820,10 +819,10 @@ func (m *QueryFeeAllowanceResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.FeeAllowance == nil { - m.FeeAllowance = &FeeAllowanceGrant{} + if m.Allowance == nil { + m.Allowance = &Grant{} } - if err := m.FeeAllowance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Allowance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -848,7 +847,7 @@ func (m *QueryFeeAllowanceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFeeAllowancesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllowancesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -871,10 +870,10 @@ func (m *QueryFeeAllowancesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFeeAllowancesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllowancesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeeAllowancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllowancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -966,7 +965,7 @@ func (m *QueryFeeAllowancesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFeeAllowancesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllowancesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -989,15 +988,15 @@ func (m *QueryFeeAllowancesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFeeAllowancesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllowancesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeeAllowancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllowancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeAllowances", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Allowances", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1024,8 +1023,8 @@ func (m *QueryFeeAllowancesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FeeAllowances = append(m.FeeAllowances, &FeeAllowanceGrant{}) - if err := m.FeeAllowances[len(m.FeeAllowances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Allowances = append(m.Allowances, &Grant{}) + if err := m.Allowances[len(m.Allowances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/feegrant/types/query.pb.gw.go b/x/feegrant/types/query.pb.gw.go index ef81bab40a..876ec84df6 100644 --- a/x/feegrant/types/query.pb.gw.go +++ b/x/feegrant/types/query.pb.gw.go @@ -31,8 +31,8 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -func request_Query_FeeAllowance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeeAllowanceRequest +func request_Query_Allowance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowanceRequest var metadata runtime.ServerMetadata var ( @@ -64,13 +64,13 @@ func request_Query_FeeAllowance_0(ctx context.Context, marshaler runtime.Marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "grantee", err) } - msg, err := client.FeeAllowance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Allowance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_FeeAllowance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeeAllowanceRequest +func local_request_Query_Allowance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowanceRequest var metadata runtime.ServerMetadata var ( @@ -102,17 +102,17 @@ func local_request_Query_FeeAllowance_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "grantee", err) } - msg, err := server.FeeAllowance(ctx, &protoReq) + msg, err := server.Allowance(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_FeeAllowances_0 = &utilities.DoubleArray{Encoding: map[string]int{"grantee": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_Allowances_0 = &utilities.DoubleArray{Encoding: map[string]int{"grantee": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_FeeAllowances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeeAllowancesRequest +func request_Query_Allowances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowancesRequest var metadata runtime.ServerMetadata var ( @@ -136,17 +136,17 @@ func request_Query_FeeAllowances_0(ctx context.Context, marshaler runtime.Marsha if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FeeAllowances_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Allowances_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.FeeAllowances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Allowances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_FeeAllowances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeeAllowancesRequest +func local_request_Query_Allowances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowancesRequest var metadata runtime.ServerMetadata var ( @@ -170,11 +170,11 @@ func local_request_Query_FeeAllowances_0(ctx context.Context, marshaler runtime. if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FeeAllowances_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Allowances_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.FeeAllowances(ctx, &protoReq) + msg, err := server.Allowances(ctx, &protoReq) return msg, metadata, err } @@ -185,7 +185,7 @@ func local_request_Query_FeeAllowances_0(ctx context.Context, marshaler runtime. // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_FeeAllowance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Allowance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -194,18 +194,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_FeeAllowance_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Allowance_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_FeeAllowance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Allowance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FeeAllowances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Allowances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -214,14 +214,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_FeeAllowances_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Allowances_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_FeeAllowances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Allowances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -266,7 +266,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_FeeAllowance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Allowance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -275,18 +275,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_FeeAllowance_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Allowance_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_FeeAllowance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Allowance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_FeeAllowances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Allowances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -295,14 +295,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_FeeAllowances_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Allowances_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_FeeAllowances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Allowances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -310,13 +310,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_FeeAllowance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "feegrant", "v1beta1", "fee_allowance", "granter", "grantee"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Allowance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "feegrant", "v1beta1", "allowance", "granter", "grantee"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_FeeAllowances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "feegrant", "v1beta1", "fee_allowances", "grantee"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Allowances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "feegrant", "v1beta1", "allowances", "grantee"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_FeeAllowance_0 = runtime.ForwardResponseMessage + forward_Query_Allowance_0 = runtime.ForwardResponseMessage - forward_Query_FeeAllowances_0 = runtime.ForwardResponseMessage + forward_Query_Allowances_0 = runtime.ForwardResponseMessage ) diff --git a/x/feegrant/types/tx.pb.go b/x/feegrant/types/tx.pb.go index d3080f10e3..703bd0d586 100644 --- a/x/feegrant/types/tx.pb.go +++ b/x/feegrant/types/tx.pb.go @@ -30,26 +30,29 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgGrantFeeAllowance adds permission for Grantee to spend up to Allowance +// MsgGrantAllowance adds permission for Grantee to spend up to Allowance // of fees from the account of Granter. -type MsgGrantFeeAllowance struct { - Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` - Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` +type MsgGrantAllowance struct { + // granter is the address of the user granting an allowance of their funds. + Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` + // grantee is the address of the user being granted an allowance of another user's funds. + Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` + // allowance can be any of basic and filtered fee allowance. Allowance *types.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"` } -func (m *MsgGrantFeeAllowance) Reset() { *m = MsgGrantFeeAllowance{} } -func (m *MsgGrantFeeAllowance) String() string { return proto.CompactTextString(m) } -func (*MsgGrantFeeAllowance) ProtoMessage() {} -func (*MsgGrantFeeAllowance) Descriptor() ([]byte, []int) { +func (m *MsgGrantAllowance) Reset() { *m = MsgGrantAllowance{} } +func (m *MsgGrantAllowance) String() string { return proto.CompactTextString(m) } +func (*MsgGrantAllowance) ProtoMessage() {} +func (*MsgGrantAllowance) Descriptor() ([]byte, []int) { return fileDescriptor_dd44ad7946dad783, []int{0} } -func (m *MsgGrantFeeAllowance) XXX_Unmarshal(b []byte) error { +func (m *MsgGrantAllowance) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgGrantFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgGrantAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgGrantFeeAllowance.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgGrantAllowance.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -59,55 +62,55 @@ func (m *MsgGrantFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgGrantFeeAllowance) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgGrantFeeAllowance.Merge(m, src) +func (m *MsgGrantAllowance) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGrantAllowance.Merge(m, src) } -func (m *MsgGrantFeeAllowance) XXX_Size() int { +func (m *MsgGrantAllowance) XXX_Size() int { return m.Size() } -func (m *MsgGrantFeeAllowance) XXX_DiscardUnknown() { - xxx_messageInfo_MsgGrantFeeAllowance.DiscardUnknown(m) +func (m *MsgGrantAllowance) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGrantAllowance.DiscardUnknown(m) } -var xxx_messageInfo_MsgGrantFeeAllowance proto.InternalMessageInfo +var xxx_messageInfo_MsgGrantAllowance proto.InternalMessageInfo -func (m *MsgGrantFeeAllowance) GetGranter() string { +func (m *MsgGrantAllowance) GetGranter() string { if m != nil { return m.Granter } return "" } -func (m *MsgGrantFeeAllowance) GetGrantee() string { +func (m *MsgGrantAllowance) GetGrantee() string { if m != nil { return m.Grantee } return "" } -func (m *MsgGrantFeeAllowance) GetAllowance() *types.Any { +func (m *MsgGrantAllowance) GetAllowance() *types.Any { if m != nil { return m.Allowance } return nil } -// MsgGrantFeeAllowanceResponse defines the Msg/GrantFeeAllowanceResponse response type. -type MsgGrantFeeAllowanceResponse struct { +// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. +type MsgGrantAllowanceResponse struct { } -func (m *MsgGrantFeeAllowanceResponse) Reset() { *m = MsgGrantFeeAllowanceResponse{} } -func (m *MsgGrantFeeAllowanceResponse) String() string { return proto.CompactTextString(m) } -func (*MsgGrantFeeAllowanceResponse) ProtoMessage() {} -func (*MsgGrantFeeAllowanceResponse) Descriptor() ([]byte, []int) { +func (m *MsgGrantAllowanceResponse) Reset() { *m = MsgGrantAllowanceResponse{} } +func (m *MsgGrantAllowanceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgGrantAllowanceResponse) ProtoMessage() {} +func (*MsgGrantAllowanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dd44ad7946dad783, []int{1} } -func (m *MsgGrantFeeAllowanceResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgGrantAllowanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgGrantFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgGrantAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgGrantFeeAllowanceResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgGrantAllowanceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -117,36 +120,38 @@ func (m *MsgGrantFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgGrantFeeAllowanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgGrantFeeAllowanceResponse.Merge(m, src) +func (m *MsgGrantAllowanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgGrantAllowanceResponse.Merge(m, src) } -func (m *MsgGrantFeeAllowanceResponse) XXX_Size() int { +func (m *MsgGrantAllowanceResponse) XXX_Size() int { return m.Size() } -func (m *MsgGrantFeeAllowanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgGrantFeeAllowanceResponse.DiscardUnknown(m) +func (m *MsgGrantAllowanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgGrantAllowanceResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgGrantFeeAllowanceResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgGrantAllowanceResponse proto.InternalMessageInfo -// MsgRevokeFeeAllowance removes any existing FeeAllowance from Granter to Grantee. -type MsgRevokeFeeAllowance struct { +// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. +type MsgRevokeAllowance struct { + // granter is the address of the user granting an allowance of their funds. Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` + // grantee is the address of the user being granted an allowance of another user's funds. Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` } -func (m *MsgRevokeFeeAllowance) Reset() { *m = MsgRevokeFeeAllowance{} } -func (m *MsgRevokeFeeAllowance) String() string { return proto.CompactTextString(m) } -func (*MsgRevokeFeeAllowance) ProtoMessage() {} -func (*MsgRevokeFeeAllowance) Descriptor() ([]byte, []int) { +func (m *MsgRevokeAllowance) Reset() { *m = MsgRevokeAllowance{} } +func (m *MsgRevokeAllowance) String() string { return proto.CompactTextString(m) } +func (*MsgRevokeAllowance) ProtoMessage() {} +func (*MsgRevokeAllowance) Descriptor() ([]byte, []int) { return fileDescriptor_dd44ad7946dad783, []int{2} } -func (m *MsgRevokeFeeAllowance) XXX_Unmarshal(b []byte) error { +func (m *MsgRevokeAllowance) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRevokeFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRevokeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRevokeFeeAllowance.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRevokeAllowance.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -156,48 +161,48 @@ func (m *MsgRevokeFeeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgRevokeFeeAllowance) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRevokeFeeAllowance.Merge(m, src) +func (m *MsgRevokeAllowance) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevokeAllowance.Merge(m, src) } -func (m *MsgRevokeFeeAllowance) XXX_Size() int { +func (m *MsgRevokeAllowance) XXX_Size() int { return m.Size() } -func (m *MsgRevokeFeeAllowance) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRevokeFeeAllowance.DiscardUnknown(m) +func (m *MsgRevokeAllowance) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevokeAllowance.DiscardUnknown(m) } -var xxx_messageInfo_MsgRevokeFeeAllowance proto.InternalMessageInfo +var xxx_messageInfo_MsgRevokeAllowance proto.InternalMessageInfo -func (m *MsgRevokeFeeAllowance) GetGranter() string { +func (m *MsgRevokeAllowance) GetGranter() string { if m != nil { return m.Granter } return "" } -func (m *MsgRevokeFeeAllowance) GetGrantee() string { +func (m *MsgRevokeAllowance) GetGrantee() string { if m != nil { return m.Grantee } return "" } -// MsgRevokeFeeAllowanceResponse defines the Msg/RevokeFeeAllowanceResponse response type. -type MsgRevokeFeeAllowanceResponse struct { +// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. +type MsgRevokeAllowanceResponse struct { } -func (m *MsgRevokeFeeAllowanceResponse) Reset() { *m = MsgRevokeFeeAllowanceResponse{} } -func (m *MsgRevokeFeeAllowanceResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRevokeFeeAllowanceResponse) ProtoMessage() {} -func (*MsgRevokeFeeAllowanceResponse) Descriptor() ([]byte, []int) { +func (m *MsgRevokeAllowanceResponse) Reset() { *m = MsgRevokeAllowanceResponse{} } +func (m *MsgRevokeAllowanceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRevokeAllowanceResponse) ProtoMessage() {} +func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dd44ad7946dad783, []int{3} } -func (m *MsgRevokeFeeAllowanceResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRevokeAllowanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRevokeFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRevokeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRevokeFeeAllowanceResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRevokeAllowanceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -207,51 +212,51 @@ func (m *MsgRevokeFeeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgRevokeFeeAllowanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRevokeFeeAllowanceResponse.Merge(m, src) +func (m *MsgRevokeAllowanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevokeAllowanceResponse.Merge(m, src) } -func (m *MsgRevokeFeeAllowanceResponse) XXX_Size() int { +func (m *MsgRevokeAllowanceResponse) XXX_Size() int { return m.Size() } -func (m *MsgRevokeFeeAllowanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRevokeFeeAllowanceResponse.DiscardUnknown(m) +func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevokeAllowanceResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRevokeFeeAllowanceResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRevokeAllowanceResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgGrantFeeAllowance)(nil), "cosmos.feegrant.v1beta1.MsgGrantFeeAllowance") - proto.RegisterType((*MsgGrantFeeAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgGrantFeeAllowanceResponse") - proto.RegisterType((*MsgRevokeFeeAllowance)(nil), "cosmos.feegrant.v1beta1.MsgRevokeFeeAllowance") - proto.RegisterType((*MsgRevokeFeeAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgRevokeFeeAllowanceResponse") + proto.RegisterType((*MsgGrantAllowance)(nil), "cosmos.feegrant.v1beta1.MsgGrantAllowance") + proto.RegisterType((*MsgGrantAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse") + proto.RegisterType((*MsgRevokeAllowance)(nil), "cosmos.feegrant.v1beta1.MsgRevokeAllowance") + proto.RegisterType((*MsgRevokeAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse") } func init() { proto.RegisterFile("cosmos/feegrant/v1beta1/tx.proto", fileDescriptor_dd44ad7946dad783) } var fileDescriptor_dd44ad7946dad783 = []byte{ - // 345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4b, 0x4d, 0x4d, 0x2f, 0x4a, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, - 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x87, 0xa8, - 0xd0, 0x83, 0xa9, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd1, 0x07, - 0xb1, 0x20, 0xca, 0xa5, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0xbc, 0xa4, 0xd2, - 0x34, 0xfd, 0xc4, 0xbc, 0x4a, 0x98, 0x14, 0xc4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3f, 0xf1, - 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, - 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, - 0xbd, 0xe4, 0xfc, 0x5c, 0x68, 0xaa, 0x82, 0x52, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x15, 0x88, 0xb4, - 0x5d, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x4e, 0x03, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x7b, 0xbe, 0x24, 0x15, 0xfb, 0x02, 0x00, 0x00, + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xc1, 0x4e, 0xc2, 0x40, + 0x10, 0x86, 0x59, 0x49, 0x34, 0xac, 0x51, 0x43, 0x43, 0x62, 0xa9, 0x66, 0x43, 0x7a, 0x22, 0x1a, + 0x76, 0x03, 0x3c, 0x01, 0x24, 0x8a, 0x1e, 0xb8, 0xf4, 0xe8, 0xc5, 0xb4, 0x38, 0xac, 0x06, 0xe8, + 0x34, 0xec, 0x82, 0xf0, 0x12, 0xc6, 0x87, 0xf1, 0x21, 0x8c, 0x27, 0x8e, 0x1e, 0x0d, 0x5c, 0x7d, + 0x08, 0x43, 0xdb, 0x15, 0x03, 0xd1, 0x68, 0x3c, 0xb5, 0x93, 0xf9, 0xe6, 0xff, 0xff, 0x76, 0x86, + 0x96, 0x3a, 0xa8, 0x06, 0xa8, 0x44, 0x17, 0x40, 0x0e, 0xfd, 0x50, 0x8b, 0x71, 0x35, 0x00, 0xed, + 0x57, 0x85, 0x9e, 0xf0, 0x68, 0x88, 0x1a, 0xad, 0xc3, 0x84, 0xe0, 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 0x9c, 0x91, 0xc7, 0x05, 0xcb, 0xcc, 0x16, 0x2c, 0xf3, 0xba, 0x60, 0x99, 0xab, 0x8a, 0xbc, + 0xd3, 0xb7, 0xa3, 0x80, 0x77, 0x70, 0x90, 0xde, 0x4d, 0xfa, 0xa8, 0xa8, 0x9b, 0x9e, 0x98, 0xac, + 0xae, 0x57, 0x4f, 0x23, 0x50, 0xc1, 0x76, 0xbc, 0xe8, 0xfa, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x8d, 0x25, 0xe0, 0x0e, 0xdd, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -266,12 +271,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // GrantFeeAllowance grants fee allowance to the grantee on the granter's + // GrantAllowance grants fee allowance to the grantee on the granter's // account with the provided expiration time. - GrantFeeAllowance(ctx context.Context, in *MsgGrantFeeAllowance, opts ...grpc.CallOption) (*MsgGrantFeeAllowanceResponse, error) - // RevokeFeeAllowance revokes any fee allowance of granter's account that + GrantAllowance(ctx context.Context, in *MsgGrantAllowance, opts ...grpc.CallOption) (*MsgGrantAllowanceResponse, error) + // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. - RevokeFeeAllowance(ctx context.Context, in *MsgRevokeFeeAllowance, opts ...grpc.CallOption) (*MsgRevokeFeeAllowanceResponse, error) + RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) } type msgClient struct { @@ -282,18 +287,18 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) GrantFeeAllowance(ctx context.Context, in *MsgGrantFeeAllowance, opts ...grpc.CallOption) (*MsgGrantFeeAllowanceResponse, error) { - out := new(MsgGrantFeeAllowanceResponse) - err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Msg/GrantFeeAllowance", in, out, opts...) +func (c *msgClient) GrantAllowance(ctx context.Context, in *MsgGrantAllowance, opts ...grpc.CallOption) (*MsgGrantAllowanceResponse, error) { + out := new(MsgGrantAllowanceResponse) + err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Msg/GrantAllowance", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) RevokeFeeAllowance(ctx context.Context, in *MsgRevokeFeeAllowance, opts ...grpc.CallOption) (*MsgRevokeFeeAllowanceResponse, error) { - out := new(MsgRevokeFeeAllowanceResponse) - err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Msg/RevokeFeeAllowance", in, out, opts...) +func (c *msgClient) RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) { + out := new(MsgRevokeAllowanceResponse) + err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Msg/RevokeAllowance", in, out, opts...) if err != nil { return nil, err } @@ -302,61 +307,61 @@ func (c *msgClient) RevokeFeeAllowance(ctx context.Context, in *MsgRevokeFeeAllo // MsgServer is the server API for Msg service. type MsgServer interface { - // GrantFeeAllowance grants fee allowance to the grantee on the granter's + // GrantAllowance grants fee allowance to the grantee on the granter's // account with the provided expiration time. - GrantFeeAllowance(context.Context, *MsgGrantFeeAllowance) (*MsgGrantFeeAllowanceResponse, error) - // RevokeFeeAllowance revokes any fee allowance of granter's account that + GrantAllowance(context.Context, *MsgGrantAllowance) (*MsgGrantAllowanceResponse, error) + // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. - RevokeFeeAllowance(context.Context, *MsgRevokeFeeAllowance) (*MsgRevokeFeeAllowanceResponse, error) + RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) GrantFeeAllowance(ctx context.Context, req *MsgGrantFeeAllowance) (*MsgGrantFeeAllowanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GrantFeeAllowance not implemented") +func (*UnimplementedMsgServer) GrantAllowance(ctx context.Context, req *MsgGrantAllowance) (*MsgGrantAllowanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GrantAllowance not implemented") } -func (*UnimplementedMsgServer) RevokeFeeAllowance(ctx context.Context, req *MsgRevokeFeeAllowance) (*MsgRevokeFeeAllowanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RevokeFeeAllowance not implemented") +func (*UnimplementedMsgServer) RevokeAllowance(ctx context.Context, req *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokeAllowance not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_GrantFeeAllowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgGrantFeeAllowance) +func _Msg_GrantAllowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgGrantAllowance) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).GrantFeeAllowance(ctx, in) + return srv.(MsgServer).GrantAllowance(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.feegrant.v1beta1.Msg/GrantFeeAllowance", + FullMethod: "/cosmos.feegrant.v1beta1.Msg/GrantAllowance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).GrantFeeAllowance(ctx, req.(*MsgGrantFeeAllowance)) + return srv.(MsgServer).GrantAllowance(ctx, req.(*MsgGrantAllowance)) } return interceptor(ctx, in, info, handler) } -func _Msg_RevokeFeeAllowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRevokeFeeAllowance) +func _Msg_RevokeAllowance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRevokeAllowance) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RevokeFeeAllowance(ctx, in) + return srv.(MsgServer).RevokeAllowance(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.feegrant.v1beta1.Msg/RevokeFeeAllowance", + FullMethod: "/cosmos.feegrant.v1beta1.Msg/RevokeAllowance", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RevokeFeeAllowance(ctx, req.(*MsgRevokeFeeAllowance)) + return srv.(MsgServer).RevokeAllowance(ctx, req.(*MsgRevokeAllowance)) } return interceptor(ctx, in, info, handler) } @@ -366,19 +371,19 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "GrantFeeAllowance", - Handler: _Msg_GrantFeeAllowance_Handler, + MethodName: "GrantAllowance", + Handler: _Msg_GrantAllowance_Handler, }, { - MethodName: "RevokeFeeAllowance", - Handler: _Msg_RevokeFeeAllowance_Handler, + MethodName: "RevokeAllowance", + Handler: _Msg_RevokeAllowance_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/feegrant/v1beta1/tx.proto", } -func (m *MsgGrantFeeAllowance) Marshal() (dAtA []byte, err error) { +func (m *MsgGrantAllowance) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -388,12 +393,12 @@ func (m *MsgGrantFeeAllowance) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgGrantFeeAllowance) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgGrantAllowance) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgGrantFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgGrantAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -427,7 +432,7 @@ func (m *MsgGrantFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgGrantFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgGrantAllowanceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -437,12 +442,12 @@ func (m *MsgGrantFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgGrantFeeAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgGrantAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgGrantFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgGrantAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -450,7 +455,7 @@ func (m *MsgGrantFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *MsgRevokeFeeAllowance) Marshal() (dAtA []byte, err error) { +func (m *MsgRevokeAllowance) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -460,12 +465,12 @@ func (m *MsgRevokeFeeAllowance) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRevokeFeeAllowance) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRevokeAllowance) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRevokeFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRevokeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -487,7 +492,7 @@ func (m *MsgRevokeFeeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgRevokeFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRevokeAllowanceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -497,12 +502,12 @@ func (m *MsgRevokeFeeAllowanceResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRevokeFeeAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRevokeAllowanceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRevokeFeeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRevokeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -521,7 +526,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgGrantFeeAllowance) Size() (n int) { +func (m *MsgGrantAllowance) Size() (n int) { if m == nil { return 0 } @@ -542,7 +547,7 @@ func (m *MsgGrantFeeAllowance) Size() (n int) { return n } -func (m *MsgGrantFeeAllowanceResponse) Size() (n int) { +func (m *MsgGrantAllowanceResponse) Size() (n int) { if m == nil { return 0 } @@ -551,7 +556,7 @@ func (m *MsgGrantFeeAllowanceResponse) Size() (n int) { return n } -func (m *MsgRevokeFeeAllowance) Size() (n int) { +func (m *MsgRevokeAllowance) Size() (n int) { if m == nil { return 0 } @@ -568,7 +573,7 @@ func (m *MsgRevokeFeeAllowance) Size() (n int) { return n } -func (m *MsgRevokeFeeAllowanceResponse) Size() (n int) { +func (m *MsgRevokeAllowanceResponse) Size() (n int) { if m == nil { return 0 } @@ -583,7 +588,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgGrantFeeAllowance) Unmarshal(dAtA []byte) error { +func (m *MsgGrantAllowance) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -606,10 +611,10 @@ func (m *MsgGrantFeeAllowance) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgGrantFeeAllowance: wiretype end group for non-group") + return fmt.Errorf("proto: MsgGrantAllowance: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGrantFeeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgGrantAllowance: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -733,7 +738,7 @@ func (m *MsgGrantFeeAllowance) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgGrantFeeAllowanceResponse) Unmarshal(dAtA []byte) error { +func (m *MsgGrantAllowanceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -756,10 +761,10 @@ func (m *MsgGrantFeeAllowanceResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgGrantFeeAllowanceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgGrantAllowanceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGrantFeeAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgGrantAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -783,7 +788,7 @@ func (m *MsgGrantFeeAllowanceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRevokeFeeAllowance) Unmarshal(dAtA []byte) error { +func (m *MsgRevokeAllowance) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -806,10 +811,10 @@ func (m *MsgRevokeFeeAllowance) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRevokeFeeAllowance: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRevokeAllowance: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRevokeFeeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRevokeAllowance: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -897,7 +902,7 @@ func (m *MsgRevokeFeeAllowance) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRevokeFeeAllowanceResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRevokeAllowanceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -920,10 +925,10 @@ func (m *MsgRevokeFeeAllowanceResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRevokeFeeAllowanceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRevokeAllowanceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRevokeFeeAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRevokeAllowanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: