Skip to content

Commit

Permalink
Change CommonLib functions to 'internal'
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
  • Loading branch information
jimthematrix committed Aug 15, 2024
1 parent bad201a commit 8d6263c
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 30 deletions.
6 changes: 4 additions & 2 deletions solidity/contracts/lib/common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ library Commonlib {
uint[2] pC;
}

function getProofHash(Proof calldata proof) public pure returns (bytes32) {
function getProofHash(
Proof calldata proof
) internal pure returns (bytes32) {
uint[8] memory inputs = [
proof.pA[0],
proof.pA[1],
Expand All @@ -44,7 +46,7 @@ library Commonlib {
// until it's available in a new release
function sort(
uint256[] memory array
) public pure returns (uint256[] memory) {
) internal pure returns (uint256[] memory) {
bytes32[] memory bytes32Array = _castToBytes32Array(array);
_quickSort(_begin(bytes32Array), _end(bytes32Array), _defaultComp);
return array;
Expand Down
7 changes: 1 addition & 6 deletions solidity/ignition/modules/zeto_anon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ export default buildModule("Zeto_Anon", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_Anon', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
Commonlib: commonlib,
},
});
const zeto = m.contract('Zeto_Anon', [depositVerifier, withdrawVerifier, verifier]);

return { zeto };
});
7 changes: 1 addition & 6 deletions solidity/ignition/modules/zeto_anon_enc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ export default buildModule("Zeto_AnonEnc", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_AnonEnc', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
Commonlib: commonlib,
},
});
const zeto = m.contract('Zeto_AnonEnc', [depositVerifier, withdrawVerifier, verifier]);

return { zeto };
});
2 changes: 0 additions & 2 deletions solidity/ignition/modules/zeto_anon_enc_nullifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export default buildModule("Zeto_AnonEncNullifier", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawNullifierVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_AnonEncNullifier', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
SmtLib: smtLib,
PoseidonUnit3L: poseidon3,
Commonlib: commonlib,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export default buildModule("Zeto_AnonEncNullifierNonRepudiation", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawNullifierVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_AnonEncNullifierNonRepudiation', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
SmtLib: smtLib,
PoseidonUnit3L: poseidon3,
Commonlib: commonlib,
},
});

Expand Down
2 changes: 0 additions & 2 deletions solidity/ignition/modules/zeto_anon_nullifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export default buildModule("Zeto_AnonNullifier", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawNullifierVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_AnonNullifier', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
SmtLib: smtLib,
PoseidonUnit3L: poseidon3,
Commonlib: commonlib,
},
});

Expand Down
2 changes: 0 additions & 2 deletions solidity/ignition/modules/zeto_anon_nullifier_kyc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ export default buildModule("Zeto_AnonNullifierKyc", (m) => {
const { verifier } = m.useModule(VerifierModule);
const { verifier: depositVerifier } = m.useModule(DepositVerifierModule);
const { verifier: withdrawVerifier } = m.useModule(WithdrawNullifierVerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_AnonNullifierKyc', [depositVerifier, withdrawVerifier, verifier], {
libraries: {
SmtLib: smtLib,
PoseidonUnit2L: poseidon2,
PoseidonUnit3L: poseidon3,
Commonlib: commonlib,
},
});

Expand Down
7 changes: 1 addition & 6 deletions solidity/ignition/modules/zeto_nf_anon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ const VerifierModule = buildModule("Groth16Verifier_NfAnon", (m) => {

export default buildModule("Zeto_NfAnon", (m) => {
const { verifier } = m.useModule(VerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_NfAnon', [verifier], {
libraries: {
Commonlib: commonlib,
},
});
const zeto = m.contract('Zeto_NfAnon', [verifier]);

return { zeto };
});
2 changes: 0 additions & 2 deletions solidity/ignition/modules/zeto_nf_anon_nullifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ const VerifierModule = buildModule("Groth16Verifier_NfAnonNullifier", (m) => {
export default buildModule("Zeto_NfAnonNullifier", (m) => {
const { smtLib, poseidon3 } = m.useModule(SmtLibModule);
const { verifier } = m.useModule(VerifierModule);
const commonlib = m.library('Commonlib');

const zeto = m.contract('Zeto_NfAnonNullifier', [verifier], {
libraries: {
SmtLib: smtLib,
PoseidonUnit3L: poseidon3,
Commonlib: commonlib,
},
});

Expand Down

0 comments on commit 8d6263c

Please sign in to comment.