Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last finalized batches received from other nodes should be verified before being used #74

Open
abramsymons opened this issue Jan 25, 2025 · 0 comments

Comments

@abramsymons
Copy link
Collaborator

abramsymons commented Jan 25, 2025

Nodes should not trust other nodes when they get the last finalized batches from them and should verify their finalization signature.

zsequencer/node/tasks.py

Lines 403 to 422 in 9fc7309

def find_all_nodes_last_finalized_batch(app_name: str) -> dict[str, Any]:
"""Find the last finalized batch from all nodes."""
last_finalized_batch: dict[str, Any] = zdb.get_last_batch(
app_name=app_name, state="finalized"
)
for node in list(zconfig.NODES.values()):
if node["id"] == zconfig.NODE["id"]:
continue
url: str = f'{node["socket"]}/node/{app_name}/batches/finalized/last'
try:
response: dict[str, Any] = requests.get(
url=url, headers=zconfig.HEADERS
).json()
if response["status"] == "error":
continue
batch: dict[str, Any] = response["data"]
if batch.get("index", 0) > last_finalized_batch.get("index", 0):
last_finalized_batch = batch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant