Skip to content

Commit

Permalink
Merge pull request #860 from EYBlockchain/wallet/updates
Browse files Browse the repository at this point in the history
Backport recent core-nightfall changes into wallet
  • Loading branch information
Ilyas Ridhuan authored Aug 8, 2022
2 parents 2c79016 + fadd247 commit 8279464
Show file tree
Hide file tree
Showing 43 changed files with 1,336 additions and 1,129 deletions.
4 changes: 2 additions & 2 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function configureAWSBucket() {
}

function parseCircuitFilesPath() {
let circuits = ['deposit', 'withdraw', 'single_transfer', 'double_transfer'];
let circuits = ['deposit', 'transfer', 'withdraw'];
if (process.env.USE_STUBS === 'true') circuits = circuits.map(circuit => `${circuit}_stub`);
const parsedPath = {};
for (const circuit of circuits) {
Expand Down Expand Up @@ -103,7 +103,7 @@ module.exports = {
TRANSACTIONS_PER_BLOCK: Number(process.env.TRANSACTIONS_PER_BLOCK) || 2,
RETRIES: Number(process.env.AUTOSTART_RETRIES) || 50,
USE_STUBS: process.env.USE_STUBS === 'true',
VK_IDS: { deposit: 0, transfer: 1, withdraw: 2 }, // withdraw: 3, withdraw_change: 4 }, // used as an enum to mirror the Shield contracts enum for vk types. The keys of this object must correspond to a 'folderpath' (the .zok file without the '.zok' bit)
VK_IDS: { deposit: 0, transfer: 1, withdraw: 2 }, // used as an enum to mirror the Shield contracts enum for vk types. The keys of this object must correspond to a 'folderpath' (the .zok file without the '.zok' bit)
MAX_PUBLIC_VALUES: {
ERCADDRESS: 2n ** 161n - 1n,
COMMITMENT: 2n ** 249n - 1n,
Expand Down
3 changes: 0 additions & 3 deletions nightfall-client/src/services/commitment-sync.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export async function decryptCommitment(transaction, zkpPrivateKey, nullifierKey
}
});

if (storeCommitments.length === 0) {
throw Error("This encrypted message isn't for any of recipients");
}
return Promise.all(storeCommitments);
}

Expand Down
185 changes: 96 additions & 89 deletions wallet/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
"webpack-dev-server": "3.11.1",
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "5.1.4",
"zokrates-js": "1.0.43"
"zokrates-js": "1.0.41"
},
"scripts": {
"start": "LOCAL_PROPOSER=true PUBLIC_URL='/nightfall/' USE_STUBS=true REACT_APP_MODE=local node scripts/start.js",
"start": "LOCAL_PROPOSER=true PUBLIC_URL='/nightfall/' USE_STUBS=false REACT_APP_MODE=local node scripts/start.js",
"start:testnet": "LOCAL_PROPOSER=false PUBLIC_URL='/nightfall/' USE_STUBS=false REACT_APP_MODE=testnet env-cmd -f .testnet.env node scripts/start.js",
"start:mainnet": "LOCAL_PROPOSER=false PUBLIC_URL='/nightfall/' USE_STUBS=false REACT_APP_MODE=mainnet env-cmd -f .mainnet.env node scripts/start.js",
"build": "LOCAL_PROPOSER=false USE_STUBS=false REACT_APP_MODE=production PUBLIC_URL='https://wallet-beta.polygon.technology/nightfall/' node scripts/build.js",
Expand Down
42 changes: 42 additions & 0 deletions wallet/src/@types/general-number/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
declare module 'general-number' {
// export interface GeneralNumber {
// hex: string
// }
export function generalise<T>(gn: Record<T>[]) : Record<GeneralNumber>[]
export function generalise<T>(gn: T[]) : GeneralNumber[]
export function generalise<T>(gn: Record<T>) : Record<GeneralNumber>
export function generalise<T>(gn: T) : GeneralNumber
// export function generalise<T>(gn: Array<T>) : Array<GeneralNumber>
class GeneralNumber {
get binary(): string

get binaryArray(): string[]

get bytes(): number[]

// returns the decimal representation, as a String type. Synonymous with `integer()`.
get decimal(): string

// returns the decimal representation, as a String type. Synonymous with `decimal()`.
get integer(): string

// returns the decimal representation, as a Number type (if less than javascript's MAX_SAFE_INTEGER). (Otherwise it will throw).
get number(): number

get bigInt(): bigint

get boolean(): bigint

get ascii(): string

get utf8(): string

// Safe fallback for accidentally calling '.all' on a GeneralNumber (rather than a GeneralObject, which actuallty supports this property)
get all(): GeneralNumber

limbs(limbBitLength: number,numberOfLimbs: undefined | number, returnType?: string, throwErrors?: boolean): string[];
hex(byteLength: number, butTruncateValueToByteLength?: number): string;
field(modulus: bigint, noOverflow?: boolean): string
}
export function stitchLimbs(_limbs: number[], _limbBits? : number)
}
23 changes: 23 additions & 0 deletions wallet/src/@types/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// globals.d.ts
declare module globalThis {
var config = {
BN128_GROUP_ORDER: bigint,
BABYJUBJUB: {
JUBJUBA: bigint,
JUBJUBD: bigint,
INFINITY: [bigint,bigint],
GENERATOR: [bigint, bigint],
JUBJUBE: bigint,
JUBJUBC: bigint,
MONTA: bigint,
MONTB: bigint,
},
COMMITMENTS_DB: string,
TIMBER_COLLECTION: string,
SUBMITTED_BLOCKS_COLLECTION: string,
TRANSACTIONS_COLLECTION: string,
COMMITMENTS_COLLECTION: string,
KEYS_COLLECTION: string,
CIRCUIT_COLLECTION: string,
}
}
Loading

0 comments on commit 8279464

Please sign in to comment.