Skip to content

Commit

Permalink
fixup! Merge branch 'bat/toochain-1.76.0' (#2687)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Feb 27, 2024
1 parent aed8798 commit 8335acb
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 45 deletions.
18 changes: 6 additions & 12 deletions crates/apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
//! Implementation of the `FinalizeBlock` ABCI++ method for the Shell
use std::cell::RefCell;

use data_encoding::HEXUPPER;
use masp_primitives::merkle_tree::CommitmentTree;
use masp_primitives::sapling::Node;
use namada::core::key::tm_raw_hash_to_string;
use namada::core::storage::{BlockHash, BlockResults, Epoch, Header};
use namada::governance::pgf::inflation as pgf_inflation;
use namada::ledger::events::EventType;
Expand Down Expand Up @@ -745,15 +742,13 @@ mod test_finalize_block {
use std::num::NonZeroU64;
use std::str::FromStr;

use data_encoding::HEXUPPER;
use namada::core::dec::{Dec, POS_DECIMAL_PRECISION};
use namada::core::ethereum_events::{EthAddress, Uint as ethUint};
use namada::core::hash::Hash;
use namada::core::keccak::KeccakHash;
use namada::core::key::testing::common_sk_from_simple_seed;
use namada::core::key::tm_consensus_key_raw_hash;
use namada::core::storage::{Epoch, KeySeg};
use namada::core::time::{DateTimeUtc, DurationSecs};
use namada::core::storage::KeySeg;
use namada::core::time::DurationSecs;
use namada::core::uint::Uint;
use namada::eth_bridge::storage::bridge_pool::{
self, get_key_from_hash, get_nonce_key, get_signed_root_key,
Expand Down Expand Up @@ -782,18 +777,17 @@ mod test_finalize_block {
};
use namada::proof_of_stake::{unjail_validator, ADDRESS as pos_address};
use namada::replay_protection;
use namada::state::StorageWrite;
use namada::tendermint::abci::types::{Misbehavior, MisbehaviorKind};
use namada::token::{Amount, DenominatedAmount, NATIVE_MAX_DECIMAL_PLACES};
use namada::tx::data::{Fee, WrapperTx};
use namada::tx::{Code, Data, Section, Signature};
use namada::vote_ext::{ethereum_events, EthereumTxData};
use namada::tx::data::Fee;
use namada::tx::{Code, Data, Signature};
use namada::vote_ext::ethereum_events;
use namada_sdk::eth_bridge::MinimumConfirmations;
use namada_sdk::governance::ProposalVote;
use namada_sdk::proof_of_stake::storage::{
liveness_missed_votes_handle, liveness_sum_missed_votes_handle,
read_consensus_validator_set_addresses,
};
use namada_sdk::tendermint::abci::types::MisbehaviorKind;
use namada_sdk::validity_predicate::VpSentinel;
use namada_test_utils::tx_data::TxWriteData;
use namada_test_utils::TestWasms;
Expand Down
4 changes: 1 addition & 3 deletions crates/apps/src/lib/node/ledger/shell/governance.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::cell::RefCell;
use std::collections::HashMap;

use namada::core::address::Address;
use namada::core::encode;
use namada::core::event::EmitEvents;
use namada::core::storage::Epoch;
Expand All @@ -17,14 +15,14 @@ use namada::governance::utils::{
VotePower,
};
use namada::governance::{storage as gov_api, ADDRESS as gov_address};
use namada::ibc;
use namada::ledger::governance::utils::ProposalEvent;
use namada::ledger::pos::BondId;
use namada::proof_of_stake::bond_amount;
use namada::proof_of_stake::parameters::PosParams;
use namada::proof_of_stake::storage::read_total_stake;
use namada::state::StorageWrite;
use namada::tx::{Code, Data};
use namada::{ibc, token};
use namada_sdk::proof_of_stake::storage::read_validator_stake;

use super::utils::force_read;
Expand Down
1 change: 1 addition & 0 deletions crates/apps/src/lib/node/ledger/shell/init_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use namada::account::protocol_pk_key;
use namada::core::hash::Hash as CodeHash;
use namada::core::time::{TimeZone, Utc};
use namada::ledger::parameters::Parameters;
use namada::ledger::{ibc, pos};
use namada::proof_of_stake::BecomeValidator;
use namada::state::StorageWrite;
use namada::token::{credit_tokens, write_denom};
Expand Down
5 changes: 2 additions & 3 deletions crates/apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ mod test_utils {

use super::*;
use crate::config::ethereum_bridge::ledger::ORACLE_CHANNEL_BUFFER_SIZE;
use crate::facade::tendermint::abci::types::Misbehavior;
use crate::facade::tendermint_proto::google::protobuf::Timestamp;
use crate::facade::tendermint_proto::v0_37::abci::{
RequestPrepareProposal, RequestProcessProposal,
Expand Down Expand Up @@ -2066,9 +2067,7 @@ mod test_utils {

#[cfg(test)]
mod shell_tests {
use namada::core::ethereum_events::EthereumEvent;
use namada::core::key::RefTo;
use namada::core::storage::{BlockHeight, Epoch};
use namada::core::storage::Epoch;
use namada::replay_protection;
use namada::token::read_denom;
use namada::tx::data::protocol::{ProtocolTx, ProtocolTxType};
Expand Down
4 changes: 1 addition & 3 deletions crates/apps/src/lib/node/ledger/shell/process_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,14 @@ where
/// are covered by the e2e tests.
#[cfg(test)]
mod test_process_proposal {
use namada::core::ethereum_events::EthereumEvent;
use namada::core::key::*;
use namada::core::storage::Epoch;
use namada::core::time::DateTimeUtc;
use namada::replay_protection;
use namada::state::StorageWrite;
use namada::token::{read_denom, Amount, DenominatedAmount};
use namada::tx::data::Fee;
use namada::tx::{Code, Data, Signature, Signed};
use namada::vote_ext::{bridge_pool_roots, ethereum_events};
use namada::{replay_protection, token};

use super::*;
use crate::node::ledger::shell::test_utils::{
Expand Down
1 change: 0 additions & 1 deletion crates/apps/src/lib/node/ledger/shell/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use namada::ledger::dry_run_tx;
use namada::ledger::queries::{RequestCtx, ResponseQuery};
use namada::token;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/merkle_tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use namada_core::storage::{
self, BlockHeight, DbKeySeg, Epoch, Error as StorageError, Key, KeySeg,
StringKey, TreeBytes, TreeKeyError, IBC_KEY_LIMIT,
};
use namada_core::{self, decode, DecodeError};
use namada_core::{decode, DecodeError};
use thiserror::Error;

/// Trait for reading from a merkle tree that is a sub-tree
Expand Down
1 change: 0 additions & 1 deletion crates/namada/src/ledger/native_vp/multitoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ mod tests {
use namada_tx::{Code, Data, Section, Signature};

use super::*;
use crate::address::{Address, InternalAddress};
use crate::core::address::testing::{
established_address_1, established_address_2, nam,
};
Expand Down
1 change: 0 additions & 1 deletion crates/namada/src/vm/wasm/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ mod tests {
use wasmer_vm::TrapCode;

use super::*;
use crate::hash::Hash;
use crate::state::testing::TestState;
use crate::tx::data::eval_vp::EvalVp;
use crate::vm::host_env::TxRuntimeError;
Expand Down
8 changes: 1 addition & 7 deletions crates/proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2928,13 +2928,7 @@ where
for evidence in byzantine_validators {
// dbg!(&evidence);
tracing::info!("Processing evidence {evidence:?}.");
let evidence_height = match u64::try_from(evidence.height) {
Ok(height) => height,
Err(err) => {
tracing::error!("Unexpected evidence block height {}", err);
continue;
}
};
let evidence_height = u64::from(evidence.height);
let evidence_epoch =
match pred_epochs.get_epoch(BlockHeight(evidence_height)) {
Some(epoch) => epoch,
Expand Down
2 changes: 2 additions & 0 deletions crates/sdk/src/eth_bridge/bridge_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,8 @@ mod recommendations {

#[cfg(test)]
mod test_recommendations {
use namada_core::address;

use super::*;
use crate::io::StdIo;

Expand Down
3 changes: 2 additions & 1 deletion crates/sdk/src/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2856,10 +2856,11 @@ pub mod testing {
use masp_primitives::ff::Field;
use masp_primitives::sapling::prover::TxProver;
use masp_primitives::sapling::redjubjub::Signature;
use masp_primitives::sapling::{PaymentAddress, ProofGenerationKey, Rseed};
use masp_primitives::sapling::{ProofGenerationKey, Rseed};
use masp_primitives::transaction::components::GROTH_PROOF_SIZE;
use masp_proofs::bellman::groth16::Proof;
use proptest::prelude::*;
use proptest::sample::SizeRange;
use proptest::test_runner::TestRng;
use proptest::{collection, option, prop_compose};

Expand Down
4 changes: 1 addition & 3 deletions crates/sdk/src/queries/shell/eth_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,7 @@ mod test_ethbridge_router {
use namada_core::eth_bridge_pool::{
GasFee, TransferToEthereum, TransferToEthereumKind,
};
use namada_core::voting_power::{
EthBridgeVotingPower, FractionalVotingPower,
};
use namada_core::voting_power::EthBridgeVotingPower;
use namada_ethereum_bridge::protocol::transactions::validator_set_update::aggregate_votes;
use namada_ethereum_bridge::storage::bridge_pool::{
get_pending_key, get_signed_root_key, BridgePoolTree,
Expand Down
2 changes: 1 addition & 1 deletion crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ mod tests {
use namada_core::storage::DbKeySeg;
use namada_core::time::{self, DateTimeUtc, Duration};
use namada_core::token;
use namada_parameters::EpochDuration;
use namada_parameters::{EpochDuration, Parameters};
use proptest::prelude::*;
use proptest::test_runner::Config;
// Use `RUST_LOG=info` (or another tracing level) and `--nocapture` to
Expand Down
4 changes: 2 additions & 2 deletions crates/state/src/wl_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,14 +849,14 @@ where
.block
.pred_epochs
.get_epoch(height)
.unwrap_or(Epoch::default());
.unwrap_or_default();
let epoch_start_height = match self
.in_mem
.block
.pred_epochs
.get_start_height_of_epoch(epoch)
{
Some(height) if height == BlockHeight(0) => BlockHeight(1),
Some(BlockHeight(0)) => BlockHeight(1),
Some(height) => height,
None => BlockHeight(1),
};
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/src/mockdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use namada_core::{decode, encode, ethereum_events, ethereum_structs};
use namada_merkle_tree::{
base_tree_key_prefix, subtree_key_prefix, MerkleTreeStoresRead, StoreType,
};
use {namada_core, namada_replay_protection as replay_protection};
use namada_replay_protection as replay_protection;

use crate::conversion_state::ConversionState;
use crate::db::{
Expand Down
2 changes: 0 additions & 2 deletions crates/tests/src/vm_host_env/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ impl TestTxEnv {
/// invoked host environment functions and so it must be initialized
/// before the test.
mod native_tx_host_env {

use std::cell::RefCell;
use std::pin::Pin;

// TODO replace with `std::concat_idents` once stabilized (https://github.com/rust-lang/rust/issues/29599)
Expand Down
2 changes: 0 additions & 2 deletions crates/tests/src/vm_host_env/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ impl TestVpEnv {
/// invoked host environment functions and so it must be initialized
/// before the test.
mod native_vp_host_env {

use std::cell::RefCell;
use std::pin::Pin;

// TODO replace with `std::concat_idents` once stabilized (https://github.com/rust-lang/rust/issues/29599)
Expand Down
2 changes: 1 addition & 1 deletion crates/vote_ext/src/ethereum_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl VextDigest {

#[cfg(test)]
mod tests {
use namada_core::ethereum_events::{EthereumEvent, Uint};
use namada_core::ethereum_events::Uint;
use namada_core::hash::Hash;
use namada_core::{address, key};

Expand Down

0 comments on commit 8335acb

Please sign in to comment.