Skip to content

Commit

Permalink
proto bumps for MsgCancelUnbondingDelegation (#9284)
Browse files Browse the repository at this point in the history
## Description

Makes the proto updating mechanism more robust, getting the latest
definitions used in the SDK branch. PTAL @JimLarson

Also adopts the new `MsgCancelUnbondingDelegation` that is available.
PTAL @0xpatrickdev

### Security Considerations

none

### Scaling Considerations

none

### Documentation Considerations

More automated now

### Testing Considerations

Manual

### Upgrade Considerations

Improves sync of cosmic-proto package with cosmic-swingset
  • Loading branch information
mergify[bot] authored Apr 25, 2024
2 parents 76b8d53 + 94334b3 commit 841f246
Show file tree
Hide file tree
Showing 89 changed files with 3,429 additions and 1,363 deletions.
4 changes: 3 additions & 1 deletion packages/cosmic-proto/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ The generated code is determined by the contents of `protos` and the config of `

## Maintaining protos

The `protos` are held in this source tree and updated from `golang/cosmos/proto` during `yarn codegen` by `yarn protos-update`. The `cosmos` protos were sourced from [@protobufjs/cosmos](https://www.npmjs.com/package/@protobufs/cosmos) per [Telescope's instructions](https://github.com/cosmology-tech/telescope?tab=readme-ov-file#add-protobufs). However we don't use that as a dependency of the package because we need a more manual approach to merge with the Golang-managed protos in the repo.
The `protos` are held in this source tree.

To update existing definitions, simply run `yarn codegen`.

To add new protobuf definitions:

Expand Down
3 changes: 1 addition & 2 deletions packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@
"scripts": {
"build": "tsc --project tsconfig.build.json",
"clean": "rimraf dist",
"codegen": "yarn protos-update && node scripts/codegen.cjs",
"codegen": "./update-protos.sh && node scripts/codegen.cjs",
"prepare": "npm run build",
"protos-update": "cp -rf ../../golang/cosmos/third_party/proto . && cp -rf ../../golang/cosmos/proto/agoric proto",
"lint-fix": "yarn lint:eslint --fix",
"lint": "tsc",
"test": "ava",
Expand Down
36 changes: 0 additions & 36 deletions packages/cosmic-proto/proto/cosmos/app/v1alpha1/config.proto

This file was deleted.

93 changes: 0 additions & 93 deletions packages/cosmic-proto/proto/cosmos/app/v1alpha1/module.proto

This file was deleted.

22 changes: 0 additions & 22 deletions packages/cosmic-proto/proto/cosmos/app/v1alpha1/query.proto

This file was deleted.

4 changes: 2 additions & 2 deletions packages/cosmic-proto/proto/cosmos/auth/v1beta1/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ message BaseAccount {
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = false;

option (cosmos_proto.implements_interface) = "cosmos.auth.AccountI";
option (cosmos_proto.implements_interface) = "AccountI";

string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty"];
Expand All @@ -27,7 +27,7 @@ message BaseAccount {
message ModuleAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "cosmos.auth.ModuleAccountI";
option (cosmos_proto.implements_interface) = "ModuleAccountI";

BaseAccount base_account = 1 [(gogoproto.embed) = true];
string name = 2;
Expand Down
101 changes: 82 additions & 19 deletions packages/cosmic-proto/proto/cosmos/auth/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,47 @@ service Query {
option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}";
}

// AccountAddressByID returns account address based on account number.
//
// Since: cosmos-sdk 0.46.2
rpc AccountAddressByID(QueryAccountAddressByIDRequest) returns (QueryAccountAddressByIDResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/address_by_id/{id}";
}

// Params queries all parameters.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/params";
}

// ModuleAccounts returns all the existing module accounts.
//
// Since: cosmos-sdk 0.46
rpc ModuleAccounts(QueryModuleAccountsRequest) returns (QueryModuleAccountsResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts";
}

// Bech32 queries bech32Prefix
// ModuleAccountByName returns the module account info by module name
rpc ModuleAccountByName(QueryModuleAccountByNameRequest) returns (QueryModuleAccountByNameResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts/{name}";
}

// Bech32Prefix queries bech32Prefix
//
// Since: cosmos-sdk 0.46
rpc Bech32Prefix(Bech32PrefixRequest) returns (Bech32PrefixResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32";
}

// AddressBytesToString converts Account Address bytes to string
//
// Since: cosmos-sdk 0.46
rpc AddressBytesToString(AddressBytesToStringRequest) returns (AddressBytesToStringResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_bytes}";
}

// AddressStringToBytes converts Address string to bytes
//
// Since: cosmos-sdk 0.46
rpc AddressStringToBytes(AddressStringToBytesRequest) returns (AddressStringToBytesResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_string}";
}
Expand All @@ -63,7 +83,7 @@ message QueryAccountsRequest {
// Since: cosmos-sdk 0.43
message QueryAccountsResponse {
// accounts are the existing accounts
repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.AccountI"];
repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "AccountI"];

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand All @@ -78,53 +98,96 @@ message QueryAccountRequest {
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method.
message QueryModuleAccountsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryAccountResponse is the response type for the Query/Account RPC method.
message QueryAccountResponse {
// account defines the account of the corresponding address.
google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.AccountI"];
google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"];
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method.
//
// Since: cosmos-sdk 0.46
message QueryModuleAccountsRequest {}

// QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method.
//
// Since: cosmos-sdk 0.46
message QueryModuleAccountsResponse {
repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.ModuleAccountI"];
repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"];
}

// Bech32PrefixRequest is the request type for Bech32Prefix rpc method
// QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method.
message QueryModuleAccountByNameRequest {
string name = 1;
}

// QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method.
message QueryModuleAccountByNameResponse {
google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"];
}

// Bech32PrefixRequest is the request type for Bech32Prefix rpc method.
//
// Since: cosmos-sdk 0.46
message Bech32PrefixRequest {}

// Bech32PrefixResponse is the response type for Bech32Prefix rpc method
// Bech32PrefixResponse is the response type for Bech32Prefix rpc method.
//
// Since: cosmos-sdk 0.46
message Bech32PrefixResponse {
string bech32_prefix = 1;
}

// AddressBytesToStringRequest is the request type for AddressString rpc method
// AddressBytesToStringRequest is the request type for AddressString rpc method.
//
// Since: cosmos-sdk 0.46
message AddressBytesToStringRequest {
bytes address_bytes = 1;
}

// AddressBytesToStringResponse is the response type for AddressString rpc method
// AddressBytesToStringResponse is the response type for AddressString rpc method.
//
// Since: cosmos-sdk 0.46
message AddressBytesToStringResponse {
string address_string = 1;
}

// AddressStringToBytesRequest is the request type for AccountBytes rpc method
// AddressStringToBytesRequest is the request type for AccountBytes rpc method.
//
// Since: cosmos-sdk 0.46
message AddressStringToBytesRequest {
string address_string = 1;
}

// AddressStringToBytesResponse is the response type for AddressBytes rpc method
// AddressStringToBytesResponse is the response type for AddressBytes rpc method.
//
// Since: cosmos-sdk 0.46
message AddressStringToBytesResponse {
bytes address_bytes = 1;
}

// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method
//
// Since: cosmos-sdk 0.46.2
message QueryAccountAddressByIDRequest {
// id is the account number of the address to be queried. This field
// should have been an uint64 (like all account numbers), and will be
// updated to uint64 in a future version of the auth query.
int64 id = 1;
}

// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method
//
// Since: cosmos-sdk 0.46.2
message QueryAccountAddressByIDResponse {
string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
6 changes: 3 additions & 3 deletions packages/cosmic-proto/proto/cosmos/authz/v1beta1/authz.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ option (gogoproto.goproto_getters_all) = false;
// GenericAuthorization gives the grantee unrestricted permissions to execute
// the provided method on behalf of the granter's account.
message GenericAuthorization {
option (cosmos_proto.implements_interface) = "cosmos.authz.Authorization";
option (cosmos_proto.implements_interface) = "Authorization";

// Msg, identified by it's type URL, to grant unrestricted permissions to execute
string msg = 1;
Expand All @@ -22,7 +22,7 @@ message GenericAuthorization {
// Grant gives permissions to execute
// the provide method with expiration time.
message Grant {
google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "cosmos.authz.Authorization"];
google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"];
// time when the grant will expire and will be pruned. If null, then the grant
// doesn't have a time expiration (other conditions in `authorization`
// may apply to invalidate the grant)
Expand All @@ -35,7 +35,7 @@ message GrantAuthorization {
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "cosmos.authz.Authorization"];
google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"];
google.protobuf.Timestamp expiration = 4 [(gogoproto.stdtime) = true];
}

Expand Down
Loading

0 comments on commit 841f246

Please sign in to comment.