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

[enhancement] store balances at block heights #77

Open
joel-u410 opened this issue Jul 18, 2024 · 0 comments
Open

[enhancement] store balances at block heights #77

joel-u410 opened this issue Jul 18, 2024 · 0 comments

Comments

@joel-u410
Copy link
Contributor

joel-u410 commented Jul 18, 2024

Currently the balances table just contains one balance row per (owner, token) pair, and it is updated continuously as balances change on-chain. I would like to propose changing it to record balance history by doing the following:

  • Rename balances to balance_changes and add a column for height.
  • When querying balances from the node via RPC, be specific about which height is requested (see this PR for an update to namada_sdk that makes this possible).
  • Instead of updating rows in balances, insert a new row to balance_changes whenever a new balance is queried.
  • (if needed) Introduce a new view named balances which takes the place of the current balances table and provides the most recent balance by height for each (owner, token).

I am working on this in my fork and expect to have a PR soon that implements these changes.

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

1 participant