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

Create validator wallet #481

Merged
merged 5 commits into from
Feb 13, 2025
Merged

Create validator wallet #481

merged 5 commits into from
Feb 13, 2025

Conversation

popenta
Copy link
Collaborator

@popenta popenta commented Feb 11, 2025

Added functionality to create a validator wallet.
Also added functionality to sign a message using a validator wallet and to verify a messages using a bls validator pubkey.

@popenta popenta self-assigned this Feb 11, 2025
@popenta popenta marked this pull request as draft February 11, 2025 12:10
Base automatically changed from validators-refactoring to feat/next February 12, 2025 10:22
@popenta popenta marked this pull request as ready for review February 12, 2025 10:22
@@ -57,6 +75,12 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
"new",
"Create a new wallet and print its mnemonic; optionally save as password-protected JSON (recommended) or PEM (not recommended)",
)
sub.add_argument(
"--validator-wallet",
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether we should have a separate sub-command, instead.

E.g.

mxpy wallet ... (for user wallets)
mxpy validator-wallet ...

Especially since other sub-sub-commands of mxpy wallet do not make sense for this kind of wallets (e.g. bech32, convert etc.). Actually, some convert functionality could be useful (e.g. PEM to raw hex), but, overall, maybe we can have them separately.

💭

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved to a separate sub-command


def sign_message_by_validator(message: str, validator: ValidatorSigner) -> SignedMessage:
message_computer = MessageComputer()
serialized_message = message_computer.compute_bytes_for_signing(Message(message.encode()))
Copy link
Contributor

@andreibancioiu andreibancioiu Feb 12, 2025

Choose a reason for hiding this comment

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

For validator wallets, this is not e regular use-case. In the few cases when validator wallets are required to sign a message, they sign the plain variant (raw bytes). Not this special enveloping:

As far as I know (see validators CLI of mxpy).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

sub.add_argument("--message", required=True, help="the message you want to sign")
sub.add_argument("--pem", required=True, type=str, help="the path to a validator pem file")
sub.add_argument(
"--validator-index",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can also be simply "index".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, fixed

)
sub.add_argument("--infile", required=True, help="the pem file of the wallet")
sub.add_argument(
"--index",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@popenta popenta merged commit a9cc650 into feat/next Feb 13, 2025
12 checks passed
@popenta popenta deleted the create-validator-wallet branch February 13, 2025 14:31
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.

3 participants