Skip to content

Commit 2eb4a53

Browse files
committed
test: fix staging validators' ports and smart-contracts response handling
added: - staging validator-5 dns resolvable when run in CI fixed: - staging validators' ports - `node smart-contracts` response handling after recent refactoring - `test_update_d_param` could not be run on staging due to missing fixture to scp skey
1 parent e72d2ed commit 2eb4a53

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed

e2e-tests/config/substrate/staging-ci.json

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"validator-4": {
1717
"host": "staging-preview-validator-4-service.staging-preview.svc.cluster.local",
1818
"port": "${nodes_config[default_port]}"
19+
},
20+
"validator-5": {
21+
"host": "staging-preview-validator-5-service.staging-preview.svc.cluster.local",
22+
"port": "${nodes_config[default_port]}"
1923
}
2024
}
2125
},

e2e-tests/config/substrate/staging_nodes.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"nodes": {
99
"validator-1": {
1010
"host": "10.0.10.90",
11-
"port": "30621",
11+
"port": "30321",
1212
"aura_ss58_address": "5GHLr2zBDNPXno9XdKgh541uRSiTxnZyzFcr4jK6HUbHMpit",
1313
"pool_id": "da74fc8256d15c7ab3370a6ca28398986cb97c32e9ef66026ac61e99",
1414
"public_key": "0x03b827f4da9711bab7292e5695576a841a4d20af9a07b1ba7a230168d2a78e9df4",
@@ -26,7 +26,7 @@
2626
},
2727
"validator-2": {
2828
"host": "10.0.10.90",
29-
"port": "30622",
29+
"port": "30322",
3030
"aura_ss58_address": "5DHbxU687f1Y3x8yBCWMtqSiJ5qt2yrxQPXNXZNNDaFtmXKv",
3131
"pool_id": "eaed153a8b046770cfd094ee72d080ea682188e63ac11937e3f7f827",
3232
"public_key": "0x02ef5bcd94d54a18ad199559782cd72ac3ccd850976aaaafbca8f9d2625afbf7c4",
@@ -44,7 +44,7 @@
4444
},
4545
"validator-3": {
4646
"host": "10.0.10.90",
47-
"port": "30623",
47+
"port": "30323",
4848
"aura_ss58_address": "5FYtL6HccYhk6KZeFP7hNnkMaXrAwVpTHJWsfnNJcu8AM6in",
4949
"pool_id": "7dfba85597a867fffa59037df7f6adcd50e745dcceac2b48eda94b20",
5050
"public_key": "0x02f2762ab6e1a125dc03908a7b738f8023d13763f28a11d7633c6c8bc463478430",
@@ -62,7 +62,7 @@
6262
},
6363
"validator-4": {
6464
"host": "10.0.10.90",
65-
"port": "30624",
65+
"port": "30324",
6666
"aura_ss58_address": "5GVpqdtqjxqUjuVKMkmh8ehSwcs2nXjpvzHqjouZXMJAyC4b",
6767
"pool_id": "2a3f5dd02da1310e081f2367412e02b72baad3e2a5045f62df2c78c5",
6868
"public_key": "0x025e19f82c5e2bac5e8869d49ff26359e442628bc5cfa38eeb5275f43d04015da8",
@@ -80,7 +80,7 @@
8080
},
8181
"validator-5": {
8282
"host": "10.0.10.90",
83-
"port": "30625",
83+
"port": "30325",
8484
"aura_ss58_address": "5DsfhT7HJe6i5LYeKBzefrXijW5UgPsn2Cuyw5WMa4uEktTn",
8585
"pool_id": "ae81beee7a6c3fa13bba811f91f63ebdd7eb25dd8a62476d4996de10",
8686
"public_key": "0x03f38a062a4b372c045c1dddc4fe98a2c9cb1d6eec8bf02f973fd29b1096cd8155",

e2e-tests/src/substrate_api.py

+23-11
Original file line numberDiff line numberDiff line change
@@ -280,33 +280,37 @@ def read_cardano_key_file(self, filepath) -> str:
280280
def update_d_param(self, permissioned_candidates_count, registered_candidates_count):
281281
signing_key = self.config.nodes_config.governance_authority.mainchain_key
282282

283-
tx_id = self.partner_chains_node.smart_contracts.update_d_param(
283+
response = self.partner_chains_node.smart_contracts.update_d_param(
284284
permissioned_candidates_count, registered_candidates_count, signing_key
285285
)
286+
tx_id = response.transaction_id
286287
effective_in_mc_epoch = self._effective_in_mc_epoch()
287288

288-
if tx_id and effective_in_mc_epoch:
289+
if tx_id:
289290
logger.info(
290291
f"Update of D Param of P: {permissioned_candidates_count} and R: {registered_candidates_count} "
291292
f" was successful and will take effect in {effective_in_mc_epoch} epoch. Transaction id: {tx_id}"
292293
)
293294
return True, effective_in_mc_epoch
294295
else:
296+
logger.error(f"Update of D Param failed, STDOUT: {response.stdout}, STDERR: {response.stderr}")
295297
return False, None
296298

297299
def upsert_permissioned_candidates(self, new_candidates_list):
298-
txId = self.partner_chains_node.smart_contracts.upsert_permissioned_candidates(
300+
response = self.partner_chains_node.smart_contracts.upsert_permissioned_candidates(
299301
self.config.nodes_config.governance_authority.mainchain_key, new_candidates_list
300302
)
303+
tx_id = response.transaction_id
301304
effective_in_mc_epoch = self._effective_in_mc_epoch()
302305

303-
if txId and effective_in_mc_epoch:
306+
if tx_id:
304307
logger.info(
305308
f"Success! New permissioned candidates are set and will be effective in "
306-
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
309+
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
307310
)
308311
return True, effective_in_mc_epoch
309312
else:
313+
logger.error(f"Upsert permissioned candidates failed, STDOUT: {response.stdout}, STDERR: {response.stderr}")
310314
return False, None
311315

312316
def register_candidate(self, candidate_name):
@@ -324,37 +328,45 @@ def register_candidate(self, candidate_name):
324328
self.config.nodes_config.nodes[candidate_name].grandpa_public_key,
325329
)
326330

327-
txId = self.partner_chains_node.smart_contracts.register(
331+
response = self.partner_chains_node.smart_contracts.register(
328332
signatures,
329333
keys_files.cardano_payment_key,
330334
self.read_cardano_key_file(keys_files.spo_public_key),
331335
registration_utxo,
332336
)
337+
tx_id = response.transaction_id
333338
effective_in_mc_epoch = self._effective_in_mc_epoch()
334339

335-
if txId and effective_in_mc_epoch:
340+
if tx_id:
336341
logger.info(
337342
f"Registration of {candidate_name} was successful and will take effect in "
338-
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
343+
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
339344
)
340345
return True, effective_in_mc_epoch
341346
else:
347+
logger.error(
348+
f"Registration of {candidate_name} failed, STDOUT: {response.stdout}, STDERR: {response.stderr}"
349+
)
342350
return False, None
343351

344352
def deregister_candidate(self, candidate_name):
345353
keys_files = self.config.nodes_config.nodes[candidate_name].keys_files
346-
txId = self.partner_chains_node.smart_contracts.deregister(
354+
response = self.partner_chains_node.smart_contracts.deregister(
347355
keys_files.cardano_payment_key, self.read_cardano_key_file(keys_files.spo_public_key)
348356
)
357+
tx_id = response.transaction_id
349358
effective_in_mc_epoch = self._effective_in_mc_epoch()
350359

351-
if txId and effective_in_mc_epoch:
360+
if tx_id:
352361
logger.info(
353362
f"Deregistration of {candidate_name} was successful and will take effect in "
354-
f"{effective_in_mc_epoch} MC epoch. Transaction id: {txId}"
363+
f"{effective_in_mc_epoch} MC epoch. Transaction id: {tx_id}"
355364
)
356365
return True, effective_in_mc_epoch
357366
else:
367+
logger.error(
368+
f"Deregistration of {candidate_name} failed, STDOUT: {response.stdout}, STDERR: {response.stderr}"
369+
)
358370
return False, None
359371

360372
def get_pc_epoch(self):

e2e-tests/tests/committee/test_committee.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class TestCommitteeDistribution:
3838
@mark.committee_distribution
3939
@mark.ariadne
4040
@mark.xdist_group("governance_action")
41+
@mark.usefixtures("governance_skey_with_cli")
4142
def test_update_d_param(
4243
self,
4344
api: BlockchainApi,
@@ -73,7 +74,7 @@ def test_update_d_param(
7374
result, mc_epoch = api.update_d_param(
7475
new_d_param.permissioned_candidates_number, new_d_param.trustless_candidates_number
7576
)
76-
assert result, "D-param update failed"
77+
assert result, "D-param transaction id is empty. Check command output for errors."
7778

7879
# FIXME: ETCM-8945 - create and use wait_for_transaction function instead of wait_for_next_pc_block
7980
api.wait_for_next_pc_block()

0 commit comments

Comments
 (0)