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

[feature] Allow balance querying at specified block height #3530

Merged
merged 3 commits into from
Sep 8, 2024

Conversation

joel-u410
Copy link
Contributor

@joel-u410 joel-u410 commented Jul 18, 2024

Describe your changes

This adds an Option argument to get_token_balance which permits querying for balances at specific block heights. Additionally, this feature is implemented for the namadac CLI via the --height argument.

This is needed for accounting / auditing purposes and for some upcoming enhancements I will be contributing to namada-indexer.

This is a breaking change to the client SDK only. (The node RPC already supports this option)

Example:

# Query balance with unspecified height (same as existing behavior)
$ ./target/debug/namadac balance \
        --node https://rpc.namada.tududes.com:443 \
        --chain-id tududes-test.81efb06d86523ae4f \
        --token tnam1q87wtaqqtlwkw927gaff34hgda36huk0kgry692a \
        --owner tnam1qrcqrpj8r8lv6632wcwv9j0r6pp4n3xsug9hkxzx
nam: 9588921.2

# Query balance with specific height where a transaction occurred
$ ./target/debug/namadac balance \
        --node https://rpc.namada.tududes.com:443 \
        --chain-id tududes-test.81efb06d86523ae4f \
        --token tnam1q87wtaqqtlwkw927gaff34hgda36huk0kgry692a \
        --owner tnam1qrcqrpj8r8lv6632wcwv9j0r6pp4n3xsug9hkxzx \
        --height 59780
nam: 9590921.25

# Query balance with specific height just before the above transaction
$ ./target/debug/namadac balance \
        --node https://rpc.namada.tududes.com:443 \
        --chain-id tududes-test.81efb06d86523ae4f \
        --token tnam1q87wtaqqtlwkw927gaff34hgda36huk0kgry692a \
        --owner tnam1qrcqrpj8r8lv6632wcwv9j0r6pp4n3xsug9hkxzx \
        --height 59781
nam: 9589921.225

Indicate on which release or other PRs this topic is based on

This is based on the current main branch.

Checklist before merging to draft

  • I have added a changelog
  • Git history is in acceptable state

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.69%. Comparing base (0d7140f) to head (e669abe).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ates/light_sdk/src/reading/asynchronous/account.rs 0.00% 2 Missing ⚠️
crates/sdk/src/args.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3530   +/-   ##
=======================================
  Coverage   72.68%   72.69%           
=======================================
  Files         338      338           
  Lines      104319   104324    +5     
=======================================
+ Hits        75826    75834    +8     
+ Misses      28493    28490    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brentstone brentstone added the merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass label Sep 8, 2024
@mergify mergify bot merged commit 59fdda8 into anoma:main Sep 8, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants