Skip to content

Changed to allow offline splitting of validator keys with different passwords - #69

Open
gnongs wants to merge 13 commits into
ssvlabs:mainfrom
dsrvlabs:enable-password-file
Open

Changed to allow offline splitting of validator keys with different passwords#69
gnongs wants to merge 13 commits into
ssvlabs:mainfrom
dsrvlabs:enable-password-file

Conversation

@gnongs

@gnongs gnongs commented Nov 28, 2024

Copy link
Copy Markdown

Fixes #<issue_number_goes_here>

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to README are included in PR

@gnongs gnongs changed the title Enable password file Changed to allow offline splitting of validator keys with different passwords Nov 28, 2024
@gnongs

gnongs commented Nov 29, 2024

Copy link
Copy Markdown
Author

@RaekwonIII @IlyaVi Could you please review this PR?

Comment thread src/commands/actions/KeySharesAction.ts
Comment thread src/commands/actions/KeySharesAction.ts Outdated
}
}
else {
keystorePassword = await fsp.readFile(this.args.password, 'utf-8');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this line outside of for loop in line 75

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlyaVi If this line is moved outside the for loop at line 75, there will be an issue with setting the value of keystoreSet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnongs let me rephrase my comment
what I meant is to have this in line 75
keystorePassword = this.args.password;
this will preserve the same approach as before your change and won't change anything for existing users in the way the use ssv-keys

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlyaVi
Now I understand your intention.

What you want is for it to behave the same as before when using the same password.

Updated.

Comment thread src/commands/actions/KeySharesAction.ts Outdated

const validatedFiles = await this.validateKeystoreFiles(keystoreSet);

process.stdout.write(validatedFiles[0].keystoreFile);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug print?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed!

Comment thread README.md Outdated
yarn cli shares --keystore=./keystore-files --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..
## folder structure
keystore_folders
├── 0xe020....

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validator public key is redundant as folder name - change to something generic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Comment thread README.md Outdated

# folder with multiple keystore files
yarn cli shares --keystore=./keystore-files --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..
## folder structure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate this usecase with this sub header
Add comment to underline that --password parameter is actual password file name
"folder structure for keystore files with different password"

Add sub header for one password and multiple files. Command should be the same as before change

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@gnongs

gnongs commented Dec 4, 2024

Copy link
Copy Markdown
Author

@IlyaVi Could you check this again?

@gnongs
gnongs requested a review from IlyaVi December 4, 2024 17:59
IlyaVi
IlyaVi previously approved these changes Dec 8, 2024
if (dirent.name.includes(this.args.password)) {
keystorePassword = await fsp.readFile(path.join(file, dirent.name), 'utf-8');
} else {
keystoreFile = path.join(file, dirent.name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnongs if there are multiple keystore files in same sub directory you will add only last one to the array

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlyaVi

Having multiple keystore files is not the folder structure I intend.
Would it be better to terminate the program in such cases?

Comment thread src/commands/actions/KeySharesAction.ts Outdated
}
}
else {
keystorePassword = await fsp.readFile(this.args.password, 'utf-8');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnongs let me rephrase my comment
what I meant is to have this in line 75
keystorePassword = this.args.password;
this will preserve the same approach as before your change and won't change anything for existing users in the way the use ssv-keys

Comment thread README.md Outdated
```bash
# single file
yarn cli shares --keystore=keystore.json --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..
yarn cli shares --keystore=./keystore.json --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert this change, user will continue using plane password as parameter

Comment thread README.md Outdated
└── keystore5.json
password.txt

yarn cli shares --keystore=./keystore_files --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to plain password instead file name and remove "password.txt" from folder structure

Comment thread README.md Outdated
├── keystore.json
└── password.txt

yarn cli shares --keystore=./keystore_folders --password=password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead "password.txt" write here and in the folder structure - the name and extension are not important as long as file can be read as utf-8 encoded text

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlyaVi

I tried to convey that it can be a simple file without an extension.

@gnongs

gnongs commented Jan 5, 2025

Copy link
Copy Markdown
Author

Hey, @IlyaVi

The update is quite late… Sorry....

I have made all the updates to the parts you mentioned, and I have some thoughts on certain areas. Please share your feedback on those comments. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants