FourthState / plasma-mvp-rootchain

smart contract implementation according to the Plasma MVP spec.
Apache License 2.0
79 stars 24 forks source link

Discussion on 2 queues #57

Closed AdityaSripal closed 6 years ago

AdityaSripal commented 6 years ago

All of the points here should be further expanded and eventually be moved into docs/ possibly under subfolder spec/

In MVP:

in one queue priority is (blocknum, txIndex, OIndex) and in another queue it’s just (DepositNonce)

This is to prevent the attack mentioned in safeDeposit where a validator can submit a malicious block before the deposit gets included. The solution of having users submit the block that they have validated allows users to claim that the only block they've validated is block 1 to get a high priority and DOS the network. Thus we use two seperate queues to process Deposits and regular UTXO's and avoid this problem

For MoreVP, since regular transactions can have their priorities be dependent on an input we need to change this

in the queue that processes regular transaction exits the priority is (blocknum, txIndex, OIndex, DepositNonce) and the other queue processes deposits and ANY TX'S THAT ONLY SPEND DEPOSITS exits it is just (DepositNonce)

so in the case where a tx spends a deposit and a regular utxo, that tx gets the priority of its regular utxo input position

in the case where tx has only deposit inputs, the priority is just the latest deposit and the tx is placed in deposit queue