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

Method fetch

crates/proof/proof/src/sync.rs:63–77  ·  view source on GitHub ↗

Fetches the safe head hash from the oracle.

(
        oracle: &O,
        agreed_l2_output_root: B256,
    )

Source from the content-addressed store, hash-verified

61impl SafeHeadFetcher {
62 /// Fetches the safe head hash from the oracle.
63 pub async fn fetch<O>(
64 oracle: &O,
65 agreed_l2_output_root: B256,
66 ) -> Result<B256, OracleProviderError>
67 where
68 O: PreimageOracleClient + Send,
69 {
70 let preimage = oracle
71 .get(PreimageKey::new_keccak256(*agreed_l2_output_root))
72 .await
73 .map_err(OracleProviderError::Preimage)?;
74 OutputRoot::decode(&preimage)
75 .map(|root| root.block_hash)
76 .ok_or(OracleProviderError::InvalidOutputRootPreimage)
77 }
78}

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected