From 41d3f5c84bb1cf6941b02635c128c4bfc42a8514 Mon Sep 17 00:00:00 2001 From: mattverse Date: Wed, 17 May 2023 14:13:54 +0900 Subject: [PATCH 1/2] Fix cl client to follow most recent state --- tests/cl-genesis-positions/convert.go | 43 +++++++++++---------------- tests/cl-genesis-positions/go.mod | 3 +- tests/cl-genesis-positions/go.sum | 14 ++++----- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/tests/cl-genesis-positions/convert.go b/tests/cl-genesis-positions/convert.go index b4b7698769b..e1737968eb9 100644 --- a/tests/cl-genesis-positions/convert.go +++ b/tests/cl-genesis-positions/convert.go @@ -5,7 +5,6 @@ import ( "fmt" "math/rand" "os" - "strconv" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" @@ -13,6 +12,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/osmosis-labs/osmosis/osmomath" + "github.com/osmosis-labs/osmosis/osmoutils/accum" "github.com/osmosis-labs/osmosis/v15/app" "github.com/osmosis-labs/osmosis/v15/app/apptesting" cl "github.com/osmosis-labs/osmosis/v15/x/concentrated-liquidity" @@ -22,20 +22,8 @@ import ( clgenesis "github.com/osmosis-labs/osmosis/v15/x/concentrated-liquidity/types/genesis" ) -// TODO: consider importing from big bang if use of the script -// becomes frequent, requiring frequent updates. -type BigBangPosition struct { - Address string `json:"address"` - JoinTime string `json:"join_time"` - Liquidity string `json:"liquidity"` - LowerTick string `json:"lower_tick"` - PoolID string `json:"pool_id"` - PositionID string `json:"position_id"` - UpperTick string `json:"upper_tick"` -} - type BigBangPositions struct { - Positions []BigBangPosition `json:"positions"` + PositionsData []clgenesis.PositionData `json:"position_data"` } type OsmosisApp struct { @@ -132,7 +120,7 @@ func ConvertSubgraphToOsmosisGenesis(positionCreatorAddresses []sdk.AccAddress, numberOfSuccesfulPositions := 0 - bigBangPositions := make([]BigBangPosition, 0) + bigBangPositions := make([]clgenesis.PositionData, 0) for _, uniV3Position := range positions { lowerPrice := parsePrice(uniV3Position.TickLower.Price0) @@ -202,14 +190,19 @@ func ConvertSubgraphToOsmosisGenesis(positionCreatorAddresses []sdk.AccAddress, fmt.Printf("created position with liquidity (%s) between ticks (%s) and (%s)\n", position.LiquidityCreated, lowerTickOsmosis, upperTickOsmosis) numberOfSuccesfulPositions++ - bigBangPositions = append(bigBangPositions, BigBangPosition{ - Address: randomCreator.String(), - PoolID: strconv.FormatUint(poolId, 10), - JoinTime: osmosis.Ctx.BlockTime().Format("2006-01-02T15:04:05Z"), // ISO 8601 - Liquidity: position.LiquidityCreated.String(), - PositionID: strconv.FormatUint(position.PositionId, 10), - LowerTick: lowerTickOsmosis.String(), - UpperTick: upperTickOsmosis.String(), + bigBangPositions = append(bigBangPositions, clgenesis.PositionData{ + Position: &model.Position{ + Address: randomCreator.String(), + PoolId: poolId, + JoinTime: osmosis.Ctx.BlockTime(), + Liquidity: position.LiquidityCreated, + PositionId: position.PositionId, + LowerTick: lowerTickOsmosis.Int64(), + UpperTick: upperTickOsmosis.Int64(), + }, + FeeAccumRecord: accum.Record{ + NumShares: position.LiquidityCreated, + }, }) } @@ -277,10 +270,10 @@ func writeStateToDisk(state map[string]json.RawMessage) { } } -func writeBigBangPositionsToState(positions []BigBangPosition) { +func writeBigBangPositionsToState(positions []clgenesis.PositionData) { fmt.Println("writing big bang positions to disk") positionsBytes, err := json.MarshalIndent(BigBangPositions{ - Positions: positions, + PositionsData: positions, }, "", " ") if err != nil { panic(err) diff --git a/tests/cl-genesis-positions/go.mod b/tests/cl-genesis-positions/go.mod index efb9515b252..86137070b60 100644 --- a/tests/cl-genesis-positions/go.mod +++ b/tests/cl-genesis-positions/go.mod @@ -6,7 +6,8 @@ require ( github.com/cosmos/cosmos-sdk v0.47.2 github.com/ignite/cli v0.23.0 github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111 - github.com/osmosis-labs/osmosis/v15 v15.0.0-20230504143153-c7d6a52cd9f5 + // this commit points to https://github.com/osmosis-labs/osmosis/commit/6e8fbee70d9067b69a900cfc7441b5c4185ec495 + github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90 github.com/tendermint/tendermint v0.34.26 ) diff --git a/tests/cl-genesis-positions/go.sum b/tests/cl-genesis-positions/go.sum index 2f77fd7ff16..6b2147bd58e 100644 --- a/tests/cl-genesis-positions/go.sum +++ b/tests/cl-genesis-positions/go.sum @@ -695,12 +695,10 @@ github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434 h1:RetE github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434/go.mod h1:ss3tUfPTwaa6NsoPZrCR7xOqLqCK0LwoNbc2Q8Zs5/Y= github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111 h1:1ahWbf9iF9sxDOjxrHWFaBGLE0nWFdpiX1pqObUaJO8= github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111/go.mod h1:a7lhiXRpn8QJ21OhFpaEnUNErTSIafaYpp02q6uI/Dk= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230504001814-1dbcc2079de1 h1:1yzJYsP1bWOX/8/aGA8Mk/UFiU9z/h6LRAr2OezyYQ8= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230504001814-1dbcc2079de1/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae h1:I1Cy+GpTPWbVi0lBw9+bS1w42YfQjvXNK9bW4YbHhcs= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A= -github.com/osmosis-labs/osmosis/v15 v15.0.0-20230504143153-c7d6a52cd9f5 h1:M4fG/zxok1+9y5SWas1sBzDZWfSbGs7vezE1NF7niCk= -github.com/osmosis-labs/osmosis/v15 v15.0.0-20230504143153-c7d6a52cd9f5/go.mod h1:NEoCQ+jkE0o6CUorEUhRdwdbvXYl5nt4oZeevaEz29o= +github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230511015306-615fa4fcbe56 h1:27yWLC0uXSatRy8aRn0yinHU+K31bkjBRmNnQUDO0Ks= +github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230511015306-615fa4fcbe56/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A= +github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90 h1:VNzFovCaXgUA76Rb4yRjCSei1TV8gm0pEccvKgQ/4wY= +github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90/go.mod h1:oYQ6+o0MKx9SAjSYvqMh1L1wK2IViXGdcvsHVFjA3Ok= github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304 h1:RIrWLzIiZN5Xd2JOfSOtGZaf6V3qEQYg6EaDTAkMnCo= github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304/go.mod h1:yPWoJTj5RKrXKUChAicp+G/4Ni/uVEpp27mi/FF/L9c= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230331072320-5d6f6cfa2627 h1:A0SwZgp4bmJFbivYJc8mmVhMjrr3EdUZluBYFke11+w= @@ -744,8 +742,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 2d01ac1769fadee950a575cd935b214064fa7d4a Mon Sep 17 00:00:00 2001 From: mattverse Date: Wed, 17 May 2023 23:31:56 +0900 Subject: [PATCH 2/2] Run go mod tidy --- tests/cl-genesis-positions/go.mod | 2 +- tests/cl-genesis-positions/go.sum | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/cl-genesis-positions/go.mod b/tests/cl-genesis-positions/go.mod index 37357ea48da..d11215cf471 100644 --- a/tests/cl-genesis-positions/go.mod +++ b/tests/cl-genesis-positions/go.mod @@ -9,6 +9,7 @@ require ( // this commit points to https://github.com/osmosis-labs/osmosis/commit/6e8fbee70d9067b69a900cfc7441b5c4185ec495 github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90 github.com/tendermint/tendermint v0.34.26 + github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae ) require ( @@ -95,7 +96,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae // indirect github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304 // indirect github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230331072320-5d6f6cfa2627 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect diff --git a/tests/cl-genesis-positions/go.sum b/tests/cl-genesis-positions/go.sum index d54e71393a7..6b2147bd58e 100644 --- a/tests/cl-genesis-positions/go.sum +++ b/tests/cl-genesis-positions/go.sum @@ -695,17 +695,10 @@ github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434 h1:RetE github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20230326212251-7a2cf2993434/go.mod h1:ss3tUfPTwaa6NsoPZrCR7xOqLqCK0LwoNbc2Q8Zs5/Y= github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111 h1:1ahWbf9iF9sxDOjxrHWFaBGLE0nWFdpiX1pqObUaJO8= github.com/osmosis-labs/osmosis/osmomath v0.0.3-dev.0.20230503232557-ba905586c111/go.mod h1:a7lhiXRpn8QJ21OhFpaEnUNErTSIafaYpp02q6uI/Dk= -<<<<<<< HEAD github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230511015306-615fa4fcbe56 h1:27yWLC0uXSatRy8aRn0yinHU+K31bkjBRmNnQUDO0Ks= github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230511015306-615fa4fcbe56/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A= github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90 h1:VNzFovCaXgUA76Rb4yRjCSei1TV8gm0pEccvKgQ/4wY= github.com/osmosis-labs/osmosis/v15 v15.0.0-20230516091847-6e8fbee70d90/go.mod h1:oYQ6+o0MKx9SAjSYvqMh1L1wK2IViXGdcvsHVFjA3Ok= -======= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae h1:I1Cy+GpTPWbVi0lBw9+bS1w42YfQjvXNK9bW4YbHhcs= -github.com/osmosis-labs/osmosis/osmoutils v0.0.0-20230510161551-8bf252f26bae/go.mod h1:hk/o9/kmTSZmZqwXcSrPuwj/gpRMCqbE/d3vj6teL2A= -github.com/osmosis-labs/osmosis/v15 v15.0.0-20230513050746-13c81d83ef0d h1:8lJNaOABRchMwMO+DoHEGrlrBXlhDloms1GKs/ti8HA= -github.com/osmosis-labs/osmosis/v15 v15.0.0-20230513050746-13c81d83ef0d/go.mod h1:mdvXaHvcLi1Loo2sUF1FPV3RynReBpexO3g3ktEWQA4= ->>>>>>> main github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304 h1:RIrWLzIiZN5Xd2JOfSOtGZaf6V3qEQYg6EaDTAkMnCo= github.com/osmosis-labs/osmosis/x/epochs v0.0.0-20230328024000-175ec88e4304/go.mod h1:yPWoJTj5RKrXKUChAicp+G/4Ni/uVEpp27mi/FF/L9c= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230331072320-5d6f6cfa2627 h1:A0SwZgp4bmJFbivYJc8mmVhMjrr3EdUZluBYFke11+w=