-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add nonce to note hash. #1019
Comments
A nullifier is often A simple nonce would be:
Which would be calculated by the kernel circuit. Where Note: an account contract SHOULD always emit a hash of the 'tx request' as the 0th nullifier of the tx (@spalladino please can you confirm?), so there should always be a Example (in pseudocode, and with naming which doesn't quite match the actual code!) Kernel: // let i = kernel.start.new_commitments.length; // Maybe don't do this, because this length might have been reduced through squashing in previous kernel iterations.
let i = kernel.start.nonce_index; // Maybe track a nonce index, which doesn't get warped by squashing.
kernel.end.nonce_index = i + call.public_inputs.new_commitments.length();
let nonce;
let unique_commitment;
let siloed_commitments = [];
for j in 0..new_commitments.length() {
nonce = pedersen({ kernel.end.new_nullifiers[0], i}, NONCE_GENERATOR_INDEX);
unique_commitment = pedersen(new_commitments[j], nonce, NONCE_INJECTION_GENERATOR_INDEX);
siloed_commitments[j] = pedersen(unique_commitment, contract_address, OUTER_COMMITMENT_GENERATOR_INDEX);
++i;
}
// Maybe some squashing of siloed_commitments happens, but the kernel.end.nonce_index is unaffected.
kernel.end.new_commitments = siloed_commitments; |
This is actually handled by the initial kernel circuit, who manually injects that nullifier: Lines 140 to 141 in d957897
|
No description provided.
The text was updated successfully, but these errors were encountered: