Skip to content

Commit

Permalink
Fix: embed zktrie spec in rust docs using github links for images (#71)
Browse files Browse the repository at this point in the history
* fix: embed zktrie in rust docs using github links for images

* lint: conditionally include zktrie spec when doctest not being run

* lint: fix clippy lint
  • Loading branch information
frisitano authored Dec 9, 2024
1 parent c3c2dde commit 82aa95a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/net/network/src/transactions/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! announcements. Validation and filtering of announcements is network dependent.
use crate::metrics::{AnnouncedTxTypesMetrics, TxTypesCounter};
use alloy_primitives::{Signature, TxHash};
use alloy_primitives::{PrimitiveSignature, TxHash};
use derive_more::{Deref, DerefMut};
use reth_eth_wire::{
DedupPayload, Eth68TxMetadata, HandleMempoolData, PartiallyValidData, ValidAnnouncementData,
Expand All @@ -14,7 +14,7 @@ use std::{fmt, fmt::Display, mem};
use tracing::trace;

/// The size of a decoded signature in bytes.
pub const SIGNATURE_DECODED_SIZE_BYTES: usize = mem::size_of::<Signature>();
pub const SIGNATURE_DECODED_SIZE_BYTES: usize = mem::size_of::<PrimitiveSignature>();

/// Interface for validating a `(ty, size, hash)` tuple from a
/// [`NewPooledTransactionHashes68`](reth_eth_wire::NewPooledTransactionHashes68)..
Expand Down
6 changes: 3 additions & 3 deletions crates/scroll/trie/assets/zktrie.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 1. Tree Structure

<figure>
<img src="arch.png" alt="zkTrie Structure" style="width:80%">
<img src="https://raw.githubusercontent.com/scroll-tech/reth/refs/heads/scroll/crates/scroll/trie/assets/arch.png" alt="zkTrie Structure" style="width:80%">
<figcaption align = "center"><b>Figure 1. zkTrie Structure</b></figcaption>
</figure>

Expand Down Expand Up @@ -161,7 +161,7 @@ valueHash = h(storageValue[0:16], storageValue[16:32])
### 4.1 Insertion

<figure>
<img src="insertion.png" alt="zkTrie Structure" style="width:80%">
<img src="https://raw.githubusercontent.com/scroll-tech/reth/refs/heads/scroll/crates/scroll/trie/assets/insertion.png" alt="zkTrie Structure" style="width:80%">
<figcaption align = "center"><b>Figure 2. Insert a new leaf node to zkTrie</b></figcaption>
</figure>

Expand All @@ -173,7 +173,7 @@ When we insert a new leaf node to the existing zkTrie, there could be two cases
### 4.2 Deletion

<figure>
<img src="deletion.png" alt="zkTrie Structure" style="width:80%">
<img src="https://raw.githubusercontent.com/scroll-tech/reth/refs/heads/scroll/crates/scroll/trie/assets/deletion.png" alt="zkTrie Structure" style="width:80%">
<figcaption align = "center"><b>Figure 3. Delete a leaf node from the zkTrie</b></figcaption>
</figure>

Expand Down
5 changes: 4 additions & 1 deletion crates/scroll/trie/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![doc = include_str!("../README.md")]
//! Fast binary Merkle-Patricia Trie (zktrie) state root calculator and proof generator for
//! prefix-sorted bits.
#![cfg_attr(not(doctest), doc = include_str!("../assets/zktrie.md"))]

#[macro_use]
#[allow(unused_imports)]
Expand Down

0 comments on commit 82aa95a

Please sign in to comment.