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

Method load

crates/proof/proof/src/boot.rs:206–374  ·  view source on GitHub ↗

Load the boot information from the preimage oracle. This method retrieves all the necessary boot parameters from the preimage oracle using predefined local keys. It handles both verified inputs (from the fault proof system) and user-submitted inputs that need validation. # Arguments `oracle` - The preimage oracle client for reading boot data # Returns `Ok(BootInfo)` - Successfully loaded and va

(oracle: &O)

Source from the content-addressed store, hash-verified

204 /// - **Serde errors**: Failed to deserialize rollup configuration
205 /// - **Missing data**: Required boot parameters not available in oracle
206 pub async fn load<O>(oracle: &O) -> Result<Self, OracleProviderError>
207 where
208 O: PreimageOracleClient + Send,
209 {
210 let mut l1_head: B256 = B256::ZERO;
211 oracle
212 .get_exact(PreimageKey::new_local(L1_HEAD_KEY.to()), l1_head.as_mut())
213 .await
214 .map_err(OracleProviderError::Preimage)?;
215
216 let mut l2_output_root: B256 = B256::ZERO;
217 oracle
218 .get_exact(PreimageKey::new_local(L2_OUTPUT_ROOT_KEY.to()), l2_output_root.as_mut())
219 .await
220 .map_err(OracleProviderError::Preimage)?;
221
222 let mut l2_claim: B256 = B256::ZERO;
223 oracle
224 .get_exact(PreimageKey::new_local(L2_CLAIM_KEY.to()), l2_claim.as_mut())
225 .await
226 .map_err(OracleProviderError::Preimage)?;
227
228 let l2_claim_block = u64::from_be_bytes(
229 oracle
230 .get(PreimageKey::new_local(L2_CLAIM_BLOCK_NUMBER_KEY.to()))
231 .await
232 .map_err(OracleProviderError::Preimage)?
233 .as_slice()
234 .try_into()
235 .map_err(OracleProviderError::SliceConversion)?,
236 );
237 let chain_id = u64::from_be_bytes(
238 oracle
239 .get(PreimageKey::new_local(L2_CHAIN_ID_KEY.to()))
240 .await
241 .map_err(OracleProviderError::Preimage)?
242 .as_slice()
243 .try_into()
244 .map_err(OracleProviderError::SliceConversion)?,
245 );
246
247 let built_in_chain_config = base_common_chains::ChainConfig::by_chain_id(chain_id);
248 let activation_admin_address =
249 base_common_chains::ChainConfig::beryl_activation_admin_address_by_chain_id(chain_id);
250
251 // Attempt to load the rollup config from the chain ID. If there is no config for the chain,
252 // fall back to loading the config from the preimage oracle.
253 let rollup_config = if let Some(config) = built_in_chain_config {
254 config.rollup_config()
255 } else {
256 warn!(
257 target: "boot_loader",
258 chain_id,
259 "no built-in rollup config found for chain ID, falling back to preimage oracle; this is insecure in production without additional validation"
260 );
261 let ser_cfg = oracle
262 .get(PreimageKey::new_local(L2_ROLLUP_CONFIG_KEY.to()))
263 .await

Callers 15

find_open_issueFunction · 0.45
run_clientMethod · 0.45
runMethod · 0.45
proveMethod · 0.45
is_valid_signerMethod · 0.45
hitsMethod · 0.45
missesMethod · 0.45
prove_callsMethod · 0.45
get_callsMethod · 0.45
delete_callsMethod · 0.45
get_next_callsMethod · 0.45
heartbeat_callsMethod · 0.45

Calls 9

as_mutMethod · 0.80
try_intoMethod · 0.80
is_someMethod · 0.80
get_exactMethod · 0.45
toMethod · 0.45
getMethod · 0.45
rollup_configMethod · 0.45
idMethod · 0.45
cloneMethod · 0.45

Tested by 3

is_valid_signerMethod · 0.36
new_creates_empty_cacheFunction · 0.36
default_equals_newFunction · 0.36