Open akolotov opened 3 years ago
In fact, the behavior of the oracles could be even more inconsistent. Consider four oracles. Three of them are observing T1 at the same time and send the confirmations to the Home chain. The first mined confirmation is executed properly indicating that the transfer is above the limit. The second and third confirmations are failed since this "incorrect" transfer was already registered in the contract. The fourth oracle will not be able to send the transaction at all by the reasons described above.
So, even if the transaction is scheduled on the fourth oracle and sent later, it will be still impossible to collect enough confirmations since first three oracles will not re-send their transactions without manual intervention.
That's why it makes sense to consider the suggestion above "to change the oracle as so it will schedule the transactions which hit the daily limit ..." as so the oracle measures explicitly the rest of amount available to be sent to the Home chain and if the current transfer is going to hit the limit, to schedule the transaction for another time.
Bearing in mind the examples above, the first oracle (and others) must not send such transaction to the Home side at all but schedule it to deliver later.
Consider to address the issue with the current behavior of the xDai bridge oracle for the following situation:
While T1 is handled and sent by the first oracle, other oracles will experience the issue described in #436. So, they will not update the revisited blocks and will try to handle T2 again and again. At the same time T2 is perfectly fit within the executed limit.
The suggestion is to change the oracle as so it will schedule the transactions which hit the daily limit to be send at 00:00 UTC of the next day. It could be done either through an additional queue in the RMQ DB or by having a separate worker that will work with another block counter that keeps the block number of the first transaction hit the daily limit. It is necessary to investigate first which approach has less drawbacks.