Skip to content
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

contribute: Add a -n / --name option to specify contributor name #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Saving file(s) to /ceremony/old
To contribute:

```
docker-compose exec multisetups node build/index.js contribute -d /ceremony/old -n /ceremony/new
docker-compose exec multisetups node build/index.js contribute -d /ceremony/old -o /ceremony/new

Contribution generated, and transcript written to /ceremony/new/transcript.1.txt.
Please run the 'attest' command next.
Expand Down Expand Up @@ -132,7 +132,7 @@ Next, perform the contribution. This may take a long time. It should ideally be
done on an airgapped computer.

```
node build/index.js contribute -m <MULTIHASH> -d ./old -n ./new
node build/index.js contribute -m <MULTIHASH> -d ./old -o ./new
```

Generate an attestation file:
Expand Down
18 changes: 15 additions & 3 deletions ts/contribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const configureSubparsers = (subparsers: ArgumentParser) => {
)

parser.add_argument(
'-n',
'--new',
'-o',
'--outdir',
{
required: true,
action: 'store',
Expand All @@ -39,6 +39,17 @@ const configureSubparsers = (subparsers: ArgumentParser) => {
}
)

parser.add_argument(
'-n',
'--name',
{
required: true,
action: 'store',
type: 'str',
help: 'The name of the contributor. Will be visible in verifications.',
}
)

parser.add_argument(
'-e',
'--entropy',
Expand All @@ -55,6 +66,7 @@ const configureSubparsers = (subparsers: ArgumentParser) => {
const contribute = async (
dirname: string,
newDirname: string,
contributorName: string,
entropy: string,
) => {
if (!fs.existsSync(newDirname)) {
Expand Down Expand Up @@ -105,7 +117,7 @@ const contribute = async (

const o = path.join(dirname, c.original)
const n = path.join(newDirname, c['new'])
const cmd = `node ./node_modules/.bin/snarkjs zkey contribute ${o} ${n}`
const cmd = `node ./node_modules/.bin/snarkjs zkey contribute ${o} ${n} --name="${contributorName}`
let out = shelljs.exec(`echo ${currentEntropy} | ${cmd}`, { silent: true })
out = out.replace(/Enter a random text\. \(Entropy\): /, '$&\n')
transcript += `${cmd}\n`
Expand Down