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

Closed
1 task done
JulianToledano opened this issue Jul 11, 2024 · 3 comments · Fixed by #21853
Closed
1 task done

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

JulianToledano opened this issue Jul 11, 2024 · 3 comments · 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/[email protected]/command.go:985 +0xbd8
github.com/spf13/cobra.(*Command).ExecuteC(0x14000eb6f08)
        /Users/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x7d0
github.com/spf13/cobra.(*Command).Execute(0x14000eb6f08)
        /Users/user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041 +0x30
github.com/spf13/cobra.(*Command).ExecuteContext(0x14000eb6f08, {0x1055d12c8, 0x140013b4e70})
        /Users/user/go/pkg/mod/github.com/spf13/[email protected]/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
Copy link
Member

Related:

$ simdv2 q gov params
cannot marshal response params:{min_deposit:{denom:"stake" amount:"10000000"} max_deposit_period:{seconds:172800} voting_period:{seconds:600} quorum:"0.334000000000000000" threshold:"0.500000000000000000" veto_threshold:"0.334000000000000000" min_initial_deposit_ratio:"0.000000000000000000" proposal_cancel_ratio:"0.500000000000000000" expedited_voting_period:{seconds:300} expedited_threshold:"0.667000000000000000" expedited_min_deposit:{denom:"stake" amount:"50000000"} burn_vote_veto:true min_deposit_ratio:"0.010000000000000000" proposal_cancel_max_period:"0.500000000000000000" optimistic_rejected_threshold:"0.100000000000000000" yes_quorum:"0.000000000000000000" expedited_quorum:"0.500000000000000000" proposal_execution_gas:10000000}: math/big: cannot unmarshal "0.334000000000000000" into a *big.Int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

3 participants