MCPcopy Create free account
hub / github.com/base/base / trie_node_by_hash

Method trie_node_by_hash

crates/proof/executor/src/test_utils.rs:221–244  ·  view source on GitHub ↗
(&self, key: B256)

Source from the content-addressed store, hash-verified

219 type Error = TestTrieNodeProviderError;
220
221 fn trie_node_by_hash(&self, key: B256) -> Result<TrieNode, Self::Error> {
222 // Fetch the preimage from the L2 chain provider.
223 let preimage: Bytes = tokio::task::block_in_place(move || {
224 Handle::current().block_on(async {
225 let preimage: Bytes = self
226 .provider
227 .client()
228 .request("debug_dbGet", &[key])
229 .await
230 .map_err(|_| TestTrieNodeProviderError::PreimageNotFound)?;
231
232 self.kv_store
233 .lock()
234 .await
235 .put(key, preimage.clone())
236 .map_err(|_| TestTrieNodeProviderError::KVStore)?;
237
238 Ok(preimage)
239 })
240 })?;
241
242 // Decode the preimage into a trie node.
243 TrieNode::decode(&mut preimage.as_ref()).map_err(TestTrieNodeProviderError::Rlp)
244 }
245}
246
247impl TrieDBProvider for ExecutorTestFixtureCreator {

Callers

nothing calls this directly

Calls 7

block_onMethod · 0.80
lockMethod · 0.80
requestMethod · 0.45
clientMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected