mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-07 07:33:07 +00:00
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
import json
|
|
|
|
import pytest
|
|
|
|
from src.client.nomos_cli import NomosCli
|
|
from src.env_vars import CONSENSUS_SLOT_TIME, NOMOS, NOMOS_CUSTOM
|
|
from src.libs.common import delay, to_app_id, to_index
|
|
from src.libs.custom_logger import get_custom_logger
|
|
from src.node.nomos_node import NomosNode
|
|
from src.steps.common import ensure_nodes_ready
|
|
from src.steps.da import StepsDataAvailability
|
|
from src.test_data import DATA_TO_DISPERSE
|
|
|
|
logger = get_custom_logger(__name__)
|
|
|
|
|
|
class TestDataConfidentiality(StepsDataAvailability):
|
|
main_nodes = []
|
|
|
|
@pytest.mark.usefixtures("setup_2_node_cluster")
|
|
def test_unauthorized_node_cannot_receive_dispersed_data(self):
|
|
self.disperse_data(DATA_TO_DISPERSE[1], to_app_id(1), to_index(0))
|
|
delay(CONSENSUS_SLOT_TIME)
|
|
rcv_data = self.get_data_range(self.node2, to_app_id(1), to_index(0), to_index(5))
|
|
rcv_data_json = json.dumps(rcv_data)
|
|
|
|
decoded_data = NomosCli(command="reconstruct").run(input_values=[rcv_data_json], decode_only=True)
|
|
|
|
assert DATA_TO_DISPERSE[1] == decoded_data, "Retrieved data are not same with original data"
|
|
|
|
# Copy the config file from first node
|
|
cfg_file = open("./cluster_config/config.yaml", "wb")
|
|
stream, _stat = self.node2.get_archive("/config.yaml")
|
|
for chunk in stream:
|
|
cfg_file.write(chunk)
|
|
cfg_file.close()
|
|
|
|
self.node2.stop()
|
|
|
|
# Start new node with the same hostname and configuration
|
|
self.nodeX = NomosNode(NOMOS_CUSTOM, "nomos_node_0")
|
|
self.nodeX.start()
|
|
|
|
try:
|
|
self.nodeX.ensure_ready()
|
|
except Exception as ex:
|
|
logger.error(f"REST service did not become ready in time: {ex}")
|
|
raise
|
|
|
|
delay(600)
|