Skip to content

Commit 07c61bf

Browse files
authored
test: remove 'genesis_utxo' from ApiConfig and obtain it from a chain in a session fixture instead
1 parent b13289e commit 07c61bf

25 files changed

+209
-160
lines changed

e2e-tests/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ All test layers upload full logs, metrics, and test reports to GitHub Artifacts
142142
| Block Production Advances | `test_block_producing` | Validate that node produces new blocks over time | Block height increases after 1.5x block duration sleep | Ensures block authoring is active and chain is progressing | Python SDK call to `get_latest_pc_block_number()` with timing validation |
143143
| Basic Transaction Execution | `test_transaction` | Send transaction and verify state change | Receiver balance increases; sender balance decreases by amount + fee | Verifies signing, submission, and state application of transactions | SDK with internal signing + submit logic, validates balance changes |
144144
| Chain Status Matches Cardano Tip | `test_get_status` | Validate that `getStatus()` aligns with Cardano CLI tip | Epoch/slot data close to Cardano tip; timestamps and sidechain data present | Confirms sync between mainchain and sidechain | `curl -d '{"jsonrpc":"2.0","method":"sidechain_getStatus","params":[],"id":1}' http://localhost:9933` with Cardano CLI comparison |
145-
| Genesis Params Returned | `test_get_params` | Confirm genesis config is available via RPC | `genesis_utxo` returned and correct | Ensures sidechain is initialized with correct bootstrap parameters | `curl -d '{"jsonrpc":"2.0","method":"partner_chain_getParams","params":[],"id":1}' http://localhost:9933` with genesis validation |
145+
| Genesis Params Returned | `test_get_params` | Confirm genesis config is available via RPC | `genesis_utxo` returned and correct | Ensures chain genesis_utxo can be retreived | `curl -d '{"jsonrpc":"2.0","method":"partner_chain_getParams","params":[],"id":1}' http://localhost:9933` with genesis validation |
146146

147147
#### **RPC Interface Tests**
148148

@@ -197,4 +197,3 @@ test_categories:
197197
```
198198

199199
Each category is run with appropriate test markers and configurations to ensure comprehensive coverage of the Partner Chain functionality.
200-

e2e-tests/config/api_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ class StackApiConfig:
123123

124124
@dataclass
125125
class ApiConfig:
126-
genesis_utxo: str = MISSING
127-
atms_kind: str = MISSING
128126
committee_epoch_slippage: int = MISSING
129127
committee_participation_tolerance: float = MISSING
130128
max_validators: int = MISSING

e2e-tests/config/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"atms_kind": "plain-ecdsa-secp256k1",
32
"committee_epoch_slippage": 0,
43
"committee_participation_tolerance": 0.05,
54
"max_validators": 32,

e2e-tests/config/substrate/ci_nodes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"deployment_mc_epoch": 958,
3-
"genesis_utxo": "d334afbb10b16d9b8bc1537d1da0d7c1b6b46ac71666a3a38161a39a0223db01#1",
43
"deployment_version": "master",
54
"test_environment": "ci",
65
"keys_path": "secrets/substrate/staging/keys",

e2e-tests/config/substrate/devnet_nodes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"deployment_mc_epoch": 958,
3-
"genesis_utxo": "f9321b197b0995c5f40e30425b1f3c5a797c4cb2678e1ed44934bc50858a9278#1",
43
"deployment_version": "v1.7.0-rc2",
54
"test_environment": "devnet",
65
"committee_participation_tolerance": 0.21,

e2e-tests/config/substrate/local_nodes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"deployment_mc_epoch": 2,
3-
"genesis_utxo": "f8fbe7316561e57de9ecd1c86ee8f8b512a314ba86499ba9a584bfa8fe2edc8d#0",
43
"main_chain": {
54
"network": "--testnet-magic 42",
65
"epoch_length": 120,

e2e-tests/config/substrate/staging_nodes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"deployment_mc_epoch": 958,
33
"initial_pc_epoch": 4859579,
4-
"genesis_utxo": "2b95ece9a1466925cbdb1b65e56531d95422ea8aa6abd9e02293e84a42368bd4#1",
54
"deployment_version": "v1.7.0-rc2",
65
"test_environment": "staging",
76
"nodes_config": {

e2e-tests/config/substrate/uat_preview_nodes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"deployment_mc_epoch": 890,
33
"initial_pc_epoch": 4843200,
4-
"genesis_utxo": "3b715a225582eae835c87d13d28fc4ea0366db8acecd13d9d80d1623d5aefd5e#1",
54
"deployment_version": "v1.6.0",
65
"test_environment": "uat_preview",
76
"nodes_config": {

e2e-tests/docs/run-tests-on-local-env.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
4. Set postgres passwords
1515
- If you used a pre-configured password, skip this step
1616
- If you used a generated password - update db and dbSync password values in `secrets/substrate/local/local.json` with the POSTGRES_PASSWORD env variable value from the `.env` file
17-
5. Update `main_chain.init_timestamp` at `config/substrate/local_nodes.json` to the resulting value of `docker exec cardano-node-1 cat /shared/cardano.start` or alteratively pass it directly to `pytest` with `--init-timestamp=1234567890`
17+
5. Update `main_chain.init_timestamp` at `config/substrate/local_nodes.json` to the resulting value of `docker exec cardano-node-1 cat /shared/cardano.start` or alteratively pass it directly to `pytest` with `--init-timestamp=$(docker exec cardano-node-1 cat /shared/cardano.start)`
1818
6. Create and activate virtual environment
1919

2020
```bash
@@ -27,7 +27,7 @@
2727
2. Run partner-chains tests on partner-chains local environment
2828

2929
```bash
30-
pytest -rP -v --blockchain substrate --env local --log-cli-level debug -vv -s -m "not probability"
30+
pytest -rP -v --blockchain substrate --env local --init-timestamp=$(docker exec cardano-node-1 cat /shared/cardano.start) --log-cli-level debug -vv -s -m "not probability"
3131
```
3232

3333
## Substrate Portal

e2e-tests/src/blockchain_api.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ def get_status(self):
113113
pass
114114

115115
@abstractmethod
116-
def update_d_param(self, permissioned_candidates_count: int, trustless_candidates_count: int) -> (bool, int):
116+
def update_d_param(self, genesis_utxo: str, permissioned_candidates_count: int, trustless_candidates_count: int) -> (bool, int):
117117
"""
118118
Update D parameter configuration for the sidechain
119119
Arguments:
120+
genesis_utxo {str} -- Genesis UTXO of the Partner Chain
120121
permissioned_candidates_count {int} -- Number of permissioned candidates
121122
trustless_candidates_count {int} -- Number of trustless candidates
122123
Returns:
@@ -125,11 +126,12 @@ def update_d_param(self, permissioned_candidates_count: int, trustless_candidate
125126
pass
126127

127128
@abstractmethod
128-
def register_candidate(self, candidate_name: str) -> (bool, int):
129+
def register_candidate(self, genesis_utxo: str, candidate_name: str) -> (bool, int):
129130
"""
130131
Registers candidate to participate in a partner chain consensus protocol
131132
132133
Arguments:
134+
genesis_utxo {str} -- Genesis UTXO of the Partner Chain
133135
candidate_name {str} -- Candidate name. Has to be the same in config and db
134136
135137
Returns:
@@ -138,11 +140,12 @@ def register_candidate(self, candidate_name: str) -> (bool, int):
138140
pass
139141

140142
@abstractmethod
141-
def deregister_candidate(self, candidate: str) -> (bool, int):
143+
def deregister_candidate(self, genesis_utxo: str, candidate: str) -> (bool, int):
142144
"""
143145
Deregisters candidate from participation in a partner chain consensus protocol
144146
145147
Arguments:
148+
genesis_utxo {str} -- Genesis UTXO of the Partner Chain
146149
candidate_name {str} -- Candidate name. Has to be the same in config and db
147150
148151
Returns:
@@ -151,7 +154,7 @@ def deregister_candidate(self, candidate: str) -> (bool, int):
151154
pass
152155

153156
@abstractmethod
154-
def upsert_permissioned_candidates(self, new_candidates_list: dict[str, Node]) -> (bool, int):
157+
def upsert_permissioned_candidates(self, genesis_utxo: str, new_candidates_list: dict[str, Node]) -> (bool, int):
155158
pass
156159

157160
@abstractmethod
@@ -390,13 +393,14 @@ def get_mc_block_by_timestamp(self, timestamp):
390393
"""
391394

392395
@abstractmethod
393-
def sign_address_association(self, address: str, stake_signing_key: str) -> AddressAssociationSignature:
396+
def sign_address_association(self, genesis_utxo: str, address: str, stake_signing_key: str) -> AddressAssociationSignature:
394397
"""
395398
Creates a signature of the association between a PC address and a Cardano address. This association along
396399
with the signature can be submitted to the network via :func:`submit_address_association` method to allow
397400
ADA delegators to participate in PC block production rewards.
398401
399402
Arguments:
403+
genesis_utxo {str} -- Genesis UTXO of the Partner Chain
400404
address {str} -- PC address (hex format) to be associated with the Cardano address
401405
stake_signing_key {str} -- Cardano Stake Signing key in hex format
402406
@@ -407,12 +411,13 @@ def sign_address_association(self, address: str, stake_signing_key: str) -> Addr
407411

408412
@abstractmethod
409413
def sign_block_producer_metadata(
410-
self, metadata: dict, cross_chain_signing_key: str
414+
self, genesis_utxo: str, metadata: dict, cross_chain_signing_key: str
411415
) -> BlockProducerMetadataSignature:
412416
"""
413417
Creates a signature for block producer metadata.
414418
415419
Arguments:
420+
genesis_utxo {str} -- Genesis UTXO of the Partner Chain
416421
metadata {dict} -- block producer metadata
417422
cross_chain_signing_key {str} -- Cross Chain Signing key in hex format
418423

0 commit comments

Comments
 (0)