Should we use Blake3 for proof of space quality derivation?

Current implementation, just like Chia, uses Blake3 for most things, but for some reason Sha256 is used for quality derivation. I am not aware of reasons why that is desirable, maybe we can consider switching it to Blake3 so we don’t have two hasing functions there?

What’s interesting, in the spec document the quality is unhashed. I found the commit that introduced hashing of qualities All ints in quality calculation, quality to quality string · Chia-Network/chiapos@0a49ad0 · GitHub and the PR Chacha8 by rostislav · Pull Request #45 · Chia-Network/chiapos · GitHub that introduced Blake3 to replace AES for table calculations 5 month later. So SHA was used for hashing qualities before Blake3 was used at all. I assume it just wasn’t updated, but I will try asking on their Discord if anyone remembers the context

1 Like

The other observation is that currently we do not use quality at all, so probably worth removing it from the codebase entirely and save some unnecessary hashing during proving?

You’re, I forgot we replaced it with proofs. Looking at the code, IMO, we can completely sidestep even looking for quality.
The current logic goes “if there is matching entry in table 7” → “there is quality” → “there is proof”. We can go directly “if there is matching entry in table 7” → “there is proof” and save another tiny bit of time (which I have suggested a while back).
I have fiddled with it for a bit, but can’t quite get the types right, I believe you’re right and we can remove all types and notion of quality from both prover and verifier.

Implemented in PoS tweaks by nazar-pc · Pull Request #2160 · subspace/subspace · GitHub. Quality search method is still present in Chiapos implementation so we can test it against reference implementation, but we are not using/exposing it in Subspace APIs anymore.