I've been looking at the OmiseGo Plasma-MVP,
And the finalizeExits()
looks like this :
// @dev Loops through the priority queue of exits, settling the ones whose challenge
// @dev challenge period has ended
function finalizeExits()
public
{
uint256 utxoPos;
uint256 exitable_at;
(utxoPos, exitable_at) = getNextExit();
exit memory currentExit = exits[utxoPos];
while (exitable_at < block.timestamp && exitsQueue.currentSize() > 0) {
currentExit = exits[utxoPos];
currentExit.owner.transfer(currentExit.amount);
exitsQueue.delMin();
delete exits[utxoPos].owner;
if (exitsQueue.currentSize() > 0) {
(utxoPos, exitable_at) = getNextExit();
} else {
return;
}
}
}
In the case that many participants are listed in the exitsQueue
, the gas required to execute this function may be prohibitively high or even exceed the maximum allowed.
Two questions here
- Who is expected to pay the gas for executing this function?
- How do we handle high number of exiters in terms of gas?