Skip to content

Commit

Permalink
update systems crates to use namada_systems
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jul 2, 2024
1 parent e3875bf commit 7345980
Show file tree
Hide file tree
Showing 26 changed files with 70 additions and 20 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/ethereum_bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum_bridge/src/vp/bridge_pool_vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum_bridge/src/vp/eth_bridge_vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum_bridge/src/vp/nut_vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 2 additions & 1 deletion crates/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -46,7 +47,7 @@ pub const ADDRESS: Address = address::GOV;
#[derive(Debug)]
pub struct Store<S>(PhantomData<S>);

impl<S> namada_core::governance::Read<S> for Store<S>
impl<S> Read<S> for Store<S>
where
S: StorageRead,
{
Expand Down
3 changes: 2 additions & 1 deletion crates/governance/src/vp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions crates/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/ibc/src/vp/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions crates/ibc/src/vp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/parameters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
2 changes: 1 addition & 1 deletion crates/parameters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/parameters/src/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/proof_of_stake/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 2 additions & 1 deletion crates/proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -112,7 +113,7 @@ use crate::validator_set_update::{
#[derive(Debug)]
pub struct Store<S>(PhantomData<S>);

impl<S> namada_core::proof_of_stake::Read<S> for Store<S>
impl<S> Read<S> for Store<S>
where
S: StorageRead,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/proof_of_stake/src/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
1 change: 1 addition & 0 deletions crates/shielded_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
5 changes: 2 additions & 3 deletions crates/shielded_token/src/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/trans_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
6 changes: 3 additions & 3 deletions crates/trans_token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,14 +59,14 @@ impl<S> Keys for Store<S> {
}
}

impl<S> namada_core::token::Read<S> for Store<S>
impl<S> Read<S> for Store<S>
where
S: StorageRead,
{
type Err = namada_storage::Error;
}

impl<S> namada_core::token::Write<S> for Store<S>
impl<S> Write<S> for Store<S>
where
S: StorageWrite + StorageRead,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/trans_token/src/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Loading

0 comments on commit 7345980

Please sign in to comment.