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 in staking contract #871

Closed
ethanfrey opened this issue Apr 9, 2021 · 0 comments · Fixed by #873
Closed

Bug in staking contract #871

ethanfrey opened this issue Apr 9, 2021 · 0 comments · Fixed by #873
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ethanfrey
Copy link
Member

With the Addr refactor in v0.14.0-beta2, we broke the staking contract.

When testing this in wasmd upgrade, I get:

Error Trace:    staking_test.go:208
                                                        staking_test.go:550
                Error:          Received unexpected error:
                                
                                github.com/CosmWasm/wasmd/x/wasm/keeper.Keeper.instantiate
                                        /home/ethan/go/src/github.com/cosmwasm/wasmd/x/wasm/keeper/keeper.go:273
                                github.com/CosmWasm/wasmd/x/wasm/keeper.PermissionedKeeper.Instantiate
                                        /home/ethan/go/src/github.com/cosmwasm/wasmd/x/wasm/keeper/contract_keeper.go:43
                                github.com/CosmWasm/wasmd/x/wasm/keeper.initializeStaking
                                        /home/ethan/go/src/github.com/cosmwasm/wasmd/x/wasm/keeper/staking_test.go:207
                                github.com/CosmWasm/wasmd/x/wasm/keeper.TestQueryStakingPlugin
                                        /home/ethan/go/src/github.com/cosmwasm/wasmd/x/wasm/keeper/staking_test.go:550
                                Generic error: addr_validate errored: invalid Bech32 prefix; expected cosmos, got cosmosvaloper: instantiate wasm contract failed

The validator (valoper) addresses must always be unverified strings as we cannot validate them.

We had this issue in wasmd some time ago: CosmWasm/wasmd#264 and concluded that we cannot validate both AccAddress and ValOperAddress. Unless you want to extend the API (which I found unnecessary), let's keep validators as string. You can verify them in init simply by making a query using them.

@ethanfrey ethanfrey added the bug Something isn't working label Apr 9, 2021
@webmaster128 webmaster128 self-assigned this Apr 11, 2021
@webmaster128 webmaster128 added this to the 0.14.0 milestone Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants