mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-22 09:47:13 +01:00
receiver -> recipient
This commit is contained in:
parent
4d6dca78b2
commit
c4dded8a20
@ -29,7 +29,7 @@ template CommitmentHasher() {
|
||||
template Withdraw(levels) {
|
||||
signal input root;
|
||||
signal input nullifierHash;
|
||||
signal input receiver; // not taking part in any computations
|
||||
signal input recipient; // not taking part in any computations
|
||||
signal input relayer; // not taking part in any computations
|
||||
signal input fee; // not taking part in any computations
|
||||
signal input refund; // not taking part in any computations
|
||||
|
34
cli.js
34
cli.js
@ -66,7 +66,7 @@ async function depositErc20() {
|
||||
return note
|
||||
}
|
||||
|
||||
async function withdrawErc20(note, receiver, relayer) {
|
||||
async function withdrawErc20(note, recipient, relayer) {
|
||||
let buf = Buffer.from(note.slice(2), 'hex')
|
||||
let deposit = createDeposit(bigInt.leBuff2int(buf.slice(0, 31)), bigInt.leBuff2int(buf.slice(31, 62)))
|
||||
|
||||
@ -98,7 +98,7 @@ async function withdrawErc20(note, receiver, relayer) {
|
||||
// public
|
||||
root: root,
|
||||
nullifierHash,
|
||||
receiver: bigInt(receiver),
|
||||
recipient: bigInt(recipient),
|
||||
relayer: bigInt(relayer),
|
||||
fee: bigInt(web3.utils.toWei('0.01')),
|
||||
refund: bigInt(0),
|
||||
@ -120,7 +120,7 @@ async function withdrawErc20(note, receiver, relayer) {
|
||||
const args = [
|
||||
toHex(input.root),
|
||||
toHex(input.nullifierHash),
|
||||
toHex(input.receiver, 20),
|
||||
toHex(input.recipient, 20),
|
||||
toHex(input.relayer, 20),
|
||||
toHex(input.fee),
|
||||
toHex(input.refund)
|
||||
@ -129,20 +129,20 @@ async function withdrawErc20(note, receiver, relayer) {
|
||||
console.log('Done')
|
||||
}
|
||||
|
||||
async function getBalance(receiver) {
|
||||
const balance = await web3.eth.getBalance(receiver)
|
||||
async function getBalance(recipient) {
|
||||
const balance = await web3.eth.getBalance(recipient)
|
||||
console.log('Balance is ', web3.utils.fromWei(balance))
|
||||
}
|
||||
|
||||
async function getBalanceErc20(receiver, relayer) {
|
||||
const balanceReceiver = await web3.eth.getBalance(receiver)
|
||||
async function getBalanceErc20(recipient, relayer) {
|
||||
const balanceRecipient = await web3.eth.getBalance(recipient)
|
||||
const balanceRelayer = await web3.eth.getBalance(relayer)
|
||||
const tokenBalanceReceiver = await erc20.methods.balanceOf(receiver).call()
|
||||
const tokenBalanceRecipient = await erc20.methods.balanceOf(recipient).call()
|
||||
const tokenBalanceRelayer = await erc20.methods.balanceOf(relayer).call()
|
||||
console.log('Receiver eth Balance is ', web3.utils.fromWei(balanceReceiver))
|
||||
console.log('Recipient eth Balance is ', web3.utils.fromWei(balanceRecipient))
|
||||
console.log('Relayer eth Balance is ', web3.utils.fromWei(balanceRelayer))
|
||||
|
||||
console.log('Receiver token Balance is ', web3.utils.fromWei(tokenBalanceReceiver.toString()))
|
||||
console.log('Recipient token Balance is ', web3.utils.fromWei(tokenBalanceRecipient.toString()))
|
||||
console.log('Relayer token Balance is ', web3.utils.fromWei(tokenBalanceRelayer.toString()))
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ function toHex(number, length = 32) {
|
||||
return str
|
||||
}
|
||||
|
||||
async function withdraw(note, receiver) {
|
||||
async function withdraw(note, recipient) {
|
||||
// Decode hex string and restore the deposit object
|
||||
let buf = Buffer.from(note.slice(2), 'hex')
|
||||
let deposit = createDeposit(bigInt.leBuff2int(buf.slice(0, 31)), bigInt.leBuff2int(buf.slice(31, 62)))
|
||||
@ -188,7 +188,7 @@ async function withdraw(note, receiver) {
|
||||
// Public snark inputs
|
||||
root: root,
|
||||
nullifierHash,
|
||||
receiver: bigInt(receiver),
|
||||
recipient: bigInt(recipient),
|
||||
relayer: bigInt(0),
|
||||
fee: bigInt(0),
|
||||
refund: bigInt(0),
|
||||
@ -210,7 +210,7 @@ async function withdraw(note, receiver) {
|
||||
const args = [
|
||||
toHex(input.root),
|
||||
toHex(input.nullifierHash),
|
||||
toHex(input.receiver, 20),
|
||||
toHex(input.recipient, 20),
|
||||
toHex(input.relayer, 20),
|
||||
toHex(input.fee),
|
||||
toHex(input.refund)
|
||||
@ -273,8 +273,8 @@ function printHelp(code = 0) {
|
||||
Submit a deposit from default eth account and return the resulting note
|
||||
$ ./cli.js deposit
|
||||
|
||||
Withdraw a note to 'receiver' account
|
||||
$ ./cli.js withdraw <note> <receiver>
|
||||
Withdraw a note to 'recipient' account
|
||||
$ ./cli.js withdraw <note> <recipient>
|
||||
|
||||
Check address balance
|
||||
$ ./cli.js balance <address>
|
||||
@ -293,8 +293,8 @@ if (inBrowser) {
|
||||
window.deposit = deposit
|
||||
window.withdraw = async () => {
|
||||
const note = prompt('Enter the note to withdraw')
|
||||
const receiver = (await web3.eth.getAccounts())[0]
|
||||
await withdraw(note, receiver)
|
||||
const recipient = (await web3.eth.getAccounts())[0]
|
||||
await withdraw(note, recipient)
|
||||
}
|
||||
init()
|
||||
} else {
|
||||
|
@ -31,15 +31,15 @@ contract ERC20Mixer is Mixer {
|
||||
_safeErc20TransferFrom(msg.sender, address(this), denomination);
|
||||
}
|
||||
|
||||
function _processWithdraw(address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) internal {
|
||||
function _processWithdraw(address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) internal {
|
||||
require(msg.value == _refund, "Incorrect refund amount received by the contract");
|
||||
|
||||
_safeErc20Transfer(_receiver, denomination - _fee);
|
||||
_safeErc20Transfer(_recipient, denomination - _fee);
|
||||
if (_fee > 0) {
|
||||
_safeErc20Transfer(_relayer, _fee);
|
||||
}
|
||||
if (_refund > 0) {
|
||||
_receiver.transfer(_refund);
|
||||
_recipient.transfer(_refund);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,12 @@ contract ETHMixer is Mixer {
|
||||
require(msg.value == denomination, "Please send `mixDenomination` ETH along with transaction");
|
||||
}
|
||||
|
||||
function _processWithdraw(address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) internal {
|
||||
function _processWithdraw(address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) internal {
|
||||
// sanity checks
|
||||
require(msg.value == 0, "Message value is supposed to be zero for ETH mixer");
|
||||
require(_refund == 0, "Refund value is supposed to be zero for ETH mixer");
|
||||
|
||||
_receiver.transfer(denomination - _fee);
|
||||
_recipient.transfer(denomination - _fee);
|
||||
if (_fee > 0) {
|
||||
_relayer.transfer(_fee);
|
||||
}
|
||||
|
@ -80,22 +80,22 @@ contract Mixer is MerkleTreeWithHistory {
|
||||
`input` array consists of:
|
||||
- merkle root of all deposits in the mixer
|
||||
- hash of unique deposit nullifier to prevent double spends
|
||||
- the receiver of funds
|
||||
- the recipient of funds
|
||||
- optional fee that goes to the transaction sender (usually a relay)
|
||||
*/
|
||||
function withdraw(bytes calldata _proof, bytes32 _root, bytes32 _nullifierHash, address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) external payable {
|
||||
function withdraw(bytes calldata _proof, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) external payable {
|
||||
require(_fee <= denomination, "Fee exceeds transfer value");
|
||||
require(!nullifierHashes[_nullifierHash], "The note has been already spent");
|
||||
require(isKnownRoot(_root), "Cannot find your merkle root"); // Make sure to use a recent one
|
||||
require(verifier.verifyProof(_proof, [uint256(_root), uint256(_nullifierHash), uint256(_receiver), uint256(_relayer), _fee, _refund]), "Invalid withdraw proof");
|
||||
require(verifier.verifyProof(_proof, [uint256(_root), uint256(_nullifierHash), uint256(_recipient), uint256(_relayer), _fee, _refund]), "Invalid withdraw proof");
|
||||
|
||||
nullifierHashes[_nullifierHash] = true;
|
||||
_processWithdraw(_receiver, _relayer, _fee, _refund);
|
||||
emit Withdrawal(_receiver, _nullifierHash, _relayer, _fee);
|
||||
_processWithdraw(_recipient, _relayer, _fee, _refund);
|
||||
emit Withdrawal(_recipient, _nullifierHash, _relayer, _fee);
|
||||
}
|
||||
|
||||
/** @dev this function is defined in a child contract */
|
||||
function _processWithdraw(address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) internal;
|
||||
function _processWithdraw(address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) internal;
|
||||
|
||||
/** @dev whether a note is already spent */
|
||||
function isSpent(bytes32 _nullifierHash) external view returns(bool) {
|
||||
|
@ -35,12 +35,12 @@ function generateDeposit() {
|
||||
return deposit
|
||||
}
|
||||
|
||||
function getRandomReceiver() {
|
||||
let receiver = rbigint(20)
|
||||
while (toHex(receiver.toString()).length !== 42) {
|
||||
receiver = rbigint(20)
|
||||
function getRandomRecipient() {
|
||||
let recipient = rbigint(20)
|
||||
while (toHex(recipient.toString()).length !== 42) {
|
||||
recipient = rbigint(20)
|
||||
}
|
||||
return receiver
|
||||
return recipient
|
||||
}
|
||||
|
||||
function toFixedHex(number, length = 32) {
|
||||
@ -63,7 +63,7 @@ contract('ERC20Mixer', accounts => {
|
||||
let tree
|
||||
const fee = bigInt(ETH_AMOUNT).shr(1) || bigInt(1e17)
|
||||
const refund = ETH_AMOUNT || '1000000000000000000' // 1 ether
|
||||
const receiver = getRandomReceiver()
|
||||
const recipient = getRandomRecipient()
|
||||
const relayer = accounts[1]
|
||||
let groth16
|
||||
let circuit
|
||||
@ -141,7 +141,7 @@ contract('ERC20Mixer', accounts => {
|
||||
root,
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
relayer,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
|
||||
@ -158,10 +158,10 @@ contract('ERC20Mixer', accounts => {
|
||||
|
||||
const balanceMixerBefore = await token.balanceOf(mixer.address)
|
||||
const balanceRelayerBefore = await token.balanceOf(relayer)
|
||||
const balanceRecieverBefore = await token.balanceOf(toHex(receiver.toString()))
|
||||
const balanceRecieverBefore = await token.balanceOf(toHex(recipient.toString()))
|
||||
|
||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
const ethBalanceRelayerBefore = await web3.eth.getBalance(relayer)
|
||||
let isSpent = await mixer.isSpent(toFixedHex(input.nullifierHash))
|
||||
isSpent.should.be.equal(false)
|
||||
@ -171,7 +171,7 @@ contract('ERC20Mixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -181,8 +181,8 @@ contract('ERC20Mixer', accounts => {
|
||||
const balanceMixerAfter = await token.balanceOf(mixer.address)
|
||||
const balanceRelayerAfter = await token.balanceOf(relayer)
|
||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverAfter = await token.balanceOf(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverAfter = await token.balanceOf(toHex(recipient.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
const ethBalanceRelayerAfter = await web3.eth.getBalance(relayer)
|
||||
const feeBN = toBN(fee.toString())
|
||||
balanceMixerAfter.should.be.eq.BN(toBN(balanceMixerBefore).sub(toBN(tokenDenomination)))
|
||||
@ -217,7 +217,7 @@ contract('ERC20Mixer', accounts => {
|
||||
root,
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
relayer,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
|
||||
@ -235,7 +235,7 @@ contract('ERC20Mixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -284,7 +284,7 @@ contract('ERC20Mixer', accounts => {
|
||||
root,
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
|
||||
@ -302,8 +302,8 @@ contract('ERC20Mixer', accounts => {
|
||||
const balanceMixerBefore = await usdtToken.balanceOf(mixer.address)
|
||||
const balanceRelayerBefore = await usdtToken.balanceOf(relayer)
|
||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverBefore = await usdtToken.balanceOf(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverBefore = await usdtToken.balanceOf(toHex(recipient.toString()))
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
let isSpent = await mixer.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
||||
isSpent.should.be.equal(false)
|
||||
|
||||
@ -313,7 +313,7 @@ contract('ERC20Mixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -323,8 +323,8 @@ contract('ERC20Mixer', accounts => {
|
||||
const balanceMixerAfter = await usdtToken.balanceOf(mixer.address)
|
||||
const balanceRelayerAfter = await usdtToken.balanceOf(relayer)
|
||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverAfter = await usdtToken.balanceOf(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverAfter = await usdtToken.balanceOf(toHex(recipient.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
const feeBN = toBN(fee.toString())
|
||||
balanceMixerAfter.should.be.eq.BN(toBN(balanceMixerBefore).sub(toBN(tokenDenomination)))
|
||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||
@ -373,7 +373,7 @@ contract('ERC20Mixer', accounts => {
|
||||
root,
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
|
||||
@ -391,8 +391,8 @@ contract('ERC20Mixer', accounts => {
|
||||
const balanceMixerBefore = await token.balanceOf(mixer.address)
|
||||
const balanceRelayerBefore = await token.balanceOf(relayer)
|
||||
const ethBalanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverBefore = await token.balanceOf(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverBefore = await token.balanceOf(toHex(recipient.toString()))
|
||||
const ethBalanceRecieverBefore = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
let isSpent = await mixer.isSpent(input.nullifierHash.toString(16).padStart(66, '0x00000'))
|
||||
isSpent.should.be.equal(false)
|
||||
|
||||
@ -402,7 +402,7 @@ contract('ERC20Mixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -413,8 +413,8 @@ contract('ERC20Mixer', accounts => {
|
||||
const balanceMixerAfter = await token.balanceOf(mixer.address)
|
||||
const balanceRelayerAfter = await token.balanceOf(relayer)
|
||||
const ethBalanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverAfter = await token.balanceOf(toHex(receiver.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverAfter = await token.balanceOf(toHex(recipient.toString()))
|
||||
const ethBalanceRecieverAfter = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
const feeBN = toBN(fee.toString())
|
||||
balanceMixerAfter.should.be.eq.BN(toBN(balanceMixerBefore).sub(toBN(tokenDenomination)))
|
||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||
|
@ -43,12 +43,12 @@ function BNArrayToStringArray(array) {
|
||||
return arrayToPrint
|
||||
}
|
||||
|
||||
function getRandomReceiver() {
|
||||
let receiver = rbigint(20)
|
||||
while (toHex(receiver.toString()).length !== 42) {
|
||||
receiver = rbigint(20)
|
||||
function getRandomRecipient() {
|
||||
let recipient = rbigint(20)
|
||||
while (toHex(recipient.toString()).length !== 42) {
|
||||
recipient = rbigint(20)
|
||||
}
|
||||
return receiver
|
||||
return recipient
|
||||
}
|
||||
|
||||
function snarkVerify(proof) {
|
||||
@ -75,7 +75,7 @@ contract('ETHMixer', accounts => {
|
||||
let tree
|
||||
const fee = bigInt(ETH_AMOUNT).shr(1) || bigInt(1e17)
|
||||
const refund = bigInt(0)
|
||||
const receiver = getRandomReceiver()
|
||||
const recipient = getRandomRecipient()
|
||||
const relayer = accounts[1]
|
||||
let groth16
|
||||
let circuit
|
||||
@ -152,7 +152,7 @@ contract('ETHMixer', accounts => {
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -209,7 +209,7 @@ contract('ETHMixer', accounts => {
|
||||
root,
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
|
||||
@ -227,7 +227,7 @@ contract('ETHMixer', accounts => {
|
||||
const balanceMixerBefore = await web3.eth.getBalance(mixer.address)
|
||||
const balanceRelayerBefore = await web3.eth.getBalance(relayer)
|
||||
const balanceOperatorBefore = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverBefore = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverBefore = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
let isSpent = await mixer.isSpent(toFixedHex(input.nullifierHash))
|
||||
isSpent.should.be.equal(false)
|
||||
|
||||
@ -237,7 +237,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -247,7 +247,7 @@ contract('ETHMixer', accounts => {
|
||||
const balanceMixerAfter = await web3.eth.getBalance(mixer.address)
|
||||
const balanceRelayerAfter = await web3.eth.getBalance(relayer)
|
||||
const balanceOperatorAfter = await web3.eth.getBalance(operator)
|
||||
const balanceRecieverAfter = await web3.eth.getBalance(toHex(receiver.toString()))
|
||||
const balanceRecieverAfter = await web3.eth.getBalance(toHex(recipient.toString()))
|
||||
const feeBN = toBN(fee.toString())
|
||||
balanceMixerAfter.should.be.eq.BN(toBN(balanceMixerBefore).sub(toBN(value)))
|
||||
balanceRelayerAfter.should.be.eq.BN(toBN(balanceRelayerBefore))
|
||||
@ -275,7 +275,7 @@ contract('ETHMixer', accounts => {
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -287,7 +287,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -309,7 +309,7 @@ contract('ETHMixer', accounts => {
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -321,7 +321,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(toBN(input.nullifierHash).add(toBN('21888242871839275222246405745257275088548364400416034343698204186575808495617'))),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -342,7 +342,7 @@ contract('ETHMixer', accounts => {
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee: oneEtherFee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -355,7 +355,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -376,7 +376,7 @@ contract('ETHMixer', accounts => {
|
||||
root,
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -390,7 +390,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(randomHex(32)),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -411,7 +411,7 @@ contract('ETHMixer', accounts => {
|
||||
nullifierHash: pedersenHash(deposit.nullifier.leInt2Buff(31)),
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund,
|
||||
secret: deposit.secret,
|
||||
@ -423,7 +423,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -431,7 +431,7 @@ contract('ETHMixer', accounts => {
|
||||
let incorrectArgs
|
||||
const originalProof = proof.slice()
|
||||
|
||||
// receiver
|
||||
// recipient
|
||||
incorrectArgs = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
@ -447,7 +447,7 @@ contract('ETHMixer', accounts => {
|
||||
incorrectArgs = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex('0x000000000000000000000000000000000000000000000000015345785d8a0000'),
|
||||
toFixedHex(input.refund)
|
||||
@ -459,7 +459,7 @@ contract('ETHMixer', accounts => {
|
||||
incorrectArgs = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex('0x00abdfc78211f8807b9c6504a6e537e71b8788b2f529a95f1399ce124a8642ad'),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
@ -487,7 +487,7 @@ contract('ETHMixer', accounts => {
|
||||
root,
|
||||
nullifier: deposit.nullifier,
|
||||
relayer: operator,
|
||||
receiver,
|
||||
recipient,
|
||||
fee,
|
||||
refund: bigInt(1),
|
||||
secret: deposit.secret,
|
||||
@ -501,7 +501,7 @@ contract('ETHMixer', accounts => {
|
||||
const args = [
|
||||
toFixedHex(input.root),
|
||||
toFixedHex(input.nullifierHash),
|
||||
toFixedHex(input.receiver, 20),
|
||||
toFixedHex(input.recipient, 20),
|
||||
toFixedHex(input.relayer, 20),
|
||||
toFixedHex(input.fee),
|
||||
toFixedHex(input.refund)
|
||||
|
Loading…
Reference in New Issue
Block a user