Skip to content

Commit

Permalink
Merge branch 'tomas/crates-dir' (#2386)
Browse files Browse the repository at this point in the history
* origin/tomas/crates-dir:
  `mv crates/shared crates/namada` and update paths
  git: ignore the old proto artifact
  changelog: add #2386
  fix relative paths
  move most sub-crates into crates dir
  • Loading branch information
tzemanovic committed Jan 16, 2024
2 parents 14b80a0 + 5e66c0b commit c5f8ff0
Show file tree
Hide file tree
Showing 447 changed files with 89 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/2386-crates-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Moved Rust crates into a crates sub-dir.
([\#2386](https://github.com/anoma/namada/pull/2386))
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ target/
wasm/*.wasm

# app version string file
/apps/version.rs
/crates/apps/version.rs

# Hidden to stop from re-appearing. Moved to `tx/src/proto/generated/types.rs`.
core/src/proto/generated/types.rs
62 changes: 31 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
resolver = "2"

members = [
"account",
"apps",
"benches",
"core",
"encoding_spec",
"ethereum_bridge",
"light_sdk",
"macros",
"crates/account",
"crates/apps",
"crates/benches",
"crates/core",
"crates/encoding_spec",
"crates/ethereum_bridge",
"crates/gas",
"crates/governance",
"crates/ibc",
"crates/light_sdk",
"crates/macros",
"crates/macros",
"crates/merkle_tree",
"crates/parameters",
"crates/proof_of_stake",
"crates/sdk",
"crates/namada",
"crates/shielded_token",
"crates/state",
"crates/storage",
"crates/test_utils",
"crates/tests",
"crates/token",
"crates/trans_token",
"crates/tx_env",
"crates/tx_prelude",
"crates/tx",
"crates/vm_env",
"crates/vote_ext",
"crates/vp_env",
"crates/vp_prelude",
"examples",
"gas",
"governance",
"ibc",
"macros",
"merkle_tree",
"parameters",
"proof_of_stake",
"sdk",
"shared",
"shielded_token",
"state",
"storage",
"test_utils",
"tests",
"token",
"trans_token",
"tx",
"tx_env",
"tx_prelude",
"vm_env",
"vote_ext",
"vp_env",
"vp_prelude",
]

# wasm packages have to be built separately
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ endif
audit-ignores += RUSTSEC-2021-0076

# Workspace crates
crates := namada_core
crates += namada
crates := namada
crates += namada_account
crates += namada_apps
crates += namada_benchmarks
crates += namada_core
crates += namada_encoding_spec
crates += namada_ethereum_bridge
crates += namada_gas
Expand Down Expand Up @@ -95,7 +95,7 @@ check:
check-mainnet:
$(cargo) check --workspace --features "mainnet"

# Check that every crate can be built with default features and that shared crate
# Check that every crate can be built with default features and that namada crate
# can be built for wasm
check-crates:
$(foreach p,$(crates), echo "Checking $(p)" && cargo +$(nightly) check -Z unstable-options --tests -p $(p) && ) \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions apps/Cargo.toml → crates/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ integration = []


[dependencies]
namada = {path = "../shared", features = ["multicore", "http-client", "tendermint-rpc", "std"]}
namada = {path = "../namada", features = ["multicore", "http-client", "tendermint-rpc", "std"]}
namada_sdk = {path = "../sdk", default-features = false, features = ["wasm-runtime", "download-params", "std", "rand"]}
namada_test_utils = {path = "../test_utils", optional = true}

Expand Down Expand Up @@ -149,7 +149,7 @@ rocksdb = { workspace = true }

[dev-dependencies]
assert_matches = "1.5.0"
namada = {path = "../shared", default-features = false, features = ["testing", "wasm-runtime"]}
namada = {path = "../namada", default-features = false, features = ["testing", "wasm-runtime"]}
namada_test_utils = {path = "../test_utils"}
bit-set.workspace = true
proptest.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ use crate::facade::tendermint_proto::google::protobuf::Timestamp;
use crate::node::ledger::shell::Shell;
use crate::wallet::{defaults, CliWalletUtils};

pub const WASM_DIR: &str = "../wasm";
pub const WASM_DIR: &str = "../../wasm";

pub const ALBERT_PAYMENT_ADDRESS: &str = "albert_payment";
pub const ALBERT_SPENDING_KEY: &str = "albert_spending";
Expand Down Expand Up @@ -571,7 +571,8 @@ impl BenchShell {
}

pub fn generate_foreign_key_tx(signer: &SecretKey) -> Tx {
let wasm_code = std::fs::read("../wasm_for_tests/tx_write.wasm").unwrap();
let wasm_code =
std::fs::read("../../wasm_for_tests/tx_write.wasm").unwrap();

let mut tx = Tx::from_type(namada::tx::data::TxType::Decrypted(
namada::tx::data::DecryptedTx::Decrypted,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ mod test {
fn test_finalize_is_deterministic() {
// Load the localnet templates
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/localnet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,8 @@ mod tests {
#[test]
fn test_validate_localnet_genesis_templates() {
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/localnet");
Expand All @@ -950,6 +952,8 @@ mod tests {
#[test]
fn test_validate_starter_genesis_templates() {
let templates_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.parent()
.unwrap()
.join("genesis/starter");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,8 @@ mod test_utils {
while current_path.file_name().unwrap() != "apps" {
current_path.pop();
}
// Two-dirs up to root
current_path.pop();
current_path.pop();
current_path
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion benches/Cargo.toml → crates/benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ path = "host_env.rs"
[dependencies]

[dev-dependencies]
namada = { path = "../shared", features = ["rand", "testing"] }
namada = { path = "../namada", features = ["rand", "testing"] }
namada_apps = { path = "../apps", features = ["benches"] }
masp_primitives.workspace = true
borsh.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ version.workspace = true
default = []

[dependencies]
namada = { path = "../shared", features = ["rand", "tendermint-rpc", "download-params"] }
namada = { path = "../namada", features = ["rand", "tendermint-rpc", "download-params"] }
borsh.workspace = true
itertools.workspace = true
lazy_static.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ where
// avoid crashing the ledger (required
// `UnwindSafe`
// and `RefUnwindSafe` in
// shared/src/ledger/pos/vp.rs)
// namada/src/ledger/pos/vp.rs)
let keys_changed_ref = &keys_changed;
let result = pos_ref
.validate_tx(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c5f8ff0

Please sign in to comment.