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

[Bug]: LiquidityNetInDirection Panics #8469

Closed
maxrobot opened this issue Jul 1, 2024 · 1 comment · Fixed by #8509
Closed

[Bug]: LiquidityNetInDirection Panics #8469

maxrobot opened this issue Jul 1, 2024 · 1 comment · Fixed by #8509
Assignees

Comments

@maxrobot
Copy link
Contributor

maxrobot commented Jul 1, 2024

What happened?

A bug happened!

I tried querying:

// LiquidityNetInDirection returns an array of LiquidityDepthWithRange, which contains the range(lower tick and upper tick), the liquidity amount in the range, and current sqrt price.
func (q Querier) LiquidityNetInDirection(ctx sdk.Context, req clquery.LiquidityNetInDirectionRequest) (*clquery.LiquidityNetInDirectionResponse, error) {

It seems that the line x/concentrated-liquidity/client/query-proto-wrap:159 has an issue where:

return &clquery.LiquidityNetInDirectionResponse{LiquidityDepths: liquidityDepths, CurrentLiquidity: pool.GetLiquidity(), CurrentTick: pool.GetCurrentTick(), CurrentSqrtPrice: pool.GetCurrentSqrtPrice()}, nil

as pool.GetCurrentTick() returns a legacy type

and I received a panic:

panic: invalid Go type math.LegacyDec for field osmosis.concentratedliquidity.v1beta1.LiquidityNetInDirectionResponse.current_liquidity

goroutine 54 [running]:
google.golang.org/protobuf/internal/impl.newSingularConverter({0x1038e5a50, 0x103857020}, {0x1038e5c78, 0x140015d01f8})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/convert.go:142 +0x950
google.golang.org/protobuf/internal/impl.NewConverter({0x1038e5a50, 0x103857020}, {0x1038e5c78, 0x140015d01f8})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/convert.go:60 +0x8c
google.golang.org/protobuf/internal/impl.fieldInfoForScalar({0x1038e5c78, 0x140015d01f8}, {{0x10364324e, 0x10}, {0x0, 0x0}, {0x1038e5a50, 0x103857020}, {0x103643260, 0xa3}, ...}, ...)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect_field.go:270 +0x198
google.golang.org/protobuf/internal/impl.(*MessageInfo).makeKnownFieldsFunc(0x1400127b1e0, {0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, ...})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect.go:80 +0x5d0
google.golang.org/protobuf/internal/impl.(*MessageInfo).makeReflectFuncs(0x1400127b1e0, {0x1038e5a50, 0x10365e8c0}, {0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, ...})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect.go:42 +0x4c
google.golang.org/protobuf/internal/impl.(*MessageInfo).initOnce(0x1400127b1e0)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message.go:90 +0x1cc
google.golang.org/protobuf/internal/impl.(*MessageInfo).init(...)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message.go:72
google.golang.org/protobuf/internal/impl.(*messageReflectWrapper).ProtoMethods(0x14000b0ef50)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/internal/impl/message_reflect_gen.go:150 +0x40
google.golang.org/protobuf/proto.protoMethods(...)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/proto/proto_methods.go:19
google.golang.org/protobuf/proto.UnmarshalOptions.unmarshal({{}, 0x1, 0x1, 0x0, {0x103897720, 0x14000127ce0}, 0x2710}, {0x1400102ebe0, 0x98, 0x98}, ...)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/proto/decode.go:93 +0xb8
google.golang.org/protobuf/proto.Unmarshal({0x1400102ebe0, 0x98, 0x98}, {0x10388f420?, 0x14000b0ef50?})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/proto/decode.go:55 +0x68
google.golang.org/grpc/encoding/proto.codec.Unmarshal({}, {0x1400102ebe0?, 0x98?, 0x98?}, {0x10376fc80?, 0x140013ed020?})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/encoding/proto/proto.go:56 +0x6c
google.golang.org/grpc.recv(0x14001033440?, {0x12d20ead0, 0x10504ed80}, 0x50?, {0x0?, 0x0?}, {0x10376fc80, 0x140013ed020}, 0x140013940d0?, 0x12d282ee8?, ...)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/rpc_util.go:839 +0x98
google.golang.org/grpc.(*csAttempt).recvMsg(0x140013a69c0, {0x10376fc80, 0x140013ed020}, 0x100dd4648?)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/stream.go:1086 +0x208
google.golang.org/grpc.(*clientStream).RecvMsg.func1(0x14000064cc8?)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/stream.go:929 +0x28
google.golang.org/grpc.(*clientStream).withRetry(0x14001033200, 0x14000064ce0, 0x14000064d28)
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/stream.go:778 +0x188
google.golang.org/grpc.(*clientStream).RecvMsg(0x14001033200, {0x10376fc80?, 0x140013ed020?})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/stream.go:928 +0xbc
google.golang.org/grpc.invoke({0x1038bd730?, 0x10504ed80?}, {0x1024f9b28?, 0x105b58f18?}, {0x1037d3b40, 0x14000e6b0c0}, {0x10376fc80, 0x140013ed020}, 0x0?, {0x0?, ...})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/call.go:73 +0xb0
google.golang.org/grpc.(*ClientConn).Invoke(0x101b8715f?, {0x1038bd730?, 0x10504ed80?}, {0x1024f9b28?, 0x103df6f7d?}, {0x1037d3b40?, 0x14000e6b0c0?}, {0x10376fc80?, 0x140013ed020?}, {0x0?, ...})
	/Users/wandlitz/go/pkg/mod/google.golang.org/[email protected]/call.go:37 +0x1a4
github.com/osmosis-labs/osmosis/v25/x/concentrated-liquidity/client/queryproto.(*queryClient).LiquidityNetInDirection(0x14000738610, {0x1038bd730, 0x10504ed80}, 0x14000e6b0c0, {0x0, 0x0, 0x0})
	/Users/wandlitz/go/pkg/mod/github.com/osmosis-labs/osmosis/[email protected]/x/concentrated-liquidity/client/queryproto/query.pb.go:2013 +0x98
github.com/toy-project/scratch/internal/maths.CalculateAmountToSwap({0x1038bd730, 0x10504ed80}, {0x1038d7cd0, 0x14000738610}, 0x140002e1500, 0x4e4, {0x140010fb7ed, 0x5}, {0x44?}, {0x140010fb7ed?})
	/Users/wandlitz/go/src/github.com/toy-project/scratch/internal/maths/maths.go:80 +0x75c
github.com/toy-project/scratch/internal/strategies.ExecuteRedemptionStrategy({0x1038bd730, 0x10504ed80}, 0x140002e1500, 0x0?, 0x1?, 0x1400092f6d0, {0x3e8, 0x3e8, {0x140010fb5aa, 0x3f}, ...}, ...)
	/Users/wandlitz/go/src/github.com/toy-project/scratch/internal/strategies/redemption.go:109 +0x77c
github.com/toy-project/scratch/internal/strategies.(*RedemptionStrategy).Execute(0x140007390c0, {0x1038bd730, 0x10504ed80}, 0x140002e1500, 0x14001522000, 0x14000be2908, 0x1400092f6d0, 0x1400107b020?, {0x3e8, 0x3e8, ...})
	/Users/wandlitz/go/src/github.com/toy-project/scratch/internal/strategies/redemption.go:76 +0x280
main.handleStrategy({0x1038bd730, 0x10504ed80}, 0x14000b17500, 0x14001522000, 0x14000be2908, 0x1400092f6d0, 0x14001392f30, {0x3e8, 0x3e8, {0x140010fb5aa, ...}, ...})
	/Users/wandlitz/go/src/github.com/toy-project/scratch/cmd/locust/main.go:148 +0x7d4
created by main.main in goroutine 1
	/Users/wandlitz/go/src/github.com/toy-project/scratch/cmd/locust/main.go:234 +0x804

Osmosis Version

3f7d1a7

How to reproduce?

No response

@ValarDragon
Copy link
Member

Cc @mattverse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants