Skip to content

Commit

Permalink
Rename RollupConfig to FullNodeConfig (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakanalh authored Jun 18, 2024
1 parent 329e52e commit 196c015
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions bin/citrea/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sov_mock_da::MockDaConfig;
use sov_modules_api::Spec;
use sov_modules_rollup_blueprint::RollupBlueprint;
use sov_state::storage::NativeStorage;
use sov_stf_runner::{from_toml_path, ProverConfig, RollupConfig};
use sov_stf_runner::{from_toml_path, FullNodeConfig, ProverConfig};
use tracing::{error, instrument};

#[cfg(test)]
Expand Down Expand Up @@ -135,7 +135,7 @@ where
S: CitreaRollupBlueprint<DaConfig = DaC>,
<<S as RollupBlueprint>::NativeContext as Spec>::Storage: NativeStorage,
{
let rollup_config: RollupConfig<DaC> = from_toml_path(rollup_config_path)
let rollup_config: FullNodeConfig<DaC> = from_toml_path(rollup_config_path)
.context("Failed to read rollup configuration")
.unwrap();
let rollup_blueprint = S::new();
Expand Down
8 changes: 4 additions & 4 deletions bin/citrea/src/rollup/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use sov_prover_storage_manager::ProverStorageManager;
use sov_rollup_interface::da::DaVerifier;
use sov_rollup_interface::zk::{Zkvm, ZkvmHost};
use sov_state::{DefaultStorageSpec, Storage, ZkStorage};
use sov_stf_runner::{ParallelProverService, ProverConfig, RollupConfig};
use sov_stf_runner::{FullNodeConfig, ParallelProverService, ProverConfig};
use tracing::instrument;

use crate::CitreaRollupBlueprint;
Expand Down Expand Up @@ -92,7 +92,7 @@ impl RollupBlueprint for BitcoinRollup {
#[instrument(level = "trace", skip_all, err)]
fn create_storage_manager(
&self,
rollup_config: &sov_stf_runner::RollupConfig<Self::DaConfig>,
rollup_config: &sov_stf_runner::FullNodeConfig<Self::DaConfig>,
) -> Result<Self::StorageManager, anyhow::Error> {
let storage_config = StorageConfig {
path: rollup_config.storage.path.clone(),
Expand All @@ -103,7 +103,7 @@ impl RollupBlueprint for BitcoinRollup {
#[instrument(level = "trace", skip_all)]
async fn create_da_service(
&self,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> Self::DaService {
BitcoinService::new(
rollup_config.da.clone(),
Expand All @@ -119,7 +119,7 @@ impl RollupBlueprint for BitcoinRollup {
async fn create_prover_service(
&self,
prover_config: ProverConfig,
_rollup_config: &RollupConfig<Self::DaConfig>,
_rollup_config: &FullNodeConfig<Self::DaConfig>,
_da_service: &Self::DaService,
) -> Self::ProverService {
let vm = Risc0BonsaiHost::new(
Expand Down
8 changes: 4 additions & 4 deletions bin/citrea/src/rollup/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sov_modules_stf_blueprint::StfBlueprint;
use sov_prover_storage_manager::ProverStorageManager;
use sov_rollup_interface::zk::{Zkvm, ZkvmHost};
use sov_state::{DefaultStorageSpec, Storage, ZkStorage};
use sov_stf_runner::{ParallelProverService, ProverConfig, RollupConfig};
use sov_stf_runner::{FullNodeConfig, ParallelProverService, ProverConfig};

use crate::CitreaRollupBlueprint;

Expand Down Expand Up @@ -81,15 +81,15 @@ impl RollupBlueprint for MockDemoRollup {

async fn create_da_service(
&self,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> Self::DaService {
MockDaService::new(rollup_config.da.sender_address, &rollup_config.da.db_path)
}

async fn create_prover_service(
&self,
prover_config: ProverConfig,
_rollup_config: &RollupConfig<Self::DaConfig>,
_rollup_config: &FullNodeConfig<Self::DaConfig>,
_da_service: &Self::DaService,
) -> Self::ProverService {
let vm = Risc0BonsaiHost::new(
Expand All @@ -113,7 +113,7 @@ impl RollupBlueprint for MockDemoRollup {

fn create_storage_manager(
&self,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> anyhow::Result<Self::StorageManager> {
let storage_config = StorageConfig {
path: rollup_config.storage.path.clone(),
Expand Down
8 changes: 4 additions & 4 deletions bin/citrea/src/rollup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sov_modules_api::Spec;
use sov_modules_rollup_blueprint::RollupBlueprint;
use sov_modules_stf_blueprint::{Runtime as RuntimeTrait, StfBlueprint};
use sov_state::storage::NativeStorage;
use sov_stf_runner::{InitVariant, ProverConfig, RollupConfig};
use sov_stf_runner::{FullNodeConfig, InitVariant, ProverConfig};
use tracing::instrument;

mod bitcoin;
Expand All @@ -26,7 +26,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint {
Self::NativeContext,
Self::DaSpec,
>>::GenesisPaths,
rollup_config: RollupConfig<Self::DaConfig>,
rollup_config: FullNodeConfig<Self::DaConfig>,
sequencer_config: SequencerConfig,
) -> Result<Sequencer<Self>, anyhow::Error>
where
Expand Down Expand Up @@ -92,7 +92,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint {
Self::NativeContext,
Self::DaSpec,
>>::GenesisPaths,
rollup_config: RollupConfig<Self::DaConfig>,
rollup_config: FullNodeConfig<Self::DaConfig>,
) -> Result<FullNode<Self>, anyhow::Error>
where
<Self::NativeContext as Spec>::Storage: NativeStorage,
Expand Down Expand Up @@ -163,7 +163,7 @@ pub trait CitreaRollupBlueprint: RollupBlueprint {
Self::NativeContext,
Self::DaSpec,
>>::GenesisPaths,
rollup_config: RollupConfig<Self::DaConfig>,
rollup_config: FullNodeConfig<Self::DaConfig>,
prover_config: ProverConfig,
) -> Result<Prover<Self>, anyhow::Error>
where
Expand Down
8 changes: 4 additions & 4 deletions bin/citrea/tests/test_helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sov_mock_da::{MockAddress, MockDaConfig, MockDaService};
use sov_modules_api::default_signature::private_key::DefaultPrivateKey;
use sov_modules_api::PrivateKey;
use sov_stf_runner::{
ProverConfig, RollupConfig, RollupPublicKeys, RpcConfig, RunnerConfig, StorageConfig,
FullNodeConfig, ProverConfig, RollupPublicKeys, RpcConfig, RunnerConfig, StorageConfig,
};
use tempfile::TempDir;
use tokio::sync::oneshot;
Expand All @@ -39,7 +39,7 @@ pub async fn start_rollup(
da_db_path: PathBuf,
min_soft_confirmations_per_commitment: u64,
include_tx_body: bool,
rollup_config: Option<RollupConfig<MockDaConfig>>,
rollup_config: Option<FullNodeConfig<MockDaConfig>>,
sequencer_config: Option<SequencerConfig>,
test_mode: Option<bool>,
deposit_mempool_fetch_limit: usize,
Expand Down Expand Up @@ -124,8 +124,8 @@ pub fn create_default_rollup_config(
rollup_path: &Path,
da_path: &Path,
node_mode: NodeMode,
) -> RollupConfig<MockDaConfig> {
RollupConfig {
) -> FullNodeConfig<MockDaConfig> {
FullNodeConfig {
public_keys: RollupPublicKeys {
sequencer_public_key: vec![
32, 64, 64, 227, 100, 193, 15, 43, 236, 156, 31, 229, 0, 161, 205, 76, 36, 124,
Expand Down
6 changes: 3 additions & 3 deletions crates/sovereign-sdk/full-node/sov-stf-runner/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub struct RollupPublicKeys {
}
/// Rollup Configuration
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct RollupConfig<DaServiceConfig> {
pub struct FullNodeConfig<DaServiceConfig> {
/// RPC configuration
pub rpc: RpcConfig,
/// Currently rollup config runner only supports storage path parameter
Expand Down Expand Up @@ -176,10 +176,10 @@ mod tests {

let config_file = create_config_from(&config);

let config: RollupConfig<sov_mock_da::MockDaConfig> =
let config: FullNodeConfig<sov_mock_da::MockDaConfig> =
from_toml_path(config_file.path()).unwrap();

let expected = RollupConfig {
let expected = FullNodeConfig {
runner: Some(RunnerConfig {
sequencer_client_url: "http://0.0.0.0:12346".to_owned(),
include_tx_body: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use sov_mock_zkvm::{MockCodeCommitment, MockZkvm};
use sov_prover_storage_manager::ProverStorageManager;
use sov_state::{ArrayWitness, DefaultStorageSpec};
use sov_stf_runner::{
InitVariant, ParallelProverService, RollupConfig, RollupPublicKeys, RpcConfig, RunnerConfig,
FullNodeConfig, InitVariant, ParallelProverService, RollupPublicKeys, RpcConfig, RunnerConfig,
StateTransitionRunner, StorageConfig,
};

Expand Down Expand Up @@ -67,7 +67,7 @@ fn initialize_runner(
}

let address = MockAddress::new([11u8; 32]);
let rollup_config = RollupConfig::<MockDaConfig> {
let rollup_config = FullNodeConfig::<MockDaConfig> {
storage: StorageConfig {
path: rollup_storage_path.clone(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sov_mock_da::{
use sov_mock_zkvm::MockZkvm;
use sov_modules_api::default_context::DefaultContext;
use sov_stf_runner::{
InitVariant, ParallelProverService, ProverGuestRunConfig, RollupConfig, RollupPublicKeys,
FullNodeConfig, InitVariant, ParallelProverService, ProverGuestRunConfig, RollupPublicKeys,
RpcConfig, RunnerConfig, StateTransitionRunner, StorageConfig,
};

Expand Down Expand Up @@ -118,7 +118,7 @@ async fn runner_execution(
da_service: MockDaService,
) -> ([u8; 32], [u8; 32]) {
let rollup_storage_path = storage_path.join("rollup").to_path_buf();
let rollup_config = RollupConfig::<MockDaConfig> {
let rollup_config = FullNodeConfig::<MockDaConfig> {
storage: StorageConfig {
path: rollup_storage_path.clone(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use sov_rollup_interface::zk::{Zkvm, ZkvmHost};
use sov_state::storage::NativeStorage;
use sov_state::Storage;
use sov_stf_runner::{
InitVariant, ProverConfig, ProverService, RollupConfig, StateTransitionRunner,
FullNodeConfig, InitVariant, ProverConfig, ProverService, StateTransitionRunner,
};
use tokio::sync::oneshot;
use tracing::{instrument, Instrument};
Expand Down Expand Up @@ -83,7 +83,7 @@ pub trait RollupBlueprint: Sized + Send + Sync {
Self::NativeContext,
Self::DaSpec,
>>::GenesisPaths,
_rollup_config: &RollupConfig<Self::DaConfig>,
_rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> anyhow::Result<
GenesisParams<
<Self::NativeRuntime as RuntimeTrait<Self::NativeContext, Self::DaSpec>>::GenesisConfig,
Expand All @@ -102,26 +102,26 @@ pub trait RollupBlueprint: Sized + Send + Sync {
/// Creates instance of [`DaService`].
async fn create_da_service(
&self,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> Self::DaService;

/// Creates instance of [`ProverService`].
async fn create_prover_service(
&self,
prover_config: ProverConfig,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
da_service: &Self::DaService,
) -> Self::ProverService;

/// Creates instance of [`Self::StorageManager`].
/// Panics if initialization fails.
fn create_storage_manager(
&self,
rollup_config: &RollupConfig<Self::DaConfig>,
rollup_config: &FullNodeConfig<Self::DaConfig>,
) -> Result<Self::StorageManager, anyhow::Error>;

/// Creates instance of a LedgerDB.
fn create_ledger_db(&self, rollup_config: &RollupConfig<Self::DaConfig>) -> LedgerDB {
fn create_ledger_db(&self, rollup_config: &FullNodeConfig<Self::DaConfig>) -> LedgerDB {
LedgerDB::with_path(&rollup_config.storage.path).expect("Ledger DB failed to open")
}

Expand All @@ -133,7 +133,7 @@ pub trait RollupBlueprint: Sized + Send + Sync {
Self::NativeContext,
Self::DaSpec,
>>::GenesisPaths,
rollup_config: RollupConfig<Self::DaConfig>,
rollup_config: FullNodeConfig<Self::DaConfig>,
) -> Result<FullNode<Self>, anyhow::Error>
where
<Self::NativeContext as Spec>::Storage: NativeStorage,
Expand Down

0 comments on commit 196c015

Please sign in to comment.