Skip to content

Instantly share code, notes, and snippets.

View yongkangc's full-sized avatar
🎃
Focusing

YK yongkangc

🎃
Focusing
View GitHub Profile
@yongkangc
yongkangc / FINAL_REPORT.md
Last active February 2, 2026 09:12
RocksDB Parameter Tuning Results for Reth

RocksDB Parameter Tuning - 3-Run Average Results

Executive Summary

After running each configuration 3 times for statistical significance, the baseline configuration performs best for this workload. The tuned configurations show regressions, not improvements.

Performance Summary (3-run average)

Config Ggas/s p50 (ms) p90 (ms) p99 (ms)
@yongkangc
yongkangc / market-maker-spread.md
Created January 30, 2026 12:00
Market Maker Spread Tightening Diagram

Market Maker Spread Tightening

flowchart LR
    subgraph before["Before MM Enters"]
        direction TB
        B1["Best Bid: $0.45"]
        A1["Best Ask: $0.70"]
        S1["Spread: $0.25 (25%)"]
 end
@yongkangc
yongkangc / sweep_report_2h.md
Last active January 30, 2026 10:55
pm-replay parameter sweep results - 100 runs across min_edge_bps, volatility, blend_weight

Parameter Sweep Report - 2 Hour Backtest

Date: 2026-01-30
Time Window: Last 2 hours
Total Runs: 100

Key Findings

All Runs Unprofitable

  • P&L Range: -$112.63 to -$82.21
@yongkangc
yongkangc / reth-trie-guide.md
Created January 28, 2026 07:36
Reth Sparse Trie Guide - Understanding Ethereum's Merkle Patricia Trie
@yongkangc
yongkangc / fill_logic.md
Created January 27, 2026 16:15
pm-mm-rs Paper Trading Fill Logic

Paper Trading Fill Logic - pm-mm-rs

Overview

The paper trading system simulates realistic order fills using PaperVenue which wraps MockVenue. Fills are triggered when real-time Polymarket book updates cross resting order prices.

Two Fill Types

1. Aggressive Fills (Crossing the Spread)

@yongkangc
yongkangc / prune-parallelism-analysis.md
Created January 27, 2026 08:06
ParallelSparseTrie::prune() parallelism analysis - rayon overhead makes parallel path always slower

ParallelSparseTrie::prune() Parallelism Analysis

Summary

Benchmarking revealed that rayon parallelism in ParallelSparseTrie::prune() causes significant overhead without any performance benefit. The parallel path is always slower than serial, even at the maximum of 256 lower subtries.

Benchmark Results

Serial vs Parallel (forced paths)

@yongkangc
yongkangc / trading_strategy.md
Created January 27, 2026 05:57
Polymarket 15-Min Binary Market Making Strategy

Polymarket 15-Minute Binary Market Making Strategy

The Market

Polymarket offers 15-minute binary prediction markets:

"Will BTC be higher than $100,000 at 3:15 PM?"

  • YES token: Pays $1 if BTC > strike at expiry, else $0
  • NO token: Pays $1 if BTC ≤ strike at expiry, else $0
  • YES + NO always = $1 (complements)
@yongkangc
yongkangc / Cargo.toml
Created January 25, 2026 09:31
RocksDB block size benchmark for reth
[package]
name = "rocksdb-blocksize-bench"
version = "0.1.0"
edition = "2021"
[dependencies]
rocksdb = "0.22"
clap = { version = "4", features = ["derive"] }
hdrhistogram = "7"
serde = { version = "1", features = ["derive"] }
@yongkangc
yongkangc / ROCKSDB_ARCHITECTURE_ANALYSIS.md
Last active January 20, 2026 14:16
RocksDB Execution Divergence Bug - Commit Order Race Condition (reth edge feature)

RocksDB Multi-Database Consistency Architecture Analysis

Problem Statement

When reth uses multiple storage backends (RocksDB for history indices + MDBX for changesets), a commit order race condition causes execution divergence during block validation.

The bug manifests as "nonce 917 too high, expected 0" because:

  1. RocksDB history indices commit first, saying "account X was modified at block N"
  2. MDBX changesets haven't committed yet
  3. Read path follows RocksDB's pointer to a non-existent changeset
@yongkangc
yongkangc / bench.log
Last active January 20, 2026 13:27
RocksDB execution divergence bug - nonce mismatch at block 24262076 (edge feature)
2026-01-20T13:13:15.734451Z  INFO Running benchmark using data from RPC URL: https://eth.drpc.org
2026-01-20T13:13:15.772700Z  INFO Connecting to Engine RPC at http://localhost:8551/ for replay
2026-01-20T13:13:16.002256Z  INFO combined_result=Block 24262068 processed at 0.9734 Ggas/s, used 20307563 total gas. Combined: 0.9143 Ggas/s. fcu: 1.348709ms, newPayload: 20.862554ms
2026-01-20T13:13:16.112979Z  INFO combined_result=Block 24262069 processed at 1.0036 Ggas/s, used 19394546 total gas. Combined: 0.9371 Ggas/s. fcu: 1.37066ms, newPayload: 19.32462ms
2026-01-20T13:13:16.210811Z  INFO combined_result=Block 24262070 processed at 0.9430 Ggas/s, used 20225346 total gas. Combined: 0.8675 Ggas/s. fcu: 1.8666ms, newPayload: 21.448162ms
2026-01-20T13:13:16.333041Z  INFO combined_result=Block 24262071 processed at 1.6818 Ggas/s, used 49123279 total gas