elixir-omg
elixir-omg copied to clipboard
Let the Child Chain server hint on its view of deposits recognition
A common scenario now is that:
- Alice places a deposit
- Alice's Watcher waits some finality and reports the deposit as a spendable UTXO
- Alice wants to spend that UTXO but gets
utxo_not_found
The main reason for this is a slower syncing of deposits on the Child Chain server end. Can take the form of:
- Child Chain server hiccups/stalls and is behind Alice's Watcher
- Child Chain server's Ethereum node is delayed wrt. Alice's for no big reason (the frustrated Pepe problem described by @InoMurko )
To gather the suggested solutions, that I've seen proposed:
- expose extra endpoints on the Child Chain server API to inform about its
synced_height
or directly its recognized deposits - enable subscriptions on the Child Chain server API to allow it to push deposit recognized events to the Watcher
- enrich the
utxo_not_found
with details likeprobably_because_I_haven't_recognized_deposits_this_far
- the above combined with enriching the
utxo_not_found
with details likesynced_height
to give the caller an idea of where the Child Chain server is - (quick, simple but incomplete patch) - split the
deposit_finality_margin
used in the Watcher into two: "state_processing_deposit_finality_margin
" - drivesOMG.State
and deposit recognition for the use of syncing and "spendable_deposit_finality_margin
" - drives the moment when Watcher (-Info) present deposited UTXOs as spendable. The latter is then>
than the former and impact is partially minimized
Considerations:
- it must be stressed, that any response from the chch is informational and non-binding. Only valid inclusion of the submitted transaction in a valid, mined and confirmed block submission gives certainty, that the transaction has been indeed accepted
- solutions which "ask for permission not for forgiveness" are preferred, so as to not reveal transaction signatures prematurely (limit the transaction's in-flight span). However, note the above - the child chain server can always "lie" about the permission