Skip to content

Support composite keys on secondary indexes (multi-index) #163

@ethanfrey

Description

@ethanfrey

Right now, keys is always Vec<u8>.

If I combine say (status, height) as one vector, I can not easily search over all heights for a given status (which I can on primary indices). This is due to combining them, then length-prefixing.

If we return say (U8Key, U64Key), then we could get a prefix on the first key (status) and range within it, just like on Map.

This example was the first time I came across this need (which I hacked by knowing the internals of storage-plus), but we will want this in the future as well as app complexity grow: https://github.com/CosmWasm/cosmwasm-plus/blob/7975aef08a8d44444742d7dc187d341f839a6039/contracts/cw3-flex-multisig/src/state.rs#L53-L83

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions