Skip to content

Commit

Permalink
Fix proto services for balancer and superfluid module (#1672)
Browse files Browse the repository at this point in the history
## What is the purpose of the change

This fix is necessary in order to support ORM.

The legacy problem with proto package for balancer has been a problem for a long time, which has been fixed and addressed over multiple PRs(#1208, #1469). The latest decision that has been made upon this legacy package issue was to change the `tx.proto`(https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/gamm/pool-models/balancer/tx.proto) to the correct package while leaving `balacerPool.proto` under the legacy wrong package so that we wouldn't have to deal with migration logic. 

Even though such decision has fixed duplicate package issue that has been a blocker for typescript proto generation, it is now an issue with orm support, as protoc does not allow one package path to have different packages within the protofiles(ex. protoc-gen-go-grpc: Go package "github.com/osmosis-labs/osmosis/api/osmosis/gamm/pool-models/balancer" has inconsistent names gammv1beta1 (osmosis/gamm/pool-models/balancer/balancerPool.proto) and balancerv1beta1 (osmosis/gamm/pool-models/balancer/tx.proto)).

There would be multiple ways to fix this problem, open to other ways of fixing this as well.  

The way this PR solves it is physically creating a new folder for the `tx.proto` file under the `proto/gamm/pool-models/balancer` folder to avoid the problem stated above. 

---

As for the superfluid module, we have had inconsistency with the packages as well proto package for `gov.proto` set to `osmosis.superfluid.v1beta`, while the other proto packages have the proto package of `osmosis.superfluid`. The suggested fix in this PR is creating a new folder under `proto/superfluid` to fix the duplicate proto package path issue. 


## Brief Changelog

- Change proto package for `proto/gamm/pool-models/balancer/tx.proto` and `proto/superfluid/gov.proto`

## Testing and Verifying

Additional testing needed that this fix does not break unknown unknowns in the state side.

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?no
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented)
  • Loading branch information
mattverse authored Jun 5, 2022
1 parent d77a311 commit 88786c4
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 64 deletions.
4 changes: 4 additions & 0 deletions proto/osmosis/gamm/pool-models/balancer/balancerPool.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
syntax = "proto3";
// this is a legacy package that requires additional migration logic
// in order to use the correct packge. Decision made to use legacy package path
// until clear steps for migration logic and the unknowns for state breaking are
// investigated for changing proto package.
package osmosis.gamm.v1beta1;

import "cosmos_proto/cosmos.proto";
Expand Down
11 changes: 6 additions & 5 deletions proto/osmosis/gamm/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ import "cosmos/base/v1beta1/coin.proto";
message Params {
repeated cosmos.base.v1beta1.Coin pool_creation_fee = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"pool_creation_fee\"",
(gogoproto.nullable) = false
(gogoproto.moretags) = "yaml:\"pool_creation_fee\"",
(gogoproto.nullable) = false
];
}

option go_package = "github.com/osmosis-labs/osmosis/v7/x/gamm/types";

// GenesisState defines the gamm module's genesis state.
message GenesisState {
repeated google.protobuf.Any pools = 1 [(cosmos_proto.accepts_interface) = "PoolI"];
uint64 next_pool_number = 2;
Params params = 3 [(gogoproto.nullable) = false];
repeated google.protobuf.Any pools = 1
[ (cosmos_proto.accepts_interface) = "PoolI" ];
uint64 next_pool_number = 2;
Params params = 3 [ (gogoproto.nullable) = false ];
}
File renamed without changes.
5 changes: 5 additions & 0 deletions x/gamm/pool-models/balancer/balancerPool.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 33 additions & 33 deletions x/gamm/pool-models/balancer/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 28 additions & 26 deletions x/superfluid/types/gov.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 88786c4

Please sign in to comment.