MerosCrypto / Meros

An instant and feeless cryptocurrency for the future, secured by the Merit Caching Consensus Mechanism.
https://meroscrypto.io
Other
82 stars 19 forks source link

Meros will crash after syncing ~1 billion Transactions. #156

Open kayabaNerve opened 4 years ago

kayabaNerve commented 4 years ago

After syncing 1 million Transactions, and the accompanying 1 million VerificationPackets, Meros will overflow the counter it uses for SyncRequests (a counter used to give each request an unique ID). Nim will then have its checks kill the program. The solution is two-fold:

1) Confirm IDs can be re-used if the old request has completed. Using every ID would then require creating 2 billion sync requests in less than 5 seconds. This should be okay thanks to a mix of table-indexing and because I believe we cleanup the metadata (as to not cause a memory leak).

2) Change the int to an uint. Not only does this double our space, Nim doesn't mind if uints are overflown.

kayabaNerve commented 4 years ago

This bug is notoriously hard to test. Therefore, DT4S's goal is to theoretically fix this, giving it the untested label.

kayabaNerve commented 4 years ago

This same issue exists with peer IDs.

kayabaNerve commented 4 years ago

For some reason, my mind thinks 2^32 is 4 million; not 4 billion (rounded, of course).

I'm not sure this is feasible to test with such a large quantity, not to mention it'd take years to trigger naturally. I do want to theoretically fix it, but I don't see any value in doing more than that.