Skip to content

Commit

Permalink
Merge of #3744
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 6, 2024
2 parents ef00f27 + 87675d5 commit 3d4fca6
Show file tree
Hide file tree
Showing 65 changed files with 5,158 additions and 4,489 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/3744-mask-sdk-refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Factored most of the masp code out of the sdk and into shielded token crate. These
required the creation of two futher crates: "namada_io" and "namada_wallet". ([\#3744](https://github.com/anoma/namada/pull/3744))
100 changes: 79 additions & 21 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"crates/gas",
"crates/governance",
"crates/ibc",
"crates/io",
"crates/light_sdk",
"crates/macros",
"crates/migrations",
Expand All @@ -40,6 +41,7 @@ members = [
"crates/vp",
"crates/vp_env",
"crates/vp_prelude",
"crates/wallet",
"examples",
"fuzz",
]
Expand Down
1 change: 1 addition & 0 deletions crates/apps_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namada_macros = {path = "../macros"}
namada_migrations = {path = "../migrations", optional = true}
namada_sdk = {path = "../sdk", features = ["download-params", "multicore"]}
namada_vm = {path = "../vm"}
namada_wallet = { path = "../wallet", features = ["std"]}

async-trait.workspace = true
base64.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/apps_lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -3231,7 +3232,6 @@ pub mod args {
use namada_sdk::keccak::KeccakHash;
use namada_sdk::key::*;
use namada_sdk::masp::utils::RetryStrategy;
use namada_sdk::masp::{MaspEpoch, PaymentAddress};
use namada_sdk::storage::{self, BlockHeight, Epoch};
use namada_sdk::time::DateTimeUtc;
use namada_sdk::token::NATIVE_MAX_DECIMAL_PLACES;
Expand Down
3 changes: 1 addition & 2 deletions crates/apps_lib/src/cli/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use namada_sdk::error::Error;
use namada_sdk::io::Io;
use namada_sdk::queries::Client;
use namada_sdk::io::{Client, Io};
use namada_sdk::rpc::wait_until_node_is_synched;

use crate::tendermint_rpc::client::CompatMode;
Expand Down
7 changes: 4 additions & 3 deletions crates/apps_lib/src/cli/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::io::Read;

use color_eyre::eyre::Result;
use namada_sdk::io::Io;
use namada_sdk::{display_line, Namada, NamadaImpl};
use namada_sdk::io::{display_line, Io, NamadaIo};
use namada_sdk::masp::ShieldedContext;
use namada_sdk::{Namada, NamadaImpl};

use crate::cli;
use crate::cli::api::{CliApi, CliClient};
Expand Down Expand Up @@ -353,7 +354,7 @@ impl CliApi {
);

crate::client::masp::syncing(
chain_ctx.shielded,
ShieldedContext::new(chain_ctx.shielded),
client,
args,
&io,
Expand Down
10 changes: 7 additions & 3 deletions crates/apps_lib/src/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;

use color_eyre::eyre::Result;
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::{ShieldedContext, *};
use namada_sdk::masp::ShieldedWallet;
use namada_sdk::wallet::{DatedSpendingKey, DatedViewingKey, Wallet};
use namada_sdk::{Namada, NamadaImpl};

Expand Down Expand Up @@ -128,7 +132,7 @@ pub struct ChainContext {
/// The ledger configuration for a specific chain ID
pub config: Config,
/// The context fr shielded operations
pub shielded: ShieldedContext<FsShieldedUtils>,
pub shielded: ShieldedWallet<FsShieldedUtils>,
/// Native token's address
pub native_token: Address,
}
Expand Down Expand Up @@ -231,7 +235,7 @@ impl Context {
/// Make an implementation of Namada from this object and parameters.
pub fn to_sdk<C, IO>(self, client: C, io: IO) -> impl Namada
where
C: namada_sdk::queries::Client + Sync,
C: namada_sdk::io::Client + Sync,
IO: Io,
{
let chain_ctx = self.take_chain_or_exit();
Expand Down
2 changes: 1 addition & 1 deletion crates/apps_lib/src/cli/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl CliApi {
where
C: CliClient,
{
use namada_sdk::display_line;
use namada_sdk::io::display_line;

display_line!(&io, "The Namada Ethereum bridge is disabled");
Ok(())
Expand Down
Loading

0 comments on commit 3d4fca6

Please sign in to comment.