threefoldfoundation / tfchain

Official implementation of the ThreeFold blockchain
https://explorer.threefoldtoken.com
Apache License 2.0
13 stars 7 forks source link

decide if and how to validate the block delay of ERC20 TFT Coin Creations #244

Open GlenDC opened 5 years ago

GlenDC commented 5 years ago

Currently there is no validation on the block delay that was applied by the bridge upon the ERC20 Coin Creation. Meaning that it isn't currently checked that the linked ERC20 Tx is part of a block older than at least x amount of blocks.

GlenDC commented 5 years ago

Initial conversation about this issue:

Glen De Cauwsemaecker, [21 Dec 2018 at 16:12:27 (21/12/2018, 16:12:41)]:
ah I forgot one validation, @leesmet, I probably should also check if the minimum block delay is respected, no?

Lee Smet, [21 Dec 2018 at 16:14:52]:
You could, not sure if its super usefull to check that

Glen De Cauwsemaecker, [21 Dec 2018 at 16:15:09]:
is it not something we want to enforce?

such a delay is also enforced for our regular payouts

Lee Smet, [21 Dec 2018 at 16:15:55]:
The problem is that this value changes over time

Glen De Cauwsemaecker, [21 Dec 2018 at 16:16:05]:
how so?

we are not going to keep it at 6?

Lee Smet, [21 Dec 2018 at 16:17:35]:
yes, but if somewhow I push a tx as soon as I see the eth transaction (lets say 1 block old), it is invalid due to this rool. Yet if this validator (or anohter one for that matter) comes back an hour later, there will be a lot of new eth blocks probably, and so there will suddenly be 100 or so confirmation on the tx, so the validators will now say it is valid

Glen De Cauwsemaecker, [21 Dec 2018 at 16:19:33]:
yes, but you shouldn’t push it it as soon, right?

Lee Smet, [21 Dec 2018 at 16:21:13]:
Indeed, I'll try to add the 6 blocks delay, but I'm not sure how usefull it is to do validation on that (escpecially if the validation happens on a newly syncing node which sees "old" transactions).

Glen De Cauwsemaecker, [21 Dec 2018 at 16:22:45 (21/12/2018, 16:22:57)]:
Hmm, I do get your concern, but not sure we should just allow TFT transactions backed by a just-created ERC20 tx, there is still plenty of chance for a fork, hence why we introduced the idea of the delay in the first place

Lee Smet, [21 Dec 2018 at 16:23:17]:
I know, but its a tricky situation to do validation on

Besides that, lets say I wait 6 blocks, then immediatly push the tx. Then a block is mined on our chain. But your client did not yet receive the new eth block due to latency, and it gets my new tft block. then the block is also rejected

It's unlikely but possible

Glen De Cauwsemaecker, [21 Dec 2018 at 16:25:11]:
that we could mitigate by perhaps making the bridge wait longer than is required by the validation

Lee Smet, [21 Dec 2018 at 16:25:47]:
true
LeeSmet commented 5 years ago

@GlenDC I assume this can be closed now?