diff --git a/E2E-tests/config/substrate/ci_stack.json b/E2E-tests/config/substrate/ci_stack.json index 779224368..dbe5b338a 100644 --- a/E2E-tests/config/substrate/ci_stack.json +++ b/E2E-tests/config/substrate/ci_stack.json @@ -17,7 +17,7 @@ "cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli", "ssh": "${stack_config[ssh]}" }, - "sidechain_main_cli": { + "pc_contracts_cli": { "cli": "/tools/partner-chains-smart-contracts-6.1.0/sidechain-cli", "ssh": "${stack_config[ssh]}" }, diff --git a/E2E-tests/config/substrate/devnet_stack.json b/E2E-tests/config/substrate/devnet_stack.json index e9a0534f4..644effcb8 100644 --- a/E2E-tests/config/substrate/devnet_stack.json +++ b/E2E-tests/config/substrate/devnet_stack.json @@ -17,7 +17,7 @@ "cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli", "ssh": "${stack_config[ssh]}" }, - "sidechain_main_cli": { + "pc_contracts_cli": { "cli": "/tools/partner-chains-smart-contracts-6.2.2/pc-contracts-cli", "ssh": "${stack_config[ssh]}" }, diff --git a/E2E-tests/config/substrate/local_stack.json b/E2E-tests/config/substrate/local_stack.json index 3e64c6206..14f2c2b4c 100644 --- a/E2E-tests/config/substrate/local_stack.json +++ b/E2E-tests/config/substrate/local_stack.json @@ -10,7 +10,7 @@ "cli": "cardano-cli", "shell": "docker exec cardano-node-1 bash -c" }, - "sidechain_main_cli": { + "pc_contracts_cli": { "cli": "./pc-contracts-cli", "shell": "docker exec pc-contracts-cli bash -c" }, diff --git a/E2E-tests/config/substrate/staging_stack.json b/E2E-tests/config/substrate/staging_stack.json index 7f16a3b10..7122e465b 100644 --- a/E2E-tests/config/substrate/staging_stack.json +++ b/E2E-tests/config/substrate/staging_stack.json @@ -17,7 +17,7 @@ "cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli", "ssh": "${stack_config[ssh]}" }, - "sidechain_main_cli": { + "pc_contracts_cli": { "cli": "/tools/partner-chains-smart-contracts-6.2.2/pc-contracts-cli", "ssh": "${stack_config[ssh]}" }, diff --git a/E2E-tests/docs/configure-stack.md b/E2E-tests/docs/configure-stack.md index a7044ef11..ecabcb22d 100644 --- a/E2E-tests/docs/configure-stack.md +++ b/E2E-tests/docs/configure-stack.md @@ -14,7 +14,7 @@ As a user, you can choose where to place those services and binaries: on the tes In case of the test runner machine (and local execution), you will need to update the binaries path in `stack_config.tools` for `-stack.json` file in the `config//` folder: - `cardano_cli` -- `sidechain_main_cli` +- `pc_contracts_cli` - `generate_signatures_cli` ## Set up stack on remote host @@ -30,7 +30,7 @@ To configure the stack, you will need to do the following: 3. Set `stack_config.ssh.host_keys_path` to the file added at step 3 4. Set `stack_config.ssh.private_key_path` to the file added at step 4 6. Set `tools.cardano_cli.cli` to the path to the cardano-cli binary. Do not forget about exposing CARDANO_NODE_SOCKET_PATH. E.g. `export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /cardano-cli` -7. Set `tools.sidechain_main_cli` to the path to the `partner-chains-smart-contracts` binary +7. Set `tools.pc_contracts_cli` to the path to the `partner-chains-smart-contracts` binary 8. Set `tools.generate_signatures_cli` to the path to the `partner-chains-node` binary ### `-stack.json` template: @@ -52,7 +52,7 @@ To configure the stack, you will need to do the following: "cli": , "ssh": "${stack_config[ssh]}" }, - "sidechain_main_cli": { + "pc_contracts_cli": { "cli": , "ssh": "${stack_config[ssh]}" }, diff --git a/E2E-tests/docs/run-tests-on-new-env.md b/E2E-tests/docs/run-tests-on-new-env.md index 66353adf0..bbae4ae26 100644 --- a/E2E-tests/docs/run-tests-on-new-env.md +++ b/E2E-tests/docs/run-tests-on-new-env.md @@ -178,8 +178,8 @@ E.g. for Cardano Preview it will be: "cardano_cli": { "cli": , // path to cardano-cli binary }, - "sidechain_main_cli": { - "cli": // path to sidechain-main-cli binary + "pc_contracts_cli": { + "cli": // path to pc-contracts-cli binary }, "generate_signatures_cli": { "cli": // path to partner-chains-node binary diff --git a/E2E-tests/src/sidechain_main_cli.py b/E2E-tests/src/pc_contracts_cli.py similarity index 94% rename from E2E-tests/src/sidechain_main_cli.py rename to E2E-tests/src/pc_contracts_cli.py index a64656b32..f4ee50a47 100644 --- a/E2E-tests/src/sidechain_main_cli.py +++ b/E2E-tests/src/pc_contracts_cli.py @@ -5,8 +5,8 @@ import logging as logger -class SidechainMainCliException(Exception): - def __init__(self, message="Sidechain Main CLI error occurred", status_code=None): +class PCContractsCliException(Exception): + def __init__(self, message="PC Contracts CLI error occurred", status_code=None): self.message = message self.status_code = status_code super().__init__(self.message) @@ -31,18 +31,17 @@ def __init__( self.sidechain_signature = sidechain_signature -class SidechainMainCli: +class PCContractsCli: def __init__(self, config: ApiConfig, cardano_cli: CardanoCli): - sidechain_main_cli_config = config.stack_config.tools["sidechain_main_cli"] - self.cli = sidechain_main_cli_config.cli - self.generate_signatures_cli = config.stack_config.tools["generate_signatures_cli"].cli + pc_contracts_cli_config = config.stack_config.tools["pc_contracts_cli"] + self.cli = pc_contracts_cli_config.cli self.cardano_cli = cardano_cli self.config = config - self.run_command = RunnerFactory.get_runner(sidechain_main_cli_config.ssh, sidechain_main_cli_config.shell) + self.run_command = RunnerFactory.get_runner(pc_contracts_cli_config.ssh, pc_contracts_cli_config.shell) def get_signatures( self, - sidechain_registration_utxo, + partner_chain_registration_utxo, spo_signing_key, sidechain_signing_key, aura_verification_key, @@ -57,7 +56,7 @@ def get_signatures( f"--governance-authority {self.config.governance_authority} " f"--mainchain-signing-key {spo_signing_key} " f"--sidechain-signing-key {sidechain_signing_key} " - f"--registration-utxo {sidechain_registration_utxo}" + f"--registration-utxo {partner_chain_registration_utxo}" ) result = self.run_command.run(get_signatures_cmd) @@ -249,7 +248,7 @@ def update_permissioned_candidates(self, governance_key, add_candidates_list, re def handle_response(self, result): if result.stderr and not result.stdout: logger.error(f"Error during command: {result.stderr}") - raise SidechainMainCliException(result.stderr) + raise PCContractsCliException(result.stderr) try: json_part = self._get_json_string(result.stdout) @@ -257,7 +256,7 @@ def handle_response(self, result): return response except json.JSONDecodeError: logger.error(f"Could not parse response of command: {result}") - raise SidechainMainCliException(result.stdout) + raise PCContractsCliException(result.stdout) def _get_json_string(self, s): start = s.find('{') diff --git a/E2E-tests/src/substrate_api.py b/E2E-tests/src/substrate_api.py index b8733269e..710fa0b53 100644 --- a/E2E-tests/src/substrate_api.py +++ b/E2E-tests/src/substrate_api.py @@ -13,7 +13,7 @@ import logging as logger from .run_command import RunnerFactory from .cardano_cli import CardanoCli -from .sidechain_main_cli import SidechainMainCli +from .pc_contracts_cli import PCContractsCli from .partner_chain_rpc import PartnerChainRpc, PartnerChainRpcResponse, PartnerChainRpcException, DParam import string import time @@ -65,7 +65,7 @@ def __init__(self, config: ApiConfig, secrets, db_sync: Session): self._substrate = None self.run_command = RunnerFactory.get_runner(config.stack_config.ssh, config.stack_config.tools_shell) self.cardano_cli = CardanoCli(config.main_chain, config.stack_config.tools["cardano_cli"]) - self.sidechain_main_cli = SidechainMainCli(config, self.cardano_cli) + self.pc_contracts_cli = PCContractsCli(config, self.cardano_cli) self.partner_chain_rpc = PartnerChainRpc(config.nodes_config.node.rpc_url) self.partner_chain_epoch_calculator = PartnerChainEpochCalculator(config) self.compact_encoder = RuntimeConfiguration().create_scale_object('Compact') @@ -292,7 +292,7 @@ def register_candidate(self, candidate_name): registration_utxo = next(filter(lambda utxo: utxos_json[utxo]["value"]["lovelace"] > 2500000, utxos_json), None) assert registration_utxo is not None, "ERROR: Could not find a well funded utxo for registration" - signatures = self.sidechain_main_cli.get_signatures( + signatures = self.pc_contracts_cli.get_signatures( registration_utxo, self._read_cardano_key_file(keys_files.spo_signing_key), self._read_json_file(keys_files.partner_chain_signing_key)['skey'], @@ -300,7 +300,7 @@ def register_candidate(self, candidate_name): self.config.nodes_config.nodes[candidate_name].grandpa_public_key, ) - txId, next_status_epoch = self.sidechain_main_cli.register_candidate( + txId, next_status_epoch = self.pc_contracts_cli.register_candidate( signatures, keys_files.cardano_payment_key, self._read_cardano_key_file(keys_files.spo_public_key), @@ -318,7 +318,7 @@ def register_candidate(self, candidate_name): def deregister_candidate(self, candidate_name): keys_files = self.config.nodes_config.nodes[candidate_name].keys_files - txId, next_status_epoch = self.sidechain_main_cli.deregister_candidate( + txId, next_status_epoch = self.pc_contracts_cli.deregister_candidate( keys_files.cardano_payment_key, self._read_cardano_key_file(keys_files.spo_public_key), ) @@ -359,7 +359,7 @@ def burn_tokens(self, recipient, amount, payment_key): return self.burn_tokens_for_hex_address(recipient_hex, amount, payment_key) def burn_tokens_for_hex_address(self, recipient_hex, amount, payment_key): - txHash = self.sidechain_main_cli.burn_tokens(recipient_hex, amount, payment_key) + txHash = self.pc_contracts_cli.burn_tokens(recipient_hex, amount, payment_key) if txHash: tx_block_no = self.get_mc_block_no_by_tx_hash(txHash) mc_stable_block = tx_block_no + self.config.main_chain.security_param @@ -434,7 +434,7 @@ def get_epoch_signatures(self, epoch) -> PartnerChainRpcResponse: return response def claim_tokens(self, mc_private_key_file, combined_proof, distributed_set_utxo=None) -> bool: - return self.sidechain_main_cli.claim_tokens( + return self.pc_contracts_cli.claim_tokens( mc_private_key_file, combined_proof, distributed_set_utxo=distributed_set_utxo ) @@ -586,7 +586,7 @@ def check_epoch_signatures_uploaded(self, pc_epoch=None): def add_permissioned_candidate(self, candidate_name: str): candidate = PermissionedCandidate(self.config.nodes_config.nodes[candidate_name]) - txId, next_status_epoch = self.sidechain_main_cli.update_permissioned_candidates( + txId, next_status_epoch = self.pc_contracts_cli.update_permissioned_candidates( self.config.nodes_config.governance_authority.mainchain_key, [candidate], [] ) @@ -601,7 +601,7 @@ def add_permissioned_candidate(self, candidate_name: str): def remove_permissioned_candidate(self, candidate_name: str): candidate = PermissionedCandidate(self.config.nodes_config.nodes[candidate_name]) - txId, next_status_epoch = self.sidechain_main_cli.update_permissioned_candidates( + txId, next_status_epoch = self.pc_contracts_cli.update_permissioned_candidates( self.config.nodes_config.governance_authority.mainchain_key, [], [candidate] ) diff --git a/E2E-tests/tests/active_flow/test_active_flow.py b/E2E-tests/tests/active_flow/test_active_flow.py index 585020b10..18c96098e 100644 --- a/E2E-tests/tests/active_flow/test_active_flow.py +++ b/E2E-tests/tests/active_flow/test_active_flow.py @@ -4,7 +4,7 @@ from src.db.models import OutgoingTx from sqlalchemy.orm import Session from pytest import mark, raises -from src.sidechain_main_cli import SidechainMainCliException +from src.pc_contracts_cli import PCContractsCliException @mark.skip_blockchain("pc_evm", reason="not implemented yet") @@ -127,7 +127,7 @@ def test_claim_transactions( """Test that the user can claim tokens after committee handover * wait until the next committee handover for a partner chain epoch - * claim tokens by executing claimTokens() from sidechain-main-cli + * claim tokens by executing claimTokens() from pc-contracts-cli """ for db_tx in unclaimed_outgoing_txs: logging.info(f"Checking if committee handover happened for epoch {db_tx.available_on_pc_epoch}") @@ -342,7 +342,7 @@ def test_claim_transaction_signed_by_another_recipient_should_fail( logging.info(f"Checking if committee handover happened for epoch {db_tx.available_on_pc_epoch}") wait_until(api.check_epoch_signatures_uploaded, db_tx.available_on_pc_epoch, timeout=config.timeouts.claim_cmd) logging.info(f"Handover for pc epoch {db_tx.available_on_pc_epoch} has happened") - with raises(SidechainMainCliException) as excinfo: + with raises(PCContractsCliException) as excinfo: api.claim_tokens(config.nodes_config.random_mc_account.mainchain_key, db_tx.combined_proof) assert "ERROR-FUEL-MINTING-POLICY-04" in excinfo.value.message @@ -368,7 +368,7 @@ def test_claim_transaction_with_invalid_key_should_fail( logging.info(f"Checking if committee handover happened for epoch {db_tx.available_on_pc_epoch}") wait_until(api.check_epoch_signatures_uploaded, db_tx.available_on_pc_epoch, timeout=config.timeouts.claim_cmd) logging.info(f"Handover for pc epoch {db_tx.available_on_pc_epoch} has happened") - with raises(SidechainMainCliException) as excinfo: + with raises(PCContractsCliException) as excinfo: api.claim_tokens(config.nodes_config.invalid_mc_skey.mainchain_key, db_tx.combined_proof) assert "Error while decoding key" in excinfo.value.message @@ -384,7 +384,7 @@ def test_claim_on_already_claimed_transaction_should_fail( * claiming tokens for that transaction again should fail """ logging.info(f"Claiming tx that should fail: {latest_claimed_outgoing_tx}") - with raises(SidechainMainCliException) as excinfo: + with raises(PCContractsCliException) as excinfo: api.claim_tokens( config.nodes_config.active_transfer_account.mainchain_key, latest_claimed_outgoing_tx.combined_proof, diff --git a/E2E-tests/tests/committee/test_permissioned_registrations.py b/E2E-tests/tests/committee/test_permissioned_registrations.py index 8f8be6a9b..c022b6de7 100644 --- a/E2E-tests/tests/committee/test_permissioned_registrations.py +++ b/E2E-tests/tests/committee/test_permissioned_registrations.py @@ -3,7 +3,7 @@ from src.blockchain_api import BlockchainApi from src.db.models import PermissionedCandidates from sqlalchemy.orm import Session -from src.sidechain_main_cli import SidechainMainCliException +from src.pc_contracts_cli import PCContractsCliException from pytest import mark @@ -24,7 +24,7 @@ def test_add_permissioned_candidate(permissioned_candidate: PermissionedCandidat logging.info(f"Adding permissioned candidate {permissioned_candidate.name}") try: result, next_status_epoch = api.add_permissioned_candidate(permissioned_candidate.name) - except SidechainMainCliException as e: + except PCContractsCliException as e: if 'InvalidCLIParams "New candidates list is the same as the currently stored list."' in str(e): pytest.skip("Skipping test because the candidate is already in the list") else: diff --git a/E2E-tests/tests/passive_flow/test_passive_flow.py b/E2E-tests/tests/passive_flow/test_passive_flow.py index b40c1b022..2f221c8b3 100644 --- a/E2E-tests/tests/passive_flow/test_passive_flow.py +++ b/E2E-tests/tests/passive_flow/test_passive_flow.py @@ -6,7 +6,7 @@ from sqlalchemy import Sequence from pytest import mark import pytest -from src.sidechain_main_cli import SidechainMainCliException +from src.pc_contracts_cli import PCContractsCliException def get_burn_tx_from_rpc(api: BlockchainApi, tx_hash): @@ -115,7 +115,7 @@ def test_burn_more_than_balance_should_fail(api: BlockchainApi, config: ApiConfi burning_key = config.nodes_config.passive_transfer_account.mainchain_key pc_addr = config.nodes_config.negative_test_transfer_account.partner_chain_address - with pytest.raises(SidechainMainCliException) as excinfo: + with pytest.raises(PCContractsCliException) as excinfo: api.burn_tokens(pc_addr, amount, burning_key) assert "BalanceInsufficientError" in excinfo.value.message @@ -133,7 +133,7 @@ def test_burn_negative_balance_should_fail(api: BlockchainApi, config: ApiConfig burning_key = config.nodes_config.passive_transfer_account.mainchain_key pc_addr = config.nodes_config.negative_test_transfer_account.partner_chain_address - with pytest.raises(SidechainMainCliException) as excinfo: + with pytest.raises(PCContractsCliException) as excinfo: api.burn_tokens(pc_addr, amount, burning_key) assert "ExUnitsEvaluationFailed" in excinfo.value.message @@ -150,7 +150,7 @@ def test_burn_with_invalid_key_should_fail(api: BlockchainApi, config: ApiConfig burning_key = config.nodes_config.invalid_mc_skey.mainchain_key pc_addr = config.nodes_config.negative_test_transfer_account.partner_chain_address - with pytest.raises(SidechainMainCliException) as excinfo: + with pytest.raises(PCContractsCliException) as excinfo: api.burn_tokens(pc_addr, amount, burning_key) assert "Error while decoding key" in excinfo.value.message diff --git a/dev/local-environment/modules/pc-contracts-cli.txt b/dev/local-environment/modules/pc-contracts-cli.txt index 4a7a93699..a77b98d55 100644 --- a/dev/local-environment/modules/pc-contracts-cli.txt +++ b/dev/local-environment/modules/pc-contracts-cli.txt @@ -1,7 +1,7 @@ pc-contracts-cli: container_name: pc-contracts-cli - image: ${SIDECHAIN_MAIN_CLI_IMAGE} + image: ${PC_CONTRACTS_CLI_IMAGE} platform: linux/amd64 volumes: - shared-volume:/shared diff --git a/dev/local-environment/setup.sh b/dev/local-environment/setup.sh index e41bfca21..2720664e1 100755 --- a/dev/local-environment/setup.sh +++ b/dev/local-environment/setup.sh @@ -6,7 +6,7 @@ DBSYNC_IMAGE="ghcr.io/intersectmbo/cardano-db-sync:13.5.0.2" KUPO_IMAGE="cardanosolutions/kupo:v2.9.0" OGMIOS_IMAGE="cardanosolutions/ogmios:v6.9.0" POSTGRES_IMAGE="postgres:15.3" -SIDECHAIN_MAIN_CLI_IMAGE="node:22-bookworm" +PC_CONTRACTS_CLI_IMAGE="node:22-bookworm" TESTS_IMAGE="python:3.10-slim" PC_CONTRACTS_CLI_ZIP_URL="https://github.com/input-output-hk/partner-chains-smart-contracts/releases/download/v6.2.2/pc-contracts-cli-v6.2.2.zip" PARTNER_CHAINS_NODE_URL="https://github.com/input-output-hk/partner-chains/releases/download/v1.3.0/partner-chains-node-v1.3.0-x86_64-linux" @@ -367,7 +367,7 @@ DBSYNC_IMAGE=$DBSYNC_IMAGE KUPO_IMAGE=$KUPO_IMAGE OGMIOS_IMAGE=$OGMIOS_IMAGE POSTGRES_IMAGE=$POSTGRES_IMAGE -SIDECHAIN_MAIN_CLI_IMAGE=$SIDECHAIN_MAIN_CLI_IMAGE +PC_CONTRACTS_CLI_IMAGE=$PC_CONTRACTS_CLI_IMAGE TESTS_IMAGE=$TESTS_IMAGE PARTNER_CHAINS_NODE_IMAGE=${node_image:-$PARTNER_CHAINS_NODE_IMAGE} PC_CONTRACTS_CLI_ZIP_URL=$PC_CONTRACTS_CLI_ZIP_URL