1#![deny(missing_docs)]
2#![doc = include_str!("../README.md")]
3
4#[cfg(feature = "native")]
5mod config;
6
7#[cfg(feature = "native")]
8use std::path::Path;
9
10#[cfg(feature = "native")]
11use anyhow::Context;
12use borsh::{BorshDeserialize, BorshSerialize};
13#[cfg(feature = "native")]
14pub use config::RpcConfig;
15#[cfg(feature = "native")]
16mod runner;
17#[cfg(feature = "native")]
18pub use config::{from_toml_path, RollupConfig, RunnerConfig, StorageConfig};
19#[cfg(feature = "native")]
20pub use runner::*;
21use serde::de::DeserializeOwned;
22use serde::{Deserialize, Serialize};
23use sov_rollup_interface::da::DaSpec;
24
25pub mod verifier;
27
28#[derive(Serialize, BorshDeserialize, BorshSerialize, Deserialize)]
29#[serde(bound = "StateRoot: Serialize + DeserializeOwned, Witness: Serialize + DeserializeOwned")]
32pub struct StateTransitionData<StateRoot, Witness, DA: DaSpec> {
34 pub pre_state_root: StateRoot,
36 pub da_block_header: DA::BlockHeader,
38 pub inclusion_proof: DA::InclusionMultiProof,
40 pub completeness_proof: DA::CompletenessProof,
42 pub blobs: Vec<<DA as DaSpec>::BlobTransaction>,
44 pub state_transition_witness: Witness,
46}
47
48#[cfg(feature = "native")]
49pub fn read_json_file<T: DeserializeOwned, P: AsRef<Path>>(path: P) -> anyhow::Result<T> {
51 let path_str = path.as_ref().display();
52
53 let data = std::fs::read_to_string(&path)
54 .with_context(|| format!("Failed to read genesis from {}", path_str))?;
55 let config: T = serde_json::from_str(&data)
56 .with_context(|| format!("Failed to parse genesis from {}", path_str))?;
57
58 Ok(config)
59}