Skip to content

Commit

Permalink
feat: CLI, queries and final changes for CW Pool (osmosis-labs#5448)
Browse files Browse the repository at this point in the history
* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* codec updates

* try more codec changes

* updates

* updates

* latest WIP

* fixed bad package in proto

* adding custom serialization to the pools and moving serialization onto the last part of the query execution

* Revert "chore: temp disable cw pool tests (osmosis-labs#5478)"

This reverts commit bf4d3fe.

* fix mocks

* fix lint

* added updated mocks for cfmm pools

* updated cl mocks

* uncomment tests

* revert test changes

* updates

* restore transmuter contract

---------

Co-authored-by: Nicolas Lara <[email protected]>
  • Loading branch information
p0mvn and nicolaslara authored Jun 14, 2023
1 parent b29b2c6 commit 6ad2827
Show file tree
Hide file tree
Showing 38 changed files with 1,810 additions and 128 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ cl-create-bigbang-config:
go-mock-update:
mockgen -source=x/poolmanager/types/routes.go -destination=tests/mocks/pool_module.go -package=mocks
mockgen -source=x/poolmanager/types/pool.go -destination=tests/mocks/pool.go -package=mocks
mockgen -source=x/gamm/types/pool.go -destination=tests/mocks/cfmm_pool.go -package=mocks
mockgen -source=x/concentrated-liquidity/types/cl_pool_extensionI.go -destination=tests/mocks/cl_pool.go -package=mocks

.PHONY: all build-linux install format lint \
go-mod-cache draw-deps clean build build-contract-tests-hooks \
Expand Down
2 changes: 0 additions & 2 deletions app/apptesting/cosmwasmpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ const (

// PrepareCosmWasmPool sets up a cosmwasm pool with the default parameters.
func (s *KeeperTestHelper) PrepareCosmWasmPool() cosmwasmpooltypes.CosmWasmExtension {
s.T().Skip("CI was getting flaky: https://github.com/osmosis-labs/osmosis/issues/5477")
return s.PrepareCustomTransmuterPool(s.TestAccs[0], []string{DefaultTransmuterDenomA, DefaultTransmuterDenomB})
}

// PrepareCustomConcentratedPool sets up a concentrated liquidity pool with the custom parameters.
func (s *KeeperTestHelper) PrepareCustomTransmuterPool(owner sdk.AccAddress, denoms []string) cosmwasmpooltypes.CosmWasmExtension {
s.T().Skip("CI was getting flaky: https://github.com/osmosis-labs/osmosis/issues/5477")
// Mint some assets to the account.
s.FundAcc(s.TestAccs[0], DefaultAcctFunds)

Expand Down
3 changes: 3 additions & 0 deletions app/keepers/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
_ "github.com/osmosis-labs/osmosis/v16/client/docs/statik"
clclient "github.com/osmosis-labs/osmosis/v16/x/concentrated-liquidity/client"
concentratedliquidity "github.com/osmosis-labs/osmosis/v16/x/concentrated-liquidity/clmodule"
cwpoolclient "github.com/osmosis-labs/osmosis/v16/x/cosmwasmpool/client"
cosmwasmpoolmodule "github.com/osmosis-labs/osmosis/v16/x/cosmwasmpool/module"
downtimemodule "github.com/osmosis-labs/osmosis/v16/x/downtime-detector/module"
"github.com/osmosis-labs/osmosis/v16/x/gamm"
Expand Down Expand Up @@ -82,6 +83,8 @@ var AppModuleBasics = []module.AppModuleBasic{
gammclient.UpdateMigrationRecordsProposalHandler,
clclient.CreateConcentratedLiquidityPoolProposalHandler,
clclient.TickSpacingDecreaseProposalHandler,
cwpoolclient.UploadCodeIdAndWhitelistProposalHandler,
cwpoolclient.MigratePoolContractsProposalHandler,
)...,
),
params.AppModuleBasic{},
Expand Down
1 change: 0 additions & 1 deletion osmoutils/cosmwasm/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cosmwasm

import (
"encoding/json"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down
44 changes: 42 additions & 2 deletions proto/osmosis/cosmwasmpool/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,51 @@ import "google/protobuf/timestamp.proto";
option go_package = "github.com/osmosis-labs/osmosis/v16/x/cosmwasmpool/client/queryproto";

service Query {
// Pools returns all cosmwasm pools
rpc Pools(PoolsRequest) returns (PoolsResponse) {
option (google.api.http).get = "/osmosis/cosmwasmpool/v1beta1/pools";
}

// Params returns the parameters of the x/cosmwasmpool module.
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http).get = "/osmosis/cosmwasmpool/v1beta1/Params";
option (google.api.http).get = "/osmosis/cosmwasmpool/v1beta1/params";
}

rpc ContractInfoByPoolId(ContractInfoByPoolIdRequest)
returns (ContractInfoByPoolIdResponse) {
option (google.api.http).get =
"/osmosis/cosmwasmpool/v1beta1/contract_info";
}
}

//=============================== Params
//=============================== ContractInfoByPoolId
message ParamsRequest {}
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }

//=============================== Pools
message PoolsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
message PoolsResponse {
repeated google.protobuf.Any pools = 1
[ (cosmos_proto.accepts_interface) = "PoolI" ];

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

//=============================== ContractInfoByPoolId
message ContractInfoByPoolIdRequest {
// pool_id is the pool id of the requested pool.
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
}
message ContractInfoByPoolIdResponse {
// contract_address is the pool address and contract address
// of the requested pool id.
string contract_address = 1
[ (gogoproto.moretags) = "yaml:\"contract_address\"" ];

// code_id is the code id of the requested pool id.
uint64 code_id = 2 [ (gogoproto.moretags) = "yaml:\"code_id\"" ];
}
10 changes: 10 additions & 0 deletions proto/osmosis/cosmwasmpool/v1beta1/query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ queries:
query_func: "k.GetParams"
cli:
cmd: "GetParams"
Pools:
proto_wrapper:
query_func: "k.Pools"
cli:
cmd: "Pools"
ContractInfoByPoolId:
proto_wrapper:
query_func: "k.ContractInfoByPoolId"
cli:
cmd: "ContractInfoByPoolId"
1 change: 1 addition & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ func (s *IntegrationTestSuite) TestLargeWasmUpload() {
node, err := chainA.GetDefaultNode()
s.NoError(err)
node.StoreWasmCode("bytecode/large.wasm", initialization.ValidatorWalletName)
chainA.LatestCodeId = int(node.QueryLatestWasmCodeID())
}

func (s *IntegrationTestSuite) UploadAndInstantiateCounter(chain *chain.Config) string {
Expand Down
42 changes: 42 additions & 0 deletions tests/mocks/cfmm_pool.go

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

Loading

0 comments on commit 6ad2827

Please sign in to comment.