From 36de01ae7bb261bb04a48338bedb3e1339efd769 Mon Sep 17 00:00:00 2001 From: Rima <153289003+casks-mutters@users.noreply.github.com> Date: Mon, 17 Nov 2025 03:55:07 -0500 Subject: [PATCH] Send storage read errors to stderr and tidy up Errors should go to stderr and the message should be more explicit --- slot_diff_attest.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/slot_diff_attest.py b/slot_diff_attest.py index 98e6a58..e180943 100644 --- a/slot_diff_attest.py +++ b/slot_diff_attest.py @@ -147,12 +147,16 @@ def main() -> None: print("⚠️ Target has no contract code — likely an EOA (reads will be zero).") if not code: print("❌ Target has no contract code (EOA)."); sys.exit(2) - try: + try: v_a = w3.eth.get_storage_at(address, slot, block_identifier=block_a) v_b = w3.eth.get_storage_at(address, slot, block_identifier=block_b) - if v_a in (None, b"") or v_b in (None, b""): print("❌ Historical storage unavailable (archive node required)."); sys.exit(2) + if v_a in (None, b"") or v_b in (None, b""): + print("❌ Historical storage unavailable (archive node required).", file=sys.stderr) + sys.exit(2) except Exception as e: - print(f"❌ Storage read failed: {e}"); sys.exit(2) + print(f"❌ Storage read failed: {e}", file=sys.stderr) + sys.exit(2) + leaf_a = leaf_commitment(chain_id, address, slot, block_a, v_a) leaf_b = leaf_commitment(chain_id, address, slot, block_b, v_b)