Skip to content

Commit

Permalink
feat: add feegrant query to see allowances from a given granter (back…
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored and randy75828 committed Aug 10, 2022
1 parent dcd486f commit b90c151
Show file tree
Hide file tree
Showing 33 changed files with 2,172 additions and 1,197 deletions.
2,059 changes: 1,028 additions & 1,031 deletions CHANGELOG.md

Large diffs are not rendered by default.

46 changes: 44 additions & 2 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@
- [cosmos/feegrant/v1beta1/query.proto](#cosmos/feegrant/v1beta1/query.proto)
- [QueryAllowanceRequest](#cosmos.feegrant.v1beta1.QueryAllowanceRequest)
- [QueryAllowanceResponse](#cosmos.feegrant.v1beta1.QueryAllowanceResponse)
- [QueryAllowancesByGranterRequest](#cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest)
- [QueryAllowancesByGranterResponse](#cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse)
- [QueryAllowancesRequest](#cosmos.feegrant.v1beta1.QueryAllowancesRequest)
- [QueryAllowancesResponse](#cosmos.feegrant.v1beta1.QueryAllowancesResponse)

Expand Down Expand Up @@ -934,6 +936,8 @@ the provide method with expiration time.
GrantAuthorization extends a grant with both the addresses of the grantee and granter.
It is used in genesis.proto and query.proto

Since: cosmos-sdk 0.45.2


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
Expand Down Expand Up @@ -1158,10 +1162,10 @@ Query defines the gRPC querier service.
| `Grants` | [QueryGrantsRequest](#cosmos.authz.v1beta1.QueryGrantsRequest) | [QueryGrantsResponse](#cosmos.authz.v1beta1.QueryGrantsResponse) | Returns list of `Authorization`, granted to the grantee by the granter. | GET|/cosmos/authz/v1beta1/grants|
| `GranterGrants` | [QueryGranterGrantsRequest](#cosmos.authz.v1beta1.QueryGranterGrantsRequest) | [QueryGranterGrantsResponse](#cosmos.authz.v1beta1.QueryGranterGrantsResponse) | GranterGrants returns list of `GrantAuthorization`, granted by granter.

Since: cosmos-sdk 0.46 | GET|/cosmos/authz/v1beta1/grants/granter/{granter}|
Since: cosmos-sdk 0.45.2 | GET|/cosmos/authz/v1beta1/grants/granter/{granter}|
| `GranteeGrants` | [QueryGranteeGrantsRequest](#cosmos.authz.v1beta1.QueryGranteeGrantsRequest) | [QueryGranteeGrantsResponse](#cosmos.authz.v1beta1.QueryGranteeGrantsResponse) | GranteeGrants returns a list of `GrantAuthorization` by grantee.

Since: cosmos-sdk 0.46 | GET|/cosmos/authz/v1beta1/grants/grantee/{grantee}|
Since: cosmos-sdk 0.45.2 | GET|/cosmos/authz/v1beta1/grants/grantee/{grantee}|

<!-- end services -->

Expand Down Expand Up @@ -4882,6 +4886,38 @@ QueryAllowanceResponse is the response type for the Query/Allowance RPC method.



<a name="cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest"></a>

### QueryAllowancesByGranterRequest
QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `granter` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an pagination for the request. |






<a name="cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse"></a>

### QueryAllowancesByGranterResponse
QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `allowances` | [Grant](#cosmos.feegrant.v1beta1.Grant) | repeated | allowances that have been issued by the granter. |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. |






<a name="cosmos.feegrant.v1beta1.QueryAllowancesRequest"></a>

### QueryAllowancesRequest
Expand Down Expand Up @@ -4929,6 +4965,7 @@ Query defines the gRPC querier service.
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `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}|
| `AllowancesByGranter` | [QueryAllowancesByGranterRequest](#cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest) | [QueryAllowancesByGranterResponse](#cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse) | AllowancesByGranter returns all the grants given by an address Since v0.46 | GET|/cosmos/feegrant/v1beta1/issued/{granter}|

<!-- end services -->

Expand Down Expand Up @@ -7627,6 +7664,11 @@ SignMode represents a signing mode with its own security guarantees.
| SIGN_MODE_DIRECT | 1 | SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is verified with raw bytes from Tx |
| SIGN_MODE_TEXTUAL | 2 | SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable textual representation on top of the binary representation from SIGN_MODE_DIRECT |
| SIGN_MODE_LEGACY_AMINO_JSON | 127 | SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses Amino JSON and will be removed in the future |
| SIGN_MODE_EIP_191 | 191 | SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos SDK. Ref: https://eips.ethereum.org/EIPS/eip-191

Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, but is not implemented on the SDK by default. To enable EIP-191, you need to pass a custom `TxConfig` that has an implementation of `SignModeHandler` for EIP-191. The SDK may decide to fully support EIP-191 in the future.

Since: cosmos-sdk 0.45.2 |


<!-- end enums -->
Expand Down
10 changes: 5 additions & 5 deletions proto/cosmos/bank/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ service Query {

// QueryBalanceRequest is the request type for the Query/Balance RPC method.
message QueryBalanceRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// address is the address to query balances for.
Expand All @@ -73,7 +73,7 @@ message QueryBalanceResponse {

// QueryBalanceRequest is the request type for the Query/AllBalances RPC method.
message QueryAllBalancesRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// address is the address to query balances for.
Expand All @@ -88,7 +88,7 @@ message QueryAllBalancesRequest {
message QueryAllBalancesResponse {
// balances is the balances of all the coins.
repeated cosmos.base.v1beta1.Coin balances = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand Down Expand Up @@ -121,7 +121,7 @@ message QuerySpendableBalancesResponse {
// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
// method.
message QueryTotalSupplyRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// pagination defines an optional pagination for the request.
Expand All @@ -135,7 +135,7 @@ message QueryTotalSupplyRequest {
message QueryTotalSupplyResponse {
// supply is the supply of the coins
repeated cosmos.base.v1beta1.Coin supply = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];

// pagination defines the pagination in the response.
//
Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/base/snapshots/v1beta1/snapshot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ message SnapshotStoreItem {

// SnapshotIAVLItem is an exported IAVL node.
message SnapshotIAVLItem {
bytes key = 1;
bytes value = 2;
bytes key = 1;
bytes value = 2;
// version is block height
int64 version = 3;
// height is depth of the tree.
int32 height = 4;
int32 height = 4;
}

// SnapshotExtensionMeta contains metadata about an external snapshotter.
Expand Down
16 changes: 8 additions & 8 deletions proto/cosmos/base/tendermint/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ message GetNodeInfoResponse {

// VersionInfo is the type for the GetNodeInfoResponse message.
message VersionInfo {
string name = 1;
string app_name = 2;
string version = 3;
string git_commit = 4;
string build_tags = 5;
string go_version = 6;
repeated Module build_deps = 7;
string name = 1;
string app_name = 2;
string version = 3;
string git_commit = 4;
string build_tags = 5;
string go_version = 6;
repeated Module build_deps = 7;
// Since: cosmos-sdk 0.43
string cosmos_sdk_version = 8;
string cosmos_sdk_version = 8;
}

// Module is the type for VersionInfo
Expand Down
23 changes: 23 additions & 0 deletions proto/cosmos/feegrant/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ service Query {
rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) {
option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}";
}

// AllowancesByGranter returns all the grants given by an address
// Since v0.46
rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) {
option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}";
}
}

// QueryAllowanceRequest is the request type for the Query/Allowance RPC method.
Expand Down Expand Up @@ -53,3 +59,20 @@ message QueryAllowancesResponse {
// pagination defines an pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.
message QueryAllowancesByGranterRequest {
string granter = 1;

// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
message QueryAllowancesByGranterResponse {
// allowances that have been issued by the granter.
repeated cosmos.feegrant.v1beta1.Grant allowances = 1;

// pagination defines an pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
2 changes: 1 addition & 1 deletion proto/cosmos/gov/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ message Vote {
// Deprecated: Prefer to use `options` instead. This field is set in queries
// if and only if `len(options) == 1` and that option has weight 1. In all
// other cases, this field will default to VOTE_OPTION_UNSPECIFIED.
VoteOption option = 3 [deprecated = true];
VoteOption option = 3 [deprecated = true];
// Since: cosmos-sdk 0.43
repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false];
}
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/tx/signing/v1beta1/signing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum SignMode {

// SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
// SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
//
//
// Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,
// but is not implemented on the SDK by default. To enable EIP-191, you need
// to pass a custom `TxConfig` that has an implementation of
Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/tx/v1beta1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ message GetBlockWithTxsRequest {
// Since: cosmos-sdk 0.45.2
message GetBlockWithTxsResponse {
// txs are the transactions in the block.
repeated cosmos.tx.v1beta1.Tx txs = 1;
.tendermint.types.BlockID block_id = 2;
.tendermint.types.Block block = 3;
repeated cosmos.tx.v1beta1.Tx txs = 1;
.tendermint.types.BlockID block_id = 2;
.tendermint.types.Block block = 3;
// pagination defines a pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 4;
}
17 changes: 17 additions & 0 deletions types/kv/helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package kv

import "fmt"

// AssertKeyAtLeastLength panics when store key length is less than the given length.
func AssertKeyAtLeastLength(bz []byte, length int) {
if len(bz) < length {
panic(fmt.Sprintf("expected key of length at least %d, got %d", length, len(bz)))
}
}

// AssertKeyLength panics when store key length is not equal to the given length.
func AssertKeyLength(bz []byte, length int) {
if len(bz) != length {
panic(fmt.Sprintf("unexpected key length; got: %d, expected: %d", len(bz), length))
}
}
82 changes: 44 additions & 38 deletions types/tx/signing/signing.pb.go

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

Loading

0 comments on commit b90c151

Please sign in to comment.