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]: protocolpool create-continuous-pool panics #20935

Open
1 task done
JulianToledano opened this issue Jul 11, 2024 · 2 comments · May be fixed by #21853
Open
1 task done

[Bug]: protocolpool create-continuous-pool panics #20935

JulianToledano opened this issue Jul 11, 2024 · 2 comments · May be fixed by #21853
Assignees
Labels

Comments

@JulianToledano
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When calling create-continuous-fund with a percentage expressed as a float, the command panics.

As I understand, auto-cli generates dynamicpb messages using protoreflect message Descriptor() and Interface(). In the case of MsgCreateContinuousFund, the percentage is set as a human-readable number.

Screenshot 2024-07-11 at 10 39 02

Thus, it fails when decoding, as the unmarshalling of LegacyDec expects a machine representation of the floating-point number.

if err := m.Percentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}

panic: math/big: cannot unmarshal "0.1" into a *big.Int

goroutine 1 [running]:
cosmossdk.io/x/auth/tx.(*builder).GetTx(0x1400157a240)
        /Users/user/github.com/cosmos/cosmos-sdk/x/auth/tx/builder.go:99 +0xd8
github.com/cosmos/cosmos-sdk/client/tx.BroadcastTx({{0x1055f12e8, 0x140013b5650}, 0x0, {0x14001041b08, 0x4}, {0x10560dca8, 0x14000e37150}, {0x1055edf40, 0x14000d67040}, {0x105595da0, ...}, ...}, ...)
        /Users/user/github.com/cosmos/cosmos-sdk/client/tx/tx.go:108 +0x510
github.com/cosmos/cosmos-sdk/client/tx.GenerateOrBroadcastTxWithFactory({{0x1055f12e8, 0x140013b5650}, 0x0, {0x14001041b08, 0x4}, {0x10560dca8, 0x14000e37150}, {0x1055edf40, 0x14000d67040}, {0x105595da0, ...}, ...}, ...)
        /Users/user/github.com/cosmos/cosmos-sdk/client/tx/tx.go:67 +0x448
github.com/cosmos/cosmos-sdk/client/tx.GenerateOrBroadcastTxCLI({{0x1055f12e8, 0x140013b5650}, 0x0, {0x14001041b08, 0x4}, {0x10560dca8, 0x14000e37150}, {0x1055edf40, 0x14000d67040}, {0x105595da0, ...}, ...}, ...)
        /Users/user/github.com/cosmos/cosmos-sdk/client/tx/tx.go:32 +0x180
cosmossdk.io/client/v2/autocli.(*Builder).handleGovProposal(_, _, {_, _}, {{0x1055f12e8, 0x140013b5650}, 0x0, {0x14001041b08, 0x4}, {0x10560dca8, ...}, ...}, ...)
        /Users/user/github.com/cosmos/cosmos-sdk/client/v2/autocli/msg.go:227 +0x724
cosmossdk.io/client/v2/autocli.(*Builder).BuildMsgMethodCommand.func1(0x14001355808, {0x1056051c8, 0x140013ae8a0})
        /Users/user/github.com/cosmos/cosmos-sdk/client/v2/autocli/msg.go:136 +0x30c
cosmossdk.io/client/v2/autocli.(*Builder).buildMethodCommandCommon.func1(0x14001355808, {0x14000e90080, 0x2, 0x8})
        /Users/user/github.com/cosmos/cosmos-sdk/client/v2/autocli/common.go:97 +0x3dc
github.com/spf13/cobra.(*Command).execute(0x14001355808, {0x14000e90000, 0x8, 0x8})
        /Users/user/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xbd8
github.com/spf13/cobra.(*Command).ExecuteC(0x14000eb6f08)
        /Users/user/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x7d0
github.com/spf13/cobra.(*Command).Execute(0x14000eb6f08)
        /Users/user/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 +0x30
github.com/spf13/cobra.(*Command).ExecuteContext(0x14000eb6f08, {0x1055d12c8, 0x140013b4e70})
        /Users/user/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1034 +0x70
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x14000eb6f08, {0x0, 0x0}, {0x14001029350, 0x21})
        /Users/user/github.com/cosmos/cosmos-sdk/server/cmd/execute.go:40 +0x2ac
main.main()
        /Users/user/github.com/cosmos/cosmos-sdk/simapp/simd/main.go:15 +0x40
Exiting.

Cosmos SDK Version

main

How to reproduce?

./simd tx protocolpool create-continuous-fund cosmos18mfx85veapt3xs0vdr2cx9skeregs9sqawku8f 0.1 --summary test --title test --deposit 100000stake

@facundomedica
Copy link
Member

This looks like an issue, but made me realize we shouldn't be exposing that command at all, given that it's meant to be used only through gov proposals

@julienrbrt
Copy link
Member

This looks like an issue, but made me realize we shouldn't be exposing that command at all, given that it's meant to be used only through gov proposals

We should expose the command, it will create a gov proposal thanks to https://github.com/cosmos/cosmos-sdk/blob/03d70aa/x/protocolpool/autocli.go#L73

@julienrbrt julienrbrt self-assigned this Sep 13, 2024
@julienrbrt julienrbrt linked a pull request Sep 23, 2024 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🤸‍♂️ In Progress
Development

Successfully merging a pull request may close this issue.

3 participants