diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 116d7b06fcc..2c344444cfb 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -101,7 +101,7 @@ jobs: matrix: os: [ubuntu-latest] wasm_cache_version: ["v2"] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] steps: @@ -164,7 +164,7 @@ jobs: matrix: os: [ubuntu-latest] wasm_cache_version: ["v2"] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] steps: @@ -194,7 +194,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] make: - name: ABCI @@ -292,7 +292,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] make: - name: ABCI @@ -381,7 +381,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] make: - name: ABCI @@ -569,7 +569,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] comet_bft: [0.37.2] hermes: [1.7.4-namada-beta7] diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7c5f589e08b..504b09922da 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] make: - name: Clippy command: clippy diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 96fa86a8ed3..689e044b429 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] make: - name: Audit command: audit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9cf28fecb3c..f409ff0c9fd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mdbook_version: [rust-lang/mdbook@v0.4.18] mdbook_mermaid: [badboy/mdbook-mermaid@v0.11.1] mdbook_linkcheck: [Michael-F-Bryan/mdbook-linkcheck@v0.7.6] diff --git a/.github/workflows/triggerable_sync.yml b/.github/workflows/triggerable_sync.yml index bf1f01d6f11..28578d87f6a 100644 --- a/.github/workflows/triggerable_sync.yml +++ b/.github/workflows/triggerable_sync.yml @@ -41,7 +41,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - nightly_version: [nightly-2023-06-01] + nightly_version: [nightly-2024-02-08] mold_version: [2.4.0] comet_bft: [0.37.2] name: ["Run chain sync test"] diff --git a/Cargo.lock b/Cargo.lock index 0a28a005daf..ee525b062c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,8 +51,7 @@ dependencies = [ [[package]] name = "ahash" version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +source = "git+https://github.com/Manishearth/aHash.git?branch=build-time-rm#38427365f6f2ce834b05713493c03055163e7325" dependencies = [ "getrandom 0.2.11", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index c5fa5b5b039..9ba5650fd7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -184,3 +184,8 @@ lto = true opt-level = 3 panic = "unwind" overflow-checks = true + +[patch.crates-io] +# TEMP: ahash v0.7.7 is not compatible with Rust 1.76. +# Update once backport https://github.com/tkaitchuck/aHash/pull/202 is released +ahash = { git = "https://github.com/Manishearth/aHash.git", branch = "build-time-rm" } diff --git a/crates/apps/src/lib/node/ledger/abortable.rs b/crates/apps/src/lib/node/ledger/abortable.rs index ceb4a4c8920..58c3c260023 100644 --- a/crates/apps/src/lib/node/ledger/abortable.rs +++ b/crates/apps/src/lib/node/ledger/abortable.rs @@ -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 { diff --git a/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs b/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs index c5e0343ccf9..7163cdf8777 100644 --- a/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs +++ b/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs @@ -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; diff --git a/crates/apps/src/lib/node/ledger/shell/init_chain.rs b/crates/apps/src/lib/node/ledger/shell/init_chain.rs index a881171b51f..c10afc7a555 100644 --- a/crates/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/crates/apps/src/lib/node/ledger/shell/init_chain.rs @@ -282,8 +282,8 @@ where vp_cache: &mut HashMap>, ) -> ControlFlow<(), Vec> { use std::collections::hash_map::Entry; - let Some(vp_filename) = - self.validate( + let Some(vp_filename) = self + .validate( genesis .vps .wasm @@ -291,8 +291,10 @@ where .map(|conf| conf.filename.clone()) .ok_or_else(|| { Panic::MissingVpWasmConfig(name.to_string()) - })) - .or_placeholder(None)? else { + }), + ) + .or_placeholder(None)? + else { return self.proceed_with(vec![]); }; let code = match vp_cache.entry(vp_filename.clone()) { @@ -322,10 +324,13 @@ where } = params; let mut is_implicit_vp_stored = false; - let Some(checksums) = self.validate( - wasm_loader::Checksums::read_checksums(&self.wasm_dir) - .map_err(|_| Panic::ChecksumsFile) - ).or_placeholder(None)? else { + let Some(checksums) = self + .validate( + wasm_loader::Checksums::read_checksums(&self.wasm_dir) + .map_err(|_| Panic::ChecksumsFile), + ) + .or_placeholder(None)? + else { return self.proceed_with(()); }; @@ -459,15 +464,20 @@ where for (token_alias, TokenBalances(balances)) in &genesis.balances.token { tracing::debug!("Initializing token balances {token_alias}"); - let Some(token_address) = self.validate(genesis - .tokens - .token - .get(token_alias) - .ok_or_else(|| Panic::MissingTokenConfig(token_alias.to_string())) - .map(|conf| &conf.address) - ) - .or_placeholder(None)? else { - continue + let Some(token_address) = self + .validate( + genesis + .tokens + .token + .get(token_alias) + .ok_or_else(|| { + Panic::MissingTokenConfig(token_alias.to_string()) + }) + .map(|conf| &conf.address), + ) + .or_placeholder(None)? + else { + continue; }; let mut total_token_balance = token::Amount::zero(); @@ -998,10 +1008,9 @@ mod test { *vp_cache.get("vp_user.wasm").expect("Test failed"), Vec::::new() ); - let [Panic::ReadingWasm(_, _)]: [Panic; 1] = initializer.panics - .clone() - .try_into() - .expect("Test failed") else { + let [Panic::ReadingWasm(_, _)]: [Panic; 1] = + initializer.panics.clone().try_into().expect("Test failed") + else { panic!("Test failed") }; @@ -1009,10 +1018,9 @@ mod test { genesis.vps.wasm.remove("vp_user").expect("Test failed"); let code = initializer.lookup_vp("vp_user", &genesis, &mut vp_cache); assert_eq!(code, ControlFlow::Continue(vec![])); - let [Panic::MissingVpWasmConfig(_)]: [Panic; 1] = initializer.panics - .clone() - .try_into() - .expect("Test failed") else { + let [Panic::MissingVpWasmConfig(_)]: [Panic; 1] = + initializer.panics.clone().try_into().expect("Test failed") + else { panic!("Test failed") }; } @@ -1053,10 +1061,9 @@ mod test { .store_wasms(&genesis.get_chain_parameters(test_dir.path())); assert_eq!(res, ControlFlow::Continue(())); let errors = initializer.errors.iter().collect::>(); - let [ - Error::ReadingWasm(_), - Error::LoadingWasm(_), - ]: [&Error; 2] = errors.try_into().expect("Test failed") else { + let [Error::ReadingWasm(_), Error::LoadingWasm(_)]: [&Error; 2] = + errors.try_into().expect("Test failed") + else { panic!("Test failed"); }; let expected_panics = vec![ @@ -1083,7 +1090,8 @@ mod test { Error::ReadingWasm(_), Error::LoadingWasm(_), Error::LoadingWasm(_), - ]: [&Error; 3] = errors.try_into().expect("Test failed") else { + ]: [&Error; 3] = errors.try_into().expect("Test failed") + else { panic!("Test failed"); }; let expected_panics = vec![Panic::MissingImplicitVP("None".into())]; @@ -1107,10 +1115,9 @@ mod test { .expect("Test failed"); let res = initializer.init_token_balances(&genesis); assert_eq!(res, ControlFlow::Continue(())); - let [Panic::MissingTokenConfig(_)]: [Panic; 1] = initializer.panics - .clone() - .try_into() - .expect("Test failed") else { + let [Panic::MissingTokenConfig(_)]: [Panic; 1] = + initializer.panics.clone().try_into().expect("Test failed") + else { panic!("Test failed") }; } diff --git a/crates/apps/src/lib/node/ledger/shell/mod.rs b/crates/apps/src/lib/node/ledger/shell/mod.rs index cfc5ea888d0..9bff13e6ed2 100644 --- a/crates/apps/src/lib/node/ledger/shell/mod.rs +++ b/crates/apps/src/lib/node/ledger/shell/mod.rs @@ -932,8 +932,12 @@ where ); return; } - let Some(config) = EthereumOracleConfig::read(&self.wl_storage) else { - tracing::info!("Not starting oracle as the Ethereum bridge config couldn't be found in storage"); + let Some(config) = EthereumOracleConfig::read(&self.wl_storage) + else { + tracing::info!( + "Not starting oracle as the Ethereum bridge config \ + couldn't be found in storage" + ); return; }; let active = diff --git a/crates/core/src/types/address.rs b/crates/core/src/types/address.rs index 7626d3c0b66..8cc99a66cff 100644 --- a/crates/core/src/types/address.rs +++ b/crates/core/src/types/address.rs @@ -227,6 +227,7 @@ impl<'addr> From<&'addr Address> for raw::Address<'addr, raw::Validated> { // We're using the string format of addresses (bech32m) for ordering to ensure // that addresses as strings, storage keys and storage keys as strings preserve // the order. +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for Address { fn partial_cmp(&self, other: &Self) -> Option { self.encode().partial_cmp(&other.encode()) @@ -725,7 +726,7 @@ pub fn gen_established_address(seed: impl AsRef) -> Address { let mut key_gen = EstablishedAddressGen::new(seed); let mut rng: ThreadRng = thread_rng(); - let mut rng_bytes = vec![0u8; 32]; + let mut rng_bytes = [0u8; 32]; rng.fill_bytes(&mut rng_bytes[..]); let rng_source = rng_bytes .iter() diff --git a/crates/core/src/types/eth_abi.rs b/crates/core/src/types/eth_abi.rs index 886b5b9c46c..73d839002d2 100644 --- a/crates/core/src/types/eth_abi.rs +++ b/crates/core/src/types/eth_abi.rs @@ -38,6 +38,7 @@ impl ::std::cmp::PartialEq for EncodeCell { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl ::std::cmp::PartialOrd for EncodeCell { fn partial_cmp(&self, other: &Self) -> Option<::std::cmp::Ordering> { self.encoded_data.partial_cmp(&other.encoded_data) diff --git a/crates/core/src/types/ethereum_events.rs b/crates/core/src/types/ethereum_events.rs index 8569b118e4f..ee65d77b2bb 100644 --- a/crates/core/src/types/ethereum_events.rs +++ b/crates/core/src/types/ethereum_events.rs @@ -37,6 +37,7 @@ use crate::types::token::Amount; )] pub struct Uint(pub [u64; 4]); +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for Uint { #[inline] fn partial_cmp(&self, other: &Self) -> Option { diff --git a/crates/core/src/types/ibc.rs b/crates/core/src/types/ibc.rs index f517c843636..efd0d4b9348 100644 --- a/crates/core/src/types/ibc.rs +++ b/crates/core/src/types/ibc.rs @@ -80,6 +80,7 @@ pub struct IbcEvent { pub attributes: HashMap, } +#[allow(clippy::non_canonical_partial_ord_impl)] impl std::cmp::PartialOrd for IbcEvent { fn partial_cmp(&self, other: &Self) -> Option { self.event_type.partial_cmp(&other.event_type) diff --git a/crates/core/src/types/key/ed25519.rs b/crates/core/src/types/key/ed25519.rs index 2e118fe90eb..04e19fb588b 100644 --- a/crates/core/src/types/key/ed25519.rs +++ b/crates/core/src/types/key/ed25519.rs @@ -103,6 +103,7 @@ impl Hash for PublicKey { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { self.0.to_bytes().partial_cmp(&other.0.to_bytes()) @@ -314,6 +315,7 @@ impl Hash for Signature { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for Signature { fn partial_cmp(&self, other: &Self) -> Option { self.0.to_bytes().partial_cmp(&other.0.to_bytes()) diff --git a/crates/core/src/types/key/secp256k1.rs b/crates/core/src/types/key/secp256k1.rs index 06ae2c42168..51254d81caf 100644 --- a/crates/core/src/types/key/secp256k1.rs +++ b/crates/core/src/types/key/secp256k1.rs @@ -116,6 +116,7 @@ impl Hash for PublicKey { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { self.0.to_sec1_bytes().partial_cmp(&other.0.to_sec1_bytes()) @@ -488,6 +489,7 @@ impl Hash for Signature { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for Signature { fn partial_cmp(&self, other: &Self) -> Option { match self.0.to_bytes().partial_cmp(&other.0.to_bytes()) { diff --git a/crates/core/src/types/token.rs b/crates/core/src/types/token.rs index 02370b98544..473a14e35f8 100644 --- a/crates/core/src/types/token.rs +++ b/crates/core/src/types/token.rs @@ -570,6 +570,7 @@ impl FromStr for DenominatedAmount { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for DenominatedAmount { fn partial_cmp(&self, other: &Self) -> Option { if self.denom < other.denom { diff --git a/crates/core/src/types/uint.rs b/crates/core/src/types/uint.rs index e13cb9ce1b2..fd3371a50aa 100644 --- a/crates/core/src/types/uint.rs +++ b/crates/core/src/types/uint.rs @@ -634,6 +634,7 @@ impl Neg for I256 { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for I256 { fn partial_cmp(&self, other: &Self) -> Option { match (self.non_negative(), other.non_negative()) { diff --git a/crates/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs b/crates/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs index 1adcf3d09bd..cc1580600bd 100644 --- a/crates/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs +++ b/crates/ethereum_bridge/src/protocol/transactions/validator_set_update/mod.rs @@ -134,7 +134,9 @@ where }; let valset_upd_keys = vote_tallies::Keys::from(&next_epoch); let maybe_proof = 'check_storage: { - let Some(seen) = votes::storage::maybe_read_seen(wl_storage, &valset_upd_keys)? else { + let Some(seen) = + votes::storage::maybe_read_seen(wl_storage, &valset_upd_keys)? + else { break 'check_storage None; }; if seen { diff --git a/crates/ethereum_bridge/src/protocol/transactions/votes.rs b/crates/ethereum_bridge/src/protocol/transactions/votes.rs index 7accb41f665..e19474b8b2c 100644 --- a/crates/ethereum_bridge/src/protocol/transactions/votes.rs +++ b/crates/ethereum_bridge/src/protocol/transactions/votes.rs @@ -57,7 +57,8 @@ pub trait EpochedVotingPowerExt { D: 'static + DB + for<'iter> DBIter<'iter> + Sync, H: 'static + StorageHasher + Sync, { - let Some(max_voting_power) = self.epoch_max_voting_power(wl_storage) else { + let Some(max_voting_power) = self.epoch_max_voting_power(wl_storage) + else { return FractionalVotingPower::NULL; }; FractionalVotingPower::new( @@ -75,7 +76,8 @@ pub trait EpochedVotingPowerExt { D: 'static + DB + for<'iter> DBIter<'iter> + Sync, H: 'static + StorageHasher + Sync, { - let Some(max_voting_power) = self.epoch_max_voting_power(wl_storage) else { + let Some(max_voting_power) = self.epoch_max_voting_power(wl_storage) + else { return false; }; // NB: Preserve the safety property of the Tendermint protocol across diff --git a/crates/ethereum_bridge/src/storage/eth_bridge_queries.rs b/crates/ethereum_bridge/src/storage/eth_bridge_queries.rs index 44b38a751a2..ce6d0de40e6 100644 --- a/crates/ethereum_bridge/src/storage/eth_bridge_queries.rs +++ b/crates/ethereum_bridge/src/storage/eth_bridge_queries.rs @@ -481,8 +481,8 @@ where /// NUTs are minted when: /// /// 1. `token` is not whitelisted. - /// 2. `token` has exceeded the configured token caps, - /// after minting `amount_to_mint`. + /// 2. `token` has exceeded the configured token caps, after minting + /// `amount_to_mint`. pub fn get_eth_assets_to_mint( self, token: &EthAddress, diff --git a/crates/namada/src/ledger/protocol/mod.rs b/crates/namada/src/ledger/protocol/mod.rs index 9ffa91b6c9b..56a222b34b6 100644 --- a/crates/namada/src/ledger/protocol/mod.rs +++ b/crates/namada/src/ledger/protocol/mod.rs @@ -683,9 +683,9 @@ where use namada_vote_ext::{ethereum_events, validator_set_update}; let Some(data) = data else { - return Err(Error::ProtocolTxError( - eyre!("Protocol tx data must be present")), - ); + return Err(Error::ProtocolTxError(eyre!( + "Protocol tx data must be present" + ))); }; let ethereum_tx_data = EthereumTxData::deserialize(&tx, &data) .wrap_err_with(|| { diff --git a/crates/namada/src/vm/types.rs b/crates/namada/src/vm/types.rs index 54cc1703717..28d3232f5db 100644 --- a/crates/namada/src/vm/types.rs +++ b/crates/namada/src/vm/types.rs @@ -2,12 +2,10 @@ //! memory. //! //! These are either: -//! 1. Module call types -//! The module call inputs are passed host-to-guest. +//! 1. Module call types The module call inputs are passed host-to-guest. //! -//! 2. Execution environment types -//! The environment inputs are passed guest-to-host and outputs back from -//! host-to-guest. +//! 2. Execution environment types The environment inputs are passed +//! guest-to-host and outputs back from host-to-guest. use std::collections::BTreeSet; diff --git a/crates/namada/src/vm/wasm/run.rs b/crates/namada/src/vm/wasm/run.rs index 8d841851355..a69e796f054 100644 --- a/crates/namada/src/vm/wasm/run.rs +++ b/crates/namada/src/vm/wasm/run.rs @@ -698,7 +698,8 @@ mod tests { let downcasted_tx_rt_err: &TxRuntimeError = source_err .downcast_ref() .unwrap_or_else(|| panic!("{assert_msg}: {source_err}")); - let TxRuntimeError::MemoryError(tx_mem_err) = downcasted_tx_rt_err else { + let TxRuntimeError::MemoryError(tx_mem_err) = downcasted_tx_rt_err + else { panic!("{assert_msg}: {downcasted_tx_rt_err}"); }; tx_mem_err diff --git a/crates/sdk/src/eth_bridge/mod.rs b/crates/sdk/src/eth_bridge/mod.rs index 91077989384..0ff13a97a7a 100644 --- a/crates/sdk/src/eth_bridge/mod.rs +++ b/crates/sdk/src/eth_bridge/mod.rs @@ -74,10 +74,7 @@ where .timeout(deadline, || async { let fut_syncing = client.syncing(); let fut_block_num = client.get_block_number(); - let Ok(status) = futures::try_join!( - fut_syncing, - fut_block_num, - ) else { + let Ok(status) = futures::try_join!(fut_syncing, fut_block_num,) else { return ControlFlow::Continue(()); }; ControlFlow::Break(match status { diff --git a/crates/sdk/src/eth_bridge/validator_set.rs b/crates/sdk/src/eth_bridge/validator_set.rs index c11b9b62c6d..0c95600a46e 100644 --- a/crates/sdk/src/eth_bridge/validator_set.rs +++ b/crates/sdk/src/eth_bridge/validator_set.rs @@ -598,25 +598,30 @@ where // update epoch in the contract args.epoch = Some(new_epoch); - let result = relay_validator_set_update_once::( - &args, - Arc::clone(ð_client), - client, - |transf_result| { - let Some(receipt) = transf_result else { - tracing::warn!("No transfer receipt received from the Ethereum node"); - last_call_succeeded = false; - return; - }; - last_call_succeeded = receipt.is_successful(); - if last_call_succeeded { - tracing::info!(?receipt, "Ethereum transfer succeeded"); - tracing::info!(?new_epoch, "Updated the validator set"); - } else { - tracing::error!(?receipt, "Ethereum transfer failed"); - } - }, - ).await; + let result = + relay_validator_set_update_once::( + &args, + Arc::clone(ð_client), + client, + |transf_result| { + let Some(receipt) = transf_result else { + tracing::warn!( + "No transfer receipt received from the Ethereum \ + node" + ); + last_call_succeeded = false; + return; + }; + last_call_succeeded = receipt.is_successful(); + if last_call_succeeded { + tracing::info!(?receipt, "Ethereum transfer succeeded"); + tracing::info!(?new_epoch, "Updated the validator set"); + } else { + tracing::error!(?receipt, "Ethereum transfer failed"); + } + }, + ) + .await; if let Err(err) = result { // only print errors, do not exit diff --git a/crates/sdk/src/masp.rs b/crates/sdk/src/masp.rs index c3cf8d1bf34..18e4a1f43a5 100644 --- a/crates/sdk/src/masp.rs +++ b/crates/sdk/src/masp.rs @@ -1237,7 +1237,7 @@ impl ShieldedContext { let Some(denom) = query_denom(context.client(), token).await else { return Err(Error::Query(QueryError::General(format!( "denomination for token {token}" - )))) + )))); }; for position in MaspDigitPos::iter() { let asset_type = @@ -1304,7 +1304,10 @@ impl ShieldedContext { { // Query for the ID of the last accepted transaction let Some((token, denom, position, ep, conv, path)) = - query_conversion(client, asset_type).await else { return }; + query_conversion(client, asset_type).await + else { + return; + }; self.asset_types.insert( asset_type, AssetData { @@ -1968,9 +1971,9 @@ impl ShieldedContext { // Convert transaction amount into MASP types let Some(denom) = query_denom(context.client(), token).await else { - return Err(TransferErr::General(Error::from(QueryError::General(format!( - "denomination for token {token}" - ))))) + return Err(TransferErr::General(Error::from( + QueryError::General(format!("denomination for token {token}")), + ))); }; let (asset_types, masp_amount) = { let mut shielded = context.shielded_mut().await; diff --git a/crates/sdk/src/queries/shell/eth_bridge.rs b/crates/sdk/src/queries/shell/eth_bridge.rs index 92ee5f3ca8c..6dab29f7045 100644 --- a/crates/sdk/src/queries/shell/eth_bridge.rs +++ b/crates/sdk/src/queries/shell/eth_bridge.rs @@ -368,8 +368,8 @@ where { let Some(contract) = StorageRead::read(ctx.wl_storage, key)? else { return Err(namada_storage::Error::SimpleMessage( - "Failed to read contract: The Ethereum bridge \ - storage is not initialized", + "Failed to read contract: The Ethereum bridge storage is not \ + initialized", )); }; Ok(contract) diff --git a/crates/tests/src/e2e/eth_bridge_tests.rs b/crates/tests/src/e2e/eth_bridge_tests.rs index b1ea2636f59..3486c3aafa2 100644 --- a/crates/tests/src/e2e/eth_bridge_tests.rs +++ b/crates/tests/src/e2e/eth_bridge_tests.rs @@ -279,10 +279,9 @@ async fn test_roundtrip_eth_transfer() -> Result<()> { /// In this test, we check the following: /// 1. We can successfully add transfers to the bridge pool. /// 2. We can query the bridge pool and it is non-empty. -/// 3. We request a proof of inclusion of the transfer into the -/// bridge pool. -/// 4. We submit an Ethereum event indicating that the transfer -/// has been relayed. +/// 3. We request a proof of inclusion of the transfer into the bridge pool. +/// 4. We submit an Ethereum event indicating that the transfer has been +/// relayed. /// 5. We check that the event is removed from the bridge pool. #[tokio::test] async fn test_bridge_pool_e2e() { diff --git a/crates/tests/src/e2e/ledger_tests.rs b/crates/tests/src/e2e/ledger_tests.rs index d7c1e803deb..54c3c0729d8 100644 --- a/crates/tests/src/e2e/ledger_tests.rs +++ b/crates/tests/src/e2e/ledger_tests.rs @@ -346,8 +346,8 @@ fn run_ledger_load_state_and_reset() -> Result<()> { } /// In this test we -/// 1. Run the ledger node until a pre-configured height, -/// at which point it should suspend. +/// 1. Run the ledger node until a pre-configured height, at which point it +/// should suspend. /// 2. Check that we can still query the ledger. /// 3. Check that we can shutdown the ledger normally afterwards. #[test] @@ -1544,8 +1544,8 @@ fn pos_init_validator() -> Result<()> { client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); - // 3. Submit a delegation to the new validator - // First, transfer some tokens to the validator's key for fees: + // 3. Submit a delegation to the new validator First, transfer some tokens + // to the validator's key for fees: let tx_args = vec![ "transfer", "--source", @@ -2963,13 +2963,12 @@ fn double_signing_gets_slashed() -> Result<()> { /// In this test we: /// 1. Run the ledger node -/// 2. For some transactions that need signature authorization: -/// 2a. Generate a new key for an implicit account. -/// 2b. Send some funds to the implicit account. -/// 2c. Submit the tx with the implicit account as the source, that -/// requires that the account has revealed its PK. This should be done -/// by the client automatically. -/// 2d. Submit same tx again, this time the client shouldn't reveal again. +/// 2. For some transactions that need signature authorization: 2a. Generate a +/// new key for an implicit account. 2b. Send some funds to the implicit +/// account. 2c. Submit the tx with the implicit account as the source, that +/// requires that the account has revealed its PK. This should be done by the +/// client automatically. 2d. Submit same tx again, this time the client +/// shouldn't reveal again. #[test] fn implicit_account_reveal_pk() -> Result<()> { let test = setup::single_node_net()?; diff --git a/crates/vote_ext/src/lib.rs b/crates/vote_ext/src/lib.rs index ca49e96801e..bb895b640e5 100644 --- a/crates/vote_ext/src/lib.rs +++ b/crates/vote_ext/src/lib.rs @@ -113,15 +113,15 @@ impl TryFrom<&Tx> for EthereumTxData { fn try_from(tx: &Tx) -> Result { let TxType::Protocol(protocol_tx) = tx.header().tx_type else { - return Err(TxError::Deserialization( - "Expected protocol tx type".into(), - )); - }; + return Err(TxError::Deserialization( + "Expected protocol tx type".into(), + )); + }; let Some(tx_data) = tx.data() else { - return Err(TxError::Deserialization( - "Expected protocol tx type associated data".into(), - )); - }; + return Err(TxError::Deserialization( + "Expected protocol tx type associated data".into(), + )); + }; Self::deserialize(&protocol_tx.tx, &tx_data) } } diff --git a/docker/namada-wasm/Dockerfile b/docker/namada-wasm/Dockerfile index b6422340bdb..1749c1f85b7 100644 --- a/docker/namada-wasm/Dockerfile +++ b/docker/namada-wasm/Dockerfile @@ -1,12 +1,12 @@ # This docker is used for deterministic wasm builds # The version should be matching the version set in wasm/rust-toolchain.toml -FROM rust:1.70.0-bullseye +FROM rust:1.76.0-bullseye WORKDIR /__w/namada/namada # The version should be matching the version set above -RUN rustup toolchain install 1.70.0 --profile minimal +RUN rustup toolchain install 1.76.0 --profile minimal RUN rustup target add wasm32-unknown-unknown RUN apt-get update && apt-get install -y \ diff --git a/docker/namada/Dockerfile b/docker/namada/Dockerfile index 617b65be613..4dd1224afd6 100644 --- a/docker/namada/Dockerfile +++ b/docker/namada/Dockerfile @@ -1,4 +1,4 @@ -FROM lukemathwalker/cargo-chef:latest-rust-1.70.0 AS chef +FROM lukemathwalker/cargo-chef:latest-rust-1.76.0 AS chef WORKDIR /app FROM chef AS planner diff --git a/rust-nightly-version b/rust-nightly-version index df18b6ae376..36e57ce7155 100644 --- a/rust-nightly-version +++ b/rust-nightly-version @@ -1 +1 @@ -nightly-2023-06-01 +nightly-2024-02-08 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 196d6c41ec1..f5378778965 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.70.0" +channel = "1.76.0" components = ["rustc", "cargo", "rust-std", "rust-docs", "rls", "rust-src", "rust-analysis"] targets = ['wasm32-unknown-unknown'] \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml index 6a1590b990a..943b8da0f23 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -45,7 +45,7 @@ remove_nested_parens = true reorder_impl_items = true reorder_imports = true reorder_modules = true -required_version = "1.5.2" +required_version = "1.7.0" skip_children = false space_after_colon = true space_before_colon = false diff --git a/wasm/rust-toolchain.toml b/wasm/rust-toolchain.toml index 2658985cb04..16235b717fb 100644 --- a/wasm/rust-toolchain.toml +++ b/wasm/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.70.0" +channel = "1.76.0" components = ["rustc", "cargo", "rust-std", "rust-docs", "rls", "rust-analysis"]