-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(scripts): add MACI key generation script #1869
base: dev
Are you sure you want to change the base?
feat(scripts): add MACI key generation script #1869
Conversation
- Add generateMaciKeys.js script - Update package.json with new script command - Update .gitignore to exclude maci-keys directory
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@programmerraja thanks, there are some changes requested
scripts/generateMaciKeys.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use typescript
scripts/generateMaciKeys.js
Outdated
publicKey: pubKey.toString(), | ||
}; | ||
|
||
const outputDir = path.join(__dirname, "..", "maci-keys"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const outputDir = path.join(__dirname, "..", "maci-keys"); | |
const outputDir = path.resolve(__dirname, "..", "maci-keys"); |
scripts/generateMaciKeys.js
Outdated
fs.mkdirSync(outputDir, { recursive: true }); | ||
} | ||
|
||
const outputFile = path.join(outputDir, "maci-keys.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const outputFile = path.join(outputDir, "maci-keys.json"); | |
const outputFile = path.resolve(outputDir, "maci-keys.json"); |
scripts/generateMaciKeys.js
Outdated
if (!fs.existsSync(outputDir)) { | ||
fs.mkdirSync(outputDir, { recursive: true }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use async version here
scripts/generateMaciKeys.js
Outdated
} | ||
|
||
const outputFile = path.join(outputDir, "maci-keys.json"); | ||
fs.writeFileSync(outputFile, JSON.stringify(keys, null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same with async
@0xmad can you check and let me know anything else i want to change |
scripts/generateMaciKeys.ts
Outdated
import { promises as fs } from "fs"; | ||
import * as path from "path"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { promises as fs } from "fs"; | |
import * as path from "path"; | |
import fs from "fs"; | |
import path from "path"; |
scripts/generateMaciKeys.ts
Outdated
|
||
const outputDir = path.resolve(__dirname, "..", "maci-keys"); | ||
try { | ||
await fs.access(outputDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await fs.access(outputDir); | |
await fs.promises.access(outputDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the same change for other fs
calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xmad done can you check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure writing coordinator keys to disk is something we should be encouraging. I'd probably only let the script print to console (basically just call the cli script using pnpm: node build/ts/index.js genMaciKeyPair
)
@0xmad is everything fine or did i need to do any changes? |
@programmerraja here is a question and also there are failed ci jobs. |
@0xmad can you give me guidance what next I need to do |
Description
add MACI key generation script
- Add generateMaciKeys.js script
- Update package.json with new script command
- Update .gitignore to exclude maci-keys directory
feat for #1861
Additional Notes
Related issue(s)
Confirmation