diff --git a/Cargo.lock b/Cargo.lock index dc07ccd..b11fbf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -313,11 +313,7 @@ name = "cesium-cli" version = "0.2.0" [[package]] -name = "cesium-econ" -version = "0.2.0" - -[[package]] -name = "cesium-material" +name = "cesium-crypto" version = "0.2.0" dependencies = [ "bs58", @@ -329,6 +325,14 @@ dependencies = [ "sha3", ] +[[package]] +name = "cesium-material" +version = "0.2.0" +dependencies = [ + "cesium-crypto", + "rand", +] + [[package]] name = "cesium-mempool" version = "0.2.0" @@ -344,7 +348,7 @@ version = "0.2.0" name = "cesium-proc" version = "0.2.0" dependencies = [ - "cesium-material", + "cesium-crypto", "dashmap", "tokio", ] @@ -353,6 +357,7 @@ dependencies = [ name = "cesium-state" version = "0.2.0" dependencies = [ + "cesium-crypto", "cesium-material", "tokio", ] @@ -362,7 +367,7 @@ name = "cesium-storage" version = "0.2.0" dependencies = [ "bincode", - "cesium-material", + "cesium-crypto", "rocksdb", "serde", "tempfile", @@ -1841,7 +1846,7 @@ dependencies = [ name = "selenide-wasm" version = "0.2.0" dependencies = [ - "cesium-material", + "cesium-crypto", "wasmer", "wasmer-middlewares", ] diff --git a/Cargo.toml b/Cargo.toml index 1e4a662..4a83f7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,11 @@ resolver = "2" members = [ # Inner libs + "crates/cesium-crypto", "crates/cesium-storage", "crates/cesium-material", "crates/cesium-mempool", "crates/cesium-state", - "crates/cesium-econ", "crates/cesium-proc", "crates/selenide-sdk", "crates/selenide-sdk-macros", @@ -59,11 +59,11 @@ wasmer-middlewares = "5.0.0" clap = { version = "4.5.20", features = ["derive"]} dashmap = "6.1.0" # Inner libs +cesium-crypto = { path = "crates/cesium-crypto" } cesium-storage = { path = "crates/cesium-storage" } cesium-material = { path = "crates/cesium-material" } cesium-mempool = { path = "crates/cesium-mempool" } cesium-state = { path = "crates/cesium-state" } -cesium-econ = { path = "crates/cesium-econ" } cesium-runtime = { path = "crates/cesium-runtime" } cesium-proc = { path = "crates/cesium-proc" } selenide-sdk = { path = "crates/selenide-sdk" } diff --git a/crates/cesium-crypto/Cargo.toml b/crates/cesium-crypto/Cargo.toml new file mode 100644 index 0000000..b8de00f --- /dev/null +++ b/crates/cesium-crypto/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "cesium-crypto" +edition = "2021" +version.workspace = true +license = "GPL-3.0" +publish = false + + +[dependencies] +pqcrypto-sphincsplus.workspace = true +pqcrypto-traits.workspace = true +hex.workspace = true +rand.workspace = true +bs58.workspace = true +serde.workspace = true +sha3.workspace = true \ No newline at end of file diff --git a/crates/cesium-material/src/constants.rs b/crates/cesium-crypto/src/constants.rs similarity index 92% rename from crates/cesium-material/src/constants.rs rename to crates/cesium-crypto/src/constants.rs index bf519ff..93448b2 100644 --- a/crates/cesium-material/src/constants.rs +++ b/crates/cesium-crypto/src/constants.rs @@ -1,5 +1,4 @@ pub const DEFAULT_DECIMALS: u8 = 12; -pub const MAX_BLOCK_TRANSACTIONS: usize = 2250; pub const NATIVE_TOKEN: &str = "cesium111111111111111111111111111111111111111111111111111111111111"; // [99, 101, 115, 105, 117, 109, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49] pub const NATIVE_DECIMALS: u8 = 12; diff --git a/crates/cesium-material/src/id.rs b/crates/cesium-crypto/src/id.rs similarity index 100% rename from crates/cesium-material/src/id.rs rename to crates/cesium-crypto/src/id.rs diff --git a/crates/cesium-material/src/keys.rs b/crates/cesium-crypto/src/keys.rs similarity index 100% rename from crates/cesium-material/src/keys.rs rename to crates/cesium-crypto/src/keys.rs diff --git a/crates/cesium-crypto/src/lib.rs b/crates/cesium-crypto/src/lib.rs new file mode 100644 index 0000000..0f66fb7 --- /dev/null +++ b/crates/cesium-crypto/src/lib.rs @@ -0,0 +1,4 @@ +pub mod constants; +pub mod id; +pub mod keys; +pub mod serializer; diff --git a/crates/cesium-material/src/serializer.rs b/crates/cesium-crypto/src/serializer.rs similarity index 100% rename from crates/cesium-material/src/serializer.rs rename to crates/cesium-crypto/src/serializer.rs diff --git a/crates/cesium-econ/Cargo.toml b/crates/cesium-econ/Cargo.toml deleted file mode 100644 index c5daf99..0000000 --- a/crates/cesium-econ/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "cesium-econ" -edition = "2021" -version.workspace = true -license = "GPL-3.0" -publish = false - -[dependencies] diff --git a/crates/cesium-econ/src/lib.rs b/crates/cesium-econ/src/lib.rs deleted file mode 100644 index 8b13789..0000000 --- a/crates/cesium-econ/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/cesium-material/Cargo.toml b/crates/cesium-material/Cargo.toml index a1ab4a5..66f4e90 100644 --- a/crates/cesium-material/Cargo.toml +++ b/crates/cesium-material/Cargo.toml @@ -7,10 +7,5 @@ publish = false [dependencies] -pqcrypto-sphincsplus.workspace = true -pqcrypto-traits.workspace = true -hex.workspace = true rand.workspace = true -bs58.workspace = true -serde.workspace = true -sha3.workspace = true \ No newline at end of file +cesium-crypto.workspace = true \ No newline at end of file diff --git a/crates/cesium-material/src/block.rs b/crates/cesium-material/src/block.rs index bf7d4eb..515bf5c 100644 --- a/crates/cesium-material/src/block.rs +++ b/crates/cesium-material/src/block.rs @@ -1,10 +1,9 @@ +use cesium_crypto::keys::{KeyPair, PublicKeyBytes}; use rand::Rng; -use crate::{ - constants::MAX_BLOCK_TRANSACTIONS, - keys::{KeyPair, PublicKeyBytes}, - transaction::Transaction, -}; +use crate::transaction::Transaction; + +const MAX_BLOCK_TRANSACTIONS: usize = 2250; pub struct Block { pub index: u64, @@ -97,13 +96,15 @@ impl Block { #[cfg(test)] mod tests { - use super::*; - use crate::{ + use cesium_crypto::{ constants::{NATIVE_DECIMALS, NATIVE_TOKEN}, - instruction::Instruction, - keys::{self, KeyPair, SIG_BYTE_LEN}, + keys::{self, SIG_BYTE_LEN}, }; + use crate::instruction::Instruction; + + use super::*; + #[test] fn test_block() { let sender_kp = KeyPair::create(); diff --git a/crates/cesium-material/src/instruction.rs b/crates/cesium-material/src/instruction.rs index 9443498..a036cbd 100644 --- a/crates/cesium-material/src/instruction.rs +++ b/crates/cesium-material/src/instruction.rs @@ -1,6 +1,7 @@ -use crate::constants::NATIVE_TOKEN; -use crate::keys; -use crate::keys::PublicKeyBytes; +use cesium_crypto::{ + constants::NATIVE_TOKEN, + keys::{self, PublicKeyBytes}, +}; pub struct DataParameter { pub d: Vec, // the data diff --git a/crates/cesium-material/src/lib.rs b/crates/cesium-material/src/lib.rs index 39d14e5..ec9e1ae 100644 --- a/crates/cesium-material/src/lib.rs +++ b/crates/cesium-material/src/lib.rs @@ -1,7 +1,3 @@ pub mod block; -pub mod constants; -pub mod id; pub mod instruction; -pub mod keys; -pub mod serializer; pub mod transaction; diff --git a/crates/cesium-material/src/transaction.rs b/crates/cesium-material/src/transaction.rs index a8629e9..cfab69d 100644 --- a/crates/cesium-material/src/transaction.rs +++ b/crates/cesium-material/src/transaction.rs @@ -1,4 +1,6 @@ -use crate::{instruction::Instruction, keys::KeyPair}; +use cesium_crypto::keys::KeyPair; + +use crate::instruction::Instruction; pub struct Transaction { pub instructions: Vec, diff --git a/crates/cesium-proc/Cargo.toml b/crates/cesium-proc/Cargo.toml index e40303d..d19fd96 100644 --- a/crates/cesium-proc/Cargo.toml +++ b/crates/cesium-proc/Cargo.toml @@ -7,5 +7,5 @@ publish = false [dependencies] tokio.workspace = true -cesium-material.workspace = true +cesium-crypto.workspace = true dashmap.workspace = true \ No newline at end of file diff --git a/crates/cesium-proc/src/graph/dag.rs b/crates/cesium-proc/src/graph/dag.rs index 9c939b5..30453d6 100644 --- a/crates/cesium-proc/src/graph/dag.rs +++ b/crates/cesium-proc/src/graph/dag.rs @@ -1,4 +1,4 @@ -use cesium_material::{ +use cesium_crypto::{ id::generate_id, keys::{slice_to_array_48, SIG_BYTE_LEN}, }; diff --git a/crates/cesium-state/Cargo.toml b/crates/cesium-state/Cargo.toml index 9ff015a..ea295cb 100644 --- a/crates/cesium-state/Cargo.toml +++ b/crates/cesium-state/Cargo.toml @@ -6,5 +6,6 @@ license = "GPL-3.0" publish = false [dependencies] +cesium-crypto.workspace = true cesium-material.workspace = true tokio.workspace = true \ No newline at end of file diff --git a/crates/cesium-state/src/block.rs b/crates/cesium-state/src/block.rs index d8d0381..e139d5d 100644 --- a/crates/cesium-state/src/block.rs +++ b/crates/cesium-state/src/block.rs @@ -1,4 +1,5 @@ -use cesium_material::{block::Block, keys::KeyPair}; +use cesium_crypto::keys::KeyPair; +use cesium_material::block::Block; use std::sync::Arc; use tokio::sync::OnceCell; diff --git a/crates/cesium-storage/Cargo.toml b/crates/cesium-storage/Cargo.toml index f61692b..434cd2a 100644 --- a/crates/cesium-storage/Cargo.toml +++ b/crates/cesium-storage/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] -cesium-material.workspace = true +cesium-crypto.workspace = true rocksdb.workspace = true # tokio.workspace = true bincode.workspace = true diff --git a/crates/cesium-storage/src/account.rs b/crates/cesium-storage/src/account.rs index 5499655..c32e8bd 100644 --- a/crates/cesium-storage/src/account.rs +++ b/crates/cesium-storage/src/account.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use cesium_material::id::{generate_id, to_readable_id}; +use cesium_crypto::id::{generate_id, to_readable_id}; use rocksdb::{Options, WriteBatch, DB}; use serde::{Deserialize, Serialize}; @@ -85,7 +85,7 @@ impl DataAccountManager { #[cfg(test)] mod tests { use super::*; - use cesium_material::keys::KeyPair; + use cesium_crypto::keys::KeyPair; use tempfile::TempDir; #[test] diff --git a/crates/cesium-storage/src/data.rs b/crates/cesium-storage/src/data.rs index f5b3e9b..9003b90 100644 --- a/crates/cesium-storage/src/data.rs +++ b/crates/cesium-storage/src/data.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use cesium_material::serializer::Array48; +use cesium_crypto::serializer::Array48; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct DataObject { diff --git a/crates/selenide-wasm/Cargo.toml b/crates/selenide-wasm/Cargo.toml index 0d34ea7..d9fd79e 100644 --- a/crates/selenide-wasm/Cargo.toml +++ b/crates/selenide-wasm/Cargo.toml @@ -9,4 +9,4 @@ publish = false [dependencies] wasmer.workspace = true wasmer-middlewares.workspace = true -cesium-material.workspace = true \ No newline at end of file +cesium-crypto.workspace = true \ No newline at end of file diff --git a/crates/selenide-wasm/src/functions/generate_id.rs b/crates/selenide-wasm/src/functions/generate_id.rs index d942d8d..b12f2f2 100644 --- a/crates/selenide-wasm/src/functions/generate_id.rs +++ b/crates/selenide-wasm/src/functions/generate_id.rs @@ -1,4 +1,4 @@ -use cesium_material::id::generate_id; +use cesium_crypto::id::generate_id; use wasmer::FunctionEnvMut; use crate::{env::ContractEnv, memory};