Skip to content

Commit

Permalink
update all core types usages
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Feb 1, 2024
1 parent 650c76a commit 8e8ebf2
Show file tree
Hide file tree
Showing 305 changed files with 1,694 additions and 1,865 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions crates/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ mod storage_key;
mod types;

use borsh::{BorshDeserialize, BorshSerialize};
pub use namada_core::types::account::AccountPublicKeysMap;
use namada_core::types::address::Address;
use namada_core::types::key::common;
pub use namada_core::account::AccountPublicKeysMap;
use namada_core::address::Address;
use namada_core::key::common;
use serde::{Deserialize, Serialize};
pub use storage::*;
pub use storage_key::*;
Expand Down
6 changes: 3 additions & 3 deletions crates/account/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Cryptographic signature keys storage API
use namada_core::types::address::Address;
use namada_core::types::key::common;
use namada_core::types::storage;
use namada_core::address::Address;
use namada_core::key::common;
use namada_core::storage;
use namada_storage::{Result, StorageRead, StorageWrite};

use super::*;
Expand Down
6 changes: 3 additions & 3 deletions crates/account/src/storage_key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use namada_core::types::address::Address;
use namada_core::types::key::common;
use namada_core::types::storage::{self, DbKeySeg};
use namada_core::address::Address;
use namada_core::key::common;
use namada_core::storage::{self, DbKeySeg};
use namada_macros::StorageKeys;
use namada_storage::collections::lazy_map::LazyMap;
use namada_storage::collections::{lazy_map, LazyCollection};
Expand Down
12 changes: 6 additions & 6 deletions crates/account/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use namada_core::address::Address;
use namada_core::borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use namada_core::types::address::Address;
use namada_core::types::hash::Hash;
use namada_core::types::key::common;
use namada_core::hash::Hash;
use namada_core::key::common;
use serde::{Deserialize, Serialize};

/// A tx data type to initialize a new established account
Expand Down Expand Up @@ -53,9 +53,9 @@ pub struct UpdateAccount {
#[cfg(any(test, feature = "testing"))]
/// Tests and strategies for accounts
pub mod tests {
use namada_core::types::address::testing::arb_non_internal_address;
use namada_core::types::hash::testing::arb_hash;
use namada_core::types::key::testing::arb_common_pk;
use namada_core::address::testing::arb_non_internal_address;
use namada_core::hash::testing::arb_hash;
use namada_core::key::testing::arb_common_pk;
use proptest::prelude::Just;
use proptest::{collection, option, prop_compose};

Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/bin/namada-node/cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Namada node CLI.
use eyre::{Context, Result};
use namada::types::time::{DateTimeUtc, Utc};
use namada::core::time::{DateTimeUtc, Utc};
use namada_apps::cli::{self, cmds};
use namada_apps::config::ValidatorLocalConfig;
use namada_apps::node::ledger;
Expand Down
24 changes: 12 additions & 12 deletions crates/apps/src/lib/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ use borsh_ext::BorshSerializeExt;
use masp_primitives::transaction::Transaction;
use masp_primitives::zip32::ExtendedFullViewingKey;
use masp_proofs::prover::LocalTxProver;
use namada::core::address::{self, Address, InternalAddress};
use namada::core::chain::ChainId;
use namada::core::hash::Hash;
use namada::core::key::common::SecretKey;
use namada::core::masp::{
ExtendedViewingKey, PaymentAddress, TransferSource, TransferTarget,
};
use namada::core::storage::{BlockHeight, Epoch, Key, KeySeg, TxIndex};
use namada::core::time::DateTimeUtc;
use namada::core::token::{Amount, DenominatedAmount, Transfer};
use namada::governance::storage::proposal::ProposalType;
use namada::governance::InitProposalData;
use namada::ibc::apps::transfer::types::msgs::transfer::MsgTransfer;
Expand Down Expand Up @@ -50,6 +60,7 @@ use namada::ibc::core::host::types::path::{
use namada::ibc::primitives::proto::{Any, Protobuf};
use namada::ibc::primitives::{Msg, Timestamp as IbcTimestamp};
use namada::ibc::storage::port_key;
use namada::io::StdIo;
use namada::ledger::dry_run_tx;
use namada::ledger::gas::TxGasMeter;
use namada::ledger::ibc::storage::{channel_key, connection_key};
Expand All @@ -62,17 +73,6 @@ use namada::tendermint_rpc::{self};
use namada::tx::data::pos::Bond;
use namada::tx::data::{TxResult, VpsResult};
use namada::tx::{Code, Data, Section, Signature, Tx};
use namada::types::address::{self, Address, InternalAddress};
use namada::types::chain::ChainId;
use namada::types::hash::Hash;
use namada::types::io::StdIo;
use namada::types::key::common::SecretKey;
use namada::types::masp::{
ExtendedViewingKey, PaymentAddress, TransferSource, TransferTarget,
};
use namada::types::storage::{BlockHeight, Epoch, Key, KeySeg, TxIndex};
use namada::types::time::DateTimeUtc;
use namada::types::token::{Amount, DenominatedAmount, Transfer};
use namada::vm::wasm::run;
use namada::{proof_of_stake, tendermint};
use namada_sdk::masp::{
Expand Down Expand Up @@ -1021,7 +1021,7 @@ impl BenchShieldedCtx {

let mut hasher = Sha256::new();
let shielded_section_hash = shielded.clone().map(|transaction| {
namada::types::hash::Hash(
namada::core::hash::Hash(
Section::MaspTx(transaction)
.hash(&mut hasher)
.finalize_reset()
Expand Down
24 changes: 12 additions & 12 deletions crates/apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod wallet;

use clap::{ArgGroup, ArgMatches, ColorChoice};
use color_eyre::eyre::Result;
use namada::types::io::StdIo;
use namada::io::StdIo;
use utils::*;
pub use utils::{safe_exit, Cmd};

Expand Down Expand Up @@ -2826,19 +2826,19 @@ pub mod args {
use std::path::PathBuf;
use std::str::FromStr;

use namada::core::address::{Address, EstablishedAddress};
use namada::core::chain::{ChainId, ChainIdPrefix};
use namada::core::dec::Dec;
use namada::core::ethereum_events::EthAddress;
use namada::core::keccak::KeccakHash;
use namada::core::key::*;
use namada::core::masp::PaymentAddress;
use namada::core::storage::{self, BlockHeight, Epoch};
use namada::core::time::DateTimeUtc;
use namada::core::token;
use namada::core::token::NATIVE_MAX_DECIMAL_PLACES;
use namada::ibc::core::host::types::identifiers::{ChannelId, PortId};
use namada::tx::data::GasLimit;
use namada::types::address::{Address, EstablishedAddress};
use namada::types::chain::{ChainId, ChainIdPrefix};
use namada::types::dec::Dec;
use namada::types::ethereum_events::EthAddress;
use namada::types::keccak::KeccakHash;
use namada::types::key::*;
use namada::types::masp::PaymentAddress;
use namada::types::storage::{self, BlockHeight, Epoch};
use namada::types::time::DateTimeUtc;
use namada::types::token;
use namada::types::token::NATIVE_MAX_DECIMAL_PLACES;
pub use namada_sdk::args::*;
pub use namada_sdk::tx::{
TX_BECOME_VALIDATOR_WASM, TX_BOND_WASM, TX_BRIDGE_POOL_WASM,
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/cli/api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use namada::io::Io;
use namada::tendermint_rpc::HttpClient;
use namada::types::io::Io;
use namada_sdk::error::Error;
use namada_sdk::queries::Client;
use namada_sdk::rpc::wait_until_node_is_synched;
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/cli/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use color_eyre::eyre::Result;
use namada::types::io::Io;
use namada::io::Io;
use namada_sdk::{Namada, NamadaImpl};

use crate::cli;
Expand Down
14 changes: 7 additions & 7 deletions crates/apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;

use color_eyre::eyre::Result;
use namada::core::address::{Address, InternalAddress};
use namada::core::chain::ChainId;
use namada::core::ethereum_events::EthAddress;
use namada::core::ibc::is_ibc_denom;
use namada::core::key::*;
use namada::core::masp::*;
use namada::io::Io;
use namada::ledger::ibc::storage::ibc_token;
use namada::types::address::{Address, InternalAddress};
use namada::types::chain::ChainId;
use namada::types::ethereum_events::EthAddress;
use namada::types::ibc::is_ibc_denom;
use namada::types::io::Io;
use namada::types::key::*;
use namada::types::masp::*;
use namada_sdk::masp::fs::FsShieldedUtils;
use namada_sdk::masp::ShieldedContext;
use namada_sdk::wallet::Wallet;
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/cli/relayer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use color_eyre::eyre::Result;
use namada::types::io::Io;
use namada::io::Io;
use namada_sdk::eth_bridge::{bridge_pool, validator_set};

use crate::cli;
Expand Down
8 changes: 4 additions & 4 deletions crates/apps/src/lib/cli/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use ledger_namada_rs::{BIP44Path, NamadaApp};
use ledger_transport_hid::hidapi::HidApi;
use ledger_transport_hid::TransportNativeHID;
use masp_primitives::zip32::ExtendedFullViewingKey;
use namada::types::address::{Address, DecodeError};
use namada::types::io::Io;
use namada::types::key::*;
use namada::types::masp::{ExtendedSpendingKey, MaspValue, PaymentAddress};
use namada::core::address::{Address, DecodeError};
use namada::core::key::*;
use namada::core::masp::{ExtendedSpendingKey, MaspValue, PaymentAddress};
use namada::io::Io;
use namada_sdk::masp::find_valid_diversifier;
use namada_sdk::wallet::{
DecryptionError, DerivationPath, DerivationPathError, FindKeyError, Wallet,
Expand Down
22 changes: 11 additions & 11 deletions crates/apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ use masp_primitives::merkle_tree::MerklePath;
use masp_primitives::sapling::{Node, ViewingKey};
use masp_primitives::transaction::components::I128Sum;
use masp_primitives::zip32::ExtendedFullViewingKey;
use namada::core::address::{Address, InternalAddress, MASP};
use namada::core::hash::Hash;
use namada::core::ibc::{is_ibc_denom, IbcTokenHash};
use namada::core::key::*;
use namada::core::masp::{BalanceOwner, ExtendedViewingKey, PaymentAddress};
use namada::core::storage::{
BlockHeight, BlockResults, Epoch, IndexedTx, Key, KeySeg,
};
use namada::core::token::{Change, MaspDigitPos};
use namada::governance::cli::offline::{
find_offline_proposal, find_offline_votes, read_offline_files,
OfflineSignedProposal, OfflineVote,
Expand All @@ -29,6 +38,7 @@ use namada::governance::storage::proposal::{
use namada::governance::utils::{
compute_proposal_result, ProposalVotes, TallyType, TallyVote, VotePower,
};
use namada::io::Io;
use namada::ledger::events::Event;
use namada::ledger::ibc::storage::{
ibc_denom_key, ibc_denom_key_prefix, is_ibc_denom_key,
Expand All @@ -38,16 +48,6 @@ use namada::ledger::pos::types::{CommissionPair, Slash};
use namada::ledger::pos::PosParams;
use namada::ledger::queries::RPC;
use namada::proof_of_stake::types::{ValidatorState, WeightedValidator};
use namada::types::address::{Address, InternalAddress, MASP};
use namada::types::hash::Hash;
use namada::types::ibc::{is_ibc_denom, IbcTokenHash};
use namada::types::io::Io;
use namada::types::key::*;
use namada::types::masp::{BalanceOwner, ExtendedViewingKey, PaymentAddress};
use namada::types::storage::{
BlockHeight, BlockResults, Epoch, IndexedTx, Key, KeySeg,
};
use namada::types::token::{Change, MaspDigitPos};
use namada::{state as storage, token};
use namada_sdk::error::{
is_pinned_error, Error, PinnedBalanceError, QueryError,
Expand Down Expand Up @@ -329,7 +329,7 @@ pub async fn query_transparent_balance(
args: args::QueryBalance,
) {
let prefix = Key::from(
Address::Internal(namada::types::address::InternalAddress::Multitoken)
Address::Internal(namada::core::address::InternalAddress::Multitoken)
.to_db_key(),
);
match (args.token, args.owner) {
Expand Down
8 changes: 4 additions & 4 deletions crates/apps/src/lib/client/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use borsh_ext::BorshSerializeExt;
use ledger_namada_rs::{BIP44Path, NamadaApp};
use ledger_transport_hid::hidapi::HidApi;
use ledger_transport_hid::TransportNativeHID;
use namada::core::address::{Address, ImplicitAddress};
use namada::core::dec::Dec;
use namada::core::key::{self, *};
use namada::governance::cli::offline::{
OfflineProposal, OfflineSignedProposal, OfflineVote,
};
Expand All @@ -15,13 +18,10 @@ use namada::governance::cli::onchain::{
};
use namada::governance::ProposalVote;
use namada::ibc::apps::transfer::types::Memo;
use namada::io::Io;
use namada::state::EPOCH_SWITCH_BLOCKS_DELAY;
use namada::tx::data::pos::{BecomeValidator, ConsensusKeyChange};
use namada::tx::{CompressedSignature, Section, Signer, Tx};
use namada::types::address::{Address, ImplicitAddress};
use namada::types::dec::Dec;
use namada::types::io::Io;
use namada::types::key::{self, *};
use namada_sdk::rpc::{InnerTxResult, TxBroadcastData, TxResponse};
use namada_sdk::wallet::alias::validator_consensus_key;
use namada_sdk::wallet::{Wallet, WalletIo};
Expand Down
12 changes: 6 additions & 6 deletions crates/apps/src/lib/client/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use flate2::read::GzDecoder;
use flate2::write::GzEncoder;
use flate2::Compression;
use itertools::Either;
use namada::types::chain::ChainId;
use namada::types::dec::Dec;
use namada::types::key::*;
use namada::types::string_encoding::StringEncoded;
use namada::types::token;
use namada::types::uint::Uint;
use namada::core::chain::ChainId;
use namada::core::dec::Dec;
use namada::core::key::*;
use namada::core::string_encoding::StringEncoded;
use namada::core::token;
use namada::core::uint::Uint;
use namada::vm::validate_untrusted_wasm;
use namada_sdk::wallet::{alias, Wallet};
use prost::bytes::Bytes;
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/config/ethereum_bridge/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Runtime configuration for a validator node.
#[allow(unused_imports)]
use namada::types::ethereum_events::EthereumEvent;
use namada::core::ethereum_events::EthereumEvent;
use serde::{Deserialize, Serialize};

/// Default [Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/) endpoint used by the oracle
Expand Down
26 changes: 13 additions & 13 deletions crates/apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ use std::str::FromStr;

use borsh::{BorshDeserialize, BorshSerialize};
use derivative::Derivative;
use namada::core::address::{Address, EstablishedAddress};
use namada::core::chain::ProposalBytes;
use namada::core::key::*;
use namada::core::storage;
use namada::core::string_encoding::StringEncoded;
use namada::core::time::{DateTimeUtc, DurationSecs};
use namada::core::token::Denomination;
use namada::governance::parameters::GovernanceParameters;
use namada::governance::pgf::parameters::PgfParameters;
use namada::ledger::eth_bridge::EthereumBridgeParams;
use namada::ledger::parameters::EpochDuration;
use namada::ledger::pos::{Dec, GenesisValidator, OwnedPosParams};
use namada::token;
use namada::types::address::{Address, EstablishedAddress};
use namada::types::chain::ProposalBytes;
use namada::types::key::*;
use namada::types::storage;
use namada::types::string_encoding::StringEncoded;
use namada::types::time::{DateTimeUtc, DurationSecs};
use namada::types::token::Denomination;
use serde::{Deserialize, Serialize};

#[cfg(all(any(test, feature = "benches"), not(feature = "integration")))]
Expand Down Expand Up @@ -313,13 +313,13 @@ pub fn make_dev_genesis(
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;

use namada::core::address::wnam;
use namada::core::chain::ChainIdPrefix;
use namada::core::ethereum_events::EthAddress;
use namada::core::key::*;
use namada::ledger::eth_bridge::{Contracts, UpgradeableContract};
use namada::ledger::pos::types::ValidatorMetaData;
use namada::tx::standalone_signature;
use namada::types::address::wnam;
use namada::types::chain::ChainIdPrefix;
use namada::types::ethereum_events::EthAddress;
use namada::types::key::*;
use namada_sdk::wallet::alias::Alias;

use crate::config::genesis::chain::{finalize, DeriveEstablishedAddress};
Expand Down Expand Up @@ -554,8 +554,8 @@ pub fn make_dev_genesis(
#[cfg(test)]
pub mod tests {
use borsh_ext::BorshSerializeExt;
use namada::types::address::testing::gen_established_address;
use namada::types::key::*;
use namada::core::address::testing::gen_established_address;
use namada::core::key::*;
use rand::prelude::ThreadRng;
use rand::thread_rng;

Expand Down
Loading

0 comments on commit 8e8ebf2

Please sign in to comment.