diff --git a/gists/FramePerfLog.ts b/gists/FramePerfLog.ts new file mode 100644 index 00000000..8de79026 --- /dev/null +++ b/gists/FramePerfLog.ts @@ -0,0 +1,24 @@ +type FramePerfLog = { + frame: [number, number]; + distributable: bigint; + operators: { + [operatorId: string]: { + distributed: bigint; + stuck: boolean; + validators: { + [validatorId: string]: { + perf: { + assigned: number; + included: number; + }; + slashed: boolean; + }; + }; + }; + }; + threshold: number; + blockstamp: { + ref_slot: number; + block_hash: `0x${string}`; + }; +}; diff --git a/gists/check_frame_log.py b/gists/check_frame_log.py new file mode 100644 index 00000000..b24e8c24 --- /dev/null +++ b/gists/check_frame_log.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +from collections import defaultdict +import json + +with open("log.json", mode="r") as f: + log = json.load(f) + +shares_of_op = defaultdict(int) +for op_id, op in log["operators"].items(): + for v in op["validators"].values(): + perf = v["perf"]["included"] / v["perf"]["assigned"] + if not v["slashed"] and perf > log["threshold"]: + shares_of_op[op_id] += v["perf"]["assigned"] + +total_shares = sum(shares_of_op.values()) +for op_id, op_share in shares_of_op.items(): + expected = log["distributable"] * op_share // total_shares + actual = log["operators"][op_id]["distributed"] + diff = actual - expected + if diff != 0: + print(f"[{op_id}]\t{actual} != {expected}, {diff=}")