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

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

gnongs
Copy link

@gnongs gnongs commented Nov 28, 2024

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
Copy link
Author

gnongs commented Nov 29, 2024

@RaekwonIII @IlyaVi Could you please review this PR?

src/commands/actions/KeySharesAction.ts Show resolved Hide resolved
}
}
else {
keystorePassword = await fsp.readFile(this.args.password, 'utf-8');
Copy link
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
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
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
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.


const validatedFiles = await this.validateKeystoreFiles(keystoreSet);

process.stdout.write(validatedFiles[0].keystoreFile);
Copy link
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
Author

Choose a reason for hiding this comment

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

Removed!

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
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
Author

Choose a reason for hiding this comment

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

Updated!

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
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
Author

Choose a reason for hiding this comment

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

Updated.

@gnongs
Copy link
Author

gnongs commented Dec 4, 2024

@IlyaVi Could you check this again?

@gnongs gnongs requested a review from IlyaVi December 4, 2024 17:59
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
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
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?

}
}
else {
keystorePassword = await fsp.readFile(this.args.password, 'utf-8');
Copy link
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

README.md Outdated
@@ -100,10 +100,39 @@ To run you will use the "shares" command

```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
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

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
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

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
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
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
Copy link
Author

gnongs commented Jan 5, 2025

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. :)

@gnongs gnongs requested a review from IlyaVi January 5, 2025 08:34
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