erigon-exec-from-0

Re-executes all Ethereum blocks from block 0 to validate state and reproduce bugs.

3.6k|1.5k|Updated May 27, 2019
One-click install
npx skills add https://github.com/erigontech/erigon --skill erigon-exec-from-0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: erigon-exec-from-0
Source: https://github.com/erigontech/erigon/tree/main/.claude/skills/erigon-exec-from-0
Command: npx skills add https://github.com/erigontech/erigon --skill erigon-exec-from-0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When debugging state root mismatches or validating execution-layer code changes in Erigon, developers need a reliable way to wipe execution state and re-run every block from genesis without re-downloading block data.

Core Features & Use Cases

  • State snapshot cleanup: Removes .kv state snapshots while preserving .seg block snapshots so block data does not need to be re-downloaded.
  • Execution stage reset: Clears execution-stage progress in the database so the next run starts from block 0.
  • Controlled re-execution: Runs stage_exec with tunable batch size, optional pprof profiling, correctness assertions via ERIGON_ASSERT, and a --block flag to stop at a specific height.
  • Use Case: After fixing a state root mismatch at block 5,000,000 on the chiado chain, reset the execution stage and re-run blocks up to that height with assertions enabled to confirm the fix.

Quick Start

Ask the assistant to reset the execution stage and re-run all blocks from block 0 on your Erigon datadir for a given chain.

Frequently Asked Questions about erigon-exec-from-0

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I re-execute all blocks from block 0 in Erigon?

First remove state snapshots with `erigon snapshots rm-all-state-snapshots`, then reset the execution stage with `integration stage_exec --reset`, and finally run `integration stage_exec` with your datadir and chain. Block snapshots are preserved so no re-download is needed.

How do I reproduce a state root mismatch at a specific block?

Reset the execution stage, then run stage_exec with the `--block=<N>` flag to stop execution at the target block. Add `ERIGON_ASSERT=true` to enable correctness assertions that help pinpoint the divergence.

Does re-execution from block 0 require re-downloading block data?

No. The workflow only removes `.kv` state snapshot files while keeping `.seg` block snapshot files intact, so historical block data stays on disk and execution can restart immediately.

What does the batchSize flag do during Erigon execution?

The `--batchSize` flag controls how frequently state is flushed to disk during execution. Larger values run faster but consume more RAM; `8m` is a reasonable default for most re-execution runs.

How can I check if Erigon snapshot files are corrupted before re-execution?

Run `erigon seg integrity --datadir <datadir> --sample=0.001` to verify snapshot integrity on a sample of the data. This helps rule out corrupted segment files before spending time on a full re-execution.