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

refactor(proto)!: run linter and standardize versioning #1270

Merged
merged 6 commits into from
Apr 8, 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking

* [#1270](https://github.com/NibiruChain/nibiru/pull/1270) - refactor(proto)!: lint protos and standardize versioning
* [#1271](https://github.com/NibiruChain/nibiru/pull/1271) - refactor(perp)!: vpool → perp/amm #2 | imports and renames
* [#1267](https://github.com/NibiruChain/nibiru/pull/1267) - refactor(perp)!: vpool → perp/amm #1 | Moves types, keeper, and cli
* [#1269](https://github.com/NibiruChain/nibiru/pull/1269) - refactor(perp)!: merge x/util with x/perp
* [#1267](https://github.com/NibiruChain/nibiru/pull/1267) - refactor(perp)!: vpool → perp/amm #1 | Moves types, keeper, and cli
* [#1243](https://github.com/NibiruChain/nibiru/pull/1243) - feat(vpool): sqrt of liquidity depth tracked on pool
* [#1220](https://github.com/NibiruChain/nibiru/pull/1220) - feat: reduce gas fees when posting price
* [#1229](https://github.com/NibiruChain/nibiru/pull/1229) - feat: upgrade ibc to v4.2.0 and wasm v0.30.0
Expand Down
6 changes: 2 additions & 4 deletions proto/epochs/event.proto → proto/epochs/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ message EventEpochStart {
uint64 epoch_number = 1;

// The start timestamp of the epoch.
google.protobuf.Timestamp epoch_start_time = 2 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
google.protobuf.Timestamp epoch_start_time = 2
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
}

message EventEpochEnd {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package nibiru.epochs.v1beta1;
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "epochs/state.proto";
import "epochs/v1/state.proto";

option go_package = "github.com/NibiruChain/nibiru/x/epochs/types";

Expand Down
2 changes: 1 addition & 1 deletion proto/epochs/query.proto → proto/epochs/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package nibiru.epochs.v1beta1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "epochs/state.proto";
import "epochs/v1/state.proto";

option go_package = "github.com/NibiruChain/nibiru/x/epochs/types";

Expand Down
4 changes: 2 additions & 2 deletions proto/epochs/state.proto → proto/epochs/v1/state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ message EpochInfo {
(gogoproto.moretags) = "yaml:\"current_epoch_start_time\""
];

// Whether or not this epoch has started. Set to true if current blocktime >= start_time.
// Whether or not this epoch has started. Set to true if current blocktime >=
// start_time.
bool epoch_counting_started = 6;

// The block height at which the current epoch started at.
int64 current_epoch_start_height = 7;
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package nibiru.oracle.v1beta1;
package nibiru.oracle.v1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
Expand All @@ -11,8 +11,8 @@ option go_package = "github.com/NibiruChain/nibiru/x/oracle/types";
message OraclePriceUpdate {
string pair = 1;
string price = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
int64 timestamp_ms = 3;
}
45 changes: 45 additions & 0 deletions proto/oracle/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";
package nibiru.oracle.v1;

import "gogoproto/gogo.proto";
import "oracle/v1/oracle.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/NibiruChain/nibiru/x/oracle/types";

// GenesisState defines the oracle module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
repeated FeederDelegation feeder_delegations = 2
[ (gogoproto.nullable) = false ];
repeated ExchangeRateTuple exchange_rates = 3 [
(gogoproto.castrepeated) = "ExchangeRateTuples",
(gogoproto.nullable) = false
];
repeated MissCounter miss_counters = 4 [ (gogoproto.nullable) = false ];
repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5
[ (gogoproto.nullable) = false ];
repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6
[ (gogoproto.nullable) = false ];
repeated string pairs = 7 [
(gogoproto.customtype) =
"github.com/NibiruChain/nibiru/x/common/asset.Pair",
(gogoproto.nullable) = false
];
repeated PairReward pair_rewards = 8 [ (gogoproto.nullable) = false ];
}

// FeederDelegation is the address for where oracle feeder authority are
// delegated to. By default this struct is only used at genesis to feed in
// default feeder addresses.
message FeederDelegation {
string feeder_address = 1;
string validator_address = 2;
}

// MissCounter defines an miss counter and validator address pair used in
// oracle module's genesis state
message MissCounter {
string validator_address = 1;
uint64 miss_counter = 2;
}
104 changes: 53 additions & 51 deletions proto/oracle/v1beta1/oracle.proto → proto/oracle/v1/oracle.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package nibiru.oracle.v1beta1;
package nibiru.oracle.v1;

import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
Expand All @@ -9,17 +9,17 @@ option go_package = "github.com/NibiruChain/nibiru/x/oracle/types";

// Params defines the module parameters for the x/oracle module.
message Params {
option (gogoproto.equal) = true;
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;

// VotePeriod defines the number of blocks during which voting takes place.
uint64 vote_period = 1 [(gogoproto.moretags) = "yaml:\"vote_period\""];
// VoteThreshold specifies the minimum proportion of votes that must be
// VotePeriod defines the number of blocks during which voting takes place.
uint64 vote_period = 1 [ (gogoproto.moretags) = "yaml:\"vote_period\"" ];
// VoteThreshold specifies the minimum proportion of votes that must be
// received for a ballot to pass.
string vote_threshold = 2 [
(gogoproto.moretags) = "yaml:\"vote_threshold\"",
(gogoproto.moretags) = "yaml:\"vote_threshold\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];
// RewardBand defines a maxium divergence that a price vote can have from the
// weighted median in the ballot. If a vote lies within the valid range
Expand All @@ -30,34 +30,33 @@ message Params {
// Note that if the reward band is smaller than 1 standard
// deviation, the band is taken to be 1 standard deviation.a price
string reward_band = 3 [
(gogoproto.moretags) = "yaml:\"reward_band\"",
(gogoproto.moretags) = "yaml:\"reward_band\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];
// The set of whitelisted markets, or asset pairs, for the module.
// The set of whitelisted markets, or asset pairs, for the module.
// Ex. '["unibi:uusd","ubtc:uusd"]'
repeated string whitelist = 4 [
(gogoproto.moretags) = "yaml:\"whitelist\"",
(gogoproto.moretags) = "yaml:\"whitelist\"",
(gogoproto.customtype) = "github.com/NibiruChain/nibiru/x/common/asset.Pair"
];
// SlashFraction returns the proportion of an oracle's stake that gets
// slashed in the event of slashing. `SlashFraction` specifies the exact
// penalty for failing a voting period.
// SlashFraction returns the proportion of an oracle's stake that gets
// slashed in the event of slashing. `SlashFraction` specifies the exact
// penalty for failing a voting period.
string slash_fraction = 5 [
(gogoproto.moretags) = "yaml:\"slash_fraction\"",
(gogoproto.moretags) = "yaml:\"slash_fraction\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];
// SlashWindow returns the number of voting periods that specify a
// "slash window". After each slash window, all oracles that have missed more
// than the penalty threshold are slashed. Missing the penalty threshold is
// SlashWindow returns the number of voting periods that specify a
// "slash window". After each slash window, all oracles that have missed more
// than the penalty threshold are slashed. Missing the penalty threshold is
// synonymous with submitting fewer valid votes than `MinValidPerWindow`.
uint64 slash_window = 6 [
(gogoproto.moretags) = "yaml:\"slash_window\""];
uint64 slash_window = 6 [ (gogoproto.moretags) = "yaml:\"slash_window\"" ];
string min_valid_per_window = 7 [
(gogoproto.moretags) = "yaml:\"min_valid_per_window\"",
(gogoproto.moretags) = "yaml:\"min_valid_per_window\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];

// Amount of time to look back for TWAP calculations
Expand All @@ -66,75 +65,78 @@ message Params {
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "twap_lookback_window,omitempty",
(gogoproto.moretags) = "yaml:\"twap_lookback_window\""
];

// The minimum number of voters (i.e. oracle validators) per pair for it to be considered a passing ballot.
// Recommended at least 4.
uint64 min_voters = 9 [
(gogoproto.moretags) = "yaml:\"min_voters\""
];

// The minimum number of voters (i.e. oracle validators) per pair for it to be
// considered a passing ballot. Recommended at least 4.
uint64 min_voters = 9 [ (gogoproto.moretags) = "yaml:\"min_voters\"" ];
}

// Struct for aggregate prevoting on the ExchangeRateVote.
// The purpose of aggregate prevote is to hide vote exchange rates with hash
// which is formatted as hex string in SHA256("{salt}:({pair},{exchange_rate})|...|({pair},{exchange_rate}):{voter}")
// which is formatted as hex string in
// SHA256("{salt}:({pair},{exchange_rate})|...|({pair},{exchange_rate}):{voter}")
message AggregateExchangeRatePrevote {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""];
string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""];
uint64 submit_block = 3 [(gogoproto.moretags) = "yaml:\"submit_block\""];
string hash = 1 [ (gogoproto.moretags) = "yaml:\"hash\"" ];
string voter = 2 [ (gogoproto.moretags) = "yaml:\"voter\"" ];
uint64 submit_block = 3 [ (gogoproto.moretags) = "yaml:\"submit_block\"" ];
}

// MsgAggregateExchangeRateVote - struct for voting on
// the exchange rates different assets.
message AggregateExchangeRateVote {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

repeated ExchangeRateTuple exchange_rate_tuples = 1 [
(gogoproto.moretags) = "yaml:\"exchange_rate_tuples\"",
(gogoproto.moretags) = "yaml:\"exchange_rate_tuples\"",
(gogoproto.castrepeated) = "ExchangeRateTuples",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];

string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""];
string voter = 2 [ (gogoproto.moretags) = "yaml:\"voter\"" ];
}

// ExchangeRateTuple - struct to store interpreted exchange rates data to store
message ExchangeRateTuple {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string pair = 1 [
string pair = 1 [
(gogoproto.moretags) = "yaml:\"pair\"",
(gogoproto.customtype) = "github.com/NibiruChain/nibiru/x/common/asset.Pair",
(gogoproto.customtype) =
"github.com/NibiruChain/nibiru/x/common/asset.Pair",
(gogoproto.nullable) = false
];

string exchange_rate = 2 [
(gogoproto.moretags) = "yaml:\"exchange_rate\"",
(gogoproto.moretags) = "yaml:\"exchange_rate\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
(gogoproto.nullable) = false
];
}

// PairReward defines a credit object towards validators
// which provide prices faithfully for different pairs.
message PairReward {
// pair defines the pair for which we incentivize validator to provide prices for.
string pair = 1 [
(gogoproto.customtype) = "github.com/NibiruChain/nibiru/x/common/asset.Pair",
// pair defines the pair for which we incentivize validator to provide prices
// for.
string pair = 1 [
(gogoproto.customtype) =
"github.com/NibiruChain/nibiru/x/common/asset.Pair",
(gogoproto.nullable) = false
];
// id uniquely identifies the rewards instance of the pair
uint64 id = 2;
// vote_periods defines the vote periods left in which rewards will be distributed.
// vote_periods defines the vote periods left in which rewards will be
// distributed.
uint64 vote_periods = 3;
// Coins defines the amount of coins to distribute in a single vote period.
repeated cosmos.base.v1beta1.Coin coins = 4 [(gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin coins = 4 [ (gogoproto.nullable) = false ];
}
Loading