semuxproject / semux-core

Semux Core
https://www.semux.org
MIT License
76 stars 31 forks source link

Transaction timestamp is higher than block timestamp #162

Closed honeycrypto closed 5 years ago

honeycrypto commented 5 years ago

Here is an example: https://semux.info/explorer/block/1371015

This block includes 91 Tx and some of them (from savel validator) have timestamp 22 May 2019 12:00:19 GMT. The block timestamp is 22 May 2019 12:00:05 GMT. So these Txs are from the future (14 seconds ahead).

Shouldn't validator reject these TXs in that specific block with a lower timestamp?

orogvany commented 5 years ago

I think there is some allowed timeshift. We could ignore/not propose any in future, but apart from being visually distracting, any reason to deny/delay tx from client who has wrong local time set?

honeycrypto commented 5 years ago

Probably there is only visual issue for transactions from the future. But I now realised that I'm using tx.timestamp for Last Activity in explorer's rich list. So someone can spam the network with transactions with timestamp months/years ago. Can this work? At what point validators will reject transaction as too old (even if valid)? I mean if the 'very old' tx has been added to mempool just now.

orogvany commented 5 years ago

Think mempool only allows. Few hours diff at most. I'd have to check. But per block inclusion may have separate check. Would be good to check to make sure it seems reasonable

orogvany commented 5 years ago

I think timedrift within a small window is reasonable. We do make effort to make sure that clients are using NTP time, but I think we should be ok with seconds/minutes in the future.