#![deny(missing_docs)]
#![doc = include_str!("../README.md")]
#[cfg(feature = "native")]
mod config;
#[cfg(feature = "native")]
use std::path::Path;
#[cfg(feature = "native")]
use anyhow::Context;
use borsh::{BorshDeserialize, BorshSerialize};
#[cfg(feature = "native")]
pub use config::RpcConfig;
#[cfg(feature = "native")]
mod runner;
#[cfg(feature = "native")]
pub use config::{from_toml_path, RollupConfig, RunnerConfig, StorageConfig};
#[cfg(feature = "native")]
pub use runner::*;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use sov_rollup_interface::da::DaSpec;
pub mod verifier;
#[derive(Serialize, BorshDeserialize, BorshSerialize, Deserialize)]
#[serde(bound = "StateRoot: Serialize + DeserializeOwned, Witness: Serialize + DeserializeOwned")]
pub struct StateTransitionData<StateRoot, Witness, DA: DaSpec> {
pub pre_state_root: StateRoot,
pub da_block_header: DA::BlockHeader,
pub inclusion_proof: DA::InclusionMultiProof,
pub completeness_proof: DA::CompletenessProof,
pub blobs: Vec<<DA as DaSpec>::BlobTransaction>,
pub state_transition_witness: Witness,
}
#[cfg(feature = "native")]
pub fn read_json_file<T: DeserializeOwned, P: AsRef<Path>>(path: P) -> anyhow::Result<T> {
let path_str = path.as_ref().display();
let data = std::fs::read_to_string(&path)
.with_context(|| format!("Failed to read genesis from {}", path_str))?;
let config: T = serde_json::from_str(&data)
.with_context(|| format!("Failed to parse genesis from {}", path_str))?;
Ok(config)
}