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

proto formatting #267

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ proto-pulsar-gen:
@$(protoImage) sh ./scripts/protocgen-pulsar.sh

proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
@$(protoImage) find ./ -name "*.proto" -exec buf format {} -w \;

proto-lint:
@$(protoImage) buf lint --error-format=json ./proto
Expand Down
34 changes: 20 additions & 14 deletions proto/ibc/applications/nft_transfer/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,42 @@ syntax = "proto3";

package ibc.applications.nft_transfer.v1;

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

import "ibc/applications/nft_transfer/v1/types.proto";
import "gogoproto/gogo.proto";
import "ibc/applications/nft_transfer/v1/types.proto";

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

// GenesisState defines the ibc nft-transfer genesis state
message GenesisState {
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""];
repeated ClassTrace class_traces = 2 [
(gogoproto.castrepeated) = "Traces",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"class_traces\""
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"class_traces\""
];
repeated ClassData class_data = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"class_data\""
];
repeated TokenData token_data = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"token_data\""
];
repeated ClassData class_data = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"class_data\""];
repeated TokenData token_data = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"token_data\""];

Params params = 5 [(gogoproto.nullable) = false];
}

// ClassData contains the class trace hash and the class data
// for genesis.
message ClassData {
bytes trace_hash = 1;
string data = 2;
bytes trace_hash = 1;
string data = 2;
}

// TokenData contains the trace hash, token id, and the token data
// for genesis.
message TokenData {
bytes trace_hash = 1;
string token_id = 2;
string data = 3;
}
bytes trace_hash = 1;
string token_id = 2;
string data = 3;
}
4 changes: 2 additions & 2 deletions proto/ibc/applications/nft_transfer/v1/packet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package ibc.applications.nft_transfer.v1;

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

import "gogoproto/gogo.proto";

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

// NonFungibleTokenPacketData defines a struct for the packet payload
// See NonFungibleTokenPacketData spec:
// https://github.com/cosmos/ibc/tree/main/spec/app/ics-721-nft-transfer
Expand Down
15 changes: 9 additions & 6 deletions proto/ibc/applications/nft_transfer/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ syntax = "proto3";

package ibc.applications.nft_transfer.v1;

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "ibc/applications/nft_transfer/v1/types.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "ibc/applications/nft_transfer/v1/types.proto";

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

// Query provides defines the gRPC querier service.
service Query {
Expand Down Expand Up @@ -62,7 +62,10 @@ message QueryClassTracesRequest {
// method.
message QueryClassTracesResponse {
// class_traces returns all class id traces information.
repeated ClassTrace class_traces = 1 [(gogoproto.castrepeated) = "Traces", (gogoproto.nullable) = false];
repeated ClassTrace class_traces = 1 [
(gogoproto.castrepeated) = "Traces",
(gogoproto.nullable) = false
];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
Expand Down Expand Up @@ -102,4 +105,4 @@ message QueryParamsRequest {}
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1;
}
}
27 changes: 19 additions & 8 deletions proto/ibc/applications/nft_transfer/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ service Msg {
// https://github.com/cosmos/ibc/tree/main/spec/app/ics-721-nft-transfer
message MsgTransfer {
option (cosmos.msg.v1.signer) = "sender";
option (amino.name) = "nft-transfer/MsgTransfer";
option (amino.name) = "nft-transfer/MsgTransfer";

option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// the port on which the packet will be sent
Expand All @@ -42,13 +42,21 @@ message MsgTransfer {
// the token id of the NFT
repeated string token_ids = 4 [(gogoproto.moretags) = "yaml:\"token_ids\""];
// the sender address
string sender = 5 [(gogoproto.moretags) = "yaml:\"sender\"", (cosmos_proto.scalar) = "cosmos.AddressString"];
string sender = 5 [
(gogoproto.moretags) = "yaml:\"sender\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
// the recipient address on the destination chain
string receiver = 6 [(gogoproto.moretags) = "yaml:\"receiver\"", (cosmos_proto.scalar) = "cosmos.AddressString"];
string receiver = 6 [
(gogoproto.moretags) = "yaml:\"receiver\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
// Timeout height relative to the current block height.
// The timeout is disabled when set to 0.
ibc.core.client.v1.Height timeout_height = 7
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
ibc.core.client.v1.Height timeout_height = 7 [
(gogoproto.moretags) = "yaml:\"timeout_height\"",
(gogoproto.nullable) = false
];
// Timeout timestamp in absolute nanoseconds since unix epoch.
// The timeout is disabled when set to 0.
uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
Expand All @@ -65,14 +73,17 @@ message MsgTransferResponse {
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "nft-transfer/MsgUpdateParams";
option (amino.name) = "nft-transfer/MsgUpdateParams";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the x/nft-transfer parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
Params params = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// MsgUpdateParamsResponse defines the response structure for executing a
Expand Down
10 changes: 5 additions & 5 deletions proto/ibc/applications/nft_transfer/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package ibc.applications.nft_transfer.v1;

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/initia-labs/initia/x/ibc/nft-transfer/types";

// ClassTrace contains the base class id for ICS721 non fungible tokens and the
// source tracing information path.
Expand All @@ -19,8 +19,8 @@ message ClassTrace {

// Params defines the set of IBC nft transfer parameters.
message Params {
option (amino.name) = "nft-transfer/Params";
option (gogoproto.equal) = true;
option (amino.name) = "nft-transfer/Params";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;

// send_enabled enables or disables all cross-chain token transfers from this chain.
Expand Down
6 changes: 4 additions & 2 deletions proto/ibc/applications/perm/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ option go_package = "github.com/initia-labs/initia/x/ibc/perm/types";

// GenesisState defines the ibc perm genesis state
message GenesisState {
repeated ChannelState channel_states = 1
[(gogoproto.moretags) = "yaml:\"channel_states\"", (gogoproto.nullable) = false];
repeated ChannelState channel_states = 1 [
(gogoproto.moretags) = "yaml:\"channel_states\"",
(gogoproto.nullable) = false
];
}
2 changes: 1 addition & 1 deletion proto/ibc/applications/perm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ message QueryChannelStatesResponse {
// QueryChannelStateRequest is the request type for the Query/ChannelState RPC method.
message QueryChannelStateRequest {
string channel_id = 1;
string port_id = 2;
string port_id = 2;
}

// QueryChannelStateResponse is the response type for the Query/ChannelState RPC method.
Expand Down
33 changes: 21 additions & 12 deletions proto/ibc/applications/perm/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ service Msg {
// the specific ibc channel.
message MsgSetPermissionedRelayers {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "perm/MsgSetPermissionedRelayers";
option (amino.name) = "perm/MsgSetPermissionedRelayers";

option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// authority is the address that controls the module
// (defaults to x/gov unless overwritten).
string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\"", (cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [
(gogoproto.moretags) = "yaml:\"authority\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
repeated string relayers = 4 [(gogoproto.moretags) = "yaml:\"relayers\""];
}

Expand All @@ -45,16 +48,19 @@ message MsgSetPermissionedRelayersResponse {}
// MsgHaltChannel defines msg to halt the specific ibc channel.
message MsgHaltChannel {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "perm/MsgHaltChannel";
option (amino.name) = "perm/MsgHaltChannel";

option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// authority is the address that controls the module
// (defaults to x/gov unless overwritten).
string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\"", (cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [
(gogoproto.moretags) = "yaml:\"authority\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
}

// MsgHaltChannelResponse defines the Msg/HaltChannel response type.
Expand All @@ -63,16 +69,19 @@ message MsgHaltChannelResponse {}
// MsgResumeChannel defines msg to resume the specific ibc channel.
message MsgResumeChannel {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "perm/MsgResumeChannel";
option (amino.name) = "perm/MsgResumeChannel";

option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// authority is the address that controls the module
// (defaults to x/gov unless overwritten).
string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\"", (cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [
(gogoproto.moretags) = "yaml:\"authority\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""];
}

// MsgResumeChannelResponse defines the Msg/ResumeChannel response type.
Expand Down
10 changes: 5 additions & 5 deletions proto/ibc/applications/perm/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ option go_package = "github.com/initia-labs/initia/x/ibc/perm/types";

// ChannelState defines the channel state for the specific port-id:channel-id pair.
message ChannelState {
string port_id = 1;
string channel_id = 2;
HaltState halt_state = 3 [(gogoproto.nullable) = false];
repeated string relayers = 4;
string port_id = 1;
string channel_id = 2;
HaltState halt_state = 3 [(gogoproto.nullable) = false];
repeated string relayers = 4;
}

// HaltState defines the halt state for the specific port-id:channel-id pair.
message HaltState {
bool halted = 1;
bool halted = 1;
string halted_by = 2;
}
13 changes: 8 additions & 5 deletions proto/initia/bank/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
syntax = "proto3";
package initia.bank.v1;

option go_package = "github.com/initia-labs/initia/x/bank/types";
option (gogoproto.equal_all) = false;

import "amino/amino.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/initia-labs/initia/x/bank/types";
option (gogoproto.equal_all) = false;

// Msg defines the bank Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
Expand All @@ -22,13 +22,16 @@ service Msg {
// MsgSetDenomMetadata is the Msg/UpdateParams request type.
message MsgSetDenomMetadata {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "bank/MsgSetDenomMetadata";
option (amino.name) = "bank/MsgSetDenomMetadata";

// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// metadata defines the x/bank denom metadata to update.
cosmos.bank.v1beta1.Metadata metadata = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
cosmos.bank.v1beta1.Metadata metadata = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// MsgSetDenomMetadataResponse defines the response structure for executing a
Expand Down
4 changes: 1 addition & 3 deletions proto/initia/distribution/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import "cosmos/app/v1alpha1/module.proto";

// Module is the config object of the builder module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/initia-labs/initia/x/distribution"
};
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/initia-labs/initia/x/distribution"};

// Authority defines the custom module authority.
// If not set, defaults to the governance module.
Expand Down
Loading
Loading