Skip to content

Commit

Permalink
Merge pull request #442 from multiversx/add-amount-param-for-unjailin…
Browse files Browse the repository at this point in the history
…g-nodes

Use value parameter for unjailing nodes
  • Loading branch information
popenta authored Sep 18, 2024
2 parents e585e3c + eea5966 commit 2fd6ad0
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def list_configs(args: Any):
def delete_config(args: Any):
config_file = config.resolve_config_path()
if not config_file.is_file():
logger.info(f"Config file not found. Aborting...")
logger.info("Config file not found. Aborting...")
return

confirm_continuation(f"The file `{str(config_file)}` will be deleted. Do you want to continue? (y/n)")
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
"Create a delegation contract from validator data. Must be called by the node operator")

sub.add_argument("--max-cap", required=True, help="total delegation cap in EGLD, fully denominated. Use value 0 for uncapped")
sub.add_argument("--fee", required=True, help=f"service fee as hundredths of percents. (e.g. a service fee of 37.45 percent is expressed by the integer 3745)")
sub.add_argument("--fee", required=True, help="service fee as hundredths of percents. (e.g. a service fee of 37.45 percent is expressed by the integer 3745)")
_add_common_arguments(args, sub)
sub.set_defaults(func=make_new_contract_from_validator_data)

Expand Down
4 changes: 3 additions & 1 deletion multiversx_sdk_cli/delegation/staking_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ def prepare_transaction_for_unjailing_nodes(self, owner: IAccount, args: Any) ->
delegation_contract = Address.new_from_bech32(args.delegation_contract)

public_keys = self._load_validators_public_keys(args)
amount = int(args.value)

tx = self._factory.create_transaction_for_unjailing_nodes(
sender=owner.address,
delegation_contract=delegation_contract,
public_keys=public_keys
public_keys=public_keys,
amount=amount
)
tx.nonce = int(args.nonce)
tx.version = int(args.version)
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def is_docker_installed():
return True
else:
return False
except:
except Exception:
logger.error("Something went wrong when checking if docker is installed!")


Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/ledger/ledger_app_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LedgerApp:
def __init__(self):
try:
self.transport = Transport(interface="hid", debug=False) # Nano S/X using HID interface
except:
except Exception:
raise LedgerError(CONNECTION_ERROR_MSG)

def close(self):
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk_cli/localnet/config_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def _validate_overriding_entries(self, overriding: Dict[str, Any]) -> None:

if unknown_entries:
logger.error(f"""\
Unknown localnet configuration entries: {unknown_entries}.
Please check the configuration of the localnet.
Unknown localnet configuration entries: {unknown_entries}.
Please check the configuration of the localnet.
For "{self.get_name()}", the allowed entries are: {allowed_entries}.""")
raise UnknownConfigurationError(f"Unknown localnet configuration entries: {unknown_entries}")

Expand Down
2 changes: 2 additions & 0 deletions multiversx_sdk_cli/simulation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import OrderedDict
from typing import Any, Dict, Protocol

from multiversx_sdk_cli.interfaces import ISimulateResponse, ITransaction
from multiversx_sdk_cli.utils import ISerializable

Expand All @@ -19,6 +20,7 @@ def to_dictionary(self) -> Dict[str, Any]:

return dictionary


class Simulator():
def __init__(self, proxy: INetworkProvider) -> None:
self.proxy = proxy
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk_cli/tests/local_verify_server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
from http.server import BaseHTTPRequestHandler, HTTPServer

HOST = 'localhost'
PORT = 7777
Expand All @@ -14,7 +14,7 @@ def do_POST(self):
if self.path == "/initialise":
response = {'token': 7890}
self.wfile.write(bytes(json.dumps(response), 'utf-8'))

if self.path == "/verify":
response = {'status': 'sent to verification'}
self.wfile.write(bytes(json.dumps(response), 'utf-8'))
Expand Down
2 changes: 2 additions & 0 deletions multiversx_sdk_cli/tests/test_cli_staking_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def test_unjail_nodes(capsys: Any):
"staking-provider", "unjail-nodes",
"--bls-keys", f"{first_bls_key},{second_bls_key}",
"--delegation-contract", "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqthllllsy5r6rh",
"--value", "5000000000000000000",
"--pem", str(alice),
"--chain", "T",
"--nonce", "7", "--estimate-gas"
Expand All @@ -235,6 +236,7 @@ def test_unjail_nodes(capsys: Any):
assert transaction["sender"] == "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"
assert transaction["receiver"] == "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqthllllsy5r6rh"
assert transaction["gasLimit"] == 13645500
assert transaction["value"] == "5000000000000000000"


def test_change_service_fee(capsys: Any):
Expand Down
21 changes: 8 additions & 13 deletions multiversx_sdk_cli/validators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from multiversx_sdk_cli.validators.core import (prepare_args_for_change_reward_address,
prepare_args_for_claim,
prepare_args_for_stake,
prepare_args_for_unbond,
prepare_args_for_unjail,
prepare_args_for_unstake,
prepare_args_for_unstake_nodes,
prepare_args_for_unstake_tokens,
prepare_args_for_unbond_tokens,
prepare_args_for_unbond_nodes,
prepare_args_for_clean_registered_data,
prepare_args_for_restake_unstaked_nodes)

from multiversx_sdk_cli.validators.core import (
prepare_args_for_change_reward_address, prepare_args_for_claim,
prepare_args_for_clean_registered_data,
prepare_args_for_restake_unstaked_nodes, prepare_args_for_stake,
prepare_args_for_unbond, prepare_args_for_unbond_nodes,
prepare_args_for_unbond_tokens, prepare_args_for_unjail,
prepare_args_for_unstake, prepare_args_for_unstake_nodes,
prepare_args_for_unstake_tokens)
from multiversx_sdk_cli.validators.validators_file import ValidatorsFile

__all__ = ["prepare_args_for_stake",
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def get_version() -> str:
try:
# Works for local development
return _get_version_from_pyproject()
except Exception as error:
except Exception:
try:
# Works for the installed package
return _get_version_from_metadata()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ classifiers = [

dependencies = [
"toml>=0.10.2",
"requests",
"requests>=2.32.0,<3.0.0",
"prettytable",
"ledgercomm[hid]",
"semver",
"requests-cache",
"rich==13.3.4",
"multiversx-sdk>=0.9.2,<1.0.0",
"multiversx-sdk==0.13.0",
"argcomplete==3.2.2"
]

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
toml>=0.10.2
types-toml
requests~=2.31.0
requests>=2.32.0,<3.0.0
types-requests
prettytable
types-prettytable
Expand All @@ -10,4 +10,4 @@ requests-cache
rich==13.3.4
argcomplete==3.2.2

multiversx-sdk>=0.9.2,<1.0.0
multiversx-sdk==0.13.0

0 comments on commit 2fd6ad0

Please sign in to comment.