feat!: obfuscate note and cipher order by byte-sort

BREAKING:

Before: Commitments, nullifiers, and ciphers of an account ID I were
all bound to the same possition in their respective vectors.

After: Before writing to journal, the PPC sorts the commitments and
nullifiers by bytes and encrypted account data by ciphertext
comparissons.

Mitigation: Do not rely on the plaintext order to be preserved for
private accounts after proving
This commit is contained in:
agureev 2026-06-22 22:26:54 +04:00
parent ed4329103e
commit 78e5b1d1ae

View File

@ -252,6 +252,16 @@ pub fn compute_circuit_output(
}
}
output
.new_commitments
.sort_unstable_by_key(Commitment::to_byte_array);
output
.new_nullifiers
.sort_unstable_by_key(|(nullifier, _)| nullifier.to_byte_array());
output
.encrypted_private_post_states
.sort_unstable_by(|a, b| a.ciphertext.as_bytes().cmp(b.ciphertext.as_bytes()));
output
}