Skip to content

Commit

Permalink
chore: remove pswd (#192)
Browse files Browse the repository at this point in the history
* chore: opt code
  • Loading branch information
eigmax authored Jul 3, 2023
1 parent 5380e7b commit 4b19637
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 59 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Lint sol&js
on:
push:
branches:
branches:
- main
- zkpay_dev
pull_request:
branches:
- main
- zkpay_dev

jobs:
jobs:
lint_contract:
name: Lint contracts
runs-on: ubuntu-latest
Expand All @@ -19,7 +17,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
- run: yarn install --frozen-lockfile
- name: Lint Check
run: yarn lint_sol
Expand All @@ -32,7 +30,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x
- run: yarn install --frozen-lockfile
- name: Lint Check
run: yarn lint_ts
2 changes: 1 addition & 1 deletion circuits/main_withdraw.input.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"enabled":1,"R8x":"7900057579831422969066755372143079471642596886732364045376106897045652807008","R8y":"8818544028041482152234736710206694128344868195461809522920816117882142230858","S":"566679549899229622296419731124176987168003503944743734081109116527164618222","Ax":"4854053237640473781395610862462666107784372287183459153936262864492585154525","Ay":"17441031726860011567553620519245579541047388794195077744833836453389085545835","M":"1979475358490882782695234604362398132934050455360496620085373760138828661113"}
{"enabled":1,"R8x":"14835429160084229263980736429010862925093067454856770951220172356481476793011","R8y":"8395120844545464594124235125135514943153271556646889396555467812847391403203","S":"2503681320018556796117432633228684372939133139383604611918969220943130163612","Ax":"14028971658484380332061247268348191054127422804603118271234954431121924869048","Ay":"21837818007645860566633743767426957359972637892590699800114945700783710026893","M":"1979475358490882782695234604362398132934050455360496620085373760138828661113"}
68 changes: 20 additions & 48 deletions core/lib/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,60 +257,32 @@ export class AccountCircuit {
static readonly PROOF_ID_TYPE_MIGRATE: number = 12;
static readonly PROOF_ID_TYPE_UPDATE: number = 13;

proofId: number;
outputNCs: bigint[];
proofId: number = 0;
outputNCs: bigint[] = [];

// dataTreeRoot: bigint;
// siblingsAC: bigint[];

aliasHash: bigint;
accountPubKey: bigint[];
signingPubKey: bigint[];
aliasHash: bigint = 0n;
accountPubKey: bigint[] = [];
signingPubKey: bigint[] = [];

newAccountPubKey: bigint[];
newSigningPubKey1: bigint[];
newSigningPubKey2: bigint[];
newAccountPubKey: bigint[] = [];
newSigningPubKey1: bigint[] = [];
newSigningPubKey2: bigint[] = [];

signatureR8: bigint[];
signatureS: bigint;
enabled: bigint;
signatureR8: bigint[] = [];
signatureS: bigint = 0n;
enabled: bigint = 1n;

// aux
accountNC: bigint;
newAccountNC: bigint;
accountNC: bigint = 0n;
newAccountNC: bigint = 0n;

constructor(
proofId: number,
outputNCs: bigint[],
// dataTreeRoot: bigint,
// siblingsAC: bigint[],
aliasHash: bigint,
accountPubKey: bigint[],
signingPubKey: bigint[],
newAccountPubKey: bigint[],
newSigningPubKey1: bigint[],
newSigningPubKey2: bigint[],
signatureR8: bigint[],
signatureS: bigint,
accountNC: bigint,
newAccountNC: bigint,
enabled: bigint = 1n
ac: Partial<AccountCircuit>
) {
// this.dataTreeRoot = dataTreeRoot;
// this.siblingsAC = siblingsAC;
this.proofId = proofId;
this.outputNCs = outputNCs;
this.aliasHash = aliasHash;
this.accountPubKey = accountPubKey;
this.signingPubKey = signingPubKey;
this.newAccountPubKey = newAccountPubKey;
this.newSigningPubKey1 = newSigningPubKey1;
this.newSigningPubKey2 = newSigningPubKey2;
this.signatureR8 = signatureR8;
this.signatureS = signatureS;
this.accountNC = accountNC;
this.newAccountNC = newAccountNC;
this.enabled = enabled;
Object.assign(this, ac);
}

static async createProofInput(
Expand Down Expand Up @@ -370,9 +342,9 @@ export class AccountCircuit {
*/

let sig = await signingKey.sign(msghash);
return new AccountCircuit(
return new AccountCircuit({
proofId,
[outputNC1, outputNC2],
outputNCs: [outputNC1, outputNC2],
// F.toObject(state.root()),
// siblingsPad(leaf.siblings, F),
aliasHash,
Expand All @@ -381,11 +353,11 @@ export class AccountCircuit {
newAccountPubKey,
newSigningPubKey1,
newSigningPubKey2,
[F.toObject(sig.R8[0]), F.toObject(sig.R8[1])],
sig.S,
signatureR8: [F.toObject(sig.R8[0]), F.toObject(sig.R8[1])],
signatureS: sig.S,
accountNC,
newAccountNC
);
});
}

toCircuitInput(proof: any) {
Expand Down
1 change: 0 additions & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"consola": "^2.15.3",
"ethers": "^5.6.8",
"ffjavascript": "^0.2.55",
"@types/uuid": "^9.0.2",
"ffjavascript-browser": "^0.0.3",
"snarkjs": "^0.6.1"
},
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
"ethers": "^5.6.8",
"express-async-errors": "^3.1.1",
"ffjavascript": "^0.2.55",
"http-terminator": "^3.2.0",
"node-fetch": "2.6.9",
"snarkjs": "^0.6.1"
},
"devDependencies": {
Expand All @@ -60,7 +58,7 @@
"eslint-config-google": "^0.14.0",
"eslint-plugin-unused-imports": "^2.0.0",
"hardhat": "^2.13.0",
"hardhat-gas-reporter": "^1.0.2",
"hardhat-gas-reporter": "^1.0.9",
"lerna": "^6.6.2",
"solhint": "^3.3.7",
"supertest": "^6.3.3",
Expand Down

0 comments on commit 4b19637

Please sign in to comment.