Skip to content

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

@codecov
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.

@joel-u410 joel-u410 force-pushed the joel/balance-query-at-height branch from a40556a to f5e5be2 Compare July 29, 2024 16:19
@cwgoes cwgoes requested a review from Fraccaman August 20, 2024 09:15
@joel-u410 joel-u410 force-pushed the joel/balance-query-at-height branch 2 times, most recently from 9b7abe1 to 227a540 Compare August 23, 2024 22:16
@brentstone brentstone force-pushed the joel/balance-query-at-height branch from 227a540 to 6b3838f Compare September 4, 2024 21:09
brentstone pushed a commit to joel-u410/namada that referenced this pull request Sep 4, 2024
@brentstone brentstone force-pushed the joel/balance-query-at-height branch from 125334c to e669abe Compare September 8, 2024 12:27
@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 namada-net:main Sep 8, 2024
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