Update replayproof_receipts.py
Browse files- replayproof_receipts.py +4 -5
replayproof_receipts.py
CHANGED
|
@@ -176,7 +176,6 @@ def build_receipt_bundle_zip(
|
|
| 176 |
media_sha = None
|
| 177 |
|
| 178 |
if include_gif:
|
| 179 |
-
# Replay frames deterministically for a POV clip
|
| 180 |
frames = []
|
| 181 |
st = reset_sim(cfg, recorder.seed)
|
| 182 |
frames.append(render_pov_image(st))
|
|
@@ -184,7 +183,7 @@ def build_receipt_bundle_zip(
|
|
| 184 |
for ev in recorder.events:
|
| 185 |
if ev["action"] == "RESET":
|
| 186 |
continue
|
| 187 |
-
st, _ = step_sim(cfg, st) # deterministic policy
|
| 188 |
frames.append(render_pov_image(st))
|
| 189 |
if st.done:
|
| 190 |
break
|
|
@@ -310,7 +309,7 @@ def verify_receipt_bundle_zip(zip_path: str) -> Dict[str, Any]:
|
|
| 310 |
else:
|
| 311 |
report["checks"]["media_present"] = False
|
| 312 |
|
| 313 |
-
# Replay-verify state hashes (
|
| 314 |
cfg_dict = root["cfg"]["cfg"]
|
| 315 |
cfg = SimConfig(
|
| 316 |
size=int(cfg_dict["size"]),
|
|
@@ -357,7 +356,7 @@ def verify_receipt_bundle_zip(zip_path: str) -> Dict[str, Any]:
|
|
| 357 |
return report
|
| 358 |
|
| 359 |
|
| 360 |
-
def replay_from_receipt_bundle_zip(zip_path: str,
|
| 361 |
out: Dict[str, Any] = {
|
| 362 |
"ok": False,
|
| 363 |
"message": "",
|
|
@@ -400,7 +399,7 @@ def replay_from_receipt_bundle_zip(zip_path: str, export_gif: bool = True, water
|
|
| 400 |
out["final_hash"] = st.last_state_sha256
|
| 401 |
out["expected_hash"] = root.get("final_state_sha256")
|
| 402 |
|
| 403 |
-
if
|
| 404 |
tmp_dir = tempfile.mkdtemp(prefix="replayproof_replay_")
|
| 405 |
gif_path = os.path.join(tmp_dir, f"replay_{root['session_id']}.gif")
|
| 406 |
wm = None
|
|
|
|
| 176 |
media_sha = None
|
| 177 |
|
| 178 |
if include_gif:
|
|
|
|
| 179 |
frames = []
|
| 180 |
st = reset_sim(cfg, recorder.seed)
|
| 181 |
frames.append(render_pov_image(st))
|
|
|
|
| 183 |
for ev in recorder.events:
|
| 184 |
if ev["action"] == "RESET":
|
| 185 |
continue
|
| 186 |
+
st, _ = step_sim(cfg, st) # deterministic policy
|
| 187 |
frames.append(render_pov_image(st))
|
| 188 |
if st.done:
|
| 189 |
break
|
|
|
|
| 309 |
else:
|
| 310 |
report["checks"]["media_present"] = False
|
| 311 |
|
| 312 |
+
# Replay-verify state hashes (strong integrity check)
|
| 313 |
cfg_dict = root["cfg"]["cfg"]
|
| 314 |
cfg = SimConfig(
|
| 315 |
size=int(cfg_dict["size"]),
|
|
|
|
| 356 |
return report
|
| 357 |
|
| 358 |
|
| 359 |
+
def replay_from_receipt_bundle_zip(zip_path: str, export_gif_flag: bool = True, watermark: bool = True) -> Dict[str, Any]:
|
| 360 |
out: Dict[str, Any] = {
|
| 361 |
"ok": False,
|
| 362 |
"message": "",
|
|
|
|
| 399 |
out["final_hash"] = st.last_state_sha256
|
| 400 |
out["expected_hash"] = root.get("final_state_sha256")
|
| 401 |
|
| 402 |
+
if export_gif_flag:
|
| 403 |
tmp_dir = tempfile.mkdtemp(prefix="replayproof_replay_")
|
| 404 |
gif_path = os.path.join(tmp_dir, f"replay_{root['session_id']}.gif")
|
| 405 |
wm = None
|