mirror of
https://github.com/logos-blockchain/logos-blockchain-e2e-tests.git
synced 2026-01-02 13:13:08 +00:00
test: test_da_mempool_interaction
This commit is contained in:
parent
63ae641663
commit
c04448b3d8
@ -169,3 +169,6 @@ class NomosNode:
|
||||
|
||||
def send_add_share_request(self, data):
|
||||
return self._api.da_add_share(data)
|
||||
|
||||
def send_add_blob_info_request(self, data):
|
||||
return self._api.mempool_add_blobinfo(data)
|
||||
|
||||
34
src/steps/mempool.py
Normal file
34
src/steps/mempool.py
Normal file
@ -0,0 +1,34 @@
|
||||
import allure
|
||||
from tenacity import retry, stop_after_delay, wait_fixed
|
||||
|
||||
from src.libs.custom_logger import get_custom_logger
|
||||
from src.steps.common import StepsCommon
|
||||
|
||||
logger = get_custom_logger(__name__)
|
||||
|
||||
|
||||
def prepare_add_blob_info_request(blob_id, app_id, index):
|
||||
blob_info = {"id": blob_id, "metadata": {"app_id": app_id, "index": index}}
|
||||
return blob_info
|
||||
|
||||
|
||||
class StepsMempool(StepsCommon):
|
||||
@allure.step
|
||||
def add_dispersed_blob_info(self, node, blob_id, app_id, index, **kwargs):
|
||||
|
||||
timeout_duration = kwargs.get("timeout_duration", 65)
|
||||
interval = kwargs.get("interval", 0.1)
|
||||
|
||||
data = prepare_add_blob_info_request(blob_id, app_id, index)
|
||||
|
||||
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(interval), reraise=True)
|
||||
def add_blob_info():
|
||||
try:
|
||||
response = node.send_add_blob_info_request(data)
|
||||
except Exception as ex:
|
||||
logger.error(f"Exception while adding blob info to mempool: {ex}")
|
||||
raise
|
||||
|
||||
return response
|
||||
|
||||
return add_blob_info()
|
||||
@ -1,9 +1,10 @@
|
||||
import pytest
|
||||
|
||||
from src.libs.common import to_app_id, to_index, delay
|
||||
from src.libs.common import to_app_id, to_index, delay, to_blob_id
|
||||
from src.libs.custom_logger import get_custom_logger
|
||||
from src.steps.consensus import StepsConsensus
|
||||
from src.steps.da import StepsDataAvailability
|
||||
from src.steps.mempool import StepsMempool
|
||||
from src.steps.storage import StepsStorage
|
||||
from src.test_data import DATA_TO_DISPERSE
|
||||
|
||||
@ -14,7 +15,7 @@ def extract_da_shares(index_shares):
|
||||
return [share for _, shares in index_shares for share in shares if shares]
|
||||
|
||||
|
||||
class TestInteractionDataFlow(StepsDataAvailability, StepsConsensus, StepsStorage):
|
||||
class TestInteractionDataFlow(StepsDataAvailability, StepsMempool):
|
||||
main_nodes = []
|
||||
|
||||
@pytest.mark.usefixtures("setup_2_node_cluster")
|
||||
@ -38,3 +39,15 @@ class TestInteractionDataFlow(StepsDataAvailability, StepsConsensus, StepsStorag
|
||||
delay(5)
|
||||
|
||||
assert len(da_shares) < 3, "Modified da_share should not get published"
|
||||
|
||||
@pytest.mark.usefixtures("setup_2_node_cluster")
|
||||
def test_da_mempool_interaction(self):
|
||||
self.disperse_data(DATA_TO_DISPERSE[3], to_app_id(1), to_index(0))
|
||||
self.add_dispersed_blob_info(self.node2, to_blob_id(10), to_app_id(1), to_index(0))
|
||||
|
||||
delay(5)
|
||||
|
||||
index_shares = self.get_data_range(self.node2, to_app_id(1), to_index(0), to_index(5))
|
||||
da_shares = extract_da_shares(index_shares)
|
||||
|
||||
assert len(da_shares) == 2, "Dispersal unaffected by additional blob info added to mempool"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user