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

Unable to query shielded balances of tokens received over IBC after updating epoch #2087

Closed
Tracked by #2021 ...
yito88 opened this issue Nov 3, 2023 · 3 comments
Closed
Tracked by #2021 ...
Assignees

Comments

@yito88
Copy link
Member

yito88 commented Nov 3, 2023

It is related to not only IbcToken but also Erc20 tokens.

When the epoch is updated after receiving a token over IBC, this shielded balance has only the epoch when the token is received.

let total_balance = balance
.get(&(epoch, token.clone()))
.cloned()
.unwrap_or_default();

Currently, we update the conversion state only for pre-existing tokens.

let tokens = address::tokens();

@cwgoes
Copy link
Collaborator

cwgoes commented Nov 4, 2023

Would we need to add entries to the conversion table by default, for new tokens? This may be dangerous, since any number of new tokens can be created - we should think about this. First, though, can you explicate exactly what you mean?

@yito88
Copy link
Member Author

yito88 commented Nov 4, 2023

I faced an issue with not being able to query the balance of IbcToken received at the previous epoch.
In query_shielded_balance(), compute_shielded_balance() returned the following MaspAmount as balance.

MaspAmount({(Epoch(2), Internal IbcToken: 8dc92a4843306e81055aad27883459d43410a3bb: atest1d93xxw368pjxxwfjvy6rsdpnxvcrvefcxycr2dtpv9jrydec8qengdfevs6rxdp3xpsnxcnzxv9rns): 10})

After that, to get the total_balance, it could get nothing with the current epoch (3).

let total_balance = balance
.get(&(epoch, token.clone()))
.cloned()
.unwrap_or_default();

@yito88
Copy link
Member Author

yito88 commented Feb 5, 2024

We can query the shielded balance of IBC tokens now

@yito88 yito88 closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants