Skip to content

Instantly share code, notes, and snippets.

View nflaig's full-sized avatar

Nico Flaig nflaig

View GitHub Profile
@nflaig
nflaig / value_overflow_incident.md
Last active April 3, 2025 22:11
Bitcoin value overflow incident just a deep reorg or a rollback of the chain?

This is in response to some previous discussion about this topic in the Free Madeira telegram group.

The Bitcoin value overflow incident in 2010 was a rollback of the chain and I don't see how this is a convoluted way of thinking about it... but let me try to elaborate on that.

So first, does it make a difference that this was a soft fork and not a hard fork?

I don't see any difference, the outcome is exactly the same, but it was more convenient and helped to make the recovery smoother as nodes that still had the bug eventually followed the longest valid chain again. To me this is really just a

@nflaig
nflaig / attester_slashing.json
Created March 2, 2025 21:50
Holesky attester slashing
{
"attestation_1": {
"attesting_indices": [
"20013",
"20040",
"20075",
"20102",
"20106",
"20109",
"20225",
@nflaig
nflaig / lodestar_interop_builder.yaml
Last active July 26, 2024 14:57
Lodestar interop with builder enabled
participants:
# Lighthouse
- el_type: geth
el_image: ethereum/client-go:stable
cl_type: lodestar
cl_image: chainsafe/lodestar:next
vc_type: lighthouse
vc_image: sigp/lighthouse:latest
count: 1
- el_type: geth
@nflaig
nflaig / lodestar_ssz_interop.yaml
Last active June 2, 2024 19:10
Lodestar ssz interop kurtosis config
participants:
# Lighthouse
- el_type: geth
el_image: ethereum/client-go:stable
cl_type: lodestar
cl_image: nflaig/lodestar:ssz-api
vc_type: lighthouse
vc_image: sigp/lighthouse:latest
count: 1
- el_type: geth
@nflaig
nflaig / oneOfArray.js
Last active May 27, 2024 13:50
openapi oneOf array example
import Ajv from "ajv";
const ajv = new Ajv({ strict: true });
const schema = {
type: "object",
properties: {
data: {
oneOf: [
{ type: "array", items: { type: "string" } },
@nflaig
nflaig / blob-test.js
Last active April 17, 2024 16:32
Blob ssz serialization
const {ssz} = require("@lodestar/types");
const blobHex =
"0x0006eac4e2fac2ca844810be0dc9e398fa4961656c022b65e4af13728152980a00ed1c000300611e00831900d82a0002000c1700603b000400983100671900bb000c00da14000200ef0e00402600010004250001003e4b000200c523002d1100000400a40a001b1000691a009e140001003e18000100c136000200362200141000000100d812000200f42a003615000200692100090e0004008e2100361b006800210039100002003a20000514000300a01b007e2100961b0002004f2900491c00000100094d0001008b2400010090350003008038005c18003f22000200d8360000801d0004007b1900830b008d1d00651d000200d02000b116000400e60f0000fe1e009b1300560b000300db1100e519002f1d000200fa19004f2800000001002a911eff041badfc808ec1125a420a037a0041a625a04a097dc25d7281568000f757521ddd11cc53251f8458ca1c90f465a2d8bfe014d0536f4ac19865272c0019c8405c725e3288c47f9580c3ffc7c6305fc2603dff8e1d3dc7a4ac3fc7c000a75fe3808663bc390ff1f5564fc2c96c203c360c54146adca028d429a261380056ca6bc4e8f6351d3c9afe044f1ff99271f804bf98b5085900000be206066600101d0517d7f80c004ff001ff4417f000273d128c63dd47de997ac3a8877e3f
@nflaig
nflaig / launch.json
Last active May 15, 2024 16:20
Debug Lodestar tests in currently selected file using VS code, requires https://marketplace.visualstudio.com/items?itemName=rioj7.command-variable
{
"version": "0.2.0",
"configurations": [
{
"name": "Test Current File",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/vitest",
"args": [
"--run",
@nflaig
nflaig / thread-vs-process.md
Last active August 17, 2023 08:43
Network worker thread vs child process metrics (left: network thread, middle: network process, right: network process improved)

image

image

image

image

image

@nflaig
nflaig / prysm-diff.json
Last active July 11, 2023 11:21
prysm state diff for slot 6853637
{
"data": {
"historical_roots": {
"0": "0x40cf2f3cffd63d9ffeb89999ee359926abfa07ca5eb3fe2a70bc9d6b15720b8c",
"1": "0x74a3850f3cbccce2271f7c99e53ab07dae55cd8022c937c2dde7a20c5a2b83f9",
"2": "0x76b05bfecf114e4ef967986ffeaccca8a26b4d863f9cf44d47841024e550b2b0",
"3": "0xf82d21ce7bb300a90f46eb5723d4ed84eebdd8fea9fd441eafdfeec844f52bcf",
"4": "0x4ec633af16db54c5401f4baa223f281c21cebdf21ccbed143ccf3170f615a0db",
"5": "0xeef402049efea3b72b44b6cd4ce2cf169bb66c8acb2681addf600e2f6aa51060",
"6": "0xce8f6ccd39880a25d750a917e3445657efde463a8a9ac6f0c4e832e8ac83de65",
@nflaig
nflaig / diff-json.js
Created July 11, 2023 09:44
diff two json files
import fs from "fs";
function deepSort(obj) {
if (Array.isArray(obj)) {
return obj.map(deepSort).sort((a, b) => JSON.stringify(a) > JSON.stringify(b));
} else if (typeof obj === "object" && obj !== null) {
return Object.keys(obj)
.sort()
.reduce((result, key) => {
result[key] = deepSort(obj[key]);