Skip to content

Instantly share code, notes, and snippets.

View yongkangc's full-sized avatar
🎃
Focusing

YK yongkangc

🎃
Focusing
View GitHub Profile
@yongkangc
yongkangc / overlay_root_bench.md
Created December 1, 2025 06:44
reth overlay_root bench

overlay_root bench (reth-trie-db)

Dataset: 1 block, 256 accounts × 4 slots seeded into Account/StorageChangeSets. Keccak hashing.

Results (Criterion, 100 samples, flat sampling):

  • overlay_root unsorted (HashedPostState) → 1.826 ms median
  • overlay_root_sorted (HashedPostStateSorted) → 1.699 ms median

Impact: Sorted fast-path is ~7.5% faster for this setup by skipping the HashMap→Vec conversion and using the sorted prefix-set builder. Hashing still dominates; larger/denser workloads may show bigger gaps.

@yongkangc
yongkangc / from_reverts_bench.md
Created December 1, 2025 06:40
reth from_reverts bench

from_reverts bench (reth-trie-db)

Dataset: 1 block of 256 accounts × 4 slots (Account/StorageChangeSets). Keccak hashing.

Results (Criterion, 100 samples, flat sampling):

  • from_reverts unsorted → 872.3 µs (median)
  • from_reverts sorted → 882.1 µs (median)

Observation: the sorted path is ~1.1% slower on this small dataset. The extra sort avoidance isn’t visible at this scale; overhead likely dominated by hashing and cursor walks. Larger or more skewed datasets may show wins; this run mostly confirms parity.

@yongkangc
yongkangc / violin.svg
Created December 1, 2025 04:34
from_reverts benchmark violin
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yongkangc
yongkangc / Analysis.md
Created October 11, 2025 11:37
ptj analysis

1) Fact‑check & correlation map of PTJ’s key points

A. “This feels like 1999; the NASDAQ doubled from the first week of Oct ’99 to March 2000.”

  • The analogy to 1999 (late‑cycle “blow‑off” run) is reasonable as a narrative, but the “doubled” stat isn’t quite right on a closing‑price basis. From Oct 8, 1999 (NASDAQ Composite close 2,886.57) to the bubble peak on Mar 10, 2000 (5,048.62), the index rose ~75%, not 100%. Intraday or picking an even earlier October low can make the move look closer to 2x, but by standard closes it was +75%. ([Yahoo Finance][1])

B. “Monetary policy is easing now (multiple cuts ahead) vs. hikes into the 2000 top; fiscal is very loose (≈6% deficit/GDP) vs. surplus in 1999–2000.”

  • Rate regime: The Fed cut 25 bps in September 2025 to a 4.00%–4.25% target range, and the dot plot / street base cases suggest more cuts into 2026, i.e., we’re in an easing cycle. In 1999–2000 the Fed hiked from 5.0% to 6.5%. ([fedprimerate.com][2])
@yongkangc
yongkangc / execution-cache-guard-review.md
Created September 21, 2025 03:43
Execution cache usage guard review

Execution Cache Usage Guard Review (mattsse comment)

Context

The PR introduces SavedCache::usage_guard, an Arc<()> that is meant to ensure the cached execution state for a parent block cannot be reused while prewarm tasks are still mutating it. ExecutionCache::get_cache_for only returns a cache when SavedCache::is_available() sees the guard's strong count at 1.

Why the guard never trips today

  1. PayloadProcessor::spawn_caching_with calls self.cache_for(env.parent_hash) to fetch the cached state.
  2. Immediately after, .split() consumes the SavedCache and returns (ExecutionCache, CachedStateMetrics) so we can wire them into the PrewarmContext.
@yongkangc
yongkangc / stage.md
Last active September 11, 2025 05:56
reth stages

What Does "Pipeline Sync" Mean in Reth?

Pipeline sync refers to Reth's staged, sequential processing architecture for synchronizing blockchain data. It's not a single operation, but rather a multi-stage pipeline that processes blocks through a series of specialized stages in a specific order.

The Core Concept

Instead of downloading and processing blocks all at once, Reth breaks the sync process into 15 distinct stages that run serially:

@yongkangc
yongkangc / e2e.md
Last active September 5, 2025 04:11
reth e2e test actions

Reth E2E Test Actions Reference

This document provides a comprehensive reference for all available actions in the Reth e2e test framework.

Core Infrastructure Actions

Action Purpose Key Parameters Example Usage
WaitForBlockHeight Wait for a node to reach specific block height height: u64, node: NodeId WaitForBlockHeight::new(5, NodeId::new(0))
AssertPeers Verify peer connection count expected_peers: usize, node: NodeId AssertPeers::new(2, NodeId::new(0))
@yongkangc
yongkangc / trie_debugging_walkthrough.md
Created September 2, 2025 08:56
Ethereum State Root Debugging: Nibble-by-Nibble Trie Walking Guide
@yongkangc
yongkangc / reth-merkle-trie-deep-dive.md
Last active September 2, 2025 08:39
Comprehensive deep dive into Reth's Merkle/Trie implementation - architecture, stages, state root computation, and debugging guide

Comprehensive deep dive into Reth's Merkle/Trie implementation - architecture, stages, state root computation, and debugging guide

Reth Merkle/Trie Implementation - Deep Dive

A comprehensive analysis of Reth's Merkle Patricia Trie implementation, covering architecture, state root computation, sync stages, and debugging approaches.

Table of Contents

@yongkangc
yongkangc / foundry-cast-commands-reference.md
Created September 2, 2025 08:02
Comprehensive Foundry Cast commands reference for Ethereum development and debugging