Skip to content

Commit

Permalink
Merge branch 'bat/toochain-1.76.0' (#2687)
Browse files Browse the repository at this point in the history
* bat/toochain-1.76.0:
  Update crates/core/src/types/key/secp256k1.rs
  ci+docker: update toolchain versions
  Fixed unit tests. Added changelog. Updated toolchain for wasm
  [feat]: Bumping the toolchain version
  • Loading branch information
tzemanovic committed Feb 27, 2024
2 parents f93a9d8 + 92fc1f6 commit b13c9f1
Show file tree
Hide file tree
Showing 138 changed files with 358 additions and 610 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Moving to rust version 1.76.0 ([#2687](https://github.com/anoma/anoma/pull/2687))
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions crates/account/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cryptographic signature keys storage API
use namada_core::address::Address;
use namada_core::key::common;
use namada_core::storage;
use namada_storage::{Result, StorageRead, StorageWrite};

Expand Down
1 change: 0 additions & 1 deletion crates/apps/src/lib/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ use namada::ledger::queries::{
Client, EncodedResponseQuery, RequestCtx, RequestQuery, Router, RPC,
};
use namada::state::StorageRead;
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};
Expand Down
3 changes: 1 addition & 2 deletions crates/apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2926,7 +2926,6 @@ pub mod cmds {

pub mod args {
use std::collections::HashMap;
use std::convert::TryFrom;
use std::env;
use std::net::SocketAddr;
use std::path::PathBuf;
Expand Down Expand Up @@ -6336,7 +6335,7 @@ pub mod args {

let find_viewing_key = |w: &mut Wallet<CliWalletUtils>| {
w.find_viewing_key(&self.viewing_key.raw)
.map(Clone::clone)
.copied()
.unwrap_or_else(|_| {
eprintln!(
"Unknown viewing key {}",
Expand Down
2 changes: 1 addition & 1 deletion crates/apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl ArgFromMutContext for ExtendedViewingKey {
// Or it is a stored alias of one
ctx.wallet
.find_viewing_key(raw)
.map(Clone::clone)
.copied()
.map_err(|_find_err| format!("Unknown viewing key {}", raw))
})
}
Expand Down
1 change: 1 addition & 0 deletions crates/apps/src/lib/cli/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ pub trait AppExt {
/// Extensions for finding matching commands and arguments.
/// The functions match commands and arguments defined in [`AppExt`].
pub trait ArgMatchesExt {
#[allow(dead_code)]
fn args_parse<T: Args>(&self) -> T;
}

Expand Down
7 changes: 2 additions & 5 deletions crates/apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::cmp::Ordering;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fs::{self, read_dir};
use std::io;
use std::iter::Iterator;
use std::str::FromStr;

use borsh::BorshDeserialize;
Expand Down Expand Up @@ -1330,8 +1329,8 @@ pub async fn query_proposal_result(
false,
);

if proposal.is_ok() {
proposal.unwrap()
if let Ok(proposal) = proposal {
proposal
} else {
edisplay_line!(
context.io(),
Expand Down Expand Up @@ -1960,7 +1959,6 @@ pub async fn query_bonded_stake<N: Namada>(

match args.validator {
Some(validator) => {
let validator = validator;
// Find bonded stake for the given validator
let stake =
get_validator_stake(context.client(), epoch, &validator).await;
Expand Down Expand Up @@ -2262,7 +2260,6 @@ pub async fn query_and_print_metadata(
pub async fn query_slashes<N: Namada>(context: &N, args: args::QuerySlashes) {
match args.validator {
Some(validator) => {
let validator = validator;
// Find slashes for the given validator
let slashes: Vec<Slash> = unwrap_client_response::<N::Client, _>(
RPC.vp()
Expand Down
5 changes: 3 additions & 2 deletions crates/apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::non_canonical_partial_ord_impl)]
//! The parameters used for the chain's genesis
pub mod chain;
Expand Down Expand Up @@ -401,15 +402,15 @@ pub fn make_dev_genesis(
.validator_account
.as_ref()
.unwrap()
.get(0)
.first()
.unwrap();
let genesis_addr =
GenesisAddress::EstablishedAddress(tx.tx.data.address.raw.clone());

let balance = *nam_balances.0.get(&genesis_addr).unwrap();
let bonded = {
let bond =
genesis.transactions.bond.as_mut().unwrap().get(0).unwrap();
genesis.transactions.bond.as_mut().unwrap().first().unwrap();
bond.amount
};

Expand Down
1 change: 0 additions & 1 deletion crates/apps/src/lib/config/genesis/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,6 @@ pub struct Metadata<ID> {
#[cfg(test)]
mod test {
use std::path::PathBuf;
use std::str::FromStr;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions crates/apps/src/lib/node/ledger/abortable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl AbortableSpawner {
/// This future will resolve when:
///
/// 1. A user sends a shutdown signal (e.g. SIGINT), or...
/// 2. One of the child processes of the ledger terminates,
/// which generates a notification upon dropping an [`Aborter`].
/// 2. One of the child processes of the ledger terminates, which
/// generates a notification upon dropping an [`Aborter`].
///
/// These two scenarios are represented by the [`AborterStatus`] enum.
pub async fn wait_for_abort(mut self) -> AborterStatus {
Expand Down
2 changes: 2 additions & 0 deletions crates/apps/src/lib/node/ledger/ethereum_oracle/events.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod eth_events {
#![allow(dead_code)]
use std::fmt::Debug;
use std::str::FromStr;

Expand Down Expand Up @@ -119,6 +120,7 @@ pub mod eth_events {
}
}

#[allow(unused_macros)]
macro_rules! parse_method {
($name:ident -> $type:ty) => {
fn $name(self) -> Result<$type> {
Expand Down
15 changes: 7 additions & 8 deletions crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
//!
//! The state machine moves through the following state DAG:
//!
//! 1. [`BuildingEncryptedTxBatch`] - the initial state. In
//! this state, we populate a block with DKG encrypted txs.
//! This state supports two modes of operation, which you can
//! think of as two sub-states:
//! 1. [`BuildingEncryptedTxBatch`] - the initial state. In this state, we
//! populate a block with DKG encrypted txs. This state supports two modes of
//! operation, which you can think of as two sub-states:
//! * [`WithoutEncryptedTxs`] - When this mode is active, no encrypted txs are
//! included in a block proposal.
//! * [`WithEncryptedTxs`] - When this mode is active, we are able to include
//! encrypted txs in a block proposal.
//! 2. [`BuildingDecryptedTxBatch`] - the second state. In
//! this state, we populate a block with DKG decrypted txs.
//! 3. [`BuildingProtocolTxBatch`] - the third state. In
//! this state, we populate a block with protocol txs.
//! 2. [`BuildingDecryptedTxBatch`] - the second state. In this state, we
//! populate a block with DKG decrypted txs.
//! 3. [`BuildingProtocolTxBatch`] - the third state. In this state, we populate
//! a block with protocol txs.
mod decrypted_txs;
mod encrypted_txs;
Expand Down
36 changes: 12 additions & 24 deletions crates/apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
//! 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;
use namada::ledger::gas::{GasMetering, TxGasMeter};
use namada::ledger::gas::GasMetering;
use namada::ledger::pos::namada_proof_of_stake;
use namada::ledger::protocol::{self, WrapperArgs};
use namada::ledger::protocol::WrapperArgs;
use namada::proof_of_stake;
use namada::proof_of_stake::storage::{
find_validator_by_raw_hash, write_last_block_proposer_address,
};
use namada::state::write_log::StorageModification;
use namada::state::{
ResultExt, StorageRead, StorageWrite, EPOCH_SWITCH_BLOCKS_DELAY,
};
use namada::state::{ResultExt, StorageWrite, EPOCH_SWITCH_BLOCKS_DELAY};
use namada::tx::data::protocol::ProtocolTxType;
use namada::vote_ext::ethereum_events::MultiSignedEthEvent;
use namada::vote_ext::ethereum_tx_data_variants;
Expand Down Expand Up @@ -721,9 +716,7 @@ fn pos_votes_from_abci(
);

// Try to convert voting power to u64
let validator_vp = u64::try_from(*power).expect(
"Must be able to convert voting power from i64 to u64",
);
let validator_vp = u64::from(*power);

Some(namada_proof_of_stake::types::VoteInfo {
validator_address,
Expand All @@ -744,19 +737,17 @@ fn pos_votes_from_abci(
/// are covered by the e2e tests.
#[cfg(test)]
mod test_finalize_block {
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::collections::{BTreeMap, HashMap, HashSet};
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 @@ -785,27 +776,24 @@ 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;
use test_log::test;

use super::*;
use crate::facade::tendermint::abci::types::{
Misbehavior, Validator, VoteInfo,
};
use crate::facade::tendermint::abci::types::Validator;
use crate::node::ledger::oracle::control::Command;
use crate::node::ledger::shell::test_utils::*;
use crate::node::ledger::shims::abcipp_shim_types::shim::request::{
Expand Down
7 changes: 2 additions & 5 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,15 +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::ledger::protocol;
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::{DBIter, StorageHasher, StorageWrite, DB};
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
Loading

0 comments on commit b13c9f1

Please sign in to comment.