Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All Makefile proto commands use Docker #7931

Merged
merged 8 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run commands
  • Loading branch information
amaury1093 committed Nov 13, 2020
commit cc4a88ec081824fac2fc2e403f83aa83aa7cb6ce
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ build, in which case we can fall back on `go mod tidy -v`.

We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [gogoproto](https://github.com/gogo/protobuf) to generate code for use in Cosmos-SDK.

For determinstic behavior around Protobuf tooling, everything is containerized using Docker. Make sure to have Docker installed on your machine, or head to [Docker's website](https://docs.docker.com/get-docker/) to install it.

For formatting code in `.proto` files, you can run `make proto-format` command.

For linting and checking breaking changes, we use [buf](https://buf.build/). Make sure you have Docker installed, then you can use these commands `make proto-lint` and `make proto-check-breaking` to respectively lint your proto files and check for breaking changes.
For linting and checking breaking changes, we use [buf](https://buf.build/). You can use the commands `make proto-lint` and `make proto-check-breaking` to respectively lint your proto files and check for breaking changes.

To generate the protobuf stubs, you can run `make proto-gen`.

To generate the protobuf stubs you must Docker installed. Then, you will be able to run `make proto-gen` to generate the protobuf stubs.
We also added the `make proto-all` command to run all the above commands sequentially.

In order for imports to properly compile in your IDE, you may need to manually set your protobuf path in your IDE's workspace settings/config.

Expand Down
239 changes: 239 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19992,6 +19992,221 @@ paths:
type: boolean
tags:
- Query
/ibc/client/v1beta1/params:
get:
summary: ClientParams queries all parameters of the ibc client.
operationId: ClientParams
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: params defines the parameters of the module.
type: object
properties:
allowed_clients:
type: array
items:
type: string
description: >-
allowed_clients defines the list of allowed client state
types.
description: >-
QueryClientParamsResponse is the response type for the
Query/ClientParams RPC method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
description: >-
A URL/resource name that uniquely identifies the type of
the serialized

protocol buffer message. This string must contain at
least

one "/" character. The last segment of the URL's path
must represent

the fully qualified name of the type (as in

`path/google.protobuf.Duration`). The name should be in
a canonical form

(e.g., leading "." is not accepted).


In practice, teams usually precompile into the binary
all types that they

expect it to use in the context of Any. However, for
URLs which use the

scheme `http`, `https`, or no scheme, one can optionally
set up a type

server that maps type URLs to message definitions as
follows:


* If no scheme is provided, `https` is assumed.

* An HTTP GET on the URL must yield a
[google.protobuf.Type][]
value in binary format, or produce an error.
* Applications are allowed to cache lookup results based
on the
URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)

Note: this functionality is not currently available in
the official

protobuf release, and it is not used for type URLs
beginning with

type.googleapis.com.


Schemes other than `http`, `https` (or the empty scheme)
might be

used with implementation specific semantics.
value:
type: string
format: byte
description: >-
Must be a valid serialized protocol buffer of the above
specified type.
description: >-
`Any` contains an arbitrary serialized protocol buffer
message along with a

URL that describes the type of the serialized message.


Protobuf library provides support to pack/unpack Any values
in the form

of utility functions or additional generated methods of the
Any type.


Example 1: Pack and unpack a message in C++.

Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}

Example 2: Pack and unpack a message in Java.

Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}

Example 3: Pack and unpack a message in Python.

foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...

Example 4: Pack and unpack a message in Go

foo := &pb.Foo{...}
any, err := ptypes.MarshalAny(foo)
...
foo := &pb.Foo{}
if err := ptypes.UnmarshalAny(any, foo); err != nil {
...
}

The pack methods provided by protobuf library will by
default use

'type.googleapis.com/full.type.name' as the type URL and the
unpack

methods only use the fully qualified type name after the
last '/'

in the type URL, for example "foo.bar.com/x/y.z" will yield
type

name "y.z".



JSON

====

The JSON representation of an `Any` value uses the regular

representation of the deserialized, embedded message, with
an

additional field `@type` which contains the type URL.
Example:

package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}

{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}

If the embedded message type is well-known and has a custom
JSON

representation, that representation will be embedded adding
a field

`value` which holds the custom JSON in addition to the
`@type`

field. Example (for message [google.protobuf.Duration][]):

{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
tags:
- Query
/ibc/core/client/v1beta1/client_states:
get:
summary: ClientStates queries all the IBC light clients of a chain.
Expand Down Expand Up @@ -33015,6 +33230,30 @@ definitions:
description: >-
ConsensusStateWithHeight defines a consensus state with an additional
height field.
ibc.core.client.v1.Params:
type: object
properties:
allowed_clients:
type: array
items:
type: string
description: allowed_clients defines the list of allowed client state types.
description: Params defines the set of IBC light client parameters.
ibc.core.client.v1.QueryClientParamsResponse:
type: object
properties:
params:
description: params defines the parameters of the module.
type: object
properties:
allowed_clients:
type: array
items:
type: string
description: allowed_clients defines the list of allowed client state types.
description: >-
QueryClientParamsResponse is the response type for the Query/ClientParams
RPC method.
ibc.core.client.v1.QueryClientStateResponse:
type: object
properties:
Expand Down
11 changes: 6 additions & 5 deletions proto/cosmos/auth/v1beta1/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ message BaseAccount {

option (cosmos_proto.implements_interface) = "AccountI";

string address = 1;
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""];
string address = 1;
google.protobuf.Any pub_key = 2
[(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""];
uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""];
uint64 sequence = 4;
}
Expand All @@ -29,9 +30,9 @@ message ModuleAccount {
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "ModuleAccountI";

BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
string name = 2;
repeated string permissions = 3;
BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
string name = 2;
repeated string permissions = 3;
}

// Params defines the parameters for the auth module.
Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/bank/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ message MsgSend {
}

// MsgSendResponse defines the Msg/Send response type.
message MsgSendResponse { }
message MsgSendResponse {}

// MsgMultiSend represents an arbitrary multi-in, multi-out send message.
message MsgMultiSend {
option (gogoproto.equal) = false;

repeated Input inputs = 1 [(gogoproto.nullable) = false];
repeated Input inputs = 1 [(gogoproto.nullable) = false];
repeated Output outputs = 2 [(gogoproto.nullable) = false];
}

// MsgMultiSendResponse defines the Msg/MultiSend response type.
message MsgMultiSendResponse { }
message MsgMultiSendResponse {}
2 changes: 1 addition & 1 deletion proto/cosmos/base/abci/v1beta1/abci.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ message ABCIMessageLog {
message StringEvent {
option (gogoproto.stringer) = true;

string type = 1;
string type = 1;
repeated Attribute attributes = 2 [(gogoproto.nullable) = false];
}

Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/base/store/v1beta1/commit_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/store/types";
// CommitInfo defines commit information used by the multi-store when committing
// a version/height.
message CommitInfo {
int64 version = 1;
int64 version = 1;
repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false];
}

Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/crisis/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ message MsgVerifyInvariant {
}

// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.
message MsgVerifyInvariantResponse { }
message MsgVerifyInvariantResponse {}
6 changes: 3 additions & 3 deletions proto/cosmos/crypto/ed25519/keys.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519";
// the x-coordinate. Otherwise the first byte is a 0x03.
// This prefix is followed with the x-coordinate.
message PubKey {
option (gogoproto.goproto_stringer) = false;
option (gogoproto.goproto_stringer) = false;

bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"];
bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"];
}

// PrivKey defines a ed25519 private key.
message PrivKey {
bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"];
bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"];
}
Loading