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)
| 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 |