Skip to content

Commit

Permalink
refactor(proto): Use explicit namespacing on proto imports for #1608 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine authored Oct 3, 2023
1 parent e054b45 commit 9f53504
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 415 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

* [#1610](https://github.com/NibiruChain/nibiru/pull/1610) - refactor(app): Simplify app.go with less redundant imports using struct embedding.
* [#1610](https://github.com/NibiruChain/nibiru/pull/1610) - refactor(app):
Simplify app.go with less redundant imports using struct embedding.
* [#1614](https://github.com/NibiruChain/nibiru/pull/1614) - refactor(proto): Use
explicit namespacing on proto imports for #1608

### Dependencies
- Bump `github.com/prometheus/client_golang` from 1.16.0 to 1.17.0 ([#1605](https://github.com/NibiruChain/nibiru/pull/1605))
Expand Down
5 changes: 3 additions & 2 deletions proto/nibiru/devgas/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ option go_package = "github.com/NibiruChain/nibiru/x/devgas/v1/types";
// GenesisState defines the module's genesis state.
message GenesisState {
// params are the feeshare module parameters
ModuleParams params = 1 [ (gogoproto.nullable) = false ];
nibiru.devgas.v1.ModuleParams params = 1 [ (gogoproto.nullable) = false ];
// FeeShare is a slice of active registered contracts for fee distribution
repeated FeeShare fee_share = 2 [ (gogoproto.nullable) = false ];
repeated nibiru.devgas.v1.FeeShare fee_share = 2
[ (gogoproto.nullable) = false ];
}

// ModuleParams defines the params for the devgas module
Expand Down
10 changes: 6 additions & 4 deletions proto/nibiru/devgas/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ message QueryFeeSharesRequest {
// method.
message QueryFeeSharesResponse {
// FeeShare is the slice of all stored Reveneue for the deployer
repeated FeeShare feeshare = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.devgas.v1.FeeShare feeshare = 1
[ (gogoproto.nullable) = false ];
}

// QueryFeeShareRequest is the request type for the Query/FeeShare RPC method.
Expand All @@ -70,7 +71,7 @@ message QueryFeeShareRequest {
// QueryFeeShareResponse is the response type for the Query/FeeShare RPC method.
message QueryFeeShareResponse {
// FeeShare is a stored Reveneue for the queried contract
FeeShare feeshare = 1 [ (gogoproto.nullable) = false ];
nibiru.devgas.v1.FeeShare feeshare = 1 [ (gogoproto.nullable) = false ];
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
Expand All @@ -79,7 +80,7 @@ message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params is the returned FeeShare parameter
ModuleParams params = 1 [ (gogoproto.nullable) = false ];
nibiru.devgas.v1.ModuleParams params = 1 [ (gogoproto.nullable) = false ];
}

// QueryFeeSharesByWithdrawerRequest is the request type for the
Expand All @@ -92,5 +93,6 @@ message QueryFeeSharesByWithdrawerRequest {
// QueryFeeSharesByWithdrawerResponse is the response type for the
// Query/FeeSharesByWithdrawer RPC method.
message QueryFeeSharesByWithdrawerResponse {
repeated FeeShare feeshare = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.devgas.v1.FeeShare feeshare = 1
[ (gogoproto.nullable) = false ];
}
3 changes: 2 additions & 1 deletion proto/nibiru/epochs/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ option go_package = "github.com/NibiruChain/nibiru/x/epochs/types";

// GenesisState defines the epochs module's genesis state.
message GenesisState {
repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.epochs.v1.EpochInfo epochs = 1
[ (gogoproto.nullable) = false ];
}
5 changes: 3 additions & 2 deletions proto/nibiru/epochs/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ service Query {

message QueryEpochsInfoRequest {}
message QueryEpochsInfoResponse {
repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.epochs.v1.EpochInfo epochs = 1
[ (gogoproto.nullable) = false ];
}

message QueryCurrentEpochRequest { string identifier = 1; }
message QueryCurrentEpochResponse { uint64 current_epoch = 1; }
message QueryCurrentEpochResponse { uint64 current_epoch = 1; }
2 changes: 1 addition & 1 deletion proto/nibiru/inflation/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];
nibiru.inflation.v1.Params params = 1 [ (gogoproto.nullable) = false ];
}
10 changes: 5 additions & 5 deletions proto/nibiru/oracle/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ message EventDelegateFeederConsent {
// Validator is the Bech32 address that is delegating voting rights.
string validator = 1;

// Feeder is the delegate or representative that will be able to send
// Feeder is the delegate or representative that will be able to send
// vote and prevote transaction messages.
string feeder = 2;
}
Expand All @@ -33,23 +33,23 @@ message EventAggregateVote {
// Validator is the Bech32 address to which the vote will be credited.
string validator = 1;

// Feeder is the delegate or representative that will send vote and prevote
// Feeder is the delegate or representative that will send vote and prevote
// transaction messages on behalf of the voting validator.
string feeder = 2;

repeated ExchangeRateTuple prices = 3 [
repeated nibiru.oracle.v1.ExchangeRateTuple prices = 3 [
(gogoproto.castrepeated) = "ExchangeRateTuples",
(gogoproto.nullable) = false
];
}

// Emitted by MsgAggregateExchangePrevote when an aggregate prevote is added
// Emitted by MsgAggregateExchangePrevote when an aggregate prevote is added
// to state
message EventAggregatePrevote {
// Validator is the Bech32 address to which the vote will be credited.
string validator = 1;

// Feeder is the delegate or representative that will send vote and prevote
// Feeder is the delegate or representative that will send vote and prevote
// transaction messages on behalf of the voting validator.
string feeder = 2;
}
18 changes: 10 additions & 8 deletions proto/nibiru/oracle/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@ 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
nibiru.oracle.v1.Params params = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.oracle.v1.FeederDelegation feeder_delegations = 2
[ (gogoproto.nullable) = false ];
repeated ExchangeRateTuple exchange_rates = 3 [
repeated nibiru.oracle.v1.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
repeated nibiru.oracle.v1.MissCounter miss_counters = 4
[ (gogoproto.nullable) = false ];
repeated nibiru.oracle.v1.AggregateExchangeRatePrevote
aggregate_exchange_rate_prevotes = 5 [ (gogoproto.nullable) = false ];
repeated nibiru.oracle.v1.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 Rewards rewards = 8 [ (gogoproto.nullable) = false ];
repeated nibiru.oracle.v1.Rewards rewards = 8
[ (gogoproto.nullable) = false ];
}

// FeederDelegation is the address for where oracle feeder authority are
Expand Down
15 changes: 8 additions & 7 deletions proto/nibiru/oracle/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ message QueryExchangeRatesRequest {}
message QueryExchangeRatesResponse {
// exchange_rates defines a list of the exchange rate for all whitelisted
// pairs.
repeated ExchangeRateTuple exchange_rates = 1 [
repeated nibiru.oracle.v1.ExchangeRateTuple exchange_rates = 1 [
(gogoproto.castrepeated) = "ExchangeRateTuples",
(gogoproto.nullable) = false
];
Expand Down Expand Up @@ -204,7 +204,7 @@ message QueryAggregatePrevoteRequest {
message QueryAggregatePrevoteResponse {
// aggregate_prevote defines oracle aggregate prevote submitted by a validator
// in the current vote period
AggregateExchangeRatePrevote aggregate_prevote = 1
nibiru.oracle.v1.AggregateExchangeRatePrevote aggregate_prevote = 1
[ (gogoproto.nullable) = false ];
;
}
Expand All @@ -218,7 +218,7 @@ message QueryAggregatePrevotesRequest {}
message QueryAggregatePrevotesResponse {
// aggregate_prevotes defines all oracle aggregate prevotes submitted in the
// current vote period
repeated AggregateExchangeRatePrevote aggregate_prevotes = 1
repeated nibiru.oracle.v1.AggregateExchangeRatePrevote aggregate_prevotes = 1
[ (gogoproto.nullable) = false ];
}

Expand All @@ -237,7 +237,8 @@ message QueryAggregateVoteRequest {
message QueryAggregateVoteResponse {
// aggregate_vote defines oracle aggregate vote submitted by a validator in
// the current vote period
AggregateExchangeRateVote aggregate_vote = 1 [ (gogoproto.nullable) = false ];
nibiru.oracle.v1.AggregateExchangeRateVote aggregate_vote = 1
[ (gogoproto.nullable) = false ];
}

// QueryAggregateVotesRequest is the request type for the Query/AggregateVotes
Expand All @@ -249,7 +250,7 @@ message QueryAggregateVotesRequest {}
message QueryAggregateVotesResponse {
// aggregate_votes defines all oracle aggregate votes submitted in the current
// vote period
repeated AggregateExchangeRateVote aggregate_votes = 1
repeated nibiru.oracle.v1.AggregateExchangeRateVote aggregate_votes = 1
[ (gogoproto.nullable) = false ];
}

Expand All @@ -259,5 +260,5 @@ message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];
}
nibiru.oracle.v1.Params params = 1 [ (gogoproto.nullable) = false ];
}
2 changes: 1 addition & 1 deletion proto/nibiru/oracle/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ message MsgDelegateFeedConsent {

// MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response
// type.
message MsgDelegateFeedConsentResponse {}
message MsgDelegateFeedConsentResponse {}
10 changes: 5 additions & 5 deletions proto/nibiru/perp/v2/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option go_package = "github.com/NibiruChain/nibiru/x/perp/v2/types";

// Emitted when a position changes.
message PositionChangedEvent {
Position final_position = 1 [ (gogoproto.nullable) = false ];
nibiru.perp.v2.Position final_position = 1 [ (gogoproto.nullable) = false ];

// Position notional (in quote units) after the change. In general,
// 'notional = baseAmount * priceQuotePerBase', where size is the baseAmount.
Expand Down Expand Up @@ -92,7 +92,7 @@ message PositionChangedEvent {
// Emitted when a position is liquidated. Wraps a PositionChanged event since a
// liquidation causes position changes.
message PositionLiquidatedEvent {
PositionChangedEvent position_changed_event = 1
nibiru.perp.v2.PositionChangedEvent position_changed_event = 1
[ (gogoproto.nullable) = false ];

// Address of the account that executed the tx.
Expand Down Expand Up @@ -207,7 +207,7 @@ message LiquidationFailedEvent {
// - edit depth
message AmmUpdatedEvent {
// the final state of the AMM
AMM final_amm = 1 [ (gogoproto.nullable) = false ];
nibiru.perp.v2.AMM final_amm = 1 [ (gogoproto.nullable) = false ];

// The mark price of the pair.
string mark_price_twap = 2 [
Expand All @@ -232,5 +232,5 @@ message AmmUpdatedEvent {
// - bad debt is prepaid by the ecosystem fund
message MarketUpdatedEvent {
// the final state of the market
Market final_market = 1 [ (gogoproto.nullable) = false ];
}
nibiru.perp.v2.Market final_market = 1 [ (gogoproto.nullable) = false ];
}
15 changes: 8 additions & 7 deletions proto/nibiru/perp/v2/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ option go_package = "github.com/NibiruChain/nibiru/x/perp/v2/types";
// Thge genesis state is used not only to start the network but also useful for
// exporting and importing state during network upgrades.
message GenesisState {
repeated Market markets = 2 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.Market markets = 2 [ (gogoproto.nullable) = false ];

repeated AMM amms = 3 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.AMM amms = 3 [ (gogoproto.nullable) = false ];

repeated Position positions = 4 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.Position positions = 4
[ (gogoproto.nullable) = false ];

repeated ReserveSnapshot reserve_snapshots = 5
repeated nibiru.perp.v2.ReserveSnapshot reserve_snapshots = 5
[ (gogoproto.nullable) = false ];

uint64 dnr_epoch = 6;

repeated TraderVolume trader_volumes = 7 [ (gogoproto.nullable) = false ];

message TraderVolume {
string trader = 1;
uint64 epoch = 2;
Expand All @@ -35,6 +34,8 @@ message GenesisState {
];
}

repeated TraderVolume trader_volumes = 7 [ (gogoproto.nullable) = false ];

message Discount {
string fee = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
Expand All @@ -55,7 +56,7 @@ message GenesisState {
Discount discount = 2;
}

repeated GenesisMarketLastVersion market_last_versions = 10
repeated nibiru.perp.v2.GenesisMarketLastVersion market_last_versions = 10
[ (gogoproto.nullable) = false ];
}

Expand Down
22 changes: 12 additions & 10 deletions proto/nibiru/perp/v2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ service Query {
message QueryPositionsRequest { string trader = 1; }

message QueryPositionsResponse {
repeated QueryPositionResponse positions = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.QueryPositionResponse positions = 1
[ (gogoproto.nullable) = false ];
}

message QueryPositionStoreRequest {
Expand All @@ -52,7 +53,8 @@ message QueryPositionStoreRequest {

message QueryPositionStoreResponse {
// Position responses: collection of all stored positions (with pagination)
repeated Position positions = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.Position positions = 1
[ (gogoproto.nullable) = false ];

// pagination defines a paginated response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand All @@ -74,7 +76,7 @@ message QueryPositionRequest {

message QueryPositionResponse {
// The position as it exists in the blockchain state
Position position = 1 [ (gogoproto.nullable) = false ];
nibiru.perp.v2.Position position = 1 [ (gogoproto.nullable) = false ];

// The position's current notional value, if it were to be entirely closed (in
// margin units).
Expand All @@ -101,7 +103,8 @@ message QueryPositionResponse {
message QueryModuleAccountsRequest {}

message QueryModuleAccountsResponse {
repeated AccountWithBalance accounts = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.AccountWithBalance accounts = 1
[ (gogoproto.nullable) = false ];
}

message AccountWithBalance {
Expand All @@ -115,14 +118,13 @@ message AccountWithBalance {
}

message AmmMarket {
Market market = 1 [ (gogoproto.nullable) = false ];
AMM amm = 2 [ (gogoproto.nullable) = false ];
nibiru.perp.v2.Market market = 1 [ (gogoproto.nullable) = false ];
nibiru.perp.v2.AMM amm = 2 [ (gogoproto.nullable) = false ];
}

message QueryMarketsRequest {
bool versioned = 1;
}
message QueryMarketsRequest { bool versioned = 1; }

message QueryMarketsResponse {
repeated AmmMarket amm_markets = 1 [ (gogoproto.nullable) = false ];
repeated nibiru.perp.v2.AmmMarket amm_markets = 1
[ (gogoproto.nullable) = false ];
}
8 changes: 4 additions & 4 deletions proto/nibiru/perp/v2/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ message MsgRemoveMarginResponse {
];

// The resulting position
Position position = 3;
nibiru.perp.v2.Position position = 3;
}

// -------------------------- AddMargin --------------------------
Expand All @@ -78,7 +78,7 @@ message MsgAddMarginResponse {
(gogoproto.nullable) = false
];

Position position = 2;
nibiru.perp.v2.Position position = 2;
}

// -------------------------- Liquidation --------------------------
Expand Down Expand Up @@ -132,7 +132,7 @@ message MsgMarketOrder {
(gogoproto.nullable) = false
];

Direction side = 3;
nibiru.perp.v2.Direction side = 3;

string quote_asset_amount = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand All @@ -151,7 +151,7 @@ message MsgMarketOrder {
}

message MsgMarketOrderResponse {
Position position = 1;
nibiru.perp.v2.Position position = 1;

// The amount of quote assets exchanged.
string exchanged_notional_value = 2 [
Expand Down
Loading

0 comments on commit 9f53504

Please sign in to comment.