-
Notifications
You must be signed in to change notification settings - Fork 36
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
Use validators file to stake, unstake, etc #409
Conversation
multiversx_sdk_cli/cli_delegation.py
Outdated
validators_file = args.validators_file | ||
|
||
if not bls_keys and not validators_file: | ||
raise errors.BadUsage("No bls keys or validators file provided") |
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.
Optionally, can be changed to do this, do that: "Either specify the ..., or the ...".
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.
Changed
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | |||
|
|||
[project] | |||
name = "multiversx-sdk-cli" | |||
version = "9.4.1" | |||
version = "9.5.0" |
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.
👍
@@ -72,7 +73,45 @@ def test_remove_nodes(capsys: Any): | |||
assert transaction["gasLimit"] == 13645500 | |||
|
|||
|
|||
def test_stake_nodes(capsys: Any): | |||
def test_remove_nodes_with_validators_file(capsys: Any): |
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.
🚀
if args.bls_keys: | ||
public_keys = self._parse_public_bls_keys(args.bls_keys) | ||
else: | ||
validators_file_path = Path(args.validators_file).expanduser() | ||
validators_file = ValidatorsFile(validators_file_path) | ||
public_keys = validators_file.load_public_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.
Can it be extracted to _load_validator_public_keys(args)
(duplicated below)?
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.
Extracted the code in a method
validator_pem = Path(validator.get("pemFile")).expanduser() | ||
validator_pem = validator_pem if validator_pem.is_absolute() else self.validators_file_path.parent / validator_pem | ||
|
||
pem_file = ValidatorPEM.from_file(validator_pem) |
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.
These 3 lines can also be extracted to a separate function e.g. load_validator_pem(path): ValidatorPEM
/ optional (code exists above, as well).
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.
extracted in a method
Added a parameter
--validators-file
for staking operations like remove-nodes, stake-nodes, unbond-nodes, unstake-nodes and unjail-nodes.The commands can be used by providing the bls keys using
--bls-keys
or the validators file using--validators-file
.