Skip to content

Unable to spend notes with same preimages in the same tx. #2282

@LeilaWang

Description

@LeilaWang

The purpose of adding a nonce to the note hash is to make each note unique. Allowing notes in a storage slot (a Set or a Singleton) to have the same preimages. So that nullifying note{ value: 1, asset: A } won't invalidate dup_note{ value: 1, asset: A } because they will have different nonces, so their nullifier will be hash(nonce_1, contract_address, storage_slot, 1, A) and hash(nonce_2, contract_address, storage_slot, 1, A) respectively.

But currently when we try to recover the nonce for a decrypted note, we always find the first match. Which means if those two notes are in the same tx, the note processor will assign them the same nonce and end up saving two identical notes to the db.

Metadata

Metadata

Assignees

Labels

T-bugType: Bug. Something is broken.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions