mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 01:17:58 -05:00
feat: entrypoint upgrade #9
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @0xmoebius on 5/15/2025
This pull request introduces changes to the to-be-upgraded
Entrypointcontract.With this upgrade, a
usedPrecommitmentsmapping is added to the contract, which tracks all used precommitments and prevents users from depositing using an already used precommitment, thus preventing stuck funds.Introduced changes:
An issue of this kind could theoretically happen to the secrets used on withdrawals, though it’s way less probable because of the nature of the commitment system on withdrawals:
withdraw.circomcircuit does take this in count and will never produce a withdrawal proof with a new commitment with the same nullifier as the just spent one.master_nullifierandmaster_secret, but the data used as pre-image of the ultimate secret values is inherently different. For deposits, the secrets are image ofposeidon(master_key, pool_scope, deposit_index), while the ones of withdrawals are the image ofposeidon(master_key, deposit_label, withdrawal_index). This makes the chances of collision of deposit and withdrawal secrets almost non-existent.This issue can not be used by a third actor in a malicious way whatsoever. Another account can see the chain and use your same pre-commitment for a deposit, but only the user who owns the master keys generated by the seed-phrase is the one that will be able to later spend the commitment.