Skip to content

Commit

Permalink
Merge pull request #3670 from anoma/tomas/crate-refactors
Browse files Browse the repository at this point in the history
crates refactors
  • Loading branch information
mergify[bot] authored Aug 27, 2024
2 parents 6183f3a + c71daae commit aefa330
Show file tree
Hide file tree
Showing 214 changed files with 2,954 additions and 3,474 deletions.
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/3670-crate-refactors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Reorganized some types and modules and refactored crates re-
exports, error handling features and removed unused depdendencies.
([\#3670](https://github.com/anoma/namada/pull/3670))
45 changes: 15 additions & 30 deletions Cargo.lock

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

11 changes: 5 additions & 6 deletions crates/core/src/account.rs → crates/account/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
//! Account types
//! Public keys associated with an account for n-signature authorization.

use std::collections::BTreeMap;

use borsh::{BorshDeserialize, BorshSerialize};
use namada_core::collections::HashMap;
use namada_core::hints;
use namada_core::key::common;
use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
use serde::{Deserialize, Serialize};

use super::key::{common, RefTo};
use crate::collections::HashMap;
use crate::hints;

#[derive(
Debug,
Clone,
Expand Down Expand Up @@ -86,7 +85,7 @@ impl AccountPublicKeysMap {
secret_keys
.into_iter()
.filter_map(|secret_key: common::SecretKey| {
self.get_index_from_public_key(&secret_key.ref_to())
self.get_index_from_public_key(&secret_key.to_public())
.map(|index| (index, secret_key))
})
.collect()
Expand Down
9 changes: 6 additions & 3 deletions crates/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
clippy::print_stderr
)]

mod auth;
mod storage;
mod storage_key;
mod types;

pub use auth::AccountPublicKeysMap;
use borsh::{BorshDeserialize, BorshSerialize};
pub use namada_core::account::AccountPublicKeysMap;
use namada_core::address::Address;
use namada_core::key::common;
pub use namada_core::address::Address;
pub use namada_core::hash::Hash;
pub use namada_core::key::common;
pub use namada_core::storage::Key;
use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
Expand Down
7 changes: 0 additions & 7 deletions crates/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ tracing.workspace = true
winapi.workspace = true

[dev-dependencies]
namada_test_utils = {path = "../test_utils"}

assert_matches.workspace = true
bit-set.workspace = true
proptest.workspace = true
test-log.workspace = true
tokio-test.workspace = true

[build-dependencies]
git2.workspace = true
9 changes: 2 additions & 7 deletions crates/apps_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ mainnet = [
"namada_sdk/mainnet",
]
# for integration tests and test utilities
testing = ["namada_test_utils", "lazy_static", "namada_sdk/testing"]
benches = ["namada_test_utils", "lazy_static", "namada_sdk/benches"]
testing = ["lazy_static", "namada_sdk/testing"]
benches = ["lazy_static", "namada_sdk/benches"]
integration = []
migrations = [
"namada_migrations",
Expand All @@ -35,7 +35,6 @@ namada_core = {path = "../core"}
namada_macros = {path = "../macros"}
namada_migrations = {path = "../migrations", optional = true}
namada_sdk = {path = "../sdk", features = ["download-params", "multicore"]}
namada_test_utils = {path = "../test_utils", optional = true}
namada_vm = {path = "../vm"}

async-trait.workspace = true
Expand Down Expand Up @@ -86,13 +85,9 @@ zeroize.workspace = true

[dev-dependencies]
namada_sdk = {path = "../sdk", features = ["testing"]}
namada_test_utils = {path = "../test_utils"}

assert_matches.workspace = true
bit-set.workspace = true
proptest.workspace = true
test-log.workspace = true
tokio-test.workspace = true
lazy_static.workspace= true
pretty_assertions.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/apps_lib/src/cli/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use borsh_ext::BorshSerializeExt;
use color_eyre::eyre::Result;
use itertools::sorted;
use ledger_namada_rs::{BIP44Path, NamadaApp};
use namada_core::storage::BlockHeight;
use namada_core::chain::BlockHeight;
use namada_sdk::address::{Address, DecodeError};
use namada_sdk::io::Io;
use namada_sdk::key::*;
Expand Down
3 changes: 2 additions & 1 deletion crates/apps_lib/src/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use masp_primitives::sapling::Node;
use masp_primitives::transaction::components::I128Sum;
use masp_primitives::zip32::ExtendedFullViewingKey;
use namada_sdk::address::{Address, InternalAddress, MASP};
use namada_sdk::chain::{BlockHeight, Epoch};
use namada_sdk::collections::{HashMap, HashSet};
use namada_sdk::control_flow::time::{Duration, Instant};
use namada_sdk::events::Event;
Expand All @@ -37,7 +38,7 @@ use namada_sdk::queries::{Client, RPC};
use namada_sdk::rpc::{
self, enriched_bonds_and_unbonds, query_epoch, TxResponse,
};
use namada_sdk::storage::{BlockHeight, BlockResults, Epoch};
use namada_sdk::storage::BlockResults;
use namada_sdk::tendermint_rpc::endpoint::status;
use namada_sdk::token::MaspDigitPos;
use namada_sdk::tx::display_batch_resp;
Expand Down
3 changes: 1 addition & 2 deletions crates/apps_lib/src/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
use namada_sdk::address::{Address, EstablishedAddress};
use namada_sdk::chain::ProposalBytes;
use namada_sdk::collections::HashMap;
use namada_sdk::eth_bridge::EthereumBridgeParams;
use namada_sdk::governance::parameters::GovernanceParameters;
use namada_sdk::governance::pgf::parameters::PgfParameters;
use namada_sdk::key::*;
use namada_sdk::parameters::EpochDuration;
use namada_sdk::parameters::{EpochDuration, ProposalBytes};
use namada_sdk::proof_of_stake::{Dec, GenesisValidator, OwnedPosParams};
use namada_sdk::string_encoding::StringEncoded;
use namada_sdk::time::DateTimeUtc;
Expand Down
2 changes: 1 addition & 1 deletion crates/apps_lib/src/config/genesis/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
use namada_sdk::address::Address;
use namada_sdk::chain::ProposalBytes;
use namada_sdk::dec::Dec;
use namada_sdk::eth_bridge::storage::parameters::{
Contracts, Erc20WhitelistEntry, MinimumConfirmations,
};
use namada_sdk::parameters::ProposalBytes;
use namada_sdk::token::{
Amount, DenominatedAmount, Denomination, NATIVE_MAX_DECIMAL_PLACES,
};
Expand Down
3 changes: 1 addition & 2 deletions crates/apps_lib/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use std::num::NonZeroU64;
use std::path::{Path, PathBuf};

use directories::ProjectDirs;
use namada_sdk::chain::ChainId;
use namada_sdk::chain::{BlockHeight, ChainId};
use namada_sdk::collections::HashMap;
use namada_sdk::storage::BlockHeight;
use namada_sdk::time::Rfc3339String;
use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand Down
Loading

0 comments on commit aefa330

Please sign in to comment.