gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
877 stars 359 forks source link

How to verify the timestamp of a node? #2690

Open Molaryy opened 1 month ago

Molaryy commented 1 month ago

Description

After asking in the discord developers chat about how to determine if the timestamp in a node corresponds with the real timestamp, Leon recommended me to create an issue to find out more about this and also explore the TM2 module understand better how it works. I would like to know what kind of protections do you have in TM2 for this.

DIGIX666 commented 1 month ago

I'd say that right now, timestamping a node must be complicated because if it uses Time.Now() it risks returning the original UNIX time. I encountered this problem when creating the UUID package. If you want to go further, there's an open issue on the subject and you also have validation.go for more explication on the ValidateTime :) In any case, that's what comes to mind at the moment when you talk to me about timestamps.

For TM2, if you look at the block.go and validation.go files, I think that currently to validate a block it checks the length of the stringID, the height of the block and the validity of the hash.