Skip to content

Conversation

@ManuelBilbao
Copy link
Contributor

Motivation

Description

@ManuelBilbao ManuelBilbao self-assigned this Jan 7, 2026
Copilot AI review requested due to automatic review settings January 7, 2026 19:49
@ManuelBilbao ManuelBilbao added the docs Improvements or additions to documentation label Jan 7, 2026
@ManuelBilbao ManuelBilbao requested a review from a team as a code owner January 7, 2026 19:49
@github-actions github-actions bot added the L1 Ethereum client label Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation improvements for the ethrex L1 architecture, enhancing both high-level architectural documentation and code-level API documentation.

Key Changes

  • Added new architecture documentation covering system overview, block execution pipeline, sync state machine, and crate organization
  • Enhanced Rust API documentation with module-level docs, struct documentation, and usage examples across core crates
  • Added README files for major crates (storage, RPC, P2P, blockchain) to improve discoverability

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
docs/l1/architecture/README.md New architecture section index
docs/l1/architecture/overview.md Comprehensive system architecture overview with diagrams
docs/l1/architecture/block_execution.md Detailed block execution pipeline documentation
docs/l1/architecture/sync_state_machine.md Full sync and snap sync algorithm documentation
docs/l1/architecture/crate_map.md Complete crate dependency map and responsibilities
docs/SUMMARY.md Updated navigation to include new architecture docs
crates/vm/levm/src/lib.rs Added comprehensive module-level documentation
crates/vm/levm/src/vm.rs Enhanced VM and Substate struct documentation
crates/storage/lib.rs Added storage crate overview documentation
crates/storage/store.rs Documented Store struct and related types
crates/storage/README.md New README with usage examples and architecture
crates/networking/rpc/lib.rs Added RPC crate overview documentation
crates/networking/rpc/rpc.rs Documented RPC handler trait and context types
crates/networking/rpc/utils.rs Enhanced error type and request/response documentation
crates/networking/rpc/eth/gas_price.rs Added gas price estimation documentation
crates/networking/rpc/README.md New README with supported methods and examples
crates/networking/p2p/p2p.rs Added P2P module overview documentation
crates/networking/p2p/README.md New README covering P2P protocols and usage
crates/blockchain/blockchain.rs Enhanced Blockchain struct documentation
crates/blockchain/README.md New README with block execution flow and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +58 to +60
/// The substate supports checkpointing via [`push_backup`] and restoration via
/// [`revert_backup`] or commitment via [`commit_backup`]. This is used to handle
/// nested calls where inner calls may fail and need to be reverted.
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions "push_backup" and "revert_backup" or "commit_backup" but these method names should be enclosed in backticks or brackets for proper cross-referencing in Rust documentation.

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +63
/// Most fields are private by design. The backup mechanism only works correctly
/// if data modifications are append-only.
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions the "backup mechanism" and states it "only works correctly if data modifications are append-only" but doesn't explain what "append-only" means in this context or provide examples. This could be confusing for developers unfamiliar with the implementation.

Suggested change
/// Most fields are private by design. The backup mechanism only works correctly
/// if data modifications are append-only.
/// Most fields are private by design. The backup mechanism assumes that changes
/// to the substate are *append-only*: code may add new entries (for example,
/// pushing a new log, inserting into a set, or inserting a new key into a map),
/// but must not remove existing entries or mutate them in place in a way that
/// cannot be reconstructed from the parent checkpoint. For instance, adding a
/// new address to `created_accounts` or pushing to `logs` is safe, while
/// clearing `logs`, removing entries from `selfdestruct_set`, or overwriting a
/// previously stored log would violate this assumption and can make
/// [`revert_backup`] behave incorrectly.

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +165
/// let store = Store::new("./data", EngineType::RocksDB)?;
///
/// // Add a block
/// store.add_block(block).await?;
///
/// // Query account balance
/// let info = store.get_account_info(block_number, address)?;
/// let balance = info.map(|a| a.balance).unwrap_or_default();
/// ```
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example code is marked with "ignore" but would be more helpful if it showed the actual expected types and error handling. Consider providing a more complete example or explaining why it's ignored.

Suggested change
/// let store = Store::new("./data", EngineType::RocksDB)?;
///
/// // Add a block
/// store.add_block(block).await?;
///
/// // Query account balance
/// let info = store.get_account_info(block_number, address)?;
/// let balance = info.map(|a| a.balance).unwrap_or_default();
/// ```
/// use crate::storage::Store;
/// use crate::error::StoreError;
///
/// // This example requires an async runtime (e.g. Tokio) and the `rocksdb`
/// // feature to be enabled on this crate.
/// async fn example() -> Result<(), StoreError> {
/// let db_path = "./data";
/// let engine = EngineType::RocksDB;
///
/// // Open the store
/// let store = Store::new(db_path, engine)?;
///
/// // Add a block
/// store.add_block(block).await?;
///
/// // Query account balance
/// let info = store.get_account_info(block_number, address)?;
/// let balance = info.map(|a| a.balance).unwrap_or_default();
///
/// println!("Balance: {balance}");
/// Ok(())
/// }
/// ```
///
/// This example is marked `ignore` because it depends on the `rocksdb` feature
/// and an async runtime, which are not available in the doctest environment.

Copilot uses AI. Check for mistakes.
**Purpose:** Zero-knowledge proof generation.

**Supported Provers:**
- SP1 (Succinct)
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "Succinct" in the "Supported Provers" section is unclear. It should specify that SP1 is a Succinct-based prover, or clarify what "Succinct" refers to in this context.

Suggested change
- SP1 (Succinct)
- SP1 (Succinct-based prover)

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +26
/// # Example Response
///
/// ```json
/// "0x3b9aca00" // 1 Gwei in hexadecimal
/// ```
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "TODO: This does not need a struct, but I'm leaving it like this for consistency". This TODO comment should be removed from the documentation as it's not relevant to users and suggests incomplete implementation decisions.

Suggested change
/// # Example Response
///
/// ```json
/// "0x3b9aca00" // 1 Gwei in hexadecimal
/// ```

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
//! - **eth Protocol**: Block and transaction propagation
//! - **snap Protocol**: Fast state synchronization
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation refers to "eth Protocol" and "snap Protocol" without the / version specifier. For consistency with the rest of the documentation (e.g., "eth/68", "snap/1"), consider using "eth/68 Protocol" and "snap/1 Protocol".

Suggested change
//! - **eth Protocol**: Block and transaction propagation
//! - **snap Protocol**: Fast state synchronization
//! - **eth/68 Protocol**: Block and transaction propagation
//! - **snap/1 Protocol**: Fast state synchronization

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 3.049 ± 0.088 2.990 3.284 1.01 ± 0.03
main_levm_BubbleSort 3.093 ± 0.024 3.073 3.158 1.03 ± 0.01
pr_revm_BubbleSort 3.009 ± 0.022 2.973 3.043 1.00
pr_levm_BubbleSort 3.088 ± 0.018 3.077 3.138 1.03 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.007 ± 0.012 0.994 1.037 1.01 ± 0.01
main_levm_ERC20Approval 1.105 ± 0.035 1.086 1.199 1.11 ± 0.04
pr_revm_ERC20Approval 0.995 ± 0.004 0.989 1.000 1.00
pr_levm_ERC20Approval 1.093 ± 0.019 1.080 1.128 1.10 ± 0.02

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 136.3 ± 2.9 134.2 142.2 1.03 ± 0.02
main_levm_ERC20Mint 163.7 ± 0.8 162.2 165.0 1.23 ± 0.01
pr_revm_ERC20Mint 132.6 ± 1.1 131.1 134.6 1.00
pr_levm_ERC20Mint 164.6 ± 2.3 162.3 168.4 1.24 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 243.0 ± 2.0 239.2 245.6 1.04 ± 0.01
main_levm_ERC20Transfer 279.8 ± 19.5 271.6 335.4 1.20 ± 0.08
pr_revm_ERC20Transfer 233.0 ± 1.1 231.9 234.8 1.00
pr_levm_ERC20Transfer 273.9 ± 2.8 270.2 278.7 1.18 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 225.0 ± 1.0 223.9 226.9 1.00
main_levm_Factorial 269.3 ± 2.4 267.1 274.3 1.20 ± 0.01
pr_revm_Factorial 226.6 ± 1.4 224.7 229.5 1.01 ± 0.01
pr_levm_Factorial 271.8 ± 10.5 267.3 301.5 1.21 ± 0.05

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.581 ± 0.064 1.435 1.634 1.00
main_levm_FactorialRecursive 8.358 ± 0.081 8.258 8.502 5.29 ± 0.22
pr_revm_FactorialRecursive 1.654 ± 0.049 1.539 1.709 1.05 ± 0.05
pr_levm_FactorialRecursive 8.334 ± 0.055 8.241 8.437 5.27 ± 0.22

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 204.3 ± 1.5 200.6 206.0 1.00
main_levm_Fibonacci 263.1 ± 5.8 250.1 273.8 1.29 ± 0.03
pr_revm_Fibonacci 209.2 ± 1.6 207.9 212.5 1.02 ± 0.01
pr_levm_Fibonacci 263.7 ± 3.9 254.9 270.5 1.29 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 853.0 ± 11.9 840.5 876.7 1.14 ± 0.02
main_levm_FibonacciRecursive 755.9 ± 30.5 693.2 816.1 1.01 ± 0.04
pr_revm_FibonacciRecursive 856.9 ± 5.5 848.4 866.9 1.15 ± 0.02
pr_levm_FibonacciRecursive 747.7 ± 11.8 715.6 756.9 1.00

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.5 ± 0.2 8.4 9.1 1.02 ± 0.03
main_levm_ManyHashes 9.1 ± 0.0 9.0 9.1 1.08 ± 0.01
pr_revm_ManyHashes 8.4 ± 0.1 8.3 8.6 1.00
pr_levm_ManyHashes 9.3 ± 0.7 9.0 11.4 1.11 ± 0.09

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 260.7 ± 1.5 258.7 263.7 1.07 ± 0.01
main_levm_MstoreBench 243.9 ± 1.4 242.2 246.7 1.01 ± 0.01
pr_revm_MstoreBench 261.1 ± 3.9 258.5 269.8 1.08 ± 0.02
pr_levm_MstoreBench 242.7 ± 1.9 240.6 246.7 1.00

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 291.4 ± 6.2 287.4 306.9 1.01 ± 0.02
main_levm_Push 307.7 ± 0.7 306.8 309.0 1.06 ± 0.01
pr_revm_Push 289.8 ± 3.5 286.8 296.3 1.00
pr_levm_Push 313.2 ± 16.1 306.8 359.0 1.08 ± 0.06

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 167.1 ± 5.4 159.1 177.6 1.89 ± 0.07
main_levm_SstoreBench_no_opt 88.5 ± 1.2 87.2 89.9 1.00
pr_revm_SstoreBench_no_opt 168.0 ± 3.1 163.1 173.5 1.90 ± 0.04
pr_levm_SstoreBench_no_opt 90.7 ± 4.5 87.6 102.5 1.03 ± 0.05

Copy link
Contributor

@iovoid iovoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like duplicating the documentation between the rustdocs and README might eventually lead to them being out of sync.

Comment on lines 136 to 140
## Fork Support

The blockchain automatically handles fork transitions based on chain config:

- **Homestead** through **London**: Legacy fee market
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a good place to mention we don't support pre-merge forks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Status messages and chain info

### snap/1
State snapshot protocol for fast sync:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"fast sync" usually refers to a specific sync strategy, so it's probably better to say either "snap sync" or "faster syncs" (or similar rephrasings)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use serde_json::Value;

// TODO: This does not need a struct,
// but I'm leaving it like this for consistency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the explanation?


The store maintains several caches for performance:

- **Trie Layer Cache**: Recent trie nodes for fast state access without full trie traversal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also mention difflayer management (which is the primary function of these)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-project-automation github-project-automation bot moved this to In Progress in ethrex_l1 Jan 8, 2026
@github-project-automation github-project-automation bot moved this from In Progress to In Review in ethrex_l1 Jan 9, 2026
@ManuelBilbao ManuelBilbao added this pull request to the merge queue Jan 9, 2026
Merged via the queue into main with commit 657a794 Jan 9, 2026
66 checks passed
@ManuelBilbao ManuelBilbao deleted the improve_documentation branch January 9, 2026 17:53
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants