Skip to content

Commit

Permalink
Merge pull request #509 from EYBlockchain/westlad/ercaddress-removal
Browse files Browse the repository at this point in the history
remove ERC addresses from transfer
  • Loading branch information
Ilyas Ridhuan authored Feb 23, 2022
2 parents a679011 + f5dd737 commit 2ce68f1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion nightfall-client/src/services/transfer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const {
SHIELD_CONTRACT_NAME,
PROTOCOL,
USE_STUBS,
ZERO,
} = config;
const { generalise, GN } = gen;

Expand Down Expand Up @@ -204,7 +205,7 @@ async function transfer(transferParams) {
historicRootBlockNumberL2: blockNumberL2s,
transactionType,
publicInputs,
ercAddress,
ercAddress: ZERO, // we don't want to expose the ERC address during a transfer
commitments: newCommitments,
nullifiers,
compressedSecrets,
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/circuits/double_transfer.zok
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Secrets {
}

def main(\
field[2] fErcAddress,\
private field[2] fErcAddress,\
private OldCommitmentPreimage[2] oldCommitment,\
private NewCommitmentPreimage[2] newCommitment,\
field[2] fNewCommitmentHash,\
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/circuits/double_transfer_stub.zok
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Secrets {
}

def main(\
field[2] fErcAddress,\
private field[2] fErcAddress,\
private OldCommitmentPreimage[2] oldCommitment,\
private NewCommitmentPreimage[2] newCommitment,\
field[2] fNewCommitmentHash,\
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/circuits/single_transfer.zok
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Secrets {
}

def main(\
field fErcAddress,\
private field fErcAddress,\
private OldCommitmentPreimage oldCommitment,\
private NewCommitmentPreimage newCommitment,\
field fNewCommitmentHash,\
Expand Down
2 changes: 1 addition & 1 deletion nightfall-deployer/circuits/single_transfer_stub.zok
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Secrets {
}

def main(\
field fErcAddress,\
private field fErcAddress,\
private OldCommitmentPreimage oldCommitment,\
private NewCommitmentPreimage newCommitment,\
field fNewCommitmentHash,\
Expand Down
10 changes: 5 additions & 5 deletions nightfall-optimist/src/services/transaction-checker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function checkTransactionType(transaction) {
if (
transaction.tokenId !== ZERO ||
Number(transaction.value) !== 0 ||
transaction.ercAddress === ZERO ||
transaction.ercAddress !== ZERO ||
transaction.recipientAddress !== ZERO ||
transaction.commitments[0] === ZERO ||
transaction.commitments[1] !== ZERO ||
Expand All @@ -87,7 +87,7 @@ async function checkTransactionType(transaction) {
if (
transaction.tokenId !== ZERO ||
Number(transaction.value) !== 0 ||
transaction.ercAddress === ZERO ||
transaction.ercAddress !== ZERO ||
transaction.recipientAddress !== ZERO ||
transaction.commitments.some(c => c === ZERO) ||
transaction.commitments.length !== 2 ||
Expand Down Expand Up @@ -173,7 +173,7 @@ async function verifyProof(transaction) {
break;
case 1: // single transfer transaction
inputs = new PublicInputs([
transaction.ercAddress,
// transaction.ercAddress,
transaction.commitments[0], // not truncating here as we already ensured hash < group order
generalise(transaction.nullifiers[0]).hex(32, 31),
historicRootFirst.root,
Expand All @@ -184,8 +184,8 @@ async function verifyProof(transaction) {
break;
case 2: // double transfer transaction
inputs = new PublicInputs([
transaction.ercAddress, // this is correct; ercAddress appears twice
transaction.ercAddress, // in a double-transfer public input hash
// transaction.ercAddress, // this is correct; ercAddress appears twice
// transaction.ercAddress, // in a double-transfer public input hash
transaction.commitments, // not truncating here as we already ensured hash < group order
transaction.nullifiers.map(nullifier => generalise(nullifier).hex(32, 31)),
historicRootFirst.root,
Expand Down

0 comments on commit 2ce68f1

Please sign in to comment.