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

Implement missing PrimaryKey trait for CanonicalAddr #6

Closed
FrankBoltzmann opened this issue Mar 31, 2022 · 1 comment
Closed

Implement missing PrimaryKey trait for CanonicalAddr #6

FrankBoltzmann opened this issue Mar 31, 2022 · 1 comment

Comments

@FrankBoltzmann
Copy link

The cw_storage_plus Map requires PrimaryKey implementation for its keys, which is implemented for Addr but not CanonicalAddr. However, CanonicalAddr are stable and unique and keys should be stored using that type instead of Addr.

@ethanfrey
Copy link
Member

Workaround is using addr.as_bytes() for the key.
In fact, you should never use CannonicalAddr as a key, but rather &CanonicalAddr, it is more efficient and does the same work. The only reason we support Addr in addition to &Addr was for backwards compatibility to not randomly break some older contracts.

@uint uint transferred this issue from CosmWasm/cw-plus Oct 17, 2022
@uint uint closed this as completed Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants