Skip to content

Commit

Permalink
docs(prestate): comment prestate more clear (#1527)
Browse files Browse the repository at this point in the history
* docs(provider/cache): no more than 80chars in 1line

Signed-off-by: jsvisa <delweng@gmail.com>

* docs(prestate): more clear docs

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
  • Loading branch information
jsvisa authored Oct 19, 2024
1 parent 1518621 commit a1a191c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
11 changes: 6 additions & 5 deletions crates/provider/src/layers/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ where
}
}

/// The [`CacheProvider`] holds the underlying in-memory LRU cache and overrides methods from the
/// [`Provider`] trait that should attempt to fetch from cache and fallback to the RPC in case of a
/// cache miss.
/// The [`CacheProvider`] holds the underlying in-memory LRU cache and overrides methods
/// from the [`Provider`] trait. It attempts to fetch from the cache and fallbacks to
/// the RPC in case of a cache miss.
///
/// Most importantly, the [`CacheProvider`] adds `save_cache` and `load_cache` methods to the
/// provider interface to lets users save cache to the disk and load from it on demand.
/// Most importantly, the [`CacheProvider`] adds `save_cache` and `load_cache` methods
/// to the provider interface, allowing users to save the cache to disk and load it
/// from there on demand.
#[derive(Debug, Clone)]
pub struct CacheProvider<P, T, N> {
/// Inner provider.
Expand Down
20 changes: 12 additions & 8 deletions crates/rpc-types-trace/src/geth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,18 @@ pub enum GethDebugBuiltInTracerType {
/// to the nested format of `callTracer`.
#[serde(rename = "flatCallTracer")]
FlatCallTracer,
/// The prestate tracer has two modes: prestate and diff. The prestate mode returns the
/// accounts necessary to execute a given transaction. diff mode returns the differences
/// between the transaction's pre and post-state (i.e. what changed because the transaction
/// happened). The prestateTracer defaults to prestate mode. It reexecutes the given
/// transaction and tracks every part of state that is touched. This is similar to the concept
/// of a stateless witness, the difference being this tracer doesn't return any cryptographic
/// proof, rather only the trie leaves. The result is an object. The keys are addresses of
/// accounts.
/// The prestate tracer operates in two distinct modes: prestate and diff.
/// - In prestate mode, it retrieves the accounts required for executing a specified
/// transaction.
/// - In diff mode, it identifies the changes between the transaction's initial and final
/// states, detailing the modifications caused by the transaction.
///
/// By default, the prestateTracer is set to prestate mode. It reexecutes the given transaction
/// and tracks every part of state that is accessed.
///
/// This functionality is akin to a stateless witness, with the key distinction that this
/// tracer does not provide any cryptographic proofs; it only returns the trie leaves.
/// The output is an object where the keys correspond to account addresses.
#[serde(rename = "prestateTracer")]
PreStateTracer,
/// This tracer is noop. It returns an empty object and is only meant for testing the setup.
Expand Down

0 comments on commit a1a191c

Please sign in to comment.