HPCE / hpce-2017-cw5

1 stars 6 forks source link

Mining scale does not represent the difficulty of the problem. #39

Closed crypto-perry closed 6 years ago

crypto-perry commented 6 years ago

For the mining puzzle, for scales around 50000 or 60000, the puzzle is completed basically instantly. I was just wondering if you are aware of this. Also what if there are values of scale that make the problem unsolvable?

vinaymaniam commented 6 years ago

Please see https://github.com/HPCE/hpce-2017-cw5/issues/15 . tl;dr - Since mining uses a random number generator to generate trial solutions, it isn't worthwhile to look at a single execution time, but rather the average execution time for a large number of different input sizes, such that it more or less converges to the statistical expectation.

crypto-perry commented 6 years ago

Yes of course I understand that, but for those values it always is a very short time. the threshold is just very high. My point here is that the scale does not represent the difficulty of the problem in this case. Because for certain scales like 50000, the difficulty is just trivial. At least this is what I find even I run 40 times.

m8pple commented 6 years ago

It's due to this line, and the use of 32-bit ints.

The critical point should be at scale of about 46340.

It could be fixed by changing it to:

params->threshold=(uint64_t)(pow(2.0,64) / (scale*(double)scale));

(or use a compiler that supports int as 64-bit, though they are hard to come by on x86).

So in order to reach that scale in assessment you'll need move through smaller scales first. Due to the way the scaling goes up, you'd need to solve scale=~40000 first, where the probability of any point being below the threshold is ~2^-30, and there are ~204 rounds per point, and ~20 instructions per round. So you'd need to do about 2^42 instructions to pass scale=40000. Hrmm, that's more feasible than I wanted; it probably should have been rounds=4+scale, then it would go up to 2^49.6, which is more substantial.

Anyway, thanks for pointing it out - I'll apply the fix, though because it's in the puzzle input it doesn't count as a breaking change.