loomnetwork/plasma-cash

UX Issue with multiple deposits at the same time

Closed this issue · 0 comments

Currently when creating a deposit transaction, we require that the user has to also formulate the UTXO and submit it as the extra data field in the safeTransferFrom function in ERC721. One of the parameters which can be raced across participants is the slot of the UTXO in the merkle tree, which is currently user supplied.

If two users want to deposit at the same time and they create deposit UTXOs with the same UTXO slot, only one of their transactions will get included, and the other will be invalid.

I can see 2 solutions for this:

  1. Create the deposit UTXO on chain. This would require some kind of RLP method createTx in Transaction.sol
  2. Make it so that the hash of the Deposit transactions is keccak256(slot). Since each coin is unique this should not pose any risk.

I'm working on a PoC for the second method.