2025-01-17 14:23:52 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from src.steps.da import StepsDataAvailability
|
|
|
|
|
from src.test_data import DATA_TO_DISPERSE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestDataIntegrity(StepsDataAvailability):
|
2024-12-13 15:58:25 +08:00
|
|
|
main_nodes = []
|
|
|
|
|
|
2025-01-27 18:59:08 +08:00
|
|
|
@pytest.mark.skip(reason="Waiting for PR https://github.com/logos-co/nomos-node/pull/994")
|
2025-01-21 15:39:45 +08:00
|
|
|
@pytest.mark.usefixtures("setup_5_node_cluster")
|
2025-01-16 19:08:22 +08:00
|
|
|
def test_da_identify_retrieve_missing_columns(self):
|
2025-01-21 14:55:26 +08:00
|
|
|
self.disperse_data(DATA_TO_DISPERSE[0], [0] * 31 + [1], [0] * 8)
|
2025-01-22 14:47:33 +08:00
|
|
|
received_data = []
|
|
|
|
|
# Get data only from half of nodes
|
|
|
|
|
for node in self.main_nodes[2:4]:
|
|
|
|
|
received_data.append(self.get_data_range(node, [0] * 31 + [1], [0] * 8, [0] * 7 + [3]))
|
|
|
|
|
|
|
|
|
|
# Use received blob data to reconstruct the original data
|
|
|
|
|
# nomos-cli reconstruct command required
|
|
|
|
|
reconstructed_data = []
|
|
|
|
|
assert DATA_TO_DISPERSE[0] == bytes(reconstructed_data).decode("utf-8")
|
2025-01-16 19:08:22 +08:00
|
|
|
|
2025-01-21 14:55:26 +08:00
|
|
|
@pytest.mark.usefixtures("setup_2_node_cluster")
|
2025-01-16 19:08:22 +08:00
|
|
|
def test_da_sampling_determines_data_presence(self):
|
2025-01-17 19:27:43 +08:00
|
|
|
self.disperse_data(DATA_TO_DISPERSE[0], [0] * 31 + [1], [0] * 8)
|
2025-01-22 14:52:08 +08:00
|
|
|
received_data = self.get_data_range(self.node2, [0] * 31 + [1], [0] * 8, [0] * 7 + [5])
|
2025-01-20 14:50:26 +08:00
|
|
|
assert DATA_TO_DISPERSE[0] == bytes(received_data[0][1]).decode("utf-8")
|