From 40e3cdc8701d611e4bf72777267ed1d75c23d919 Mon Sep 17 00:00:00 2001 From: Rima <153289003+casks-mutters@users.noreply.github.com> Date: Mon, 17 Nov 2025 03:53:53 -0500 Subject: [PATCH] Clamp blocks beyond tip in a readable way Right now multiple statements are on one line and hard to reason about --- slot_diff_attest.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/slot_diff_attest.py b/slot_diff_attest.py index 98e6a58..252f082 100644 --- a/slot_diff_attest.py +++ b/slot_diff_attest.py @@ -140,9 +140,14 @@ def main() -> None: chain_id = w3.eth.chain_id tip = w3.eth.block_number print(f"🌐 Connected chainId={chain_id}, tip={tip}") - if block_a > tip or block_b > tip: print(f"⚠️ Requested block beyond tip {tip}; clamping upper bound."); block_b = min(block_b, tip) + if block_a > tip or block_b > tip: + print(f"⚠️ Requested block beyond tip {tip}; clamping upper bound.", file=sys.stderr) + block_b = min(block_b, tip) + if block_b > tip: - print(f"⚠️ block_b {block_b} > tip {tip}; clamping."); block_b = tip + print(f"⚠️ block_b {block_b} > tip {tip}; clamping.", file=sys.stderr) + block_b = tip + if not w3.eth.get_code(address): 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)