diff --git a/Cargo.lock b/Cargo.lock index 31b5d19e7..01946b4a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7371,7 +7371,6 @@ dependencies = [ "bincode", "borsh", "byteorder", - "citrea-primitives", "criterion", "hex", "jmt", @@ -7563,7 +7562,6 @@ version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", - "citrea-primitives", "hex", "itertools 0.13.0", "jmt", @@ -7673,6 +7671,7 @@ dependencies = [ "sha2", "thiserror", "tokio", + "tracing", ] [[package]] @@ -7752,12 +7751,10 @@ dependencies = [ "anyhow", "async-trait", "borsh", - "citrea-primitives", "futures", "hex", "hyper 1.4.1", "jsonrpsee", - "num_cpus", "rand 0.8.5", "serde", "serde_json", diff --git a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock b/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock index 59e1b7dd4..2f4e96f65 100644 --- a/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock +++ b/bin/citrea/provers/risc0/guest-bitcoin/Cargo.lock @@ -2838,7 +2838,6 @@ version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", - "citrea-primitives", "hex", "itertools 0.13.0", "jmt", @@ -2909,9 +2908,7 @@ version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", - "citrea-primitives", "hex", - "num_cpus", "serde", "serde_json", "sov-modules-api", diff --git a/bin/citrea/provers/risc0/guest-mock/Cargo.lock b/bin/citrea/provers/risc0/guest-mock/Cargo.lock index 517af18b9..91560e0bf 100644 --- a/bin/citrea/provers/risc0/guest-mock/Cargo.lock +++ b/bin/citrea/provers/risc0/guest-mock/Cargo.lock @@ -2641,7 +2641,6 @@ version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", - "citrea-primitives", "hex", "itertools 0.13.0", "jmt", @@ -2712,9 +2711,7 @@ version = "0.4.0-rc.3" dependencies = [ "anyhow", "borsh", - "citrea-primitives", "hex", - "num_cpus", "serde", "serde_json", "sov-modules-api", diff --git a/bin/citrea/src/rollup/mod.rs b/bin/citrea/src/rollup/mod.rs index 36a0292ea..56654cb7c 100644 --- a/bin/citrea/src/rollup/mod.rs +++ b/bin/citrea/src/rollup/mod.rs @@ -1,7 +1,6 @@ use anyhow::anyhow; use async_trait::async_trait; use citrea_fullnode::{CitreaFullnode, FullNode}; -use citrea_primitives::fork::ForkManager; use citrea_primitives::forks::FORKS; use citrea_prover::{CitreaProver, Prover}; use citrea_sequencer::{CitreaSequencer, Sequencer, SequencerConfig}; @@ -11,6 +10,7 @@ use sov_modules_api::storage::HierarchicalStorageManager; use sov_modules_api::Spec; use sov_modules_rollup_blueprint::RollupBlueprint; use sov_modules_stf_blueprint::{Runtime as RuntimeTrait, StfBlueprint}; +use sov_rollup_interface::fork::ForkManager; use sov_state::storage::NativeStorage; use sov_stf_runner::{FullNodeConfig, InitVariant, ProverConfig}; use tokio::sync::broadcast; diff --git a/crates/fullnode/src/runner.rs b/crates/fullnode/src/runner.rs index 031722d48..0695c9c5d 100644 --- a/crates/fullnode/src/runner.rs +++ b/crates/fullnode/src/runner.rs @@ -6,7 +6,6 @@ use anyhow::{anyhow, bail}; use backoff::future::retry as retry_backoff; use backoff::ExponentialBackoffBuilder; use borsh::de::BorshDeserialize; -use citrea_primitives::fork::ForkManager; use citrea_primitives::types::SoftConfirmationHash; use citrea_primitives::{get_da_block_at_height, L1BlockCache, SyncError}; use jsonrpsee::core::client::Error as JsonrpseeError; @@ -25,6 +24,7 @@ use sov_rollup_interface::da::{ BlobReaderTrait, BlockHeaderTrait, DaDataBatchProof, DaDataLightClient, DaSpec, SequencerCommitment, }; +use sov_rollup_interface::fork::ForkManager; use sov_rollup_interface::rpc::SoftConfirmationStatus; use sov_rollup_interface::services::da::{DaService, SlotData}; use sov_rollup_interface::spec::SpecId; diff --git a/crates/fullnode/tests/runner_initialization_tests.rs b/crates/fullnode/tests/runner_initialization_tests.rs index e4402ad57..1bfeafe6c 100644 --- a/crates/fullnode/tests/runner_initialization_tests.rs +++ b/crates/fullnode/tests/runner_initialization_tests.rs @@ -2,12 +2,11 @@ use std::collections::HashMap; use std::sync::Arc; use citrea_fullnode::CitreaFullnode; -use citrea_primitives::fork::ForkManager; use sov_db::ledger_db::LedgerDB; use sov_mock_da::{MockAddress, MockDaConfig, MockDaService, MockDaSpec, MockValidityCond}; use sov_mock_zkvm::{MockCodeCommitment, MockZkvm}; use sov_prover_storage_manager::ProverStorageManager; -use sov_rollup_interface::fork::Fork; +use sov_rollup_interface::fork::{Fork, ForkManager}; use sov_rollup_interface::spec::SpecId; use sov_state::DefaultStorageSpec; use sov_stf_runner::{ diff --git a/crates/primitives/src/fork/mod.rs b/crates/primitives/src/fork/mod.rs deleted file mode 100644 index b77cfcf7e..000000000 --- a/crates/primitives/src/fork/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod manager; -mod migration; -#[cfg(test)] -mod tests; - -pub use manager::*; -pub use migration::*; diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 60b45190c..c9ac712f6 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -6,7 +6,6 @@ mod constants; mod da; #[cfg(feature = "native")] mod error; -pub mod fork; pub mod forks; pub mod types; #[cfg(feature = "native")] diff --git a/crates/prover/src/runner.rs b/crates/prover/src/runner.rs index e3d4c6374..00f2a4395 100644 --- a/crates/prover/src/runner.rs +++ b/crates/prover/src/runner.rs @@ -8,7 +8,6 @@ use anyhow::{anyhow, bail}; use backoff::exponential::ExponentialBackoffBuilder; use backoff::future::retry as retry_backoff; use borsh::de::BorshDeserialize; -use citrea_primitives::fork::ForkManager; use citrea_primitives::types::SoftConfirmationHash; use citrea_primitives::utils::merge_state_diffs; use citrea_primitives::{get_da_block_at_height, L1BlockCache, MAX_STATEDIFF_SIZE_PROOF_THRESHOLD}; @@ -23,6 +22,7 @@ use sov_modules_api::storage::HierarchicalStorageManager; use sov_modules_api::{BlobReaderTrait, Context, SignedSoftConfirmation, SlotData, StateDiff}; use sov_modules_stf_blueprint::StfBlueprintTrait; use sov_rollup_interface::da::{BlockHeaderTrait, DaData, DaSpec, SequencerCommitment}; +use sov_rollup_interface::fork::ForkManager; use sov_rollup_interface::rpc::SoftConfirmationStatus; use sov_rollup_interface::services::da::DaService; use sov_rollup_interface::spec::SpecId; diff --git a/crates/sequencer/src/sequencer.rs b/crates/sequencer/src/sequencer.rs index 469017568..2752efcde 100644 --- a/crates/sequencer/src/sequencer.rs +++ b/crates/sequencer/src/sequencer.rs @@ -8,7 +8,6 @@ use anyhow::{anyhow, bail}; use borsh::BorshDeserialize; use citrea_evm::{CallMessage, Evm, RlpEvmTransaction, MIN_TRANSACTION_GAS}; use citrea_primitives::basefee::calculate_next_block_base_fee; -use citrea_primitives::fork::ForkManager; use citrea_primitives::types::SoftConfirmationHash; use citrea_primitives::utils::merge_state_diffs; use citrea_primitives::MAX_STATEDIFF_SIZE_COMMITMENT_THRESHOLD; @@ -38,6 +37,7 @@ use sov_modules_api::{ }; use sov_modules_stf_blueprint::StfBlueprintTrait; use sov_rollup_interface::da::{BlockHeaderTrait, DaData, DaSpec, SequencerCommitment}; +use sov_rollup_interface::fork::ForkManager; use sov_rollup_interface::services::da::{DaService, SenderWithNotifier}; use sov_rollup_interface::stf::StateTransitionFunction; use sov_rollup_interface::storage::HierarchicalStorageManager; diff --git a/crates/sovereign-sdk/full-node/db/sov-db/Cargo.toml b/crates/sovereign-sdk/full-node/db/sov-db/Cargo.toml index c1e54a0f7..a1a33edb9 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/Cargo.toml +++ b/crates/sovereign-sdk/full-node/db/sov-db/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "sov-db" -description = "A high-level DB interface for the Sovereign SDK" -license = "Apache-2.0" # This license is inherited from Aptos -edition = { workspace = true } authors = { workspace = true } +edition = { workspace = true } homepage = { workspace = true } +license = "Apache-2.0" # This license is inherited from Aptos repository = { workspace = true } +description = "A high-level DB interface for the Sovereign SDK" version = { workspace = true } readme = "README.md" @@ -16,21 +16,14 @@ resolver = "2" [dependencies] # Maintained by sovereign labs jmt = { workspace = true } -sov-rollup-interface = { path = "../../../rollup-interface", features = [ - "native", -] } +sov-rollup-interface = { path = "../../../rollup-interface", features = ["native"] } sov-schema-db = { path = "../sov-schema-db" } -citrea-primitives = { path = "../../../../primitives" } - # External anyhow = { workspace = true, default-features = true } arbitrary = { workspace = true, optional = true } bincode = { workspace = true } -borsh = { workspace = true, default-features = true, features = [ - "bytes", - "rc", -] } +borsh = { workspace = true, default-features = true, features = ["bytes", "rc"] } byteorder = { workspace = true, default-features = true } hex = { workspace = true } proptest = { workspace = true, optional = true, default-features = true } diff --git a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs index babafe990..a6850c845 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs +++ b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs @@ -1,11 +1,10 @@ use std::path::Path; use std::sync::{Arc, Mutex}; -use citrea_primitives::fork::ForkMigration; use serde::de::DeserializeOwned; use serde::Serialize; use sov_rollup_interface::da::{DaSpec, SequencerCommitment}; -use sov_rollup_interface::fork::Fork; +use sov_rollup_interface::fork::{Fork, ForkMigration}; use sov_rollup_interface::services::da::SlotData; use sov_rollup_interface::stf::{BatchReceipt, Event, SoftConfirmationReceipt, StateDiff}; use sov_rollup_interface::zk::Proof; diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/Cargo.toml b/crates/sovereign-sdk/full-node/sov-stf-runner/Cargo.toml index 8bdb6925a..07b6ca97d 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/Cargo.toml +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/Cargo.toml @@ -19,7 +19,6 @@ futures = { workspace = true, optional = true } hex = { workspace = true } hyper = { workspace = true, optional = true } jsonrpsee = { workspace = true, features = ["http-client", "server"], optional = true } -num_cpus = { workspace = true } rand = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true } @@ -34,9 +33,6 @@ sov-db = { path = "../db/sov-db", optional = true } sov-modules-api = { path = "../../module-system/sov-modules-api", default-features = false } sov-rollup-interface = { path = "../../rollup-interface" } -# Citrea-Deps -citrea-primitives = { path = "../../../primitives" } - [dev-dependencies] sha2 = { workspace = true } tempfile = { workspace = true } diff --git a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/Cargo.toml b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/Cargo.toml index 843e90f97..6c0dd2da8 100644 --- a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/Cargo.toml +++ b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/Cargo.toml @@ -34,9 +34,6 @@ sov-state = { path = "../sov-state" } sov-zk-cycle-macros = { path = "../../utils/zk-cycle-macros", optional = true } sov-zk-cycle-utils = { path = "../../utils/zk-cycle-utils", optional = true } -# Citrea Deps -citrea-primitives = { path = "../../../primitives" } - [features] bench = ["sov-zk-cycle-macros", "risc0-zkvm", "risc0-zkvm-platform"] default = [] diff --git a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs index 080a7ecab..7c8bdc45c 100644 --- a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs +++ b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs @@ -2,7 +2,6 @@ #![doc = include_str!("../README.md")] use borsh::BorshDeserialize; -use citrea_primitives::fork::ForkManager; use itertools::Itertools; use rs_merkle::algorithms::Sha256; use rs_merkle::MerkleTree; @@ -17,7 +16,7 @@ use sov_modules_api::{ }; use sov_rollup_interface::da::{DaData, SequencerCommitment}; use sov_rollup_interface::digest::Digest; -use sov_rollup_interface::fork::Fork; +use sov_rollup_interface::fork::{Fork, ForkManager}; use sov_rollup_interface::soft_confirmation::SignedSoftConfirmation; use sov_rollup_interface::spec::SpecId; pub use sov_rollup_interface::stf::{BatchReceipt, TransactionReceipt}; diff --git a/crates/sovereign-sdk/rollup-interface/Cargo.toml b/crates/sovereign-sdk/rollup-interface/Cargo.toml index f5cf45faf..252788b2b 100644 --- a/crates/sovereign-sdk/rollup-interface/Cargo.toml +++ b/crates/sovereign-sdk/rollup-interface/Cargo.toml @@ -1,33 +1,34 @@ [package] name = "sov-rollup-interface" -description = "Defines interfaces for building rollups with the Sovereign SDK" authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } +description = "Defines interfaces for building rollups with the Sovereign SDK" version = { workspace = true } -readme = "README.md" -resolver = "2" exclude = [ - "specs/assets/*", + "specs/assets/*", ] +readme = "README.md" +resolver = "2" [dependencies] -arbitrary = { workspace = true, optional = true } anyhow = { workspace = true } +arbitrary = { workspace = true, optional = true } async-trait = { workspace = true } borsh = { workspace = true } bytes = { workspace = true, optional = true, default-features = true } digest = { workspace = true } +futures = { workspace = true, optional = true } hex = { workspace = true } serde = { workspace = true } sha2 = { workspace = true, optional = true } thiserror = { workspace = true, optional = true } -futures = { workspace = true, optional = true } # TODO: Remove tokio when https://github.com/Sovereign-Labs/sovereign-sdk/issues/1161 is resolved tokio = { workspace = true, optional = true } +tracing = { workspace = true, optional = true } # Proptest should be a dev-dependency, but those can't be optional proptest = { workspace = true, optional = true } @@ -38,19 +39,19 @@ serde_json = { workspace = true } [features] default = ["std"] -native = ["std", "tokio", "futures"] +native = ["std", "tokio", "futures", "tracing"] fuzzing = ["proptest", "proptest-derive", "sha2", "std"] testing = ["native"] arbitrary = ["dep:arbitrary"] std = [ - "anyhow/default", - "borsh/default", - "borsh/bytes", - "bytes", - "digest/default", - "hex/default", - "proptest?/default", - "serde/default", - "sha2?/default", - "thiserror" + "anyhow/default", + "borsh/default", + "borsh/bytes", + "bytes", + "digest/default", + "hex/default", + "proptest?/default", + "serde/default", + "sha2?/default", + "thiserror", ] diff --git a/crates/primitives/src/fork/manager.rs b/crates/sovereign-sdk/rollup-interface/src/fork/manager.rs similarity index 95% rename from crates/primitives/src/fork/manager.rs rename to crates/sovereign-sdk/rollup-interface/src/fork/manager.rs index f944ddebf..bd588e860 100644 --- a/crates/primitives/src/fork/manager.rs +++ b/crates/sovereign-sdk/rollup-interface/src/fork/manager.rs @@ -1,6 +1,8 @@ -use sov_rollup_interface::fork::Fork; +use alloc::boxed::Box; +use alloc::vec; +use alloc::vec::Vec; -use super::ForkMigration; +use super::{Fork, ForkMigration}; pub struct ForkManager { forks: Vec, diff --git a/crates/primitives/src/fork/migration.rs b/crates/sovereign-sdk/rollup-interface/src/fork/migration.rs similarity index 90% rename from crates/primitives/src/fork/migration.rs rename to crates/sovereign-sdk/rollup-interface/src/fork/migration.rs index 4d95aa4ee..cee812a4f 100644 --- a/crates/primitives/src/fork/migration.rs +++ b/crates/sovereign-sdk/rollup-interface/src/fork/migration.rs @@ -1,4 +1,4 @@ -use sov_rollup_interface::fork::Fork; +use super::Fork; /// Defines the interface of a migration pub trait ForkMigration { diff --git a/crates/sovereign-sdk/rollup-interface/src/fork.rs b/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs similarity index 79% rename from crates/sovereign-sdk/rollup-interface/src/fork.rs rename to crates/sovereign-sdk/rollup-interface/src/fork/mod.rs index b97aaf1b8..4acd997c9 100644 --- a/crates/sovereign-sdk/rollup-interface/src/fork.rs +++ b/crates/sovereign-sdk/rollup-interface/src/fork/mod.rs @@ -1,3 +1,13 @@ +#![allow(missing_docs)] + +mod manager; +mod migration; +#[cfg(test)] +mod tests; + +pub use manager::*; +pub use migration::*; + use crate::spec::SpecId; /// Fork is a wrapper struct that contains spec id and it's activation height diff --git a/crates/primitives/src/fork/tests.rs b/crates/sovereign-sdk/rollup-interface/src/fork/tests.rs similarity index 93% rename from crates/primitives/src/fork/tests.rs rename to crates/sovereign-sdk/rollup-interface/src/fork/tests.rs index 3194f32f6..597cd2f0d 100644 --- a/crates/primitives/src/fork/tests.rs +++ b/crates/sovereign-sdk/rollup-interface/src/fork/tests.rs @@ -1,9 +1,8 @@ use anyhow::anyhow; -use sov_rollup_interface::fork::Fork; -use sov_rollup_interface::spec::SpecId; use super::ForkManager; -use crate::fork::{fork_from_block_number, ForkMigration}; +use crate::fork::{fork_from_block_number, Fork, ForkMigration}; +use crate::spec::SpecId; #[test] fn test_fork_from_block_number() {