diff --git a/testing-suite/staking-v4/README.md b/testing-suite/staking-v4/README.md index 3e0eddbf..4059bdcd 100644 --- a/testing-suite/staking-v4/README.md +++ b/testing-suite/staking-v4/README.md @@ -1,7 +1,7 @@ # Testing suite using mvx python sdk and chain-simulator for staking-v4 feature ## Overview: -- All tests are written based on scenarios from the testing plan that can be found [here](https://docs.google.com/spreadsheets/d/154IAPppvYBScPHYOVk696o7Izi4Ode9b7Lwk2iFt_p4/edit#gid=2043239020). +- All tests are written based on scenarios from the internal testing plan. ## How to run: diff --git a/testing-suite/staking-v4/chain_commander.py b/testing-suite/staking-v4/chain_commander.py index aa83851e..bdd11b7c 100644 --- a/testing-suite/staking-v4/chain_commander.py +++ b/testing-suite/staking-v4/chain_commander.py @@ -7,11 +7,10 @@ import time - -def setEgldToAddress(egld_ammount, erd_address): +def send_egld_to_address(egld_amount, erd_address): details = { 'address': f'{erd_address}', - 'balance': f'{egld_ammount}' + 'balance': f'{egld_amount}' } details_list = [details] @@ -22,29 +21,29 @@ def setEgldToAddress(egld_ammount, erd_address): return response.text -def addBlocks(nr_of_blocks): +def add_blocks(nr_of_blocks): req = requests.post(f"{DEFAULT_PROXY}/simulator/generate-blocks/{nr_of_blocks}") return req.text -def addBlocksUntilEpochReached(epoch_to_be_reached: int): +def add_blocks_until_epoch_reached(epoch_to_be_reached: int): req = requests.post(f"{DEFAULT_PROXY}/simulator/generate-blocks-until-epoch-reached/{str(epoch_to_be_reached)}") return req.text -def addBlocksUntilTxSucceeded(tx_hash) -> str: +def add_blocks_until_tx_fully_executed(tx_hash) -> str: print("Checking: ", tx_hash) counter = 0 while counter < MAX_NUM_OF_BLOCKS_UNTIL_TX_SHOULD_BE_EXECUTED: - addBlocks(1) + add_blocks(1) time.sleep(WAIT_UNTIL_API_REQUEST_IN_SEC) - if getStatusOfTx(tx_hash) == "pending": + if get_status_of_tx(tx_hash) == "pending": counter += 1 else: print("Tx fully executed after", counter, " blocks.") - return getStatusOfTx(tx_hash) + return get_status_of_tx(tx_hash) def is_chain_online() -> bool: @@ -69,8 +68,7 @@ def force_reset_validator_statistics(): return req.text -def addKey(private_keys: list) -> str: - +def add_key(private_keys: list) -> str: post_body = { "privateKeysBase64": private_keys } @@ -79,4 +77,3 @@ def addKey(private_keys: list) -> str: req = requests.post(f"{DEFAULT_PROXY}/simulator/add-keys", data=json_structure) return req.text - diff --git a/testing-suite/staking-v4/core/validatorKey.py b/testing-suite/staking-v4/core/validatorKey.py index 2a0fffb5..f8dc5679 100644 --- a/testing-suite/staking-v4/core/validatorKey.py +++ b/testing-suite/staking-v4/core/validatorKey.py @@ -27,7 +27,7 @@ def public_address(self) -> str: # is using vm-query with "getBlsKeysStatus" function def get_status(self, owner_address: str) -> str: owner_address = Address.from_bech32(owner_address).to_hex() - key_status_pair = getBLSKeysStatus([owner_address]) + key_status_pair = get_bls_key_status([owner_address]) if key_status_pair is None: return "no bls keys on this owner" for key, status in key_status_pair.items(): @@ -56,7 +56,7 @@ def get_state(self) -> str: # using getOwner vm-query def belongs_to(self, address: str) -> bool: - owner = getOwner([self.public_address()]) + owner = get_owner([self.public_address()]) if owner == address: return True else: diff --git a/testing-suite/staking-v4/core/wallet.py b/testing-suite/staking-v4/core/wallet.py index 80295bf8..7d433c88 100644 --- a/testing-suite/staking-v4/core/wallet.py +++ b/testing-suite/staking-v4/core/wallet.py @@ -39,10 +39,10 @@ def get_balance(self) -> int: return balance - def set_balance(self, egld_ammount): + def set_balance(self, egld_amount): details = { 'address': f'{self.public_address()}', - 'balance': f'{egld_ammount}' + 'balance': f'{egld_amount}' } details_list = [details] diff --git a/testing-suite/staking-v4/delegation.py b/testing-suite/staking-v4/delegation.py index 828f3279..6eab1128 100644 --- a/testing-suite/staking-v4/delegation.py +++ b/testing-suite/staking-v4/delegation.py @@ -13,8 +13,8 @@ from core.validatorKey import * -def createNewDelegationContract(owner: Wallet, AMOUNT="1250000000000000000000", SERVICE_FEE="00", - DELEGATION_CAP="00") -> str: +def create_new_delegation_contract(owner: Wallet, AMOUNT="1250000000000000000000", SERVICE_FEE="00", + DELEGATION_CAP="00") -> str: # compute tx tx = Transaction(sender=owner.get_address().to_bech32(), receiver=SYSTEM_DELEGATION_MANAGER_CONTRACT, @@ -37,7 +37,7 @@ def createNewDelegationContract(owner: Wallet, AMOUNT="1250000000000000000000", return tx_hash -def whitelistForMerge(old_owner: Wallet, new_owner: Wallet, delegation_sc_address: str) -> str: +def whitelist_for_merge(old_owner: Wallet, new_owner: Wallet, delegation_sc_address: str) -> str: delegation_sc_address = Address.from_bech32(delegation_sc_address) # compute tx @@ -62,7 +62,7 @@ def whitelistForMerge(old_owner: Wallet, new_owner: Wallet, delegation_sc_addres return tx_hash -def mergeValidatorToDelegationWithWhitelist(new_owner: Wallet, delegation_sc_address: str): +def merge_validator_to_delegation_with_whitelist(new_owner: Wallet, delegation_sc_address: str): delegation_sc_address_as_hex = Address.from_bech32(delegation_sc_address).to_hex() # compute tx @@ -87,7 +87,7 @@ def mergeValidatorToDelegationWithWhitelist(new_owner: Wallet, delegation_sc_add return tx_hash -def addNodes(owner: Wallet, delegation_sc_address: str, validatorKeys: list[ValidatorKey]) -> str: +def add_nodes(owner: Wallet, delegation_sc_address: str, validatorKeys: list[ValidatorKey]) -> str: # load needed data for stake transactions signatures stake_signature_and_public_key = '' for key in validatorKeys: @@ -121,7 +121,7 @@ def addNodes(owner: Wallet, delegation_sc_address: str, validatorKeys: list[Vali return tx_hash -def stakeNodes(owner: Wallet, delegation_sc_address: str, validatorKeys: list[ValidatorKey]): +def stake_nodes(owner: Wallet, delegation_sc_address: str, validatorKeys: list[ValidatorKey]): pub_key_string = '' for key in validatorKeys: pub_key_string += f"@{key.public_address()}" diff --git a/testing-suite/staking-v4/get_info.py b/testing-suite/staking-v4/get_info.py index 1afaec51..9a209bb2 100644 --- a/testing-suite/staking-v4/get_info.py +++ b/testing-suite/staking-v4/get_info.py @@ -9,21 +9,7 @@ from constants import * -def getPublicAddressFromPem(pem: Path) -> str: - f = open(pem) - lines = f.readlines() - for line in lines: - if "BEGIN" in line: - line = line.split(" ") - address = line[-1].replace("-----", "") - if "\n" in address: - address = address.replace("\n", "") - break - - return address - - -def getStatusOfTx(tx_hash: str) -> str: +def get_status_of_tx(tx_hash: str) -> str: response = requests.get(f"{DEFAULT_PROXY}/transaction/{tx_hash}/process-status") response.raise_for_status() parsed = response.json() @@ -36,7 +22,7 @@ def getStatusOfTx(tx_hash: str) -> str: return status -def getDelegationContractAddressFromTx(tx_hash): +def get_delegation_contract_address_from_tx(tx_hash): response = requests.get(f"{DEFAULT_PROXY}/transaction/{tx_hash}?withResults=True") response.raise_for_status() @@ -50,13 +36,13 @@ def getDelegationContractAddressFromTx(tx_hash): topics = first_set_of_events.get("topics") delegation_contract_address = topics[1] - delegation_contract_address = base64ToHex(delegation_contract_address) + delegation_contract_address = base64_to_hex(delegation_contract_address) delegation_contract_address = Address.from_hex(delegation_contract_address, "erd").to_bech32() return delegation_contract_address -def getBLSKeysStatus(owner_public_key_in_hex: list[str]): +def get_bls_key_status(owner_public_key_in_hex: list[str]): key_status_pair = {} post_body = { @@ -79,15 +65,15 @@ def getBLSKeysStatus(owner_public_key_in_hex: list[str]): # convert all elements from list to hex and add to final dict: for i in range(0, len(key_status_temp_list), 2): - bls_decoded = base64ToHex(key_status_temp_list[i]) - status_decoded = base64ToString(key_status_temp_list[i + 1]) + bls_decoded = base64_to_hex(key_status_temp_list[i]) + status_decoded = base64_to_string(key_status_temp_list[i + 1]) key_status_pair[bls_decoded] = status_decoded return key_status_pair -def getOwner(public_validator_key: list[str]) -> str: +def get_owner(public_validator_key: list[str]) -> str: post_body = { "scAddress": STAKING_CONTRACT, @@ -109,15 +95,15 @@ def getOwner(public_validator_key: list[str]) -> str: address_list = tx_response_data.get("returnData") address = address_list[0] - address = base64ToHex(address) + address = base64_to_hex(address) address = Address.from_hex(address, "erd").to_bech32() return address -def checkIfErrorIsPresentInTx(error, tx_hash) -> bool: +def check_if_error_is_present_in_tx(error, tx_hash) -> bool: flag = False - error_bytes = stringToBase64(error) + error_bytes = string_to_base64(error) req = requests.get(f"{DEFAULT_PROXY}/transaction/{tx_hash}?withResults=True") response = req.text @@ -131,7 +117,7 @@ def checkIfErrorIsPresentInTx(error, tx_hash) -> bool: return flag -def getTotalStaked(owner: str): +def get_total_staked(owner: str): address_in_hex = Address.from_bech32(owner).to_hex() post_body = { "scAddress": VALIDATOR_CONTRACT, @@ -149,5 +135,5 @@ def getTotalStaked(owner: str): total_staked_list = tx_response_data.get("returnData") total_staked = total_staked_list[0] - total_staked = base64ToString(total_staked) + total_staked = base64_to_string(total_staked) return total_staked diff --git a/testing-suite/staking-v4/helpers.py b/testing-suite/staking-v4/helpers.py index 4e7305e8..69221fce 100644 --- a/testing-suite/staking-v4/helpers.py +++ b/testing-suite/staking-v4/helpers.py @@ -4,31 +4,31 @@ import string -def decimalToHex(value: int): +def decimal_to_hex(value: int): hex_value = f'{value:x}' if len(hex_value) % 2 > 0: hex_value = "0" + hex_value return hex_value -def base64ToHex(b): +def base64_to_hex(b): return base64.b64decode(b).hex() -def stringToBase64(s): +def string_to_base64(s): return base64.b64encode(s.encode('utf-8')) -def base64ToString(b): +def base64_to_string(b): return base64.b64decode(b).decode('utf-8') -def replaceRandomDataWithAnotherRandomData(input_string: str) -> str: - def generateRandomLetter() -> str: +def replace_random_data_with_another_random_data(input_string: str) -> str: + def generate_random_letter() -> str: return random.choice(string.ascii_letters) letter_to_be_replaced = random.choice(input_string) - letter_to_replace_with = generateRandomLetter() + letter_to_replace_with = generate_random_letter() new_string = input_string.replace(letter_to_be_replaced, letter_to_replace_with) return new_string diff --git a/testing-suite/staking-v4/scenarios/_48.py b/testing-suite/staking-v4/scenarios/_48.py index 5c4bbfe1..83dbcfa6 100644 --- a/testing-suite/staking-v4/scenarios/_48.py +++ b/testing-suite/staking-v4/scenarios/_48.py @@ -41,23 +41,23 @@ def scenario(epoch: int): if is_chain_online(): # === PRE-CONDITIONS ============================================================== - AMMOUNT_TO_MINT = "6000" + "000000000000000000" + AMOUNT_TO_MINT = "6000" + "000000000000000000" _A = Wallet(Path("./wallets/walletKey_1.pem")) # check if minting is successful - assert "success" in _A.set_balance(AMMOUNT_TO_MINT) + assert "success" in _A.set_balance(AMOUNT_TO_MINT) # add some blocks - response = addBlocks(5) + response = add_blocks(5) assert "success" in response time.sleep(0.5) # check balance - assert _A.get_balance() == AMMOUNT_TO_MINT + assert _A.get_balance() == AMOUNT_TO_MINT # move to epoch - assert "success" in addBlocksUntilEpochReached(epoch) + assert "success" in add_blocks_until_epoch_reached(epoch) # === STEP 1 ============================================================== # 1) Stake with A 2 nodes @@ -68,15 +68,15 @@ def scenario(epoch: int): tx_hash = stake(_A, A_Keys) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # === STEP 2 ============================================================== # 2) check balance of A to be - (5000+gas fees) - assert int(_A.get_balance()) < int(AMMOUNT_TO_MINT) - 5000 + assert int(_A.get_balance()) < int(AMOUNT_TO_MINT) - 5000 # === STEP 3 ============================================================== # 3) check total stake of A - total_staked = getTotalStaked(_A.public_address()) + total_staked = get_total_staked(_A.public_address()) assert total_staked == "5000" + "000000000000000000" # === STEP 4 ============================================================== diff --git a/testing-suite/staking-v4/scenarios/_49_50.py b/testing-suite/staking-v4/scenarios/_49_50.py index 3f03cb8d..a1907fd3 100644 --- a/testing-suite/staking-v4/scenarios/_49_50.py +++ b/testing-suite/staking-v4/scenarios/_49_50.py @@ -38,29 +38,29 @@ def scenario(epoch: int): if is_chain_online(): # === PRE-CONDITIONS ============================================================== - AMMOUNT_TO_MINT = "6000" + "000000000000000000" + AMOUNT_TO_MINT = "6000" + "000000000000000000" _A = Wallet(Path("./wallets/walletKey_1.pem")) _B = Wallet(Path("./wallets/walletKey_2.pem")) _C = Wallet(Path("./wallets/walletKey_3.pem")) # check if minting is successful - assert "success" in _A.set_balance(AMMOUNT_TO_MINT) - assert "success" in _B.set_balance(AMMOUNT_TO_MINT) - assert "success" in _C.set_balance(AMMOUNT_TO_MINT) + assert "success" in _A.set_balance(AMOUNT_TO_MINT) + assert "success" in _B.set_balance(AMOUNT_TO_MINT) + assert "success" in _C.set_balance(AMOUNT_TO_MINT) # add some blocks - response = addBlocks(5) + response = add_blocks(5) assert "success" in response time.sleep(0.5) # check balance - assert _A.get_balance() == AMMOUNT_TO_MINT - assert _B.get_balance() == AMMOUNT_TO_MINT - assert _C.get_balance() == AMMOUNT_TO_MINT + assert _A.get_balance() == AMOUNT_TO_MINT + assert _B.get_balance() == AMOUNT_TO_MINT + assert _C.get_balance() == AMOUNT_TO_MINT # move to epoch - assert "success" in addBlocksUntilEpochReached(epoch) + assert "success" in add_blocks_until_epoch_reached(epoch) # === STEP 1 ============================================================== # 1) Test 49 : Stake a node with an invalid bls key @@ -91,7 +91,7 @@ def scenario(epoch: int): _key = ValidatorKey(Path("./validatorKeys/validatorKey_2.pem")) tx_hash = stake(_A, [_key]) - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # make sure key is staked if epoch == 3: @@ -102,10 +102,10 @@ def scenario(epoch: int): # stake same key again tx_hash = stake(_B, [_key]) - assert addBlocksUntilTxSucceeded(tx_hash) == "fail" + assert add_blocks_until_tx_fully_executed(tx_hash) == "fail" # check if it fails with the correct error message - assert checkIfErrorIsPresentInTx("error bls key already registered", tx_hash) + assert check_if_error_is_present_in_tx("error bls key already registered", tx_hash) # === STEP 3 ============================================================== # 3) Test 50 : Stake a node with less than 2500 egld @@ -113,10 +113,10 @@ def scenario(epoch: int): _key = ValidatorKey(Path("./validatorKeys/validatorKey_3.pem")) tx_hash = malicious_stake(_C, [_key], AMOUNT_DEFICIT=1) - assert addBlocksUntilTxSucceeded(tx_hash) == "fail" + assert add_blocks_until_tx_fully_executed(tx_hash) == "fail" # check if error message is present in tx - assert checkIfErrorIsPresentInTx("insufficient stake value", tx_hash) + assert check_if_error_is_present_in_tx("insufficient stake value", tx_hash) # make sure all checks were done in needed epoch assert proxy_default.get_network_status().epoch_number == epoch diff --git a/testing-suite/staking-v4/scenarios/_68_69.py b/testing-suite/staking-v4/scenarios/_68_69.py index 089767fa..2c6d90c2 100644 --- a/testing-suite/staking-v4/scenarios/_68_69.py +++ b/testing-suite/staking-v4/scenarios/_68_69.py @@ -46,7 +46,7 @@ def scenario(epoch): if is_chain_online(): # === PRE-CONDITIONS ============================================================== # mint addresses - AMMOUNT_TO_MINT = "50000" + "000000000000000000" + AMOUNT_TO_MINT = "50000" + "000000000000000000" _A = Wallet(Path("./wallets/walletKey_1.pem")) _B = Wallet(Path("./wallets/walletKey_2.pem")) @@ -54,25 +54,25 @@ def scenario(epoch): _D = Wallet(Path("./wallets/walletKey_4.pem")) # check minting request will succeed - assert "success" in _A.set_balance(AMMOUNT_TO_MINT) - assert "success" in _B.set_balance(AMMOUNT_TO_MINT) - assert "success" in _C.set_balance(AMMOUNT_TO_MINT) - assert "success" in _D.set_balance(AMMOUNT_TO_MINT) + assert "success" in _A.set_balance(AMOUNT_TO_MINT) + assert "success" in _B.set_balance(AMOUNT_TO_MINT) + assert "success" in _C.set_balance(AMOUNT_TO_MINT) + assert "success" in _D.set_balance(AMOUNT_TO_MINT) # add some blocks - response = addBlocks(5) + response = add_blocks(5) assert "success" in response time.sleep(0.5) # check balances - assert _A.get_balance() == AMMOUNT_TO_MINT - assert _B.get_balance() == AMMOUNT_TO_MINT - assert _C.get_balance() == AMMOUNT_TO_MINT - assert _D.get_balance() == AMMOUNT_TO_MINT + assert _A.get_balance() == AMOUNT_TO_MINT + assert _B.get_balance() == AMOUNT_TO_MINT + assert _C.get_balance() == AMOUNT_TO_MINT + assert _D.get_balance() == AMOUNT_TO_MINT # go to needed epoch time.sleep(1) - response = addBlocksUntilEpochReached(epoch) + response = add_blocks_until_epoch_reached(epoch) assert "success" in response # === STEP 1 =============================================================== @@ -87,7 +87,7 @@ def scenario(epoch): tx_hash = stake(_B, B_valid_keys_list) # move on until tx is success - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # check bls keys statuses for key in B_valid_keys_list: @@ -110,7 +110,7 @@ def scenario(epoch): tx_hash = stake(_C, C_valid_keys_list) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # check bls keys statuses for key in C_valid_keys_list: @@ -133,7 +133,7 @@ def scenario(epoch): tx_hash = stake(_D, D_valid_keys_list) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # check bls keys statuses for key in D_valid_keys_list: @@ -150,27 +150,27 @@ def scenario(epoch): # 4) Create a delegation contract with A # create contract - tx_hash = createNewDelegationContract(_A) + tx_hash = create_new_delegation_contract(_A) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # get delegation contract address - DELEGATION_CONTRACT_ADDRESS = getDelegationContractAddressFromTx(tx_hash) + DELEGATION_CONTRACT_ADDRESS = get_delegation_contract_address_from_tx(tx_hash) # === STEP 5 ============================================================ # 5) Merge C nodes in A's contract - should succeed # 5.1 - send a whitelist for merge from A to C - tx_hash = whitelistForMerge(_A, _C, DELEGATION_CONTRACT_ADDRESS) + tx_hash = whitelist_for_merge(_A, _C, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # 5.2 - send merging tx from C - tx_hash = mergeValidatorToDelegationWithWhitelist(_C, DELEGATION_CONTRACT_ADDRESS) + tx_hash = merge_validator_to_delegation_with_whitelist(_C, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # check if keys from C were transfered to A's contract for key in C_valid_keys_list: @@ -186,16 +186,16 @@ def scenario(epoch): # === STEP 6 ================================================== # 6) Merge D nodes in A's contract - should succeed # 6.1 - send a whitelist for merge from A to D - tx_hash = whitelistForMerge(_A, _D, DELEGATION_CONTRACT_ADDRESS) + tx_hash = whitelist_for_merge(_A, _D, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # 6.2 - send merging tx from A - tx_hash = mergeValidatorToDelegationWithWhitelist(_D, DELEGATION_CONTRACT_ADDRESS) + tx_hash = merge_validator_to_delegation_with_whitelist(_D, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # check if keys from C were transfered to A's contract for key in C_valid_keys_list: @@ -211,21 +211,21 @@ def scenario(epoch): # === STEP 7 =============================================================== # 7) Merge B nodes in A's contract - should fail # 7.1 - send a whitelist for merge from A to B - tx_hash = whitelistForMerge(_A, _B, DELEGATION_CONTRACT_ADDRESS) + tx_hash = whitelist_for_merge(_A, _B, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" # 7.2 - send merging tx from B - tx_hash = mergeValidatorToDelegationWithWhitelist(_B, DELEGATION_CONTRACT_ADDRESS) + tx_hash = merge_validator_to_delegation_with_whitelist(_B, DELEGATION_CONTRACT_ADDRESS) # move few blocks and check tx if is failed if epoch == 3: - assert addBlocksUntilTxSucceeded(tx_hash) == "success" + assert add_blocks_until_tx_fully_executed(tx_hash) == "success" else: - assert addBlocksUntilTxSucceeded(tx_hash) == "fail" + assert add_blocks_until_tx_fully_executed(tx_hash) == "fail" # check reason of failure - assert checkIfErrorIsPresentInTx("number of nodes is too high", tx_hash) + assert check_if_error_is_present_in_tx("number of nodes is too high", tx_hash) # make sure all checks were done in needed epoch assert proxy_default.get_network_status().epoch_number == epoch diff --git a/testing-suite/staking-v4/staking.py b/testing-suite/staking-v4/staking.py index 0384add4..42d9f38c 100644 --- a/testing-suite/staking-v4/staking.py +++ b/testing-suite/staking-v4/staking.py @@ -17,7 +17,7 @@ def stake(wallet: Wallet, validatorKeys: list[ValidatorKey]): # nr of nodes staked nr_of_nodes_staked = len(validatorKeys) - nr_of_nodes_staked = decimalToHex(nr_of_nodes_staked) + nr_of_nodes_staked = decimal_to_hex(nr_of_nodes_staked) # load needed data for stake transactions signatures stake_signature_and_public_key = '' @@ -60,7 +60,7 @@ def stake(wallet: Wallet, validatorKeys: list[ValidatorKey]): def malicious_stake(wallet: Wallet, validatorKeys: list[ValidatorKey], AMOUNT_DEFICIT="0", TX_DATA_MANIPULATOR=False): # nr of nodes staked nr_of_nodes_staked = len(validatorKeys) - nr_of_nodes_staked = decimalToHex(nr_of_nodes_staked) + nr_of_nodes_staked = decimal_to_hex(nr_of_nodes_staked) # load needed data for stake transactions signatures stake_signature_and_public_key = '' @@ -87,7 +87,7 @@ def malicious_stake(wallet: Wallet, validatorKeys: list[ValidatorKey], AMOUNT_DE if TX_DATA_MANIPULATOR: data = f"{nr_of_nodes_staked}{stake_signature_and_public_key}" - manipulated_data = replaceRandomDataWithAnotherRandomData(data) + manipulated_data = replace_random_data_with_another_random_data(data) tx.data = f"stake@{manipulated_data}".encode() else: tx.data = f"stake@{nr_of_nodes_staked}{stake_signature_and_public_key}".encode() @@ -128,4 +128,4 @@ def unStake(wallet: Wallet, validator_key: ValidatorKey) -> str: # send tx tx_hash = proxy_default.send_transaction(tx) - return tx_hash \ No newline at end of file + return tx_hash