From 82aa95af34aa75ce73be66ffd47555c6710873f1 Mon Sep 17 00:00:00 2001 From: frisitano <35734660+frisitano@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:30:12 +0000 Subject: [PATCH] Fix: embed zktrie spec in rust docs using github links for images (#71) * 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 --- crates/net/network/src/transactions/validation.rs | 4 ++-- crates/scroll/trie/assets/zktrie.md | 6 +++--- crates/scroll/trie/src/lib.rs | 5 ++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index 1575d9f3374a..2bba5222c3db 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -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, @@ -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::(); +pub const SIGNATURE_DECODED_SIZE_BYTES: usize = mem::size_of::(); /// Interface for validating a `(ty, size, hash)` tuple from a /// [`NewPooledTransactionHashes68`](reth_eth_wire::NewPooledTransactionHashes68).. diff --git a/crates/scroll/trie/assets/zktrie.md b/crates/scroll/trie/assets/zktrie.md index 73883827f3dc..b86e1a016ab8 100644 --- a/crates/scroll/trie/assets/zktrie.md +++ b/crates/scroll/trie/assets/zktrie.md @@ -3,7 +3,7 @@ ## 1. Tree Structure
-zkTrie Structure +zkTrie Structure
Figure 1. zkTrie Structure
@@ -161,7 +161,7 @@ valueHash = h(storageValue[0:16], storageValue[16:32]) ### 4.1 Insertion
-zkTrie Structure +zkTrie Structure
Figure 2. Insert a new leaf node to zkTrie
@@ -173,7 +173,7 @@ When we insert a new leaf node to the existing zkTrie, there could be two cases ### 4.2 Deletion
-zkTrie Structure +zkTrie Structure
Figure 3. Delete a leaf node from the zkTrie
diff --git a/crates/scroll/trie/src/lib.rs b/crates/scroll/trie/src/lib.rs index 52109073d973..c5cd075acc76 100644 --- a/crates/scroll/trie/src/lib.rs +++ b/crates/scroll/trie/src/lib.rs @@ -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)]