Skip to content

Commit 8944da7

Browse files
committed
nuke nullifier check from circuits
1 parent b14df83 commit 8944da7

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

packages/contracts/contracts/PoolERC20.sol

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ contract PoolERC20 is PoolGeneric {
4343
) external {
4444
token.safeTransferFrom(msg.sender, address(this), amount);
4545

46-
PublicInputs.Type memory pi = PublicInputs.create(2 + 2 + U256_LIMBS);
46+
PublicInputs.Type memory pi = PublicInputs.create(1 + 2 + U256_LIMBS);
4747
pi.push(getNoteHashTree().root);
48-
pi.push(getNullifierTree().root);
4948
pi.push(address(token));
5049
pi.pushUint256Limbs(amount);
5150
// TODO(security): ensure noteHash does not already exist in the noteHashTree. If it exists, the tx will never be rolled up and the money will be lost.
@@ -107,10 +106,9 @@ contract PoolERC20 is PoolGeneric {
107106
NoteInput calldata joinNote
108107
) external {
109108
PublicInputs.Type memory pi = PublicInputs.create(
110-
2 + MAX_NOTES_TO_JOIN + 1
109+
1 + MAX_NOTES_TO_JOIN + 1
111110
);
112111
pi.push(getNoteHashTree().root);
113-
pi.push(getNullifierTree().root);
114112
pi.push(joinNote.noteHash);
115113
for (uint256 i = 0; i < MAX_NOTES_TO_JOIN; i++) {
116114
pi.push(nullifiers[i]);
@@ -137,9 +135,8 @@ contract PoolERC20 is PoolGeneric {
137135
NoteInput calldata changeNote,
138136
NoteInput calldata toNote
139137
) external {
140-
PublicInputs.Type memory pi = PublicInputs.create(5);
138+
PublicInputs.Type memory pi = PublicInputs.create(4);
141139
pi.push(getNoteHashTree().root);
142-
pi.push(getNullifierTree().root);
143140
pi.push(changeNote.noteHash);
144141
pi.push(toNote.noteHash);
145142
pi.push(nullifier);

packages/contracts/noir/common/src/lib.nr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,4 @@ impl std::ops::Sub for TokenAmount {
9797

9898
pub struct TreeRoots {
9999
pub note_hash_root: Field,
100-
pub nullifier_root: Field,
101100
}

packages/contracts/noir/common/src/owned_note.nr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ where
3838
context.tree_roots().note_hash_root,
3939
);
4040
let nullifier = compute_nullifier_of_owned_note(self.note, secret_key);
41-
// TODO(perf): optimize consume by checking nullifiers only during rollup
42-
merkle_tree::assert_check_non_membership(
43-
nullifier,
44-
self.nullifier_low_leaf_preimage,
45-
self.nullifier_low_leaf_membership_witness,
46-
context.tree_roots().nullifier_root,
47-
);
4841
context.push_nullifier(nullifier);
4942
}
5043
}

packages/contracts/noir/erc20_unshield/src/main.nr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ fn main(
1212
) -> pub common::Result<1, 1> {
1313
let mut context = common::Context::from(tree_roots);
1414

15+
// disabled because nullifiers are no longer checked on tx level
16+
panic(f"not implemented");
17+
1518
erc20::Token::burn(
1619
&mut context,
1720
from_secret_key,

packages/contracts/sdk/TreesService.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class TreesService {
2626
note_hash_root: ethers.hexlify(
2727
noteHashTree.getRoot(INCLUDE_UNCOMMITTED),
2828
),
29-
nullifier_root: nullifierTree.getRoot(),
3029
};
3130
});
3231

0 commit comments

Comments
 (0)