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

Blockchain test fails with seed 1622256150. #315

Open kayabaNerve opened 3 years ago

kayabaNerve commented 3 years ago

Found thanks to the GitHub CI failing. Given I've never seen this before, I can only assume this is an incredibly rare case. None the less, one which must be handled.

Potentially critical.

kayabaNerve commented 3 years ago

A Merit Holder who's expected to have 0 Merit actually has 1 Merit. Forged Merit Holder balances are critical.

kayabaNerve commented 3 years ago

This test apparently had its packet generation commented out at some point and it was left commented, which is somewhat horrific.

Reproducible with just 11 rounds instead of 20, roughly halving the time it takes to execute. I also disabled RandomX mining while working on this.

Changing Element generation does cause this to not trigger, which makes me wonder if it's related to Dead Merit.

kayabaNerve commented 3 years ago

Off by one error when a Merit Holder was malicious AND had a Merit Removal in a Block their Merit died in. It added back the dead Merit which should've been noted as removed by that same Block.

kayabaNerve commented 3 years ago

Fix causes failures more often; 1622346620 1622346401 have now appeared. The State Revert test also failed with seed 1622347011.

kayabaNerve commented 3 years ago

I'm running the Blockchain test overnight to look for a failure seed with the new fuzzing code. Nothing should've changed so drastically it's infeasible/impossible, yet this test having a failure seed was unknown for months across likely hundreds of runs. So we'll see. I did comment out the mining code once again to go from an ~8 minute execution time to 1 minute.

kayabaNerve commented 3 years ago

Found 1622359295 with the new fuzzing code. It took 75 runs, highlighting its infrequency,

As a side note, we should look into not RandomX mining in this test when being run on the CI. It's decently inconsiderate to GitHub and increases our chances of getting removed from their CI for RandomX mining.