Skip to content

Commit

Permalink
tests: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jan 8, 2024
1 parent 658d17b commit fd84114
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 98 deletions.
9 changes: 5 additions & 4 deletions tests/src/e2e/eth_bridge_tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ use namada::ledger::eth_bridge::{
wrapped_erc20s, ContractVersion, Contracts, EthereumBridgeParams,
MinimumConfirmations, UpgradeableContract,
};
use namada::token;
use namada::types::address::{wnam, Address};
use namada::types::ethereum_events::{EthAddress, Uint};
use namada::types::ethereum_events::{
EthAddress, EthereumEvent, TransferToNamada, Uint,
};
use namada_apps::config::ethereum_bridge;
use namada_core::types::ethereum_events::{EthereumEvent, TransferToNamada};
use namada_core::types::token;

use crate::e2e::helpers::{
get_actor_rpc, rpc_client_do, strip_trailing_newline,
Expand Down Expand Up @@ -206,7 +207,7 @@ pub fn find_wrapped_erc20_balance(
let ledger_address = get_actor_rpc(test, node);

let token = wrapped_erc20s::token(asset);
let balance_key = token::balance_key(&token, owner);
let balance_key = token::storage_key::balance_key(&token, owner);
let mut bytes = run!(
test,
Bin::Client,
Expand Down
4 changes: 2 additions & 2 deletions tests/src/e2e/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use escargot::CargoBuild;
use eyre::eyre;
use namada::ledger::queries::{Rpc, RPC};
use namada::tendermint_rpc::HttpClient;
use namada::token;
use namada::types::address::Address;
use namada::types::key::*;
use namada::types::storage::Epoch;
use namada::types::token;
use namada_apps::config::genesis::chain::DeriveEstablishedAddress;
use namada_apps::config::genesis::templates;
use namada_apps::config::utils::convert_tm_addr_to_socket_addr;
Expand Down Expand Up @@ -136,7 +136,7 @@ pub fn find_balance(
owner: &Address,
) -> Result<token::Amount> {
let ledger_address = get_actor_rpc(test, node);
let balance_key = token::balance_key(token, owner);
let balance_key = token::storage_key::balance_key(token, owner);
let mut bytes = run!(
test,
Bin::Client,
Expand Down
2 changes: 1 addition & 1 deletion tests/src/e2e/ibc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use namada::ledger::ibc::storage::*;
use namada::ledger::parameters::{storage as param_storage, EpochDuration};
use namada::ledger::queries::RPC;
use namada::ledger::storage::ics23_specs::ibc_proof_specs;
use namada::ledger::storage::traits::Sha256Hasher;
use namada::state::Sha256Hasher;
use namada::tendermint::abci::Event as AbciEvent;
use namada::tendermint::block::Height as TmHeight;
use namada::types::address::{Address, InternalAddress};
Expand Down
11 changes: 6 additions & 5 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ use borsh_ext::BorshSerializeExt;
use color_eyre::eyre::Result;
use color_eyre::owo_colors::OwoColorize;
use data_encoding::HEXLOWER;
use namada::governance::cli::onchain::{
PgfFunding, PgfFundingTarget, StewardsUpdate,
};
use namada::token;
use namada::types::address::Address;
use namada::types::storage::Epoch;
use namada::types::token;
use namada_apps::config::ethereum_bridge;
use namada_apps::config::utils::convert_tm_addr_to_socket_addr;
use namada_apps::facade::tendermint_config::net::Address as TendermintAddress;
use namada_core::ledger::governance::cli::onchain::{
PgfFunding, PgfFundingTarget, StewardsUpdate,
};
use namada_core::types::token::NATIVE_MAX_DECIMAL_PLACES;
use namada_sdk::masp::fs::FsShieldedUtils;
use namada_test_utils::TestWasms;
Expand Down Expand Up @@ -659,7 +659,8 @@ fn ledger_txs_and_queries() -> Result<()> {
// as setup in `genesis/e2e-tests-single-node.toml`
let christel_balance = token::Amount::native_whole(2000000);
let nam = find_address(&test, NAM)?;
let storage_key = token::balance_key(&nam, &christel).to_string();
let storage_key =
token::storage_key::balance_key(&nam, &christel).to_string();
let query_args_and_expected_response = vec![
// 8. Query storage key and get hex-encoded raw bytes
(
Expand Down
4 changes: 2 additions & 2 deletions tests/src/native_vp/eth_bridge_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ mod test_bridge_pool_vp {

use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use namada::core::ledger::eth_bridge::storage::bridge_pool::BRIDGE_POOL_ADDRESS;
use namada::eth_bridge::storage::bridge_pool::BRIDGE_POOL_ADDRESS;
use namada::ledger::native_vp::ethereum_bridge::bridge_pool_vp::BridgePoolVp;
use namada::proto::Tx;
use namada::tx::Tx;
use namada::types::address::{nam, wnam};
use namada::types::chain::ChainId;
use namada::types::eth_bridge_pool::{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/native_vp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::collections::BTreeSet;

use namada::ledger::gas::VpGasMeter;
use namada::ledger::native_vp::{Ctx, NativeVp};
use namada::ledger::storage::mockdb::MockDB;
use namada::ledger::storage::traits::Sha256Hasher;
use namada::state::mockdb::MockDB;
use namada::state::Sha256Hasher;
use namada::types::address::Address;
use namada::types::storage;
use namada::vm::WasmCacheRwAccess;
Expand Down
12 changes: 7 additions & 5 deletions tests/src/native_vp/pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ pub fn init_pos(
mod tests {

use namada::ledger::pos::{PosParams, PosVP};
use namada::token;
use namada::types::address;
use namada::types::key::common::PublicKey;
use namada::types::storage::Epoch;
use namada::types::{address, token};
use namada_tx_prelude::proof_of_stake::parameters::testing::arb_pos_params;
use namada_tx_prelude::Address;
use proptest::prelude::*;
Expand Down Expand Up @@ -579,12 +580,13 @@ pub mod testing {
};
use namada::proof_of_stake::types::{BondId, ValidatorState};
use namada::proof_of_stake::ADDRESS as POS_ADDRESS;
use namada::token;
use namada::token::{Amount, Change};
use namada::types::dec::Dec;
use namada::types::key::common::PublicKey;
use namada::types::key::RefTo;
use namada::types::storage::Epoch;
use namada::types::{address, key, token};
use namada_core::types::dec::Dec;
use namada_core::types::token::{Amount, Change};
use namada::types::{address, key};
use namada_tx_prelude::{Address, StorageRead, StorageWrite};
use proptest::prelude::*;

Expand Down Expand Up @@ -1309,7 +1311,7 @@ pub mod testing {
// tx::ctx().write_validator_state(&validator, state).unwrap();
}
PosStorageChange::StakingTokenPosBalance { delta } => {
let balance_key = token::balance_key(
let balance_key = token::storage_key::balance_key(
&tx::ctx().get_native_token().unwrap(),
&POS_ADDRESS,
);
Expand Down
21 changes: 7 additions & 14 deletions tests/src/storage_api/collections/lazy_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ mod tests {
use borsh::{BorshDeserialize, BorshSerialize};
use namada::types::address::{self, Address};
use namada::types::storage;
use namada_tx_prelude::collections::{LazyCollection, LazyMap};
use namada_tx_prelude::storage::KeySeg;
use namada_tx_prelude::storage_api::collections::{
lazy_map, LazyCollection, LazyMap,
};
use namada_vp_prelude::collection_validation::{self, LazyCollectionExt};
use proptest::prelude::*;
use proptest::test_runner::Config;
use proptest_state_machine::{
Expand Down Expand Up @@ -443,16 +442,15 @@ mod tests {
let current_transitions =
normalize_transitions(&self.current_transitions);
for transition in &current_transitions {
use collection_validation::lazy_map::Action;
match transition {
Transition::CommitTx | Transition::CommitTxAndBlock => {
}
Transition::Insert(expected_key, expected_val) => {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_map::Action::Insert(key, val) =
action
{
if let Action::Insert(key, val) = action {
if expected_key == key
&& expected_val == val
{
Expand All @@ -466,9 +464,7 @@ mod tests {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_map::Action::Remove(key, _val) =
action
{
if let Action::Remove(key, _val) = action {
if expected_key == key {
actions_to_check.remove(ix);
break;
Expand All @@ -480,11 +476,8 @@ mod tests {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_map::Action::Update {
key,
pre: _,
post,
} = action
if let Action::Update { key, pre: _, post } =
action
{
if expected_key == key && post == value {
actions_to_check.remove(ix);
Expand Down
14 changes: 6 additions & 8 deletions tests/src/storage_api/collections/lazy_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ mod tests {

use namada::types::address::{self, Address};
use namada::types::storage;
use namada_tx_prelude::collections::{LazyCollection, LazySet};
use namada_tx_prelude::storage::KeySeg;
use namada_tx_prelude::storage_api::collections::{
lazy_set, LazyCollection, LazySet,
};
use namada_vp_prelude::collection_validation::{self, LazyCollectionExt};
use proptest::prelude::*;
use proptest::test_runner::Config;
use proptest_state_machine::{
Expand Down Expand Up @@ -406,14 +405,15 @@ mod tests {
let current_transitions =
normalize_transitions(&self.current_transitions);
for transition in &current_transitions {
use collection_validation::lazy_set::Action;
match transition {
Transition::CommitTx | Transition::CommitTxAndBlock => {
}
Transition::Insert(expected_key) => {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_set::Action::Insert(key) = action {
if let Action::Insert(key) = action {
if expected_key == key {
actions_to_check.remove(ix);
break;
Expand All @@ -429,9 +429,7 @@ mod tests {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_set::Action::Insert(key) =
action
{
if let Action::Insert(key) = action {
if expected_key == key {
actions_to_check.remove(ix);
break;
Expand All @@ -444,7 +442,7 @@ mod tests {
for (ix, action) in
actions_to_check.iter().enumerate()
{
if let lazy_set::Action::Remove(key) = action {
if let Action::Remove(key) = action {
if expected_key == key {
actions_to_check.remove(ix);
break;
Expand Down
14 changes: 6 additions & 8 deletions tests/src/storage_api/collections/lazy_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ mod tests {
use borsh::{BorshDeserialize, BorshSerialize};
use namada::types::address::{self, Address};
use namada::types::storage;
use namada_tx_prelude::collections::{lazy_vec, LazyCollection, LazyVec};
use namada_tx_prelude::storage::KeySeg;
use namada_tx_prelude::storage_api::collections::{
lazy_vec, LazyCollection, LazyVec,
};
use namada_vp_prelude::collection_validation::{self, LazyCollectionExt};
use proptest::prelude::*;
use proptest::test_runner::Config;
use proptest_state_machine::{
Expand Down Expand Up @@ -438,14 +437,14 @@ mod tests {
new_vec_len,
);
for transition in &current_transitions {
use collection_validation::lazy_vec::Action;
match transition {
Transition::CommitTx | Transition::CommitTxAndBlock => {
}
Transition::Push(expected_val) => {
let mut ix = 0;
while ix < actions_to_check.len() {
if let lazy_vec::Action::Push(val) =
&actions_to_check[ix]
if let Action::Push(val) = &actions_to_check[ix]
{
if expected_val == val {
actions_to_check.remove(ix);
Expand All @@ -458,8 +457,7 @@ mod tests {
Transition::Pop => {
let mut ix = 0;
while ix < actions_to_check.len() {
if let lazy_vec::Action::Pop(_val) =
&actions_to_check[ix]
if let Action::Pop(_val) = &actions_to_check[ix]
{
actions_to_check.remove(ix);
break;
Expand All @@ -473,7 +471,7 @@ mod tests {
} => {
let mut ix = 0;
while ix < actions_to_check.len() {
if let lazy_vec::Action::Update {
if let Action::Update {
index,
pre: _,
post,
Expand Down
13 changes: 6 additions & 7 deletions tests/src/storage_api/collections/nested_lazy_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ mod tests {
use borsh::{BorshDeserialize, BorshSerialize};
use namada::types::address::{self, Address};
use namada::types::storage;
use namada_tx_prelude::storage::KeySeg;
use namada_tx_prelude::storage_api::collections::lazy_map::{
use namada_tx_prelude::collections::lazy_map::{
NestedMap, NestedSubKey, SubKey,
};
use namada_tx_prelude::storage_api::collections::{
lazy_map, LazyCollection, LazyMap,
};
use namada_tx_prelude::collections::{LazyCollection, LazyMap};
use namada_tx_prelude::storage::KeySeg;
use namada_vp_prelude::collection_validation::{self, LazyCollectionExt};
use proptest::prelude::*;
use proptest::test_runner::Config;
use proptest_state_machine::{
Expand Down Expand Up @@ -523,8 +522,8 @@ mod tests {
let current_transitions =
normalize_transitions(&self.current_transitions);
for transition in &current_transitions {
use lazy_map::Action;
use lazy_map::NestedAction::At;
use collection_validation::lazy_map::Action;
use collection_validation::lazy_map::NestedAction::At;

match transition {
Transition::CommitTx | Transition::CommitTxAndBlock => {
Expand Down
Loading

0 comments on commit fd84114

Please sign in to comment.