Skip to content

Commit

Permalink
Allow existing locks to be cleared
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Sep 26, 2024
1 parent 07379c3 commit a203759
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions solidity/contracts/lib/zeto_common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ abstract contract ZetoCommon is OwnableUpgradeable {
lockedProofs[proofHash] == msg.sender,
"Proof already locked by another party"
);
if (delegate != address(0)) {
lockedProofs[proofHash] = delegate;
} else {
lockedProofs[proofHash] = msg.sender;
}
lockedProofs[proofHash] = delegate;
}

function sortInputsAndOutputs(
Expand Down
3 changes: 2 additions & 1 deletion solidity/test/zkDvP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ describe("DvP flows between fungible and non-fungible tokens based on Zeto with
const utxo1 = newUTXO(100, Alice);
const proof = await zetoAnonTests.prepareProof(circuit1, provingKey1, Alice, [utxo1, ZERO_UTXO], [utxo1, ZERO_UTXO], [Alice, {}]);

await expect(zkPayment.connect(Alice.signer).lockProof(proof.encodedProof, "0x0000000000000000000000000000000000000000")).fulfilled;
await expect(zkPayment.connect(Alice.signer).lockProof(proof.encodedProof, await Alice.signer.getAddress())).fulfilled;
await expect(zkPayment.connect(Bob.signer).lockProof(proof.encodedProof, await Bob.signer.getAddress())).rejectedWith("Proof already locked by another party");
await expect(zkPayment.connect(Alice.signer).lockProof(proof.encodedProof, await Bob.signer.getAddress())).fulfilled;
await expect(zkPayment.connect(Bob.signer).lockProof(proof.encodedProof, "0x0000000000000000000000000000000000000000")).fulfilled;
});
});

Expand Down

0 comments on commit a203759

Please sign in to comment.