diff --git a/Cargo.lock b/Cargo.lock index f286f8a980..821ae7e65e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4685,11 +4685,9 @@ dependencies = [ "linkme", "masp_primitives", "namada_core", - "namada_io", "namada_macros", "namada_migrations", "namada_sdk", - "namada_token", "namada_vm", "namada_wallet", "pretty_assertions", @@ -4729,7 +4727,6 @@ dependencies = [ "masp_proofs", "namada_apps_lib", "namada_node", - "namada_token", "namada_vm", "namada_vp", "prost 0.12.3", @@ -5095,12 +5092,10 @@ dependencies = [ "masp_primitives", "masp_proofs", "namada_apps_lib", - "namada_io", "namada_migrations", "namada_replay_protection", "namada_sdk", "namada_test_utils", - "namada_token", "namada_vm", "namada_vote_ext", "namada_vp", @@ -5411,7 +5406,6 @@ dependencies = [ "namada_node", "namada_sdk", "namada_test_utils", - "namada_token", "namada_tx_env", "namada_tx_prelude", "namada_vm", diff --git a/crates/apps_lib/Cargo.toml b/crates/apps_lib/Cargo.toml index e2e6d88f5e..c0fd42e600 100644 --- a/crates/apps_lib/Cargo.toml +++ b/crates/apps_lib/Cargo.toml @@ -31,7 +31,6 @@ namada-eth-bridge = [ [dependencies] namada_core = {path = "../core"} -namada_io = { path = "../io" } namada_macros = {path = "../macros"} namada_migrations = {path = "../migrations", optional = true} namada_sdk = {path = "../sdk", features = ["download-params", "multicore"]} diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index 0cd97c36bb..7124945d0f 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -15,7 +15,7 @@ pub mod wallet; use clap::{ArgGroup, ArgMatches, ColorChoice}; use color_eyre::eyre::Result; -use namada_io::StdIo; +use namada_sdk::io::StdIo; use utils::*; pub use utils::{safe_exit, Cmd}; @@ -3220,6 +3220,7 @@ pub mod args { use std::str::FromStr; use data_encoding::HEXUPPER; + use namada_core::masp::{MaspEpoch, PaymentAddress}; use namada_sdk::address::{Address, EstablishedAddress}; pub use namada_sdk::args::*; use namada_sdk::chain::{ChainId, ChainIdPrefix}; @@ -3230,6 +3231,7 @@ pub mod args { use namada_sdk::ibc::core::host::types::identifiers::{ChannelId, PortId}; use namada_sdk::keccak::KeccakHash; use namada_sdk::key::*; + use namada_sdk::masp::utils::RetryStrategy; use namada_sdk::storage::{self, BlockHeight, Epoch}; use namada_sdk::time::DateTimeUtc; use namada_sdk::token::NATIVE_MAX_DECIMAL_PLACES; @@ -3246,8 +3248,6 @@ pub mod args { VP_USER_WASM, }; use namada_sdk::{token, DEFAULT_GAS_LIMIT}; - use namada_token::masp::utils::RetryStrategy; - use namada_token::masp::{MaspEpoch, PaymentAddress}; use super::context::*; use super::utils::*; diff --git a/crates/apps_lib/src/cli/api.rs b/crates/apps_lib/src/cli/api.rs index 51cc66af61..d9737b5174 100644 --- a/crates/apps_lib/src/cli/api.rs +++ b/crates/apps_lib/src/cli/api.rs @@ -1,5 +1,5 @@ -use namada_io::{Client, Io}; use namada_sdk::error::Error; +use namada_sdk::io::{Client, Io}; use namada_sdk::rpc::wait_until_node_is_synched; use crate::tendermint_rpc::client::CompatMode; diff --git a/crates/apps_lib/src/cli/client.rs b/crates/apps_lib/src/cli/client.rs index f92c3d042f..fb708d235f 100644 --- a/crates/apps_lib/src/cli/client.rs +++ b/crates/apps_lib/src/cli/client.rs @@ -1,7 +1,7 @@ use std::io::Read; use color_eyre::eyre::Result; -use namada_io::{display_line, Io, NamadaIo}; +use namada_sdk::io::{display_line, Io, NamadaIo}; use namada_sdk::masp::ShieldedContext; use namada_sdk::{Namada, NamadaImpl}; diff --git a/crates/apps_lib/src/cli/context.rs b/crates/apps_lib/src/cli/context.rs index 6ea688614e..16f4304f98 100644 --- a/crates/apps_lib/src/cli/context.rs +++ b/crates/apps_lib/src/cli/context.rs @@ -6,16 +6,20 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use color_eyre::eyre::Result; -use namada_io::Io; +use namada_core::masp::{ + BalanceOwner, ExtendedSpendingKey, ExtendedViewingKey, PaymentAddress, + TransferSource, TransferTarget, +}; use namada_sdk::address::{Address, InternalAddress}; use namada_sdk::chain::ChainId; use namada_sdk::ethereum_events::EthAddress; use namada_sdk::ibc::trace::{ibc_token, is_ibc_denom, is_nft_trace}; +use namada_sdk::io::Io; use namada_sdk::key::*; +use namada_sdk::masp::fs::FsShieldedUtils; +use namada_sdk::masp::ShieldedWallet; use namada_sdk::wallet::{DatedSpendingKey, DatedViewingKey, Wallet}; use namada_sdk::{Namada, NamadaImpl}; -use namada_token::masp::fs::FsShieldedUtils; -use namada_token::masp::{ShieldedWallet, *}; use super::args; use crate::cli::utils; @@ -231,7 +235,7 @@ impl Context { /// Make an implementation of Namada from this object and parameters. pub fn to_sdk(self, client: C, io: IO) -> impl Namada where - C: namada_io::Client + Sync, + C: namada_sdk::io::Client + Sync, IO: Io, { let chain_ctx = self.take_chain_or_exit(); diff --git a/crates/apps_lib/src/cli/relayer.rs b/crates/apps_lib/src/cli/relayer.rs index df88b78c49..e539a6143d 100644 --- a/crates/apps_lib/src/cli/relayer.rs +++ b/crates/apps_lib/src/cli/relayer.rs @@ -1,5 +1,5 @@ use color_eyre::eyre::Result; -use namada_io::Io; +use namada_sdk::io::Io; use crate::cli; use crate::cli::api::{CliApi, CliClient}; @@ -14,7 +14,7 @@ impl CliApi { where C: CliClient, { - use namada_io::display_line; + use namada_sdk::io::display_line; display_line!(&io, "The Namada Ethereum bridge is disabled"); Ok(()) diff --git a/crates/apps_lib/src/cli/wallet.rs b/crates/apps_lib/src/cli/wallet.rs index 44b235c32e..e6a763f234 100644 --- a/crates/apps_lib/src/cli/wallet.rs +++ b/crates/apps_lib/src/cli/wallet.rs @@ -10,15 +10,14 @@ use color_eyre::eyre::Result; use itertools::sorted; use ledger_namada_rs::{BIP44Path, NamadaApp}; use namada_core::chain::BlockHeight; -use namada_io::{display_line, edisplay_line, Io}; +use namada_core::masp::{ExtendedSpendingKey, MaspValue, PaymentAddress}; use namada_sdk::address::{Address, DecodeError}; +use namada_sdk::io::{display_line, edisplay_line, Io}; use namada_sdk::key::*; +use namada_sdk::masp::find_valid_diversifier; use namada_sdk::wallet::{ DecryptionError, DerivationPath, DerivationPathError, FindKeyError, Wallet, }; -use namada_token::masp::{ - find_valid_diversifier, ExtendedSpendingKey, MaspValue, PaymentAddress, -}; use rand_core::OsRng; use crate::cli; diff --git a/crates/apps_lib/src/client/masp.rs b/crates/apps_lib/src/client/masp.rs index fed9453bbf..7e81ac07fd 100644 --- a/crates/apps_lib/src/client/masp.rs +++ b/crates/apps_lib/src/client/masp.rs @@ -1,14 +1,16 @@ use std::time::Duration; use color_eyre::owo_colors::OwoColorize; -#[cfg(any(test, feature = "testing"))] -use namada_io::DevNullProgressBar; -use namada_io::{display, display_line, Client, Io, MaybeSend, MaybeSync}; use namada_sdk::args::ShieldedSync; use namada_sdk::control_flow::install_shutdown_signal; use namada_sdk::error::Error; -use namada_sdk::masp::{IndexerMaspClient, LedgerMaspClient, ShieldedContext}; -use namada_token::masp::{MaspLocalTaskEnv, ShieldedSyncConfig, ShieldedUtils}; +#[cfg(any(test, feature = "testing"))] +use namada_sdk::io::DevNullProgressBar; +use namada_sdk::io::{display, display_line, Client, Io, MaybeSend, MaybeSync}; +use namada_sdk::masp::{ + IndexerMaspClient, LedgerMaspClient, MaspLocalTaskEnv, ShieldedContext, + ShieldedSyncConfig, ShieldedUtils, +}; #[allow(clippy::too_many_arguments)] pub async fn syncing< diff --git a/crates/apps_lib/src/client/rpc.rs b/crates/apps_lib/src/client/rpc.rs index 1ea9096ae5..6c2a1a929b 100644 --- a/crates/apps_lib/src/client/rpc.rs +++ b/crates/apps_lib/src/client/rpc.rs @@ -10,7 +10,7 @@ use masp_primitives::merkle_tree::MerklePath; use masp_primitives::sapling::Node; use masp_primitives::transaction::components::I128Sum; use masp_primitives::zip32::ExtendedFullViewingKey; -use namada_io::{display, display_line, edisplay_line, Client, Io}; +use namada_core::masp::{BalanceOwner, MaspEpoch}; use namada_sdk::address::{Address, InternalAddress, MASP}; use namada_sdk::chain::{BlockHeight, Epoch}; use namada_sdk::collections::{HashMap, HashSet}; @@ -26,7 +26,10 @@ use namada_sdk::governance::storage::proposal::{ use namada_sdk::governance::utils::{ProposalVotes, VotePower}; use namada_sdk::governance::ProposalVote; use namada_sdk::hash::Hash; +use namada_sdk::io::{display, display_line, edisplay_line, Client, Io}; use namada_sdk::key::*; +use namada_sdk::masp::shielded_wallet::ShieldedApi; +use namada_sdk::masp::MaspTokenRewardData; use namada_sdk::parameters::{storage as param_storage, EpochDuration}; use namada_sdk::proof_of_stake::types::{ CommissionPair, Slash, ValidatorMetaData, ValidatorState, @@ -44,8 +47,6 @@ use namada_sdk::token::MaspDigitPos; use namada_sdk::tx::display_batch_resp; use namada_sdk::wallet::AddressVpType; use namada_sdk::{error, state as storage, token, Namada}; -use namada_token::masp::shielded_wallet::ShieldedApi; -use namada_token::masp::{BalanceOwner, MaspEpoch, MaspTokenRewardData}; use crate::cli::{self, args}; use crate::tendermint::merkle::proof::ProofOps; diff --git a/crates/apps_lib/src/client/tx.rs b/crates/apps_lib/src/client/tx.rs index bc8ad9aa0b..6b39bbd4f6 100644 --- a/crates/apps_lib/src/client/tx.rs +++ b/crates/apps_lib/src/client/tx.rs @@ -4,7 +4,6 @@ use std::io::Write; use borsh::BorshDeserialize; use borsh_ext::BorshSerializeExt; use ledger_namada_rs::{BIP44Path, NamadaApp}; -use namada_io::{display_line, edisplay_line, Io}; use namada_sdk::address::{Address, ImplicitAddress}; use namada_sdk::args::TxBecomeValidator; use namada_sdk::collections::HashSet; @@ -12,6 +11,7 @@ use namada_sdk::governance::cli::onchain::{ DefaultProposal, PgfFundingProposal, PgfStewardProposal, }; use namada_sdk::ibc::convert_masp_tx_to_ibc_memo; +use namada_sdk::io::{display_line, edisplay_line, Io}; use namada_sdk::key::*; use namada_sdk::rpc::{InnerTxResult, TxBroadcastData, TxResponse}; use namada_sdk::state::EPOCH_SWITCH_BLOCKS_DELAY; @@ -231,7 +231,7 @@ async fn batch_opt_reveal_pk_and_submit( tx_data: (Tx, SigningTxData), ) -> Result where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let mut batched_tx_data = vec![]; @@ -279,7 +279,7 @@ pub async fn submit_custom( args: args::TxCustom, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let custom_tx_data = args.build(namada).await?; @@ -303,7 +303,7 @@ pub async fn submit_update_account( args: args::TxUpdateAccount, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -323,7 +323,7 @@ pub async fn submit_init_account( args: args::TxInitAccount, ) -> Result, error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = tx::build_init_account(namada, &args).await?; @@ -907,7 +907,7 @@ pub async fn submit_ibc_transfer( args: args::TxIbcTransfer, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (tx, signing_data, _) = args.build(namada).await?; @@ -933,7 +933,7 @@ pub async fn submit_init_proposal( args: args::InitProposal, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let current_epoch = rpc::query_and_print_epoch(namada).await; let governance_parameters = @@ -1040,7 +1040,7 @@ pub async fn submit_vote_proposal( args: args::VoteProposal, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx_builder, signing_data) = args.build(namada).await?; @@ -1065,7 +1065,7 @@ pub async fn sign_tx( }: args::SignTx, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let tx = if let Ok(transaction) = Tx::deserialize(tx_data.as_ref()) { transaction @@ -1135,7 +1135,7 @@ pub async fn submit_reveal_pk( args: args::RevealPk, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let tx_data = submit_reveal_aux(namada, &args.tx, &(&args.public_key).into()).await?; @@ -1153,7 +1153,7 @@ pub async fn submit_bond( args: args::Bond, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let submit_bond_tx_data = args.build(namada).await?; @@ -1178,7 +1178,7 @@ pub async fn submit_unbond( args: args::Unbond, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data, latest_withdrawal_pre) = args.build(namada).await?; @@ -1209,7 +1209,7 @@ pub async fn submit_withdraw( args: args::Withdraw, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1229,7 +1229,7 @@ pub async fn submit_claim_rewards( args: args::ClaimRewards, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1249,7 +1249,7 @@ pub async fn submit_redelegate( args: args::Redelegate, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1269,7 +1269,7 @@ pub async fn submit_validator_commission_change( args: args::CommissionRateChange, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1289,7 +1289,7 @@ pub async fn submit_validator_metadata_change( args: args::MetaDataChange, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1309,7 +1309,7 @@ pub async fn submit_unjail_validator( args: args::TxUnjailValidator, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1329,7 +1329,7 @@ pub async fn submit_deactivate_validator( args: args::TxDeactivateValidator, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1349,7 +1349,7 @@ pub async fn submit_reactivate_validator( args: args::TxReactivateValidator, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1369,7 +1369,7 @@ pub async fn submit_update_steward_commission( args: args::UpdateStewardCommission, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; @@ -1389,7 +1389,7 @@ pub async fn submit_resign_steward( args: args::ResignSteward, ) -> Result<(), error::Error> where - ::Error: std::fmt::Display, + ::Error: std::fmt::Display, { let (mut tx, signing_data) = args.build(namada).await?; diff --git a/crates/benches/native_vps.rs b/crates/benches/native_vps.rs index 786d26d432..4f4ab800c3 100644 --- a/crates/benches/native_vps.rs +++ b/crates/benches/native_vps.rs @@ -42,6 +42,9 @@ use namada_apps_lib::masp_primitives::transaction::Transaction; use namada_apps_lib::masp_proofs::sapling::SaplingVerificationContextInner; use namada_apps_lib::proof_of_stake::KeySeg; use namada_apps_lib::state::{Epoch, StorageRead, StorageWrite, TxIndex}; +use namada_apps_lib::token::masp::{ + partial_deauthorize, preload_verifying_keys, PVKs, +}; use namada_apps_lib::token::{Amount, Transfer}; use namada_apps_lib::tx::{BatchedTx, Code, Section, Tx}; use namada_apps_lib::validation::{ @@ -49,17 +52,16 @@ use namada_apps_lib::validation::{ IbcVpContext, MaspVp, MultitokenVp, ParametersVp, PgfVp, PosVp, }; use namada_apps_lib::wallet::defaults; -use namada_apps_lib::{governance, parameters, proof_of_stake, storage, token}; +use namada_apps_lib::{ + governance, parameters, proof_of_stake, storage, token, TransferSource, + TransferTarget, +}; use namada_node::bench_utils::{ generate_foreign_key_tx, BenchShell, BenchShieldedCtx, ALBERT_PAYMENT_ADDRESS, ALBERT_SPENDING_KEY, BERTHA_PAYMENT_ADDRESS, TX_BRIDGE_POOL_WASM, TX_IBC_WASM, TX_INIT_PROPOSAL_WASM, TX_RESIGN_STEWARD, TX_TRANSFER_WASM, TX_UPDATE_STEWARD_COMMISSION, TX_VOTE_PROPOSAL_WASM, }; -use namada_apps_lib::token::masp::{ - partial_deauthorize, preload_verifying_keys, PVKs, TransferSource, - TransferTarget, -}; use namada_vp::native_vp::{Ctx, NativeVp}; use rand_core::OsRng; diff --git a/crates/node/src/bench_utils.rs b/crates/node/src/bench_utils.rs index 56ac90d68a..2ae4950568 100644 --- a/crates/node/src/bench_utils.rs +++ b/crates/node/src/bench_utils.rs @@ -21,7 +21,6 @@ use namada_apps_lib::cli; use namada_apps_lib::cli::context::FromContext; use namada_apps_lib::cli::Context; use namada_apps_lib::wallet::{defaults, CliWalletUtils}; -use namada_io::{Client, NamadaIo, StdIo}; use namada_sdk::address::{self, Address, InternalAddress, MASP}; use namada_sdk::args::ShieldedSync; use namada_sdk::chain::testing::get_dummy_header; @@ -70,15 +69,23 @@ use namada_sdk::ibc::storage::{ channel_key, connection_key, mint_limit_key, port_key, throughput_limit_key, }; use namada_sdk::ibc::{MsgTransfer, COMMITMENT_PREFIX}; +use namada_sdk::io::{Client, NamadaIo, StdIo}; use namada_sdk::key::common::SecretKey; -use namada_sdk::masp::ShieldedContext; +use namada_sdk::masp::shielded_wallet::ShieldedApi; +use namada_sdk::masp::utils::RetryStrategy; +use namada_sdk::masp::{ + self, ContextSyncStatus, DispatcherCache, MaspTransferData, + ShieldedContext, ShieldedUtils, ShieldedWallet, +}; use namada_sdk::queries::{ EncodedResponseQuery, RequestCtx, RequestQuery, Router, RPC, }; use namada_sdk::state::StorageRead; use namada_sdk::storage::{Key, KeySeg, TxIndex}; use namada_sdk::time::DateTimeUtc; -use namada_sdk::token::{self, Amount, DenominatedAmount, Transfer}; +use namada_sdk::token::{ + self, Amount, DenominatedAmount, MaspTxRefs, Transfer, +}; use namada_sdk::tx::data::pos::Bond; use namada_sdk::tx::data::{BatchedTxResult, Fee, TxResult, VpsResult}; use namada_sdk::tx::event::{new_tx_event, Batch}; @@ -99,15 +106,11 @@ pub use namada_sdk::tx::{ TX_WITHDRAW_WASM, VP_USER_WASM, }; use namada_sdk::wallet::Wallet; -use namada_sdk::{parameters, proof_of_stake, tendermint, Namada, NamadaImpl}; -use namada_test_utils::tx_data::TxWriteData; -use namada_token::masp::shielded_wallet::ShieldedApi; -use namada_token::masp::utils::RetryStrategy; -use namada_token::masp::{ - self, ContextSyncStatus, DispatcherCache, ExtendedViewingKey, - MaspTransferData, MaspTxRefs, PaymentAddress, ShieldedUtils, - ShieldedWallet, TransferSource, TransferTarget, +use namada_sdk::{ + parameters, proof_of_stake, tendermint, Namada, NamadaImpl, PaymentAddress, + TransferSource, TransferTarget, }; +use namada_test_utils::tx_data::TxWriteData; use namada_vm::wasm::run; use rand_core::OsRng; use tempfile::TempDir; @@ -1124,21 +1127,21 @@ impl Default for BenchShieldedCtx { ] .map(|(p, s)| (p.to_owned(), s.to_owned())) { - let viewing_key: FromContext = FromContext::new( - chain_ctx - .wallet - .find_viewing_key(viewing_alias) - .unwrap() - .key - .to_string(), - ); + let viewing_key: FromContext = + FromContext::new( + chain_ctx + .wallet + .find_viewing_key(viewing_alias) + .unwrap() + .key + .to_string(), + ); let viewing_key = ExtendedFullViewingKey::from( chain_ctx.get_cached(&viewing_key), ) .fvk .vk; - let (div, _g_d) = - namada_token::masp::find_valid_diversifier(&mut OsRng); + let (div, _g_d) = masp::find_valid_diversifier(&mut OsRng); let payment_addr = viewing_key.to_payment_address(div).unwrap(); let _ = chain_ctx .wallet diff --git a/crates/node/src/dry_run_tx.rs b/crates/node/src/dry_run_tx.rs index 416ce23029..4e697a09bd 100644 --- a/crates/node/src/dry_run_tx.rs +++ b/crates/node/src/dry_run_tx.rs @@ -138,10 +138,10 @@ where mod test { use borsh::BorshDeserialize; use borsh_ext::BorshSerializeExt; - use namada_io::Client; use namada_sdk::chain::BlockHeight; use namada_sdk::events::log::EventLog; use namada_sdk::hash::Hash; + use namada_sdk::io::Client; use namada_sdk::queries::{ EncodedResponseQuery, RequestCtx, RequestQuery, Router, RPC, }; diff --git a/crates/node/src/protocol.rs b/crates/node/src/protocol.rs index 43e69370af..e5c443f40c 100644 --- a/crates/node/src/protocol.rs +++ b/crates/node/src/protocol.rs @@ -805,7 +805,7 @@ fn get_optional_masp_ref>( state: &S, cmt: &TxCommitments, is_masp_tx: Either, -) -> Result>> { +) -> Result>> { // Always check that the transaction was indeed a MASP one by looking at the // changed keys. A malicious tx could push a MASP Action without touching // any storage keys associated with the shielded pool diff --git a/crates/node/src/shell/testing/client.rs b/crates/node/src/shell/testing/client.rs index ee98e2d7ee..21ff520bff 100644 --- a/crates/node/src/shell/testing/client.rs +++ b/crates/node/src/shell/testing/client.rs @@ -5,8 +5,8 @@ use namada_apps_lib::cli::args::Global; use namada_apps_lib::cli::{ args, cmds, Cmd, Context, NamadaClient, NamadaRelayer, }; -use namada_io::Io; use namada_sdk::error::Error as SdkError; +use namada_sdk::io::Io; use super::node::MockNode; use crate::shell::testing::utils::{Bin, TestingIo}; diff --git a/crates/node/src/shell/testing/node.rs b/crates/node/src/shell/testing/node.rs index 6570694396..7809701695 100644 --- a/crates/node/src/shell/testing/node.rs +++ b/crates/node/src/shell/testing/node.rs @@ -10,7 +10,6 @@ use color_eyre::eyre::{Report, Result}; use data_encoding::HEXUPPER; use itertools::Either; use lazy_static::lazy_static; -use namada_io::Client; use namada_sdk::address::Address; use namada_sdk::chain::{BlockHeader, BlockHeight, Epoch}; use namada_sdk::collections::HashMap; @@ -21,6 +20,7 @@ use namada_sdk::events::extend::Height as HeightAttr; use namada_sdk::events::log::dumb_queries; use namada_sdk::events::Event; use namada_sdk::hash::Hash; +use namada_sdk::io::Client; use namada_sdk::key::tm_consensus_key_raw_hash; use namada_sdk::proof_of_stake::storage::{ read_consensus_validator_set_addresses_with_stake, read_pos_params, diff --git a/crates/node/src/shell/testing/utils.rs b/crates/node/src/shell/testing/utils.rs index 0ac1672812..e64114c59a 100644 --- a/crates/node/src/shell/testing/utils.rs +++ b/crates/node/src/shell/testing/utils.rs @@ -5,7 +5,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use lazy_static::lazy_static; -use namada_io::{prompt_aux, read_aux, Io}; +use namada_sdk::io::{prompt_aux, read_aux, Io}; use tempfile::tempdir; use tokio::io::{AsyncRead, ReadBuf}; diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index 9adec611ef..0dd3b93653 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -51,15 +51,16 @@ use namada_core::dec::Dec; use namada_core::ethereum_events::EthAddress; use namada_core::ibc::core::host::types::identifiers::{ChannelId, PortId}; use namada_core::key::*; -use namada_core::masp::{ExtendedSpendingKey, PaymentAddress, TransferSource}; +pub use namada_core::masp::{ + ExtendedSpendingKey, ExtendedViewingKey, PaymentAddress, TransferSource, + TransferTarget, +}; pub use namada_core::{control_flow, task_env}; use namada_io::{Client, Io, NamadaIo}; -pub use namada_io as io; pub use namada_io::{MaybeSend, MaybeSync}; pub use namada_token::masp::{ShieldedUtils, ShieldedWallet}; use namada_tx::data::wrapper::GasLimit; use namada_tx::Tx; -pub use namada_wallet as wallet; use rpc::{denominate_amount, format_denominated_amount, query_native_token}; use signing::SigningTxData; use token::{DenominatedAmount, NATIVE_MAX_DECIMAL_PLACES}; @@ -76,6 +77,7 @@ use tx::{ VP_USER_WASM, }; use wallet::{Wallet, WalletIo, WalletStorage}; +pub use {namada_io as io, namada_wallet as wallet}; use crate::masp::ShieldedContext; diff --git a/crates/sdk/src/masp.rs b/crates/sdk/src/masp.rs index f7dc9ce006..433c0adee2 100644 --- a/crates/sdk/src/masp.rs +++ b/crates/sdk/src/masp.rs @@ -1,6 +1,6 @@ //! MASP verification wrappers. -mod utils; +mod utilities; use eyre::eyre; use masp_primitives::asset_type::AssetType; @@ -23,15 +23,16 @@ use namada_events::extend::{ use namada_ibc::{decode_message, extract_masp_tx_from_envelope, IbcMessage}; use namada_io::client::Client; use namada_token::masp::shielded_wallet::ShieldedQueries; +pub use namada_token::masp::{utils, *}; use namada_tx::Tx; -pub use utils::{IndexerMaspClient, LedgerMaspClient}; +pub use utilities::{IndexerMaspClient, LedgerMaspClient}; use crate::error::{Error, QueryError}; use crate::rpc::{ query_block, query_conversion, query_denom, query_masp_epoch, query_max_block_time_estimate, query_native_token, }; -use crate::{token, MaybeSend, MaybeSync, ShieldedUtils, ShieldedWallet}; +use crate::{token, MaybeSend, MaybeSync}; /// Extract the relevant shield portions of a [`Tx`], if any. fn extract_masp_tx( diff --git a/crates/sdk/src/masp/utils.rs b/crates/sdk/src/masp/utilities.rs similarity index 100% rename from crates/sdk/src/masp/utils.rs rename to crates/sdk/src/masp/utilities.rs diff --git a/crates/shielded_token/src/masp.rs b/crates/shielded_token/src/masp.rs index 554c1c5561..d2cc14a60f 100644 --- a/crates/shielded_token/src/masp.rs +++ b/crates/shielded_token/src/masp.rs @@ -32,7 +32,7 @@ use masp_proofs::prover::LocalTxProver; use namada_core::address::Address; use namada_core::collections::{HashMap, HashSet}; use namada_core::dec::Dec; -pub use namada_core::masp::*; +use namada_core::masp::*; use namada_core::token; use namada_core::token::Denomination; use namada_core::uint::Uint; diff --git a/crates/tests/src/e2e/ibc_tests.rs b/crates/tests/src/e2e/ibc_tests.rs index 7179427c78..a99506e160 100644 --- a/crates/tests/src/e2e/ibc_tests.rs +++ b/crates/tests/src/e2e/ibc_tests.rs @@ -19,6 +19,7 @@ use namada_apps_lib::client::rpc::query_storage_value_bytes; use namada_apps_lib::config::ethereum_bridge; use namada_apps_lib::config::genesis::templates; use namada_apps_lib::tendermint_rpc::{Client, HttpClient, Url}; +use namada_core::masp::PaymentAddress; use namada_sdk::address::MASP; use namada_sdk::chain::Epoch; use namada_sdk::governance::cli::onchain::PgfFunding; @@ -34,7 +35,6 @@ use namada_sdk::ibc::storage::*; use namada_sdk::ibc::trace::ibc_token; use namada_sdk::token::Amount; use namada_test_utils::TestWasms; -use namada_token::masp::PaymentAddress; use prost::Message; use setup::constants::*; use sha2::{Digest, Sha256}; diff --git a/crates/tests/src/integration/masp.rs b/crates/tests/src/integration/masp.rs index 47ff41556c..e2f6d66848 100644 --- a/crates/tests/src/integration/masp.rs +++ b/crates/tests/src/integration/masp.rs @@ -9,11 +9,11 @@ use namada_core::masp::TokenMap; use namada_node::shell::testing::client::run; use namada_node::shell::testing::node::NodeResults; use namada_node::shell::testing::utils::{Bin, CapturedOutput}; +use namada_sdk::masp::fs::FsShieldedUtils; use namada_sdk::state::{StorageRead, StorageWrite}; use namada_sdk::token::storage_key::masp_token_map_key; use namada_sdk::token::{self, DenominatedAmount}; use namada_sdk::DEFAULT_GAS_LIMIT; -use namada_token::masp::fs::FsShieldedUtils; use test_log::test; use super::setup; diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index bb26ec0105..758152bf8e 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -3974,7 +3974,6 @@ dependencies = [ "namada_core", "namada_sdk", "namada_test_utils", - "namada_token", "namada_tx_env", "namada_tx_prelude", "namada_vm",