Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Murisi/shared masp2 #848

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/unreleased/improvements/733-core-crate-split.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Public parts of shared `namada` crate have been split up into a
`namada_core` crate. The `namada_proof_of_stake`, `namada_vp_prelude`
and `namada_tx_prelude` crates now depend on this `namada_core` crate.
([#733](/~https://github.com/anoma/namada/pull/733))
80 changes: 60 additions & 20 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"

members = [
"apps",
"core",
"proof_of_stake",
"shared",
"tests",
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ clippy-abcipp:
$(cargo) +$(nightly) clippy \
--all-targets \
--manifest-path ./vm_env/Cargo.toml \
--no-default-features \
--features "abcipp" && \
--no-default-features && \
make -C $(wasms) clippy && \
$(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true

Expand Down
10 changes: 6 additions & 4 deletions apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,27 @@ std = ["ed25519-consensus/std", "rand/std", "rand_core/std"]
testing = ["dev"]

abcipp = [
"namada/abcipp",
"namada/tendermint-rpc-abcipp",
"tendermint-abcipp",
"tendermint-config-abcipp",
"tendermint-proto-abcipp",
"tendermint-rpc-abcipp",
"tower-abci-abcipp",
"namada/abcipp"
]

abciplus = [
"namada/abciplus",
"namada/tendermint-rpc",
"tendermint",
"tendermint-config",
"tendermint-rpc",
"tendermint-proto",
"tower-abci",
"namada/abciplus"
]

[dependencies]
namada = {path = "../shared", features = ["wasm-runtime", "ferveo-tpke", "rand", "tendermint-rpc", "secp256k1-sign-verify"]}
namada = {path = "../shared", default-features = false, features = ["wasm-runtime", "ferveo-tpke", "masp-tx-gen"]}
ark-serialize = "0.3.0"
ark-std = "0.3.0"
# branch = "bat/arse-merkle-tree"
Expand Down Expand Up @@ -148,7 +150,7 @@ rust_decimal = "1.26.1"
rust_decimal_macros = "1.26.1"

[dev-dependencies]
namada = {path = "../shared", features = ["testing", "wasm-runtime"]}
namada = {path = "../shared", default-features = false, features = ["testing", "wasm-runtime"]}
bit-set = "0.5.2"
# A fork with state machime testing
proptest = {git = "/~https://github.com/heliaxdev/proptest", branch = "tomas/sm"}
Expand Down
2 changes: 1 addition & 1 deletion apps/src/bin/anoma-wallet/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use namada::types::key::*;
use namada::types::masp::{MaspValue, PaymentAddress};
use namada_apps::cli;
use namada_apps::cli::{args, cmds, Context};
use namada_apps::client::tx::find_valid_diversifier;
use namada::ledger::masp::find_valid_diversifier;
use namada_apps::wallet::{DecryptionError, FindKeyError};
use rand_core::OsRng;

Expand Down
38 changes: 0 additions & 38 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,6 @@ pub mod args {
use super::context::*;
use super::utils::*;
use super::{ArgGroup, ArgMatches};
use crate::client::types::{ParsedTxArgs, ParsedTxTransferArgs};
use crate::config;
use crate::config::TendermintMode;
use crate::facade::tendermint::Timeout;
Expand Down Expand Up @@ -1766,21 +1765,6 @@ pub mod args {
pub amount: token::Amount,
}

impl TxTransfer {
pub fn parse_from_context(
&self,
ctx: &mut Context,
) -> ParsedTxTransferArgs {
ParsedTxTransferArgs {
tx: self.tx.parse_from_context(ctx),
source: ctx.get_cached(&self.source),
target: ctx.get(&self.target),
token: ctx.get(&self.token),
amount: self.amount,
}
}
}

impl Args for TxTransfer {
fn parse(matches: &ArgMatches) -> Self {
let tx = Tx::parse(matches);
Expand Down Expand Up @@ -2731,28 +2715,6 @@ pub mod args {
pub signer: Option<WalletAddress>,
}

impl Tx {
pub fn parse_from_context(&self, ctx: &mut Context) -> ParsedTxArgs {
ParsedTxArgs {
dry_run: self.dry_run,
force: self.force,
broadcast_only: self.broadcast_only,
ledger_address: self.ledger_address.clone(),
initialized_account_alias: self
.initialized_account_alias
.clone(),
fee_amount: self.fee_amount,
fee_token: ctx.get(&self.fee_token),
gas_limit: self.gas_limit.clone(),
signing_key: self
.signing_key
.as_ref()
.map(|sk| ctx.get_cached(sk)),
signer: self.signer.as_ref().map(|signer| ctx.get(signer)),
}
}
}

impl Args for Tx {
fn def(app: App) -> App {
app.arg(
Expand Down
7 changes: 4 additions & 3 deletions apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use namada::types::address::Address;
use namada::types::chain::ChainId;
use namada::types::key::*;
use namada::types::masp::*;
use namada::ledger::masp::ShieldedContext;

use super::args;
use crate::client::tx::ShieldedContext;
use crate::client::tx::CLIShieldedUtils;
use crate::config::genesis::genesis_config;
use crate::config::global::GlobalConfig;
use crate::config::{self, Config};
Expand Down Expand Up @@ -72,7 +73,7 @@ pub struct Context {
/// The ledger configuration for a specific chain ID
pub config: Config,
/// The context fr shielded operations
pub shielded: ShieldedContext,
pub shielded: ShieldedContext<CLIShieldedUtils>,
/// Native token's address
pub native_token: Address,
}
Expand Down Expand Up @@ -118,7 +119,7 @@ impl Context {
wallet,
global_config,
config,
shielded: ShieldedContext::new(chain_dir),
shielded: CLIShieldedUtils::new(chain_dir),
native_token,
})
}
Expand Down
Loading