-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: Add convenience method for constructing key to access account's balance for a given denom #352
Conversation
… balance for a given denom (backport cosmos#12674) (cosmos#12745) * feat: Add convenience method for constructing key to access account's balance for a given denom (cosmos#12674) This PR adds a convenience method for constructing the key necessary to query for the account's balance of a given denom. I ran into this issue since we are using ABCI query now to perform balance requests because we are also requesting merkle proofs for the returned balance [here](https://github.com/celestiaorg/celestia-node/pull/911/files#diff-0ee31f5a7bd88e9f758e6bebdf3ee36365519e55a451098d9638c39afe5eac42R144). It would be nice to have a definitive convenience method for constructing the key. [Ref.](github.com/celestiaorg/celestia-node/pull/911) (cherry picked from commit a1777a8) * Update CHANGELOG.md * fix conflict Co-authored-by: rene <[email protected]> Co-authored-by: Marko <[email protected]>
@@ -90,13 +90,13 @@ func TestBalanceKeysMigration(t *testing.T) { | |||
err = v043bank.MigrateStore(ctx, bankKey, encCfg.Marshaler) | |||
require.NoError(t, err) | |||
|
|||
newKey := append(types.CreateAccountBalancesPrefix(addr), []byte(fooCoin.Denom)...) | |||
newKey := types.CreatePrefixedAccountStoreKey(addr, []byte(fooCoin.Denom)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the caller shouldn't have to cast into a byte slice -- have CreatePrefixedAccountStoreKey
do it for them :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but should we keep this consistent with upstream to ease future backports / rebases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just test shouldn't matter much right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what core SDK does? Sigh...
… balance for a given denom (backport cosmos#12674) (cosmos#12745) (#352) * feat: Add convenience method for constructing key to access account's balance for a given denom (cosmos#12674) This PR adds a convenience method for constructing the key necessary to query for the account's balance of a given denom. I ran into this issue since we are using ABCI query now to perform balance requests because we are also requesting merkle proofs for the returned balance [here](https://github.com/celestiaorg/celestia-node/pull/911/files#diff-0ee31f5a7bd88e9f758e6bebdf3ee36365519e55a451098d9638c39afe5eac42R144). It would be nice to have a definitive convenience method for constructing the key. [Ref.](github.com/celestiaorg/celestia-node/pull/911) (cherry picked from commit a1777a8) * Update CHANGELOG.md * fix conflict Co-authored-by: rene <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: rene <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: Roman <[email protected]> (cherry picked from commit c6b1e6a)
… balance for a given denom (backport cosmos#12674) (cosmos#12745) (#352) (#365) * feat: Add convenience method for constructing key to access account's balance for a given denom (cosmos#12674) This PR adds a convenience method for constructing the key necessary to query for the account's balance of a given denom. I ran into this issue since we are using ABCI query now to perform balance requests because we are also requesting merkle proofs for the returned balance [here](https://github.com/celestiaorg/celestia-node/pull/911/files#diff-0ee31f5a7bd88e9f758e6bebdf3ee36365519e55a451098d9638c39afe5eac42R144). It would be nice to have a definitive convenience method for constructing the key. [Ref.](github.com/celestiaorg/celestia-node/pull/911) (cherry picked from commit a1777a8) * Update CHANGELOG.md * fix conflict Co-authored-by: rene <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: rene <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: Roman <[email protected]> (cherry picked from commit c6b1e6a) Co-authored-by: Matt, Park <[email protected]>
Backport : cosmos#12745