elixir-omg
elixir-omg copied to clipboard
`account.get_balance` includes spent UTXO's in balance calculation after IFE
To reproduce:
- Bob has 0 funds on the childchain
- Alice sends childchain transaction to Bob
- Bob starts an inflight exit and piggybacks his output
- Bob waits for challenge period and processes his exit
- Bob has no more UTXOs, as confirmed by
account.get_exitable_utxos
- Bob calls
account.get_balance
to confirm his childchain balance is 0. -
account.get_balance
includes the the utxo just exited.
The expected behavior of the balance returning 0 is observed after a standard exit, but not after an IFE.
As a user I want to call account.get_balance
to see my childchain balance, and not have spent utxos as part of that balance
Thank you for the report!
Yes, the support for IFEs from a "usability standpoint" is incomplete and we should fix it and make consistent with SEs.
(The incompleteness is slightly related to the fact, that an IFE is started in some form of a byzantine condition, whereby the user should not spend on the child chain anymore. But I agree the behavior should be consistent and clean regardless.)
I'd even say that both account.get_utxos
(and account.get_balance
) and account.get_exitable_utxos
should behave on par in terms that they stop showing UTXOs that start exiting, whereas account.get_exitable_utxos
requires the exit to be processed.
@pdobacz can you confirm whether your last comment will get implemented? that account.get_utxos
will stop showing UTXOS that have started exiting?
and to clarify, account.get_exitable_utxos
will not show UTXO's that have been processed but still show UTXO's that have started exits
@nicholasmueller
Maybe without delving into that comment, let's reiterate that:
Current
get_utxos
should not return UTXOs:
- which started a standard exit
get_exitable_utxos
should not return UTXOs:
- which exited successfully (processed exit) via standard or in-flight exit
Fixed
(my guess at least, depending on product's requirements and your requirements):
get_utxos
and get_exitable_utxos
should not return UTXOs:
- which started a standard exit
- which are inputs to a started IFE transaction
- which are piggybacked outputs to a started IFE transaction
All of course subject to any finality margin (currently 12 eth blocks) one uses when ingesting events.
But let's give this proposition a round of review with @Pongch @kevsul @jrhite (anyone else?). I'm not sure whether one wouldn't like to see a UTXO that started an exit flagged as such instead. Possibly in one of those endpoints. I think there are discussions on this topic going on right now.