Skip to content

Commit

Permalink
chore: rebuild generated protobuf encoders/decoders
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Aug 17, 2022
1 parent 0056718 commit 61ccf48
Show file tree
Hide file tree
Showing 41 changed files with 4,405 additions and 496 deletions.
4 changes: 2 additions & 2 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test": "yarn jest --passWithNoTests --collect-coverage --projects jest-unit.config.js",
"test:integration": "yarn jest --projects --collect-coverage jest-integration.config.js",
"syncProto": "rm -rf proto && degit Sifchain/sifnode/proto/sifnode#${TAG:-'develop'} proto/sifnode && degit Sifchain/sifnode/third_party/proto#${TAG:-'develop'} proto/third_party",
"codegen": "protoc -I=proto -I=proto/third_party proto/sifnode/**/*.proto --plugin=../node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=src/generated/proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=true'"
"codegen": "protoc -I=proto -I=proto/third_party proto/sifnode/**/**/*.proto --plugin=../node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=src/generated/proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=messages'"
},
"files": [
"build"
Expand Down Expand Up @@ -69,7 +69,7 @@
"jest-websocket-mock": "^2.3.0",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"ts-proto": "^1.118.0",
"ts-proto": "^1.121.5",
"typedoc": "^0.22.18",
"typescript": "^4.7.4",
"vite-compatible-readable-stream": "^3.6.1",
Expand Down
1 change: 1 addition & 0 deletions core/proto/sifnode/admin/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum AdminType {
TOKENREGISTRY = 2;
ETHBRIDGE = 3;
ADMIN = 4;
MARGIN = 5;
}

message AdminAccount {
Expand Down
12 changes: 12 additions & 0 deletions core/proto/sifnode/clp/v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# pool.proto

The Feature Toggle `FEATURE_TOGGLE_MARGIN_CLI_ALPHA` as described in `docs/general/FeatureToggles.md`, introduces additional fields to the `Pool` message that should not be exposed to the mainline.

To avoid having those fields exposed in the mainline code, we generated two versions of the `pool.pb.go` file:

- `pool_FEATURE_TOGGLE_MARGIN_CLI_ALPHA.pb.go`: generated protobuf code that contains the `FEATURE_TOGGLE_MARGIN_CLI_ALPHA` additional fields of the Pool message
- `pool_NO_FEATURE_TOGGLE_MARGIN_CLI_ALPHA.pb.go`: generated protobuf code that contains the original Pool message without the additional fields from `FEATURE_TOGGLE_MARGIN_CLI_ALPHA`

Whenever the protobuf files need to be re-generated, we should make sure to include the relevant changes of the Pool message generated codes to one of those files.

Also please make sure that the `pool.pb.go` file is not added and commited to the repository.
1 change: 1 addition & 0 deletions core/proto/sifnode/clp/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option go_package = "github.com/Sifchain/sifnode/x/clp/types";

import "sifnode/clp/v1/params.proto";
import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/pool.proto";

// GenesisState - all clp state that must be provided at genesis
// TODO: Add parameters to Genesis state ,such as minimum liquidity required to
Expand Down
5 changes: 4 additions & 1 deletion core/proto/sifnode/clp/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import "gogoproto/gogo.proto";
option go_package = "github.com/Sifchain/sifnode/x/clp/types";

// Params - used for initializing default parameter for clp at genesis
message Params { uint64 min_create_pool_threshold = 1; }
message Params {
uint64 min_create_pool_threshold = 1;
bool enable_removal_queue = 2;
}

message RewardParams {
uint64 liquidity_removal_lock_period = 1; // in blocks
Expand Down
65 changes: 65 additions & 0 deletions core/proto/sifnode/clp/v1/pool.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

syntax = "proto3";
package sifnode.clp.v1;

import "gogoproto/gogo.proto";
import "sifnode/clp/v1/types.proto";

option go_package = "github.com/Sifchain/sifnode/x/clp/types";

message Pool {
Asset external_asset = 1;
string native_asset_balance = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"native_asset_balance\""
];
string external_asset_balance = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"external_asset_balance\""
];
string pool_units = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"pool_units\""
];
string swap_price_native = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"swap_price_native \""
];
string swap_price_external = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"swap_price_external \""
];
string reward_period_native_distributed = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"reward_period_native_distributed\""
];
string external_liabilities = 8 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string external_custody = 9 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string native_liabilities = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string native_custody = 11 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string health = 12 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string interest_rate = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
int64 last_height_interest_rate_computed = 14;
}
1 change: 1 addition & 0 deletions core/proto/sifnode/clp/v1/querier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sifnode.clp.v1;

import "gogoproto/gogo.proto";
import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/pool.proto";
import "sifnode/clp/v1/params.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
Expand Down
9 changes: 9 additions & 0 deletions core/proto/sifnode/clp/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sifnode.clp.v1;

import "gogoproto/gogo.proto";
import "sifnode/clp/v1/types.proto";
import "sifnode/clp/v1/pool.proto";
import "sifnode/clp/v1/params.proto";

option go_package = "github.com/Sifchain/sifnode/x/clp/types";
Expand Down Expand Up @@ -234,6 +235,14 @@ message MsgCancelUnlock {

message MsgCancelUnlockResponse {}

message RemovalRequest {
int64 id = 1;
string value = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
MsgRemoveLiquidity msg = 3;
}
message MsgModifyLiquidityProtectionRates {
string signer = 1 [ (gogoproto.moretags) = "yaml:\"signer\"" ];
string current_rowan_liquidity_threshold = 2 [
Expand Down
42 changes: 10 additions & 32 deletions core/proto/sifnode/clp/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,6 @@ option go_package = "github.com/Sifchain/sifnode/x/clp/types";

message Asset { string symbol = 1; }

message Pool {
Asset external_asset = 1;
string native_asset_balance = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"native_asset_balance\""
];
string external_asset_balance = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"external_asset_balance\""
];
string pool_units = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"pool_units\""
];
string swap_price_native = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"swap_price_native \""
];
string swap_price_external = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"swap_price_external \""
];
string reward_period_native_distributed = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"reward_period_native_distributed\""
];
}

message LiquidityProvider {
Asset asset = 1;
string liquidity_provider_units = 2 [
Expand Down Expand Up @@ -76,4 +44,14 @@ message EventPolicy {
string event_type = 1;
string pmtp_period_start_block = 2;
string pmtp_period_end_block = 3;
}

message RemovalQueue {
int64 count = 1;
int64 id = 2;
int64 start_height = 3;
string total_value = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
}
113 changes: 113 additions & 0 deletions core/proto/sifnode/margin/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
syntax = "proto3";
package sifnode.margin.v1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "sifnode/margin/v1/types.proto";

option go_package = "github.com/Sifchain/sifnode/x/margin/types";

service Query {
rpc GetMTP(MTPRequest) returns (MTPResponse) {}
rpc GetPositions(PositionsRequest) returns (PositionsResponse) {
option (google.api.http).get = "/sifchain/margin/v1/positions/{pagination.key}";
}
rpc GetPositionsForAddress(PositionsForAddressRequest)
returns (PositionsForAddressResponse) {
option (google.api.http).get = "/sifchain/margin/v1/mtps-for-address/{address}/{pagination.key}";
}
rpc GetPositionsByPool(PositionsByPoolRequest) returns (PositionsByPoolResponse) {
option (google.api.http).get = "/sifchain/margin/v1/mtps-by-pool/{asset}/{pagination.key}";
}
rpc GetParams(ParamsRequest) returns (ParamsResponse) {
option (google.api.http).get = "/sifchain/margin/v1/params";
}
rpc GetStatus(StatusRequest) returns (StatusResponse) {
option (google.api.http).get = "/sifchain/margin/v1/status";
}
rpc GetSQParams(GetSQParamsRequest) returns (GetSQParamsResponse) {}
rpc GetWhitelist(WhitelistRequest) returns (WhitelistResponse) {
option (google.api.http).get = "/sifchain/margin/v1/whitelist";
}
rpc IsWhitelisted(IsWhitelistedRequest) returns (IsWhitelistedResponse) {
option (google.api.http).get = "/sifchain/margin/v1/is-whitelisted";
}
}

message MTPRequest {
string address = 1;
uint64 id = 2;
}

message MTPResponse { MTP mtp = 1; }

message PositionsForAddressRequest {
string address = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message PositionsForAddressResponse {
repeated MTP mtps = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message PositionsByPoolRequest {
string asset = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message PositionsByPoolResponse {
repeated MTP mtps = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

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

message PositionsResponse {
repeated MTP mtps = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message ParamsRequest {}

message ParamsResponse {
Params params = 1;
}

message StatusRequest {

}

message StatusResponse {
uint64 open_mtp_count = 1;
uint64 lifetime_mtp_count = 2;
}

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

message WhitelistResponse {
repeated string whitelist = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message GetSQParamsRequest {
string pool = 1;
}

message GetSQParamsResponse {
int64 begin_block = 1;
}

message IsWhitelistedRequest {
string address = 1;
}

message IsWhitelistedResponse {
string address = 1;
bool is_whitelisted = 2;
}
Loading

0 comments on commit 61ccf48

Please sign in to comment.