Submitted by Abdessamed, also found by DemoreX, anonymousjoe, 0xlemon, jesjupyter, Udsen, rbserver, 0rpse, KupiaSec, ZdravkoHr, and Kalogerone
Entropy is stored in uint256 slots, with each slot able to contain 13 concatenated entropies. Entropies are generated in three passes, and there is a golden entropy value 999999 that should not be generated in the first two passes, as specified in the documentation:
The issue is that writeEntropyBatch1 and writeEntropyBatch2 functions do not correctly check for the golden entropy:
The function (same for writeEntropyBatch2) attempts to ensure that no golden entropy is generated using the following check: require(pseudoRandomValue != 999999, 'Invalid value, retry.');. However, this check is incorrect because pseudoRandomValue does NOT represent a single entropy value but represents the entire slot value, which contains 13 entropies. For example, if the pseudo-randomly generated slot value is ........999999123345, the check will pass while it should not because the second entropy is a golden one.
The current check incorrectly validates the entire slot value. Consider updating the check to validate each of the 13 entropies within the slot value.
Invalid Validation
