diff --git a/Cargo.lock b/Cargo.lock index 384a0f687d7..c93225f27ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4886,6 +4886,7 @@ dependencies = [ "namada_proof_of_stake", "namada_state", "namada_storage", + "namada_systems", "namada_token", "namada_trans_token", "namada_tx", @@ -4970,6 +4971,7 @@ dependencies = [ "namada_parameters", "namada_proof_of_stake", "namada_state", + "namada_systems", "namada_token", "namada_trans_token", "namada_tx", @@ -5006,6 +5008,7 @@ dependencies = [ "namada_proof_of_stake", "namada_state", "namada_storage", + "namada_systems", "namada_token", "namada_tx", "namada_vm", @@ -5147,6 +5150,7 @@ dependencies = [ "namada_macros", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vp", "thiserror", @@ -5172,6 +5176,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -5282,6 +5287,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -5315,6 +5321,7 @@ dependencies = [ "namada_parameters", "namada_replay_protection", "namada_storage", + "namada_systems", "namada_tx", "patricia_tree", "pretty_assertions", @@ -5441,6 +5448,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vm", "namada_vp", diff --git a/crates/ethereum_bridge/Cargo.toml b/crates/ethereum_bridge/Cargo.toml index cd2aed558bd..49cc6e9c4f5 100644 --- a/crates/ethereum_bridge/Cargo.toml +++ b/crates/ethereum_bridge/Cargo.toml @@ -35,6 +35,7 @@ namada_parameters = {path = "../parameters"} namada_proof_of_stake = {path = "../proof_of_stake", default-features = false} namada_state = {path = "../state"} namada_storage = {path = "../storage"} +namada_systems = { path = "../systems" } namada_trans_token = {path = "../trans_token"} namada_tx = {path = "../tx"} namada_vote_ext = {path = "../vote_ext"} diff --git a/crates/ethereum_bridge/src/vp/bridge_pool_vp.rs b/crates/ethereum_bridge/src/vp/bridge_pool_vp.rs index b826488bd50..da8e03ca909 100644 --- a/crates/ethereum_bridge/src/vp/bridge_pool_vp.rs +++ b/crates/ethereum_bridge/src/vp/bridge_pool_vp.rs @@ -26,9 +26,9 @@ use namada_core::eth_bridge_pool::{ use namada_core::ethereum_events::EthAddress; use namada_core::hints; use namada_core::storage::Key; -use namada_core::token::{self, Amount}; use namada_core::uint::I320; use namada_state::{ResultExt, StateRead}; +use namada_systems::trans_token::{self as token, Amount}; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{self, Ctx, NativeVp, StorageReader, VpEvaluator}; diff --git a/crates/ethereum_bridge/src/vp/eth_bridge_vp.rs b/crates/ethereum_bridge/src/vp/eth_bridge_vp.rs index 39b2d802812..9fcd3e287d5 100644 --- a/crates/ethereum_bridge/src/vp/eth_bridge_vp.rs +++ b/crates/ethereum_bridge/src/vp/eth_bridge_vp.rs @@ -7,8 +7,8 @@ use namada_core::address::Address; use namada_core::booleans::BoolResultUnitExt; use namada_core::collections::HashSet; use namada_core::storage::Key; -use namada_core::token::{self, Amount}; use namada_state::StateRead; +use namada_systems::trans_token::{self as token, Amount}; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{self, Ctx, NativeVp, StorageReader, VpEvaluator}; diff --git a/crates/ethereum_bridge/src/vp/nut_vp.rs b/crates/ethereum_bridge/src/vp/nut_vp.rs index 009189bc678..f64e1234e0f 100644 --- a/crates/ethereum_bridge/src/vp/nut_vp.rs +++ b/crates/ethereum_bridge/src/vp/nut_vp.rs @@ -6,8 +6,8 @@ use std::marker::PhantomData; use namada_core::address::{Address, InternalAddress}; use namada_core::booleans::BoolResultUnitExt; use namada_core::storage::Key; -use namada_core::token::{self, Amount}; use namada_state::StateRead; +use namada_systems::trans_token::{self as token, Amount}; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{self, Ctx, NativeVp, VpEvaluator}; use namada_vp::VpEnv; diff --git a/crates/governance/Cargo.toml b/crates/governance/Cargo.toml index 2a8c94f5921..72cacdd3d02 100644 --- a/crates/governance/Cargo.toml +++ b/crates/governance/Cargo.toml @@ -27,6 +27,7 @@ namada_macros = { path = "../macros" } namada_migrations = { path= "../migrations", optional = true } namada_parameters = { path = "../parameters" } namada_state = { path = "../state" } +namada_systems = { path = "../systems" } namada_trans_token = { path = "../trans_token" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } diff --git a/crates/governance/src/lib.rs b/crates/governance/src/lib.rs index e1ef6ebcbc5..33d93a53358 100644 --- a/crates/governance/src/lib.rs +++ b/crates/governance/src/lib.rs @@ -35,6 +35,7 @@ pub mod utils; pub mod vp; use namada_state::StorageRead; +pub use namada_systems::governance::*; pub use storage::proposal::{InitProposalData, ProposalType, VoteProposalData}; pub use storage::vote::ProposalVote; pub use storage::{init_proposal, is_proposal_accepted, vote_proposal}; @@ -46,7 +47,7 @@ pub const ADDRESS: Address = address::GOV; #[derive(Debug)] pub struct Store(PhantomData); -impl namada_core::governance::Read for Store +impl Read for Store where S: StorageRead, { diff --git a/crates/governance/src/vp/mod.rs b/crates/governance/src/vp/mod.rs index 44776d7b1fe..9ac7d068d70 100644 --- a/crates/governance/src/vp/mod.rs +++ b/crates/governance/src/vp/mod.rs @@ -9,9 +9,10 @@ use std::marker::PhantomData; use borsh::BorshDeserialize; use namada_core::arith::{self, checked}; use namada_core::booleans::{BoolResultUnitExt, ResultBoolExt}; +use namada_core::storage; use namada_core::storage::Epoch; -use namada_core::{proof_of_stake, storage, token}; use namada_state::{StateRead, StorageRead}; +use namada_systems::{proof_of_stake, trans_token as token}; use namada_tx::action::{Action, GovAction, Read}; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{Ctx, CtxPreStorageRead, NativeVp, VpEvaluator}; diff --git a/crates/ibc/Cargo.toml b/crates/ibc/Cargo.toml index 3a63be846cb..fd48c441c73 100644 --- a/crates/ibc/Cargo.toml +++ b/crates/ibc/Cargo.toml @@ -30,6 +30,7 @@ namada_migrations = {path = "../migrations", optional = true} namada_parameters = { path = "../parameters" } namada_state = { path = "../state" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_token = { path = "../token" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } diff --git a/crates/ibc/src/vp/context.rs b/crates/ibc/src/vp/context.rs index 4b43236a3ce..82fc8f1bcd1 100644 --- a/crates/ibc/src/vp/context.rs +++ b/crates/ibc/src/vp/context.rs @@ -8,13 +8,13 @@ use namada_core::arith::checked; use namada_core::borsh::BorshSerializeExt; use namada_core::collections::{HashMap, HashSet}; use namada_core::storage::{BlockHeight, Epoch, Epochs, Header, Key, TxIndex}; -use namada_core::token::{self, Amount}; use namada_events::Event; use namada_gas::MEMORY_ACCESS_GAS_PER_BYTE; use namada_state::write_log::StorageModification; use namada_state::{ PrefixIter, StateRead, StorageError, StorageRead, StorageWrite, }; +use namada_systems::trans_token::{self as token, Amount}; use namada_vp::native_vp::{CtxPreStorageRead, VpEvaluator}; use namada_vp::VpEnv; diff --git a/crates/ibc/src/vp/mod.rs b/crates/ibc/src/vp/mod.rs index 7bbafa02c00..6539a8ea57d 100644 --- a/crates/ibc/src/vp/mod.rs +++ b/crates/ibc/src/vp/mod.rs @@ -16,11 +16,11 @@ use namada_core::address::Address; use namada_core::arith::{self, checked}; use namada_core::collections::HashSet; use namada_core::storage::Key; -use namada_core::token::{self, Amount}; -use namada_core::{governance, parameters, proof_of_stake}; use namada_gas::{IBC_ACTION_EXECUTE_GAS, IBC_ACTION_VALIDATE_GAS}; use namada_state::write_log::StorageModification; use namada_state::{StateRead, StorageError}; +use namada_systems::trans_token::{self as token, Amount}; +use namada_systems::{governance, parameters, proof_of_stake}; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{ self, Ctx, CtxPreStorageRead, NativeVp, VpEvaluator, diff --git a/crates/parameters/Cargo.toml b/crates/parameters/Cargo.toml index 07c41413e32..7a808c19a43 100644 --- a/crates/parameters/Cargo.toml +++ b/crates/parameters/Cargo.toml @@ -24,6 +24,7 @@ namada_core = { path = "../core" } namada_macros = { path = "../macros" } namada_state = { path = "../state" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } diff --git a/crates/parameters/src/lib.rs b/crates/parameters/src/lib.rs index 28227ce43ad..73af873a3c6 100644 --- a/crates/parameters/src/lib.rs +++ b/crates/parameters/src/lib.rs @@ -25,10 +25,10 @@ use std::marker::PhantomData; use namada_core::address::{Address, InternalAddress}; use namada_core::chain::ProposalBytes; -pub use namada_core::parameters::*; use namada_core::time::DurationSecs; use namada_core::token; use namada_storage::{ResultExt, StorageRead, StorageWrite}; +pub use namada_systems::parameters::*; pub use storage::get_max_block_gas; use thiserror::Error; pub use wasm_allowlist::{is_tx_allowed, is_vp_allowed}; diff --git a/crates/parameters/src/vp.rs b/crates/parameters/src/vp.rs index 2e3cdaca46d..7b5b4e20821 100644 --- a/crates/parameters/src/vp.rs +++ b/crates/parameters/src/vp.rs @@ -5,9 +5,9 @@ use std::marker::PhantomData; use namada_core::address::Address; use namada_core::booleans::BoolResultUnitExt; -use namada_core::governance; use namada_core::storage::Key; use namada_state::{StateRead, StorageError}; +use namada_systems::governance; use namada_tx::BatchedTxRef; use namada_vp::native_vp::{ self, Ctx, CtxPreStorageRead, NativeVp, VpEvaluator, diff --git a/crates/proof_of_stake/Cargo.toml b/crates/proof_of_stake/Cargo.toml index 72a1da32322..f858812ee9a 100644 --- a/crates/proof_of_stake/Cargo.toml +++ b/crates/proof_of_stake/Cargo.toml @@ -31,6 +31,7 @@ namada_macros = { path = "../macros" } namada_migrations = { path = "../migrations", optional = true } namada_state = { path = "../state" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_parameters = { path = "../parameters" } namada_trans_token = { path = "../trans_token" } namada_tx = { path = "../tx" } diff --git a/crates/proof_of_stake/src/lib.rs b/crates/proof_of_stake/src/lib.rs index 65ca763515c..fe148c40dd4 100644 --- a/crates/proof_of_stake/src/lib.rs +++ b/crates/proof_of_stake/src/lib.rs @@ -52,6 +52,7 @@ use namada_core::tendermint::abci::types::Misbehavior; use namada_events::EmitEvents; use namada_storage::collections::lazy_map::{self, Collectable, LazyMap}; use namada_storage::{OptionExt, StorageRead, StorageWrite}; +pub use namada_systems::proof_of_stake::*; pub use namada_trans_token as token; pub use parameters::{OwnedPosParams, PosParams}; pub use pos_queries::PosQueries; @@ -112,7 +113,7 @@ use crate::validator_set_update::{ #[derive(Debug)] pub struct Store(PhantomData); -impl namada_core::proof_of_stake::Read for Store +impl Read for Store where S: StorageRead, { diff --git a/crates/proof_of_stake/src/vp.rs b/crates/proof_of_stake/src/vp.rs index f86d613803c..2c82ca8211e 100644 --- a/crates/proof_of_stake/src/vp.rs +++ b/crates/proof_of_stake/src/vp.rs @@ -5,9 +5,9 @@ use std::marker::PhantomData; use namada_core::address::Address; use namada_core::booleans::BoolResultUnitExt; -use namada_core::governance; use namada_core::storage::Key; use namada_state::{StateRead, StorageError}; +use namada_systems::governance; use namada_tx::action::{ Action, Bond, ClaimRewards, PosAction, Read, Redelegation, Unbond, Withdraw, }; diff --git a/crates/shielded_token/Cargo.toml b/crates/shielded_token/Cargo.toml index a361bfaa9c7..39f3d6aec7b 100644 --- a/crates/shielded_token/Cargo.toml +++ b/crates/shielded_token/Cargo.toml @@ -30,6 +30,7 @@ namada_gas = { path = "../gas" } namada_parameters = { path = "../parameters" } namada_state = { path = "../state" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_trans_token = { path = "../trans_token" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } diff --git a/crates/shielded_token/src/vp.rs b/crates/shielded_token/src/vp.rs index efa98b4ecef..72d504dd9c5 100644 --- a/crates/shielded_token/src/vp.rs +++ b/crates/shielded_token/src/vp.rs @@ -20,13 +20,13 @@ use namada_core::borsh::BorshSerializeExt; use namada_core::collections::HashSet; use namada_core::masp::{encode_asset_type, MaspEpoch}; use namada_core::storage::Key; -use namada_core::token::MaspDigitPos; use namada_core::uint::I320; -use namada_core::{governance, parameters, token}; use namada_gas::GasMetering; use namada_state::{ ConversionState, OptionExt, ResultExt, StateRead, StorageError, }; +use namada_systems::trans_token::{Amount, MaspDigitPos}; +use namada_systems::{governance, parameters, trans_token as token}; use namada_trans_token::read_denom; use namada_trans_token::storage_key::{ is_any_shielded_action_balance_key, ShieldedActionOwner, @@ -37,7 +37,6 @@ use namada_vp::{native_vp, VpEnv}; use ripemd::Digest as RipemdDigest; use sha2::Digest as Sha2Digest; use thiserror::Error; -use token::Amount; use crate::storage_key::{ is_masp_key, is_masp_nullifier_key, is_masp_token_map_key, diff --git a/crates/state/Cargo.toml b/crates/state/Cargo.toml index 35745e32067..deccbac45a8 100644 --- a/crates/state/Cargo.toml +++ b/crates/state/Cargo.toml @@ -36,6 +36,7 @@ namada_merkle_tree = { path = "../merkle_tree" } namada_migrations = { path = "../migrations", optional = true } namada_replay_protection = { path = "../replay_protection" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_tx = { path = "../tx" } borsh.workspace = true diff --git a/crates/state/src/lib.rs b/crates/state/src/lib.rs index 57c265794fa..7aac568b5d8 100644 --- a/crates/state/src/lib.rs +++ b/crates/state/src/lib.rs @@ -33,7 +33,6 @@ use namada_core::arith::{self, checked}; use namada_core::eth_bridge_pool::is_pending_transfer_key; pub use namada_core::hash::Sha256Hasher; use namada_core::hash::{Error as HashError, Hash}; -use namada_core::parameters; pub use namada_core::storage::{ BlockHash, BlockHeight, BlockResults, Epoch, Epochs, EthEventsQueue, Header, Key, KeySeg, TxIndex, BLOCK_HASH_LENGTH, BLOCK_HEIGHT_LENGTH, @@ -58,6 +57,7 @@ pub use namada_storage::{ Result as StorageResult, ResultExt, StorageHasher, StorageRead, StorageWrite, DB, }; +use namada_systems::parameters; use thiserror::Error; pub use wl_state::{FullAccessState, TempWlState, WlState}; use write_log::WriteLog; diff --git a/crates/trans_token/Cargo.toml b/crates/trans_token/Cargo.toml index 4e187c67318..6edf89c1a2b 100644 --- a/crates/trans_token/Cargo.toml +++ b/crates/trans_token/Cargo.toml @@ -23,6 +23,7 @@ namada_core = { path = "../core" } namada_events = { path = "../events", default-features = false } namada_state = { path = "../state" } namada_storage = { path = "../storage" } +namada_systems = { path = "../systems" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } diff --git a/crates/trans_token/src/lib.rs b/crates/trans_token/src/lib.rs index 67115034cbf..da7ccb9c52a 100644 --- a/crates/trans_token/src/lib.rs +++ b/crates/trans_token/src/lib.rs @@ -25,8 +25,8 @@ pub mod vp; use std::marker::PhantomData; use namada_core::address::Address; -pub use namada_core::token::*; use namada_storage::{StorageRead, StorageWrite}; +pub use namada_systems::trans_token::*; pub use storage::*; /// Transparent token storage `Keys/Read/Write` implementation @@ -59,14 +59,14 @@ impl Keys for Store { } } -impl namada_core::token::Read for Store +impl Read for Store where S: StorageRead, { type Err = namada_storage::Error; } -impl namada_core::token::Write for Store +impl Write for Store where S: StorageWrite + StorageRead, { diff --git a/crates/trans_token/src/vp.rs b/crates/trans_token/src/vp.rs index a30ce08c9e8..cd5b5d39318 100644 --- a/crates/trans_token/src/vp.rs +++ b/crates/trans_token/src/vp.rs @@ -8,9 +8,9 @@ use namada_core::booleans::BoolResultUnitExt; use namada_core::collections::HashMap; use namada_core::storage::{Key, KeySeg}; use namada_core::token::Amount; -use namada_core::{governance, parameters}; use namada_state::{StateRead, StorageError}; use namada_storage::StorageRead; +use namada_systems::{governance, parameters}; use namada_tx::action::{ Action, Bond, ClaimRewards, GovAction, PosAction, Read, Withdraw, }; diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 9f5327f7254..ad87740feec 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -3736,6 +3736,7 @@ dependencies = [ "namada_proof_of_stake", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vote_ext", @@ -3784,6 +3785,7 @@ dependencies = [ "namada_macros", "namada_parameters", "namada_state", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -3814,6 +3816,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_token", "namada_tx", "namada_vp", @@ -3861,6 +3864,7 @@ dependencies = [ "namada_macros", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vp", "thiserror", @@ -3882,6 +3886,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -3981,6 +3986,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -4007,6 +4013,7 @@ dependencies = [ "namada_merkle_tree", "namada_replay_protection", "namada_storage", + "namada_systems", "namada_tx", "patricia_tree", "proptest", @@ -4032,6 +4039,14 @@ dependencies = [ "tracing", ] +[[package]] +name = "namada_systems" +version = "0.39.0" +dependencies = [ + "namada_core", + "namada_storage", +] + [[package]] name = "namada_test_utils" version = "0.39.0" @@ -4094,6 +4109,7 @@ dependencies = [ "namada_events", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vp", "thiserror", diff --git a/wasm_for_tests/Cargo.lock b/wasm_for_tests/Cargo.lock index 33a9526a04f..038bb90b49a 100644 --- a/wasm_for_tests/Cargo.lock +++ b/wasm_for_tests/Cargo.lock @@ -3828,6 +3828,7 @@ dependencies = [ "namada_proof_of_stake", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vote_ext", @@ -3876,6 +3877,7 @@ dependencies = [ "namada_macros", "namada_parameters", "namada_state", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -3906,6 +3908,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_token", "namada_tx", "namada_vp", @@ -3953,6 +3956,7 @@ dependencies = [ "namada_macros", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vp", "thiserror", @@ -3974,6 +3978,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -4073,6 +4078,7 @@ dependencies = [ "namada_parameters", "namada_state", "namada_storage", + "namada_systems", "namada_trans_token", "namada_tx", "namada_vp", @@ -4099,6 +4105,7 @@ dependencies = [ "namada_merkle_tree", "namada_replay_protection", "namada_storage", + "namada_systems", "namada_tx", "patricia_tree", "proptest", @@ -4124,6 +4131,14 @@ dependencies = [ "tracing", ] +[[package]] +name = "namada_systems" +version = "0.39.0" +dependencies = [ + "namada_core", + "namada_storage", +] + [[package]] name = "namada_test_utils" version = "0.39.0" @@ -4186,6 +4201,7 @@ dependencies = [ "namada_events", "namada_state", "namada_storage", + "namada_systems", "namada_tx", "namada_vp", "thiserror",