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

reformat proto #396

Merged
merged 8 commits into from
Dec 22, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Proto format
run: make check-proto-format

- name: Test
run: make test

12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ proto-gen:
proto-swagger-gen:
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh

PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae
PROTO_FORMATTER_IMAGE=bufbuild/buf:1.28.1

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
format proto -w


.PHONY: all install install-debug \
Expand Down Expand Up @@ -256,3 +256,11 @@ openapi:
mocks:
@echo "Regenerate mocks..."
@go generate ./...

format-all: format proto-format

check-proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
format proto -d --exit-code
3 changes: 2 additions & 1 deletion proto/neutron/contractmanager/failure.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ option go_package = "github.com/neutron-org/neutron/v2/x/contractmanager/types";

// Failure message contains information about ACK failures and can be used to
// replay ACK in case of requirement.
// Note that Failure means that sudo handler to cosmwasm contract failed for some reason
// Note that Failure means that sudo handler to cosmwasm contract failed for
// some reason
message Failure {
// Address of the failed contract
string address = 1;
Expand Down
8 changes: 4 additions & 4 deletions proto/neutron/contractmanager/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ syntax = "proto3";
package neutron.contractmanager;

import "gogoproto/gogo.proto";
import "neutron/contractmanager/params.proto";
import "neutron/contractmanager/failure.proto";
import "neutron/contractmanager/params.proto";
// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/neutron-org/neutron/v2/x/contractmanager/types";

// GenesisState defines the contractmanager module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
Params params = 1 [(gogoproto.nullable) = false];
// List of the contract failures
repeated Failure failures_list = 2 [ (gogoproto.nullable) = false ];
repeated Failure failures_list = 2 [(gogoproto.nullable) = false];
// this line is used by starport scaffolding # genesis/proto/state
}
}
13 changes: 6 additions & 7 deletions proto/neutron/contractmanager/query.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
syntax = "proto3";
package neutron.contractmanager;

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "neutron/contractmanager/params.proto";
import "neutron/contractmanager/failure.proto";
import "neutron/contractmanager/params.proto";
// this line is used by starport scaffolding # 1

option go_package = "github.com/neutron-org/neutron/v2/x/contractmanager/types";
Expand All @@ -24,8 +24,7 @@ service Query {

// Queries Failures by contract address.
rpc AddressFailures(QueryFailuresRequest) returns (QueryFailuresResponse) {
option (google.api.http).get =
"/neutron/contractmanager/failures/{address}";
option (google.api.http).get = "/neutron/contractmanager/failures/{address}";
}

// Queries a list of Failures occurred on the network.
Expand All @@ -42,7 +41,7 @@ message QueryParamsRequest {}
// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryFailuresRequest is request type for the Query/Failures RPC method.
Expand All @@ -56,8 +55,8 @@ message QueryFailuresRequest {

// QueryFailuresResponse is response type for the Query/Failures RPC method.
message QueryFailuresResponse {
repeated Failure failures = 1 [ (gogoproto.nullable) = false ];
repeated Failure failures = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// this line is used by starport scaffolding # 3
// this line is used by starport scaffolding # 3
34 changes: 18 additions & 16 deletions proto/neutron/contractmanager/tx.proto
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
syntax = "proto3";
package neutron.contractmanager;

import "neutron/contractmanager/params.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "neutron/contractmanager/params.proto";

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/neutron-org/neutron/v2/x/contractmanager/types";

// Msg defines the Msg service.
service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

// MsgUpdateParams is the MsgUpdateParams request type.
//
// Since: 0.47
message MsgUpdateParams {
option (amino.name) = "contractmanager/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/contractmanager parameters to update.
//
// NOTE: All parameters must be supplied.
contractmanager.Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
option (amino.name) = "contractmanager/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/contractmanager parameters to update.
//
// NOTE: All parameters must be supplied.
contractmanager.Params params = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// MsgUpdateParamsResponse defines the response structure for executing a
Expand Down
6 changes: 3 additions & 3 deletions proto/neutron/cron/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ option go_package = "github.com/neutron-org/neutron/v2/x/cron/types";

// GenesisState defines the cron module's genesis state.
message GenesisState {
repeated Schedule scheduleList = 2 [ (gogoproto.nullable) = false ];
Params params = 1 [ (gogoproto.nullable) = false ];
repeated Schedule scheduleList = 2 [(gogoproto.nullable) = false];
Params params = 1 [(gogoproto.nullable) = false];
// this line is used by starport scaffolding # genesis/proto/state
}
}
12 changes: 7 additions & 5 deletions proto/neutron/cron/query.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";
package neutron.cron;

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "neutron/cron/params.proto";
import "neutron/cron/schedule.proto";
// this line is used by starport scaffolding # 1
Expand Down Expand Up @@ -34,21 +34,23 @@ message QueryParamsRequest {}

message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [ (gogoproto.nullable) = false ];
Params params = 1 [(gogoproto.nullable) = false];
}

message QueryGetScheduleRequest { string name = 1; }
message QueryGetScheduleRequest {
string name = 1;
}

message QueryGetScheduleResponse {
Schedule schedule = 1 [ (gogoproto.nullable) = false ];
Schedule schedule = 1 [(gogoproto.nullable) = false];
}

message QuerySchedulesRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

message QuerySchedulesResponse {
repeated Schedule schedules = 1 [ (gogoproto.nullable) = false ];
repeated Schedule schedules = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

Expand Down
6 changes: 3 additions & 3 deletions proto/neutron/cron/schedule.proto
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
syntax = "proto3";
package neutron.cron;

option go_package = "github.com/neutron-org/neutron/v2/x/cron/types";

import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v2/x/cron/types";

message Schedule {
// Name of schedule
string name = 1;
// Period in blocks
uint64 period = 2;
// Msgs that will be executed every period amount of time
repeated MsgExecuteContract msgs = 3 [ (gogoproto.nullable) = false ];
repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
// Last execution's block height
uint64 last_execute_height = 4;
}
Expand Down
34 changes: 18 additions & 16 deletions proto/neutron/cron/tx.proto
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
syntax = "proto3";
package neutron.cron;

import "neutron/cron/params.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "neutron/cron/params.proto";

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/neutron-org/neutron/v2/x/cron/types";

// Msg defines the Msg service.
service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

// this line is used by starport scaffolding # proto/tx/message
Expand All @@ -23,17 +23,19 @@ service Msg {
//
// Since: 0.47
message MsgUpdateParams {
option (amino.name) = "cron/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/cron parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
option (amino.name) = "cron/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/cron parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// MsgUpdateParamsResponse defines the response structure for executing a
Expand Down
13 changes: 7 additions & 6 deletions proto/neutron/dex/deposit_record.proto
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
syntax = "proto3";
package neutron.dex;

option go_package = "github.com/neutron-org/neutron/v2/x/dex/types";
import "gogoproto/gogo.proto";
import "neutron/dex/pair_id.proto";

option go_package = "github.com/neutron-org/neutron/v2/x/dex/types";

message DepositRecord {
PairID pair_id = 1;
string shares_owned = 2 [
(gogoproto.moretags) = "yaml:\"shares_owned\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "shares_owned"
];
(gogoproto.moretags) = "yaml:\"shares_owned\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "shares_owned"
];
int64 center_tick_index = 3;
int64 lower_tick_index = 4;
int64 upper_tick_index = 5;
Expand Down
19 changes: 9 additions & 10 deletions proto/neutron/dex/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ syntax = "proto3";
package neutron.dex;

import "gogoproto/gogo.proto";
import "neutron/dex/params.proto";
import "neutron/dex/limit_order_tranche_user.proto";
import "neutron/dex/limit_order_tranche.proto";
import "neutron/dex/tick_liquidity.proto";
import "neutron/dex/limit_order_tranche_user.proto";
import "neutron/dex/params.proto";
import "neutron/dex/pool_metadata.proto";
import "neutron/dex/tick_liquidity.proto";

// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/neutron-org/neutron/v2/x/dex/types";

// GenesisState defines the dex module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
repeated TickLiquidity tick_liquidity_list = 2 [(gogoproto.nullable) = true ];
repeated LimitOrderTranche inactive_limit_order_tranche_list = 3 [(gogoproto.nullable) = true ];
repeated LimitOrderTrancheUser limit_order_tranche_user_list = 4 [(gogoproto.nullable) = true ];
repeated PoolMetadata pool_metadata_list = 5 [(gogoproto.nullable) = false];
uint64 pool_count = 6;
Params params = 1 [(gogoproto.nullable) = false];
repeated TickLiquidity tick_liquidity_list = 2 [(gogoproto.nullable) = true];
repeated LimitOrderTranche inactive_limit_order_tranche_list = 3 [(gogoproto.nullable) = true];
repeated LimitOrderTrancheUser limit_order_tranche_user_list = 4 [(gogoproto.nullable) = true];
repeated PoolMetadata pool_metadata_list = 5 [(gogoproto.nullable) = false];
uint64 pool_count = 6;
// this line is used by starport scaffolding # genesis/proto/state
}

12 changes: 5 additions & 7 deletions proto/neutron/dex/limit_order_expiration.proto
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
syntax = "proto3";
package neutron.dex;

option go_package = "github.com/neutron-org/neutron/v2/x/dex/types";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

import "gogoproto/gogo.proto";
option go_package = "github.com/neutron-org/neutron/v2/x/dex/types";

message LimitOrderExpiration {
// see limitOrderTranche.proto for details on goodTilDate
google.protobuf.Timestamp expiration_time = 1 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
bytes tranche_ref = 2;

}

Loading
Loading