Skip to content

Commit

Permalink
Optimised tau file path calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamsaxena12 committed Mar 22, 2023
1 parent 025a9f1 commit a5a29ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export class Circuit {
}

async compile() {
this._compile()
await this._compile()

if(!this._circuitConfig.isTauFileGiven){
if(!this._circuitConfig.powerOfTauFp || this._circuitConfig.powerOfTauFp.length < 1){
await this.downloadPowerOfTauFile()
}
await this._genZKey()
Expand Down Expand Up @@ -148,7 +148,7 @@ export class Circuit {
try{
await this.downloadFileOverHttp(tauFileUrl, localTaufilePath)
} catch(err){
console.log("Tau File Download Error: ", err)
log.error("Tau File Download Error: ", err)
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/configParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,8 @@ export class ConfigParser {
cktName: cktName,
inputFilePath: this._getCircuitInputPath(inputDir, c),
outputDir: cktOutputDir,
isTauFileGiven: c.powerOfTauFp? true: false,
powerOfTauFp: path.resolve(
c.powerOfTauFp ? c.powerOfTauFp : path.join(cktOutputDir, `power_of_tau.ptau`)
// Calculate total constraints from r1cs file, and download it
),
// powerOfTau file is dowloaded according to the total constraints and this powerOfTauFp is assigned in downloadPowerOfTauFile function
powerOfTauFp: c.powerOfTauFp ? path.resolve(c.powerOfTauFp) : '',
// This is not used since circom spits the output files in a fixed dir structure. It is here for consistency.
jsPath: path.join(cktOutputDir, `${cktName}_js`),
// This is here for consistency. It is not used but the output of wasm file in same as wasmPath.
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export type CircuitConfig = {
cktName: string;
inputFilePath: string;
outputDir: string;
isTauFileGiven: boolean;
powerOfTauFp: string;
jsPath: string;
wasmPath: string;
Expand Down

0 comments on commit a5a29ae

Please sign in to comment.