Skip to content

cosmwasm_3_0 missing from BuiltInCapabilities(), contracts using RawRange get rejected on store #2578

Open

Description

@akshit149

I was trying out WasmQuery::RawRange on a local wasmd v0.70.5 chain and the contract wouldn't store:

failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation:
Wasm contract requires unavailable capabilities: {"cosmwasm_3_0"}: create wasm contract failed

The contract is just built with cosmwasm-std = { version = "=3.0.11", features = ["cosmwasm_3_0", "iterator"] }. Since RawRange sits behind the cosmwasm_3_0 feature, the contract exports requires_cosmwasm_3_0, and BuiltInCapabilities() stops at cosmwasm_2_2 / ibc2.

The query itself is already implemented in wasmd (#2263, query_plugins.go), so it looks like the capability just never got added when that landed. cosmwasm_2_1 and cosmwasm_2_2 were both added alongside their features.

To double check, I added "cosmwasm_3_0" to BuiltInCapabilities() and ran the same thing again: store, instantiate, then a smart query where the contract does a RawRange over its own storage. All of it works and I get the keys back (k1=one, k2=two, k3=three). So it's only the missing capability.

Looks like it's been like this since v0.61.0, and it's the same on v0.61.x, v0.70.x and main. Neutron already works around it by appending it in their app (app.go#L802). Chains using the built-in list as is, like Juno, would reject these contracts.

Also a bit annoying: the store tx passes CheckTx and only fails in DeliverTx, so the user pays for a tx that can't succeed.

The fix should just be adding "cosmwasm_3_0" to BuiltInCapabilities() and updating the expected lists in keeper_test.go and tests/integration/module_test.go. With that, the x/wasm and integration tests pass for me. It changes which uploads succeed, though, so I guess it needs to go with a chain upgrade. Not sure if you'd want it backported to 0.61 / 0.70 or just on main.

Happy to open a PR if that sounds good.

cc @pinosu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions