Skip to content

Instantly share code, notes, and snippets.

View dapplion's full-sized avatar

Lion - dapplion dapplion

View GitHub Profile
@dapplion
dapplion / static_file_storage_audit.md
Created July 16, 2026 14:10
Deep multi-agent audit of static_file_storage (sigp/lighthouse#9644) — 29 verified findings, 87 verifier votes, empirical probes

static_file_storage — deep multi-agent audit

Full output of a 95-agent audit of sigp/lighthouse#9644 ("Add static_file_storage crate") at commit 8b2bf89c2.

Method: 8 parallel finder agents (crash-safety, concurrency, platform, logic, API/docs, consumer-fit, an empirical probe agent that built and ran 9 adversarial tests against the real code, and CI parity). 30 raw findings deduplicated to 29; every finding independently judged by 3 adversarial verifiers (reachability / accepted-tradeoff overlap / severity calibration). Vote totals: 82 confirmed / 5 refuted / 0 accepted-tradeoff out of 87. Findings matching the six tradeoffs the author had already accepted (reader-blocking mutex, Err-though-durable write_config edge, no per-record checksum, persisted data_len, runtime-only max_value_bytes, no compression) were excluded by instruction.

Executive verdict

The core design is sound: every power-loss window in the data-fsync -> offset-fsync -> con

@dapplion
dapplion / fcr_spec_review.py
Last active July 1, 2026 19:18
Lighthouse FCR: consensus-spec <-> Rust two-column review-site generator
#!/usr/bin/env python3
"""Spec <-> Rust review-site generator for Lighthouse's Fast Confirmation Rule.
Run from the root of a Lighthouse checkout on the FCR branch:
python3 fcr_spec_review.py # writes fcr_spec_review.html
Pairs every consensus-specs `fast-confirmation.md` Python function with its Rust
counterpart in `consensus/fast_confirmation/src` (matched via the `/// Spec:` doc
tags, bodies extracted by brace-matching) into a scrollable two-column page:
import { ethers } from "ethers";
const RPC_URL = "https://rpc.gnosischain.com";
const CONTRACT = "0x485c6Be503D32511c1282b68dD99E85f250572c3";
const START_BLOCK = 35343333; // inclusive
const BATCH_SIZE = 10;
const iface = new ethers.Interface([
"event RegisteredUser(address beneficiary, address safe)",
"event SubmitPendingDeposits(address beneficiary, uint256 count)"
lighthouse % git rev-parse HEAD
3a996fbbee7501adc153e801675ad14966c151d1
crate total lines main owners
account_manager 2242 23,8% Pawan Dhananjay, 23,4% Paul Hauner, 17,5% realbigsean , 14,6% Eitan Seri-Levi, 11,8% Michael Sproul
beacon_node 176046 18,7% Paul Hauner, 16,6% Age Manning, 14,8% Michael Sproul, 8,5% realbigsean , 6,4% Pawan Dhananjay, 6,3% ethDreamer , 4,7% Jimmy Chen, 3,6% Lion -, 3,3% Divma , 2,8% Mac L, 2,4% divma , 2,4% Eitan Seri-Levi
beacon_node/beacon_chain 55795 29,8% Paul Hauner, 18,9% Michael Sproul, 12,1% realbigsean , 10,8% ethDreamer , 8,5% Jimmy Chen, 4,2% Pawan Dhananjay, 2,2% Mac L
import {randomBytes} from "node:crypto";
import {compress} from "snappyjs";
import {phase0, ssz} from "@lodestar/types";
import {BitArray} from "@chainsafe/ssz";
// To run:
// $ ../../node_modules/.bin/ts-node --esm test/unit/network/snappy.test.ts
/* eslint-disable no-console */
@dapplion
dapplion / signature_verify.mjs
Created May 30, 2023 17:55
Verify signature of example payload from beacon chain
import { ssz } from "@lodestar/types";
import { createBeaconConfig } from "@lodestar/config";
import { fromHexString, toHexString } from "@chainsafe/ssz";
import bls from "@chainsafe/bls";
// To run, first install dependencies:
// $ npm install @lodestar/types @lodestar/config @chainsafe/ssz @chainsafe/bls
//
// Then
// $ node signature_verify.mjs
@dapplion
dapplion / slot_finder_gnosis.mjs
Last active January 4, 2024 14:48
Find fork slot and timestamp for a network with Gnosis preset and some time conditions
// Usage
// node slot_finder.mjs chiado
const genesisTimestamp = getGenesis();
const interval = 8192 * 5;
const now = Math.floor(Date.now() / 1000);
const futureDate = new Date();
futureDate.setMonth(futureDate.getMonth() + 2);
const futureTimestamp = Math.floor(futureDate.getTime() / 1000);
@dapplion
dapplion / beacon_chain_withdrawal_type_count.py
Created March 10, 2023 07:39
Beacon chain: count withdrawal credentials by type
import requests
# make the API request
url = "http://localhost:4000/eth/v1/beacon/states/head/validators"
response = requests.get(url)
# check if request was successful
if response.status_code != 200:
print(f"Error: API request returned status code {response.status_code}")
exit()
@dapplion
dapplion / gnosis_bellatrix_readiness.mjs
Created November 27, 2022 17:12
Print Gnosis fork bellatrix readiness, with data from https://nodewatch.chainsafe.io/query
import { execSync } from "node:child_process";
const URL = "https://nodewatch.chainsafe.io/query";
// From https://github.com/gnosischain/configs/blob/main/mainnet/config.yaml
const known_versions = {
"0x00000064": "gnosis-phase0",
"0x01000064": "gnosis-altair",
"0x02000064": "gnosis-bellatrix",
};
import {execSync} from "node:child_process";
// Usage
// ```
// node ttd.mjs https://rpc.eu-central-2.gateway.fm/v3/gnosis/archival/chiado
// ```
const rpcUrl = process.argv[2] ?? "https://rpc.gnosischain.com/";
const blocksPerDay = 17280;