-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Index supply by denom #7092
Comments
Seems to me like an easy enough change with a lot of benefits 👍 Additional note: a migrate script will also be needed. |
added an item to track state migration, ref #8517 (comment) |
Hey @sahith-narahari, I'm assigning this to myself, i'll work on this tomorrow. I won't touch the pagination stuff in #8761. Does that work for you? |
Sure, makes sense as you have more context on the in-place store migrations. |
This is linked to meta-issue #7091.
Summary
Store supply in
x/bank
on a per denom basis rather than as a single blob.Items:
Glossary
Problem Definition
Since ADR 004, balances are stored by address and denom allowing the bank module to scale to a large number of denoms. However, supply is still stored as a single blob. Every time coins are minted or burned, the entire supply blob needs to be serialized and deserialized. This supply blob could grow quite large as more denoms are added and become very inefficient.
Proposal
Store supply by denom
Instead of storing a supply blob under a single
SupplyKey
, we instead store supply by aSupplyKey(denom string) []byte
function.This will involve change the bank keeper
GetSupply
andSetSupply
interface methods to:Remove the
SupplyI
interfaceThe
SupplyI
interface is now superfluous and can just be removed. The aboveGetSupply
andSetSupply
methods can be used instead.Add proper pagination to /
cosmos.bank.v1beta1.Query/TotalSupply
Now that we have supply indexed by denom we can add proper pagination to this query rather than returning the full supply blob.
The text was updated successfully, but these errors were encountered: