fix: add get_storage_block to storage

This commit is contained in:
Roman 2025-04-08 14:17:18 +08:00
parent 6af92fa449
commit 1fe6354ac6
No known key found for this signature in database
GPG Key ID: 583BDF43C238B83E
2 changed files with 37 additions and 0 deletions

View File

@ -160,3 +160,6 @@ class NomosNode:
def send_get_commitments_request(self, data):
return self._api.da_get_commitments(data)
def send_get_storage_block_request(self, data):
return self._api.storage_block(data)

34
src/steps/storage.py Normal file
View 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_get_storage_block_request(header_id):
query_data = {"header_id": header_id}
return query_data
class StepsStorage(StepsCommon):
@allure.step
def get_storage_block(self, node, header_id, **kwargs):
timeout_duration = kwargs.get("timeout_duration", 65)
interval = kwargs.get("interval", 0.1)
query = prepare_get_storage_block_request(header_id)
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(interval), reraise=True)
def get_block():
try:
response = node.send_get_storage_block_request(query)
except Exception as ex:
logger.error(f"Exception while retrieving commitments: {ex}")
raise
return response
return get_block()