aragon-apps icon indicating copy to clipboard operation
aragon-apps copied to clipboard

Agent, Finance: token balances module doesn't live update

Open izqui opened this issue 4 years ago • 5 comments

I just did an ANT deposit into an org while Finance was open. As soon as the transaction was mined, the transfer appeared in the transfer ledger, but the balance on top didn't update until I forced a refresh

Before refreshing (as soon as the deposit was mined):

Screen Shot 2020-01-07 at 11 31 36 AM

After reloading the app:

Screen Shot 2020-01-07 at 11 32 13 AM

izqui avatar Jan 07 '20 10:01 izqui

Hmm, this is quite awkward and shouldn't be the case. Maybe there's something weird with how we're memoizing but the balances should definitely be updating.

sohkai avatar Jan 14 '20 18:01 sohkai

finance.gif

Couldn't reproduce this one @sohkai @izqui , any particular way to test this?

rperez89 avatar Apr 11 '20 02:04 rperez89

@rperez89 Now I'm suspecting this may be due to race conditions with the underlying ETH node (e.g. we got the event first, but then when we did the balance update via an eth_call, we didn't catch the update).

Here's what I would do to fix this:

  • Send an API trigger from the frontend every 30s so the script can update all of its tokens' balances

This also has the nice side-effect of catching updates for any "hidden" transfers (e.g. directly sending tokens to the Agent / Vault).


Note that we should also apply this same trick to the Agent app.

sohkai avatar Apr 12 '20 17:04 sohkai

ahh about that nice side effect that you are talking about, i did exactly that to test i sent eth directly to the vault.

rperez89 avatar Apr 12 '20 17:04 rperez89

This also happens if you deploy a token, mint, approve and deposit in the same transaction.

The tokens appear in the transfer ledger, but the withdraw is not possible.

This isn't fixed on a hard refresh.

@sohkai How should I send an API request to force a refresh? Currently testing on Rinkeby.

cleanunicorn avatar Sep 06 '20 09:09 cleanunicorn