mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-06 08:15:41 -04:00
reduce nullifier bits to 31
This commit is contained in:
parent
e387025992
commit
c7953ae2c6
3 changed files with 16 additions and 16 deletions
4
cli.js
4
cli.js
|
@ -21,7 +21,7 @@ const pedersenHash = (data) => circomlib.babyJub.unpackPoint(circomlib.pedersenH
|
|||
|
||||
function createDeposit(nullifier, secret) {
|
||||
let deposit = { nullifier, secret }
|
||||
deposit.preimage = Buffer.concat([deposit.nullifier.leInt2Buff(32), deposit.secret.leInt2Buff(32)])
|
||||
deposit.preimage = Buffer.concat([deposit.nullifier.leInt2Buff(31), deposit.secret.leInt2Buff(31)])
|
||||
deposit.commitment = pedersenHash(deposit.preimage)
|
||||
return deposit
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ async function withdraw(note, receiver) {
|
|||
})
|
||||
const tree = new merkleTree(MERKLE_TREE_HEIGHT, EMPTY_ELEMENT, leaves)
|
||||
const validRoot = await mixer.methods.isKnownRoot(await tree.root()).call()
|
||||
const nullifierHash = pedersenHash(deposit.nullifier.leInt2Buff(32))
|
||||
const nullifierHash = pedersenHash(deposit.nullifier.leInt2Buff(31))
|
||||
const nullifierHashToCheck = nullifierHash.toString(16).padStart('66', '0x000000')
|
||||
const isSpent = await mixer.methods.isSpent(nullifierHashToCheck).call()
|
||||
assert(validRoot === true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue