Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions examples/demo-prover/benches/prover_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ async fn main() -> Result<(), anyhow::Error> {
}

let rollup_config_path = "benches/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
let mut rollup_config: RollupConfig<
sov_celestia_adapter::DaServiceConfig,
sov_state::config::Config,
> = from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();

let mut num_blocks = 0;
let mut num_blobs = 0;
Expand Down
2 changes: 0 additions & 2 deletions examples/demo-prover/methods/guest-celestia/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/demo-prover/methods/guest-mock/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions examples/demo-rollup/benches/rollup_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ fn rollup_bench(_bench: &mut Criterion) {
.sample_size(10)
.measurement_time(Duration::from_secs(20));
let rollup_config_path = "benches/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
let mut rollup_config: RollupConfig<
sov_celestia_adapter::DaServiceConfig,
sov_state::config::Config,
> = from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();

let temp_dir = TempDir::new().expect("Unable to create temporary directory");
rollup_config.storage.path = PathBuf::from(temp_dir.path());
Expand Down
10 changes: 6 additions & 4 deletions examples/demo-rollup/benches/rollup_coarse_measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ async fn main() -> Result<(), anyhow::Error> {
}

let rollup_config_path = "benches/rollup_config.toml".to_string();
let mut rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
let mut rollup_config: RollupConfig<
sov_celestia_adapter::DaServiceConfig,
sov_state::config::Config,
> = from_toml_path(&rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();

let temp_dir = TempDir::new().expect("Unable to create temporary directory");
rollup_config.storage.path = PathBuf::from(temp_dir.path());
Expand Down
8 changes: 4 additions & 4 deletions examples/demo-rollup/src/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use const_rollup_config::SEQUENCER_DA_ADDRESS;
#[cfg(feature = "experimental")]
use demo_stf::app::DefaultPrivateKey;
use demo_stf::app::{create_zk_app_template, App, DefaultContext};
use demo_stf::genesis_config::{get_genesis_config, GenesisPaths};
use demo_stf::genesis_config::{get_genesis_config, GenesisPaths, StorageConfig};
use demo_stf::runtime::{get_rpc_methods, GenesisConfig, Runtime};
use demo_stf::AppVerifier;
#[cfg(feature = "experimental")]
Expand Down Expand Up @@ -98,7 +98,7 @@ pub async fn new_rollup_with_celestia_da<Vm: ZkvmHost, P: AsRef<Path>>(
"Starting demo celestia rollup with config {}",
rollup_config_path
);
let rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let rollup_config: RollupConfig<sov_celestia_adapter::DaServiceConfig, StorageConfig> =
from_toml_path(rollup_config_path).context("Failed to read rollup configuration")?;

let ledger_db = initialize_ledger(&rollup_config.storage.path);
Expand Down Expand Up @@ -156,15 +156,15 @@ pub fn new_rollup_with_mock_da<Vm: ZkvmHost, P: AsRef<Path>>(
) -> Result<Rollup<Vm, MockDaService>, anyhow::Error> {
debug!("Starting mock rollup with config {}", rollup_config_path);

let rollup_config: RollupConfig<MockDaConfig> =
let rollup_config: RollupConfig<MockDaConfig, StorageConfig> =
from_toml_path(rollup_config_path).context("Failed to read rollup configuration")?;

new_rollup_with_mock_da_from_config(rollup_config, prover, genesis_paths)
}

/// Creates MockDa based rollup.
pub fn new_rollup_with_mock_da_from_config<Vm: ZkvmHost, P: AsRef<Path>>(
rollup_config: RollupConfig<MockDaConfig>,
rollup_config: RollupConfig<MockDaConfig, StorageConfig>,
prover: Option<(Vm, DemoProverConfig)>,
genesis_paths: &GenesisPaths<P>,
) -> Result<Rollup<Vm, MockDaService>, anyhow::Error> {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-rollup/tests/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use demo_stf::genesis_config::GenesisPaths;
use sov_demo_rollup::{new_rollup_with_mock_da_from_config, DemoProverConfig};
use sov_rollup_interface::mocks::MockDaConfig;
use sov_rollup_interface::zk::ZkvmHost;
use sov_stf_runner::{RollupConfig, RpcConfig, RunnerConfig, StorageConfig};
use sov_stf_runner::{RollupConfig, RpcConfig, RunnerConfig};
use tokio::sync::oneshot;

pub async fn start_rollup<Vm: ZkvmHost, P: AsRef<Path>>(
Expand All @@ -17,7 +17,7 @@ pub async fn start_rollup<Vm: ZkvmHost, P: AsRef<Path>>(
let temp_path = temp_dir.path();

let rollup_config = RollupConfig {
storage: StorageConfig {
storage: sov_state::config::Config {
path: temp_path.to_path_buf(),
},
runner: RunnerConfig {
Expand Down
8 changes: 4 additions & 4 deletions examples/demo-stf/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use sov_modules_stf_template::AppTemplate;
pub use sov_modules_stf_template::Batch;
use sov_rollup_interface::da::DaSpec;
use sov_rollup_interface::zk::Zkvm;
use sov_state::ZkStorage;
#[cfg(feature = "native")]
use sov_state::{ProverStorage, Storage};
use sov_sequencer::batch_builder::FiFoStrictBatchBuilder;
#[cfg(feature = "native")]
use sov_stf_runner::FiFoStrictBatchBuilder;
use sov_state::config::Config as StorageConfig;
use sov_state::ZkStorage;
#[cfg(feature = "native")]
use sov_stf_runner::StorageConfig;
use sov_state::{ProverStorage, Storage};

use crate::runtime::Runtime;

Expand Down
8 changes: 7 additions & 1 deletion full-node/sov-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ jsonrpsee = { workspace = true, features = ["client", "server"] }
serde = { workspace = true, features = ["derive"] }
tracing = { workspace = true }
sov-rollup-interface = { path = "../../rollup-interface", version = "0.2" }
sov-modules-api = { path = "../../module-system/sov-modules-api", version = "0.2" }
sov-state = { path = "../../module-system/sov-state", version = "0.2" }

[dev-dependencies]
tempfile = { workspace = true }
rand = { workspace = true }
tokio = { workspace = true }
async-trait = { workspace = true }

sov-rollup-interface = { path = "../../rollup-interface", features = ["mocks", "native"] }
tokio = { workspace = true }
sov-value-setter = { path = "../../module-system/module-implementations/examples/sov-value-setter", features = ["native"] }
5 changes: 4 additions & 1 deletion full-node/sov-sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
#![doc = include_str!("../README.md")]
use std::sync::Mutex;

/// Concrete implementations of `[BatchBuilder]`
pub mod batch_builder;
/// Utilities for the sequencer rpc
pub mod utils;

use anyhow::anyhow;
use jsonrpsee::types::ErrorObjectOwned;
use jsonrpsee::RpcModule;
use sov_modules_api::utils::to_jsonrpsee_error_object;
use sov_rollup_interface::services::batch_builder::BatchBuilder;
use sov_rollup_interface::services::da::DaService;
use utils::to_jsonrpsee_error_object;

const SEQUENCER_RPC_ERROR: &str = "SEQUENCER_RPC_ERROR";

Expand Down
10 changes: 0 additions & 10 deletions full-node/sov-sequencer/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use borsh::BorshSerialize;
use jsonrpsee::core::client::ClientT;
use jsonrpsee::http_client::{HttpClient, HttpClientBuilder};
use jsonrpsee::types::ErrorObjectOwned;
use jsonrpsee::ws_client::{WsClient, WsClientBuilder};
use tracing::info;

Expand Down Expand Up @@ -81,12 +80,3 @@ impl SimpleClient {
&self.ws_client
}
}

/// Creates an jsonrpsee ErrorObject
pub fn to_jsonrpsee_error_object(err: impl ToString, message: &str) -> ErrorObjectOwned {
ErrorObjectOwned::owned(
jsonrpsee::types::error::UNKNOWN_ERROR_CODE,
message,
Some(err.to_string()),
)
}
11 changes: 6 additions & 5 deletions full-node/sov-stf-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@ tokio = { workspace = true, optional = true }
hex = { workspace = true }
tracing = { workspace = true, optional = true }
futures = { workspace = true, optional = true }

sov-db = { path = "../db/sov-db", version = "0.2", optional = true }
sov-rollup-interface = { path = "../../rollup-interface", version = "0.2" }
sov-state = { path = "../../module-system/sov-state", version = "0.2" }
sov-modules-api = { path = "../../module-system/sov-modules-api", version = "0.2" }


[dev-dependencies]
tempfile = { workspace = true }
rand = { workspace = true }

sov-sequencer-registry = { path = "../../module-system/module-implementations/sov-sequencer-registry", features = ["native"] }
sov-bank = { path = "../../module-system/module-implementations/sov-bank", features = ["native"] }
sov-modules-stf-template = { path = "../../module-system/sov-modules-stf-template", features = ["native"] }
sov-value-setter = { path = "../../module-system/module-implementations/examples/sov-value-setter", features = ["native"] }

sov-accounts = { path = "../../module-system/module-implementations/sov-accounts", features = ["native"] }
sov-celestia-adapter = { path = "../../adapters/celestia", features = ["native"] }
sov-sequencer = { path = "../sov-sequencer" }

sov-state = { path = "../../module-system/sov-state" }
sov-modules-api = { path = "../../module-system/sov-modules-api" }

[features]
default = []
Expand Down
13 changes: 6 additions & 7 deletions full-node/sov-stf-runner/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::path::Path;

use serde::de::DeserializeOwned;
use serde::Deserialize;
pub use sov_state::config::Config as StorageConfig;

/// Configuration for StateTransitionRunner.
#[derive(Debug, Clone, PartialEq, Deserialize)]
Expand All @@ -26,12 +25,12 @@ pub struct RpcConfig {

/// Rollup Configuration
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct RollupConfig<DaServiceConfig> {
/// Runner configuration.
pub struct RollupConfig<DaServiceConfig, StorageConfig> {
/// Path to serialized storage configuration.
pub storage: StorageConfig,
/// TODO
/// Runner own configuration.
pub runner: RunnerConfig,
/// DA configuration.
/// Data Availability service configuration.
pub da: DaServiceConfig,
}

Expand Down Expand Up @@ -81,7 +80,7 @@ mod tests {

let config_file = create_config_from(config);

let config: RollupConfig<sov_celestia_adapter::DaServiceConfig> =
let config: RollupConfig<sov_celestia_adapter::DaServiceConfig, sov_state::config::Config> =
from_toml_path(config_file.path()).unwrap();
let expected = RollupConfig {
runner: RunnerConfig {
Expand All @@ -98,7 +97,7 @@ mod tests {
max_celestia_response_body_size: 980,
celestia_rpc_timeout_seconds: 60,
},
storage: StorageConfig {
storage: sov_state::config::Config {
path: PathBuf::from("/tmp"),
},
};
Expand Down
10 changes: 9 additions & 1 deletion full-node/sov-stf-runner/src/ledger_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use futures::future::{select, Either};
use jsonrpsee::types::ErrorObjectOwned;
use jsonrpsee::{RpcModule, SubscriptionMessage};
use serde::de::DeserializeOwned;
use serde::Serialize;
use sov_db::ledger_db::LedgerDB;
use sov_modules_api::utils::to_jsonrpsee_error_object;
use sov_rollup_interface::rpc::{
BatchIdentifier, EventIdentifier, LedgerRpcProvider, SlotIdentifier, TxIdentifier,
};
Expand Down Expand Up @@ -128,3 +128,11 @@ mod query_args {
Ok(QueryArgs(ids, Default::default()))
}
}

pub fn to_jsonrpsee_error_object(err: impl ToString, message: &str) -> ErrorObjectOwned {
ErrorObjectOwned::owned(
jsonrpsee::types::error::UNKNOWN_ERROR_CODE,
message,
Some(err.to_string()),
)
}
9 changes: 3 additions & 6 deletions full-node/sov-stf-runner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![deny(missing_docs)]
#![doc = include_str!("../README.md")]

#[cfg(feature = "native")]
mod batch_builder;
#[cfg(feature = "native")]
mod config;

Expand All @@ -14,16 +12,15 @@ mod ledger_rpc;
#[cfg(feature = "native")]
mod runner;
#[cfg(feature = "native")]
pub use batch_builder::FiFoStrictBatchBuilder;
#[cfg(feature = "native")]
pub use config::{from_toml_path, RollupConfig, RunnerConfig, StorageConfig};
pub use config::{from_toml_path, RollupConfig, RunnerConfig};
#[cfg(feature = "native")]
pub use ledger_rpc::get_ledger_rpc;
#[cfg(feature = "native")]
pub use runner::*;
use serde::{Deserialize, Serialize};
use sov_modules_api::{DaSpec, Zkvm};
use sov_rollup_interface::da::DaSpec;
use sov_rollup_interface::stf::StateTransitionFunction;
use sov_rollup_interface::zk::Zkvm;

/// Implements the `StateTransitionVerifier` type for checking the validity of a state transition
pub mod verifier;
Expand Down
3 changes: 1 addition & 2 deletions full-node/sov-stf-runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use std::net::SocketAddr;

use jsonrpsee::RpcModule;
use sov_db::ledger_db::{LedgerDB, SlotCommit};
use sov_modules_api::SlotData;
use sov_rollup_interface::da::{BlobReaderTrait, DaSpec};
use sov_rollup_interface::services::da::DaService;
use sov_rollup_interface::services::da::{DaService, SlotData};
use sov_rollup_interface::stf::StateTransitionFunction;
use sov_rollup_interface::zk::ZkvmHost;
use tokio::sync::oneshot;
Expand Down
3 changes: 1 addition & 2 deletions full-node/sov-stf-runner/src/verifier.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::marker::PhantomData;

use sov_modules_api::Zkvm;
use sov_rollup_interface::da::DaVerifier;
use sov_rollup_interface::stf::StateTransitionFunction;
use sov_rollup_interface::zk::ZkvmGuest;
use sov_rollup_interface::zk::{Zkvm, ZkvmGuest};

use crate::StateTransitionData;

Expand Down
Loading