Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locking by spending and creating UTXOs #121

Merged
merged 29 commits into from
Jan 29, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
97f3894
spend inputs for locking
jimthematrix Jan 9, 2025
0e3de1a
Squashed commit of the following:
jimthematrix Jan 9, 2025
5a8e9f2
zeto lock with nullifiers
jimthematrix Jan 9, 2025
ac8c0f9
remove lock verifiers
jimthematrix Jan 14, 2025
4725fba
transfer() and transferLocked() with new circuits
jimthematrix Jan 14, 2025
61a0902
fix anon_nullifier and add locking support to nf_anon
jimthematrix Jan 15, 2025
e710d01
add locking support for NF token implementations
jimthematrix Jan 16, 2025
8a2504e
Add escrow contract based on Zeto_Anon for testing purposes
jimthematrix Jan 17, 2025
444a062
add escrow contracts to test locking flows
jimthematrix Jan 20, 2025
1a5a3a9
fix tests
jimthematrix Jan 22, 2025
eb8723f
fix circuit tests
jimthematrix Jan 22, 2025
7660df1
fix go-sdk integration test
jimthematrix Jan 22, 2025
7b3861b
update checks of inputs and output
jimthematrix Jan 22, 2025
a6a911e
update circuit integration tests
jimthematrix Jan 22, 2025
121185b
fix nf nullifier integration test
jimthematrix Jan 22, 2025
518cd5b
fix nf anon nullifier integration test
jimthematrix Jan 22, 2025
ff3fe10
fix test for the escrow flow
jimthematrix Jan 22, 2025
63a902a
fix anon_nullifier build and tests for batching
jimthematrix Jan 23, 2025
5f1a2df
fix deployment parameters for the factory
jimthematrix Jan 23, 2025
f4dff77
change the verifier initialization params to a struct
jimthematrix Jan 23, 2025
64966b5
move verifiers to the contracts/verifiers folder
jimthematrix Jan 23, 2025
c6c2d7e
fix factory unit tests
jimthematrix Jan 23, 2025
e7e96b7
fix tests for using the cloneable factory
jimthematrix Jan 24, 2025
073918c
consolidate solidity interfaces
jimthematrix Jan 24, 2025
7323357
use proof to check for existence in the locked commitments tree
jimthematrix Jan 27, 2025
a9c95c7
renaming of internal variables
jimthematrix Jan 27, 2025
1c54398
Update doc-site/docs/advanced/erc20-tokens-integration.md
jimthematrix Jan 28, 2025
8ced077
test for duplicate output utxos
Chengxuan Jan 29, 2025
925ee0c
Update inline comments in the transferLocked circuit
jimthematrix Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix nf nullifier integration test
Signed-off-by: Jim Zhang <[email protected]>
jimthematrix committed Jan 22, 2025
commit 121185bda4d0a738d9a29387498e080a84357037
11 changes: 7 additions & 4 deletions solidity/contracts/lib/zeto_base.sol
Original file line number Diff line number Diff line change
@@ -203,9 +203,8 @@ abstract contract ZetoBase is IZetoBase, IZetoLockable, ZetoCommon {
}
// Locks the UTXOs so that they can only be spent by submitting the appropriate
// proof from the Eth account designated as the "delegate". This function
// should be called by escrow contracts that will use uploaded proofs
// to execute transactions, in order to prevent the proof from being used
// by parties other than the escrow contract.
// should be called by a participant, to designate an escrow contract as the delegate,
// which can use uploaded proofs to execute transactions.
function _lock(
uint256[] memory inputs,
uint256[] memory outputs,
@@ -221,7 +220,11 @@ abstract contract ZetoBase is IZetoBase, IZetoLockable, ZetoCommon {
delegates[lockedOutputs[i]] != address(0) &&
delegates[lockedOutputs[i]] != msg.sender
) {
revert UTXOAlreadyLocked(lockedOutputs[i]);
revert NotLockDelegate(
lockedOutputs[i],
delegates[lockedOutputs[i]],
msg.sender
);
}
delegates[lockedOutputs[i]] = delegate;
Copy link
Contributor

@awrichar awrichar Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we set _lockedUtxos?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see that it's in another method, processInputsAndOutputs. It's slightly confusing that the setup of the locked states is split up. Maybe this method just needs a different name?

}
2 changes: 1 addition & 1 deletion zkp/js/integration-test/nf_anon_nullifier.js
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ describe("main circuit tests for Zeto non-fungible tokens with anonymity using n
let senderPrivateKey;

before(async () => {
circuit = await loadCircuit("nf_anon_nullifier");
circuit = await loadCircuit("nf_anon_nullifier_transfer");
({ provingKeyFile, verificationKey } =
loadProvingKeys("nf_anon_nullifier"));