Skip to content

Commit

Permalink
Etcm 9058 remove pc contracts cli from tests (#434)
Browse files Browse the repository at this point in the history
* test: use node binary for smart contracts operations
* add e2e deps to nix
* remove all traces of pc-contracts-cli
* ci: removing PCSC leftovers from local-env
* remove all traces of kupo

---------

Co-authored-by: Krisztian Pinter <[email protected]>
  • Loading branch information
rsporny and kpinter-iohk authored Jan 30, 2025
1 parent 260c5cc commit c97d2ba
Show file tree
Hide file tree
Showing 52 changed files with 373 additions and 1,019 deletions.
2 changes: 0 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export DATA_DIR="$RUN_DIR/data"
mkdir -p $DATA_DIR
chmod 777 $RUN_DIR $DATA_DIR
export CARDANO_CONFIG_DIR="$(pwd)/dev/docker/config"
export KUPO_WORKDIR="$RUN_DIR/kupo-db"
mkdir -p $KUPO_WORKDIR

source dev/envs/devnet/.envrc

Expand Down
10 changes: 2 additions & 8 deletions .github/actions/tests/local-environment-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@ runs:
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_REGISTRY_SECRET }}
- name: Download partner-chains-node artifact
uses: actions/download-artifact@v4
with:
name: partner-chains-node-artifact
path: dev/local-environment/configurations/pc-contracts-cli/overrides/
- name: Deploy local environment with overrides
- name: Deploy local environment
run: |
mv dev/local-environment/configurations/pc-contracts-cli/overrides/partner-chains-node-artifact dev/local-environment/configurations/pc-contracts-cli/overrides/partner-chains-node
mkdir -p dev/local-environment/configurations/tests/e2e-tests
cp -r E2E-tests/* dev/local-environment/configurations/tests/e2e-tests
cd dev/local-environment
bash setup.sh --non-interactive --overrides --postgres-password azMpOp4mTqhlKDmgCVQr --node-image ${{ inputs.image }} --tests
bash setup.sh --non-interactive --postgres-password azMpOp4mTqhlKDmgCVQr --node-image ${{ inputs.image }} --tests
docker compose up -d
cd ../../
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ dev/local-environment/.env.bak
dev/local-environment/docker-compose.yml
dev/local-environment/docker-compose.yml.bak
dev/local-environment/configurations/tests/e2e-tests
dev/local-environment/configurations/pc-contracts-cli/overrides
dev/local-environment/configurations/partner-chains-node/overrides

ogmios_client.log
4 changes: 2 additions & 2 deletions E2E-tests/config/api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class NodesApiConfig:

@dataclass
class StackApiConfig:
ogmios_scheme: str = "http"
ogmios_host: str = MISSING
ogmios_port: int = MISSING
kupo_host: str = MISSING
kupo_port: int = MISSING
ogmios_url: str = SI("${.ogmios_scheme}://${.ogmios_host}:${.ogmios_port}")
tools: dict[str, Tool] = MISSING
tools_host: str = MISSING
tools_shell: Optional[str] = None
Expand Down
8 changes: 1 addition & 7 deletions E2E-tests/config/substrate/ci_stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"stack_config": {
"ogmios_host": "devnet-services-service",
"ogmios_port": 1337,
"kupo_host": "devnet-services-service",
"kupo_port": 1442,
"tools_host": "10.0.12.126",
"ssh": {
"username": "root",
Expand All @@ -17,11 +15,7 @@
"cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli",
"ssh": "${stack_config[ssh]}"
},
"sidechain_main_cli": {
"cli": "/tools/partner-chains-smart-contracts-6.1.0/sidechain-cli",
"ssh": "${stack_config[ssh]}"
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": "/tools/partner-chains-node",
"ssh": "${stack_config[ssh]}"
},
Expand Down
4 changes: 2 additions & 2 deletions E2E-tests/config/substrate/devnet_nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"public_key": "0x020a1091341fe5664bfa1782d5e04779689068c916b04cb365ec3153755684d9a1",
"aura_public_key": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
"grandpa_public_key": "0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee",
"permissioned_candidate": false,
"permissioned_candidate": true,
"block_rewards_id": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"bob": {
Expand All @@ -26,7 +26,7 @@
"public_key": "0x0390084fdbf27d2b79d26a4f13f0ccd982cb755a661969143c37cbc49ef5b91f27",
"aura_public_key": "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48",
"grandpa_public_key": "0xd17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae69",
"permissioned_candidate": false,
"permissioned_candidate": true,
"block_rewards_id": "0x0000000000000000000000000000000000000000000000000000000000000002"
},
"charlie": {
Expand Down
8 changes: 1 addition & 7 deletions E2E-tests/config/substrate/devnet_stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"stack_config": {
"ogmios_host": "devnet-services-service",
"ogmios_port": 1337,
"kupo_host": "devnet-services-service",
"kupo_port": 1442,
"tools_host": "10.0.12.126",
"ssh": {
"username": "root",
Expand All @@ -17,11 +15,7 @@
"cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli",
"ssh": "${stack_config[ssh]}"
},
"sidechain_main_cli": {
"cli": "/tools/partner-chains-smart-contracts-7.0.2/pc-contracts-cli",
"ssh": "${stack_config[ssh]}"
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": "/tools/partner-chains-node",
"ssh": "${stack_config[ssh]}"
},
Expand Down
2 changes: 1 addition & 1 deletion E2E-tests/config/substrate/local_nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"public_key": "0x020a1091341fe5664bfa1782d5e04779689068c916b04cb365ec3153755684d9a1",
"aura_public_key": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
"grandpa_public_key": "0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee",
"permissioned_candidate": false,
"permissioned_candidate": true,
"block_rewards_id": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"bob": {
Expand Down
12 changes: 3 additions & 9 deletions E2E-tests/config/substrate/local_stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@
"stack_config": {
"ogmios_host": "ogmios",
"ogmios_port": 1337,
"kupo_host": "kupo",
"kupo_port": 1442,
"tools_shell": "/bin/bash",
"tools": {
"cardano_cli": {
"cli": "cardano-cli",
"shell": "docker exec cardano-node-1 bash -c"
},
"sidechain_main_cli": {
"cli": "./pc-contracts-cli",
"shell": "docker exec pc-contracts-cli bash -c"
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": "./partner-chains-node",
"shell": "docker exec pc-contracts-cli bash -c"
"shell": "docker exec partner-chains-setup bash -c"
},
"bech32": {
"cli": "bech32"
}
}
}
}
}
1 change: 1 addition & 0 deletions E2E-tests/config/substrate/staging_nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"public_key": "0x03f38a062a4b372c045c1dddc4fe98a2c9cb1d6eec8bf02f973fd29b1096cd8155",
"aura_public_key": "0x500d7ff6d903c85db5ee5624df9510c2a085cf30da260166bd370010d0bdc97a",
"grandpa_public_key": "0xa04d74c1539550876d04e4d2de4e0531087c3b6810ce96ddc16d78ccf4ac4f11",
"permissioned_candidate": true,
"cardano_payment_addr": "addr_test1vqqm36dcg5xeeqgc29r8gu6wujlmr4fyrdrvuzq4qnem2vs7g2kvj",
"keys_files": {
"cardano_payment_key": "./secrets/substrate/staging/keys/validator-5/payment.skey.json.decrypted",
Expand Down
8 changes: 1 addition & 7 deletions E2E-tests/config/substrate/staging_stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"stack_config": {
"ogmios_host": "staging-preview-services-service.staging-preview.svc.cluster.local",
"ogmios_port": 1337,
"kupo_host": "staging-preview-services-service.staging-preview.svc.cluster.local",
"kupo_port": 1442,
"tools_host": "10.0.12.157",
"ssh": {
"username": "root",
Expand All @@ -17,11 +15,7 @@
"cli": "export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket && /tools/cardano-cli",
"ssh": "${stack_config[ssh]}"
},
"sidechain_main_cli": {
"cli": "/tools/partner-chains-smart-contracts-7.0.2/pc-contracts-cli",
"ssh": "${stack_config[ssh]}"
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": "/tools/partner-chains-node",
"ssh": "${stack_config[ssh]}"
},
Expand Down
16 changes: 3 additions & 13 deletions E2E-tests/docs/configure-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Partner chains tests require a set of binaries for test execution:
- [partner-chains-node](https://github.com/input-output-hk/partner-chains) to generate signatures
- [cardano-cli](https://github.com/IntersectMBO/cardano-node?tab=readme-ov-file#using-cardano-cli) to query the tip of the Cardano main chain
- [pc-contracts-cli](https://github.com/input-output-hk/partner-chains-smart-contracts) to execute register commands for candidates

As a user, you can choose where to place those services and binaries: on the test runner machine or a separate remote host.

Expand All @@ -14,8 +13,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 `<env>-stack.json` file in the `config/<blockchain>/<env>` folder:

- `cardano_cli`
- `sidechain_main_cli`
- `generate_signatures_cli`
- `partner_chains_node`

## Set up stack on remote host

Expand All @@ -30,8 +28,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
8. Set `tools.generate_signatures_cli` to the path to the `partner-chains-node` binary
7. Set `tools.partner_chains_node` to the path to the `partner-chains-node` binary

### `<env>-stack.json` template:

Expand All @@ -52,11 +49,7 @@ To configure the stack, you will need to do the following:
"cli": <STRING>,
"ssh": "${stack_config[ssh]}"
},
"sidechain_main_cli": {
"cli": <STRING>,
"ssh": "${stack_config[ssh]}"
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": <STRING>,
"ssh": "${stack_config[ssh]}"
},
Expand All @@ -67,6 +60,3 @@ To configure the stack, you will need to do the following:
}
}
}
19 changes: 8 additions & 11 deletions E2E-tests/docs/run-tests-on-new-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* A partner chain node with JSON-RPC API available
* A node with Postgres SQL (for automated test data)
* A node with [cardano-node](https://github.com/IntersectMBO/cardano-node) + [cardano-db-sync](https://github.com/IntersectMBO/cardano-db-sync) + [postgres](https://www.postgresql.org/) (running locally OR on one of the partner-chains nodes)
* [ogmios](https://github.com/CardanoSolutions/ogmios) and [kupo](https://github.com/CardanoSolutions/kupo) (running locally OR on the remote host)
* [partner-chains-node](https://github.com/input-output-hk/partner-chains) and [pc-contracts-cli](https://github.com/input-output-hk/partner-chains-smart-contracts) (running locally OR on the remote tools host)
* [ogmios](https://github.com/CardanoSolutions/ogmios) (running locally OR on the remote host)
* [partner-chains-node](https://github.com/input-output-hk/partner-chains) (running locally OR on the remote tools host)
* cardano-cli (from a local cardano-node OR on the remote tools host)

**NOTE:**
Expand Down Expand Up @@ -58,7 +58,9 @@ Add payment signing key of the governance authority as `init.skey` to `secrets/<
- `public_key` - ECDSA public key (hex) for partner chain
- `aura_public_key` - Sr25519 public key (hex)
- `grandpa_public_key` - Ed25519 public key (hex)
- `permissioned_candidate` - indicator whether this node is permissioned candidate (true|false)
- `permissioned_candidate` - set to true if you want this node to participate in block production as permissioned candidate (true|false)
random candidate will be removed each execution to test rotation
use with caution, tests may alter your permissioned candidates resulting in not achieving consensus
- `block_reward_id` - reward id configured at the partner chain startup
- `key_files` - a set of keys for registered candidates
- `cardano_payment_key` - path to payment key of registered candidate (payment.skey from step 1)
Expand Down Expand Up @@ -146,10 +148,10 @@ E.g. for Cardano Preview it will be:

### 4. Add `<env>_stack.json` to `config/<blockchain>/<env>` folder

`<env>_stack.json` configuration file represents connection strings to partner chain dependencies (ogmios, kupo) and binaries (partner-chains-node, sidechain-main-cli, cardano-cli).
`<env>_stack.json` configuration file represents connection strings to partner chain dependencies (ogmios) and binaries (partner-chains-node, sidechain-main-cli, cardano-cli).

**NOTE:**
- **ogmios** and **kupo** services can be executed on the remote host or made available on test runner machine
- **ogmios** services can be executed on the remote host or made available on test runner machine
- partner chains binaries can be made available on the test runner machine or on the remote host
- if you want to use the remote host - you need to configure your own SSH keys

Expand All @@ -160,8 +162,6 @@ E.g. for Cardano Preview it will be:
"stack_config": {
"ogmios_host": <STRING>,
"ogmios_port": 1337,
"kupo_host": <STRING>,
"kupo_port": 1442,
"tools_shell": "/bin/bash",
"tools_host": <STRING,
"ssh": {
Expand All @@ -175,10 +175,7 @@ E.g. for Cardano Preview it will be:
"cardano_cli": {
"cli": <STRING>, // path to cardano-cli binary
},
"sidechain_main_cli": {
"cli": <STRING> // path to sidechain-main-cli binary
},
"generate_signatures_cli": {
"partner_chains_node": {
"cli": <STRING> // path to partner-chains-node binary
},
"bech32": {
Expand Down
1 change: 0 additions & 1 deletion E2E-tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ markers =
skip_blockchain: skip test on given blockchain
skip_on_new_chain: skip test on new chain (less than 2 MC epochs have passed)
candidate_status: active or inactive, used in test_registrations.py
permissioned_candidate_status: active or inactive, used in test_permissioned_registrations.py
ariadne: run tests for Ariadne feature
probability: run non deterministic tests
block_reward: run tests for Block Rewards feature
Expand Down
10 changes: 3 additions & 7 deletions E2E-tests/src/blockchain_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ def get_status(self):
pass

@abstractmethod
def update_d_param(self, permissioned_candidates_count: int, trustless_candidates_count: int) -> dict:
def update_d_param(self, permissioned_candidates_count: int, trustless_candidates_count: int) -> (bool, int):
"""
Update D parameter configuration for the sidechain
Arguments:
permissioned_candidates_count {int} -- Number of permissioned candidates
trustless_candidates_count {int} -- Number of trustless candidates
Returns:
(bool, json response) - True/False, and a json response from the sidechain main cli
(bool, int) - True/False, and a main chain epoch that it will take effect
"""
pass

Expand All @@ -145,10 +145,6 @@ def register_candidate(self, candidate_name: str) -> (bool, int):
"""
pass

@abstractmethod
def add_permissioned_candidate(self, candidate_name: str) -> (bool, int):
pass

@abstractmethod
def deregister_candidate(self, candidate: str) -> (bool, int):
"""
Expand All @@ -163,7 +159,7 @@ def deregister_candidate(self, candidate: str) -> (bool, int):
pass

@abstractmethod
def remove_permissioned_candidate(self, candidate_name: str) -> (bool, int):
def upsert_permissioned_candidates(self, new_candidates_list: list) -> (bool, int):
pass

@abstractmethod
Expand Down
Loading

0 comments on commit c97d2ba

Please sign in to comment.