From cbd1efac211293b0f2cdaad44d893b6eca4f8de4 Mon Sep 17 00:00:00 2001 From: ManojJiSharma Date: Mon, 16 Dec 2024 17:36:11 +0530 Subject: [PATCH] version update toolchain --- Cargo.toml | 3 +- chains/astar/server/src/lib.rs | 8 ++-- chains/ethereum/backend/src/jsonrpsee.rs | 4 +- chains/ethereum/server/src/proof.rs | 4 +- chains/ethereum/server/src/state.rs | 4 +- chains/ethereum/server/src/utils.rs | 4 +- chains/ethereum/types/src/crypto.rs | 4 +- chains/ethereum/types/src/header.rs | 38 +++++++++---------- chains/ethereum/types/src/i256.rs | 8 ++-- chains/linea/src/lib.rs | 28 ++++++-------- rosetta-client/src/client.rs | 14 +++---- rosetta-crypto/src/bip32.rs | 5 ++- rosetta-utils/src/jsonrpsee/auto_subscribe.rs | 14 +++---- rust-toolchain.toml | 2 +- 14 files changed, 69 insertions(+), 71 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e05b73fb..cd806770 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,8 @@ members = [ "chains/binance", "chains/avalanche", "chains/rosetta-chain-testing", - "chains/base", "chains/linea", + "chains/base", + "chains/linea", ] resolver = "2" diff --git a/chains/astar/server/src/lib.rs b/chains/astar/server/src/lib.rs index f76e331f..05f8b52e 100644 --- a/chains/astar/server/src/lib.rs +++ b/chains/astar/server/src/lib.rs @@ -144,13 +144,13 @@ impl AstarClient { // Verify if the ethereum block hash matches the provided ethereum block hash. // TODO: compute the block hash - if U256(actual_eth_block.header.number.0) != - U256::from(ethereum_block.header().number()) + if U256(actual_eth_block.header.number.0) + != U256::from(ethereum_block.header().number()) { anyhow::bail!("ethereum block hash mismatch"); } - if actual_eth_block.header.parent_hash.as_fixed_bytes() != - ðereum_block.header().header().parent_hash.0 + if actual_eth_block.header.parent_hash.as_fixed_bytes() + != ðereum_block.header().header().parent_hash.0 { anyhow::bail!("ethereum block hash mismatch"); } diff --git a/chains/ethereum/backend/src/jsonrpsee.rs b/chains/ethereum/backend/src/jsonrpsee.rs index 756e6459..b5afff5f 100644 --- a/chains/ethereum/backend/src/jsonrpsee.rs +++ b/chains/ethereum/backend/src/jsonrpsee.rs @@ -189,8 +189,8 @@ where return Ok(revert); } } - } else if msg.message().contains("overflow") || - msg.message().contains("underflow") + } else if msg.message().contains("overflow") + || msg.message().contains("underflow") { // we assume it's an stack overflow or underflow error. return Ok(ExitReason::Error(msg.message().to_string().into())); diff --git a/chains/ethereum/server/src/proof.rs b/chains/ethereum/server/src/proof.rs index 7a0c1b6c..3426221e 100644 --- a/chains/ethereum/server/src/proof.rs +++ b/chains/ethereum/server/src/proof.rs @@ -30,8 +30,8 @@ pub fn verify_proof(proof: &[Bytes], root: &[u8], path: &[u8], value: &[u8]) -> } else if node_list.len() == 2 { if i == proof.len() - 1 { // exclusion proof - if !paths_match(&node_list[0], skip_length(&node_list[0]), path, path_offset) && - is_empty_value(value) + if !paths_match(&node_list[0], skip_length(&node_list[0]), path, path_offset) + && is_empty_value(value) { return true; } diff --git a/chains/ethereum/server/src/state.rs b/chains/ethereum/server/src/state.rs index 99bf6269..e65e1233 100644 --- a/chains/ethereum/server/src/state.rs +++ b/chains/ethereum/server/src/state.rs @@ -131,8 +131,8 @@ impl StateInner { // Block is younger than the latest finalized block, so it can't be imported return Ok(()); } - if block.number() == (best_block.number() + 1) && - block.parent_hash() != best_block.hash() + if block.number() == (best_block.number() + 1) + && block.parent_hash() != best_block.hash() { // the block is not descendent of the best finalized block return Ok(()); diff --git a/chains/ethereum/server/src/utils.rs b/chains/ethereum/server/src/utils.rs index 14d1dfbf..a7db0d90 100644 --- a/chains/ethereum/server/src/utils.rs +++ b/chains/ethereum/server/src/utils.rs @@ -130,8 +130,8 @@ fn estimate_priority_fee(rewards: &[Vec]) -> U256 { // If we encountered a big change in fees at a certain position, then consider only // the values >= it. - let values = if max_change >= F::EIP1559_FEE_ESTIMATION_THRESHOLD_MAX_CHANGE.into() && - (max_change_index >= (rewards.len() / 2)) + let values = if max_change >= F::EIP1559_FEE_ESTIMATION_THRESHOLD_MAX_CHANGE.into() + && (max_change_index >= (rewards.len() / 2)) { rewards[max_change_index..].to_vec() } else { diff --git a/chains/ethereum/types/src/crypto.rs b/chains/ethereum/types/src/crypto.rs index 0abb9e8d..69ed1a2d 100644 --- a/chains/ethereum/types/src/crypto.rs +++ b/chains/ethereum/types/src/crypto.rs @@ -340,8 +340,8 @@ impl Signer for Keypair { }; let v = u8::try_from(v) .map_err(|_| secp256k1::Error::InvalidRecoveryId) - .map(u64::from)? & - 1; + .map(u64::from)? + & 1; // All transaction signatures whose s-value is greater than secp256k1n/2 are invalid. // - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md diff --git a/chains/ethereum/types/src/header.rs b/chains/ethereum/types/src/header.rs index 3f3ee502..f3f90414 100644 --- a/chains/ethereum/types/src/header.rs +++ b/chains/ethereum/types/src/header.rs @@ -273,24 +273,24 @@ impl rlp::Decodable for Header { impl rlp::Encodable for Header { fn rlp_append(&self, s: &mut rlp::RlpStream) { let mut size = 15; - if self.base_fee_per_gas.is_some() || - self.withdrawals_root.is_some() || - self.blob_gas_used.is_some() || - self.excess_blob_gas.is_some() || - self.parent_beacon_block_root.is_some() + if self.base_fee_per_gas.is_some() + || self.withdrawals_root.is_some() + || self.blob_gas_used.is_some() + || self.excess_blob_gas.is_some() + || self.parent_beacon_block_root.is_some() { size += 1; } - if self.withdrawals_root.is_some() || - self.blob_gas_used.is_some() || - self.excess_blob_gas.is_some() || - self.parent_beacon_block_root.is_some() + if self.withdrawals_root.is_some() + || self.blob_gas_used.is_some() + || self.excess_blob_gas.is_some() + || self.parent_beacon_block_root.is_some() { size += 1; } - if self.blob_gas_used.is_some() || - self.excess_blob_gas.is_some() || - self.parent_beacon_block_root.is_some() + if self.blob_gas_used.is_some() + || self.excess_blob_gas.is_some() + || self.parent_beacon_block_root.is_some() { size += 1; } @@ -322,10 +322,10 @@ impl rlp::Encodable for Header { // but withdrawals root is present. if let Some(ref base_fee) = self.base_fee_per_gas { s.append(&U256::from(*base_fee)); - } else if self.withdrawals_root.is_some() || - self.blob_gas_used.is_some() || - self.excess_blob_gas.is_some() || - self.parent_beacon_block_root.is_some() + } else if self.withdrawals_root.is_some() + || self.blob_gas_used.is_some() + || self.excess_blob_gas.is_some() + || self.parent_beacon_block_root.is_some() { s.begin_list(0); } @@ -334,9 +334,9 @@ impl rlp::Encodable for Header { // but blob gas used is present. if let Some(ref root) = self.withdrawals_root { s.append(root); - } else if self.blob_gas_used.is_some() || - self.excess_blob_gas.is_some() || - self.parent_beacon_block_root.is_some() + } else if self.blob_gas_used.is_some() + || self.excess_blob_gas.is_some() + || self.parent_beacon_block_root.is_some() { s.append_empty_data(); } diff --git a/chains/ethereum/types/src/i256.rs b/chains/ethereum/types/src/i256.rs index 20bcb661..d677eab4 100644 --- a/chains/ethereum/types/src/i256.rs +++ b/chains/ethereum/types/src/i256.rs @@ -524,8 +524,8 @@ impl I256 { // the result. let overflow = matches!( (self.sign(), rhs.sign(), result.sign()), - (Sign::Positive, Sign::Positive, Sign::Negative) | - (Sign::Negative, Sign::Negative, Sign::Positive) + (Sign::Positive, Sign::Positive, Sign::Negative) + | (Sign::Negative, Sign::Negative, Sign::Positive) ); (result, overflow) @@ -583,8 +583,8 @@ impl I256 { // the result. let overflow = matches!( (self.sign(), rhs.sign(), result.sign()), - (Sign::Positive, Sign::Negative, Sign::Negative) | - (Sign::Negative, Sign::Positive, Sign::Positive) + (Sign::Positive, Sign::Negative, Sign::Negative) + | (Sign::Negative, Sign::Positive, Sign::Positive) ); (result, overflow) diff --git a/chains/linea/src/lib.rs b/chains/linea/src/lib.rs index 601e0891..638d4e8a 100644 --- a/chains/linea/src/lib.rs +++ b/chains/linea/src/lib.rs @@ -94,10 +94,9 @@ mod tests { let client = MaybeWsEthereumClient::new("linea", "dev", LINEA_RPC_WS_URL, None) .await .expect("Error creating LineaClient"); - let wallet = - Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) - .await - .unwrap(); + let wallet = Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) + .await + .unwrap(); let value = 10 * u128::pow(10, client.config().currency_decimals); let _ = wallet.faucet(value, None).await; let amount = wallet.balance().await.unwrap(); @@ -114,10 +113,9 @@ mod tests { .expect("Error creating LineaClient"); let faucet = 100 * u128::pow(10, client.config().currency_decimals); let value = u128::pow(10, client.config().currency_decimals); - let alice = - Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) - .await - .unwrap(); + let alice = Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) + .await + .unwrap(); let bob = Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) .await .unwrap(); @@ -174,10 +172,9 @@ mod tests { .await .expect("Error creating LineaClient"); let faucet = 10 * u128::pow(10, client.config().currency_decimals); - let wallet = - Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) - .await - .unwrap(); + let wallet = Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) + .await + .unwrap(); wallet.faucet(faucet, None).await.unwrap(); let bytes = compile_snippet( @@ -217,10 +214,9 @@ mod tests { .await .expect("Error creating LineaClient"); let faucet = 10 * u128::pow(10, client.config().currency_decimals); - let wallet = - Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) - .await - .unwrap(); + let wallet = Wallet::from_config(client.config().clone(), LINEA_RPC_WS_URL, None, None) + .await + .unwrap(); wallet.faucet(faucet, None).await.unwrap(); let bytes = compile_snippet( r" diff --git a/rosetta-client/src/client.rs b/rosetta-client/src/client.rs index f4c736d2..ac20e9e9 100644 --- a/rosetta-client/src/client.rs +++ b/rosetta-client/src/client.rs @@ -91,13 +91,13 @@ impl GenericClient { ) -> Result { let blockchain = Blockchain::from_str(config.blockchain)?; Ok(match blockchain { - Blockchain::Ethereum | - Blockchain::Polygon | - Blockchain::Arbitrum | - Blockchain::Binance | - Blockchain::Base | - Blockchain::Linea | - Blockchain::Avalanche => { + Blockchain::Ethereum + | Blockchain::Polygon + | Blockchain::Arbitrum + | Blockchain::Binance + | Blockchain::Base + | Blockchain::Linea + | Blockchain::Avalanche => { let client = EthereumClient::from_config(config, url, private_key).await?; Self::Ethereum(client) }, diff --git a/rosetta-crypto/src/bip32.rs b/rosetta-crypto/src/bip32.rs index 75f81a76..45cd9bd3 100644 --- a/rosetta-crypto/src/bip32.rs +++ b/rosetta-crypto/src/bip32.rs @@ -32,8 +32,9 @@ impl SecretKey { fn tweak_add(&self, secret_key: &Self) -> Result> { use ecdsa::elliptic_curve::NonZeroScalar; match (self, secret_key) { - (Self::EcdsaSecp256k1(secret), Self::EcdsaSecp256k1(secret2)) | - (Self::EcdsaRecoverableSecp256k1(secret), Self::EcdsaRecoverableSecp256k1(secret2)) => { + (Self::EcdsaSecp256k1(secret), Self::EcdsaSecp256k1(secret2)) + | (Self::EcdsaRecoverableSecp256k1(secret), Self::EcdsaRecoverableSecp256k1(secret2)) => + { let scalar = secret.as_nonzero_scalar().as_ref(); let tweak = secret2.as_nonzero_scalar().as_ref(); let scalar: Option> = diff --git a/rosetta-utils/src/jsonrpsee/auto_subscribe.rs b/rosetta-utils/src/jsonrpsee/auto_subscribe.rs index f2cca681..bc3b5a72 100644 --- a/rosetta-utils/src/jsonrpsee/auto_subscribe.rs +++ b/rosetta-utils/src/jsonrpsee/auto_subscribe.rs @@ -69,8 +69,8 @@ where #[must_use] pub const fn is_initializing(&self) -> bool { - matches!(self.state, State::Idle(_) | State::Subscribing(_)) && - self.total_subscriptions == 0 + matches!(self.state, State::Idle(_) | State::Subscribing(_)) + && self.total_subscriptions == 0 } #[must_use] @@ -94,11 +94,11 @@ where /// Consume the subscription and return the inner subscriber. pub fn into_subscriber(self) -> Option { match self.state { - State::Idle(subscriber) | - State::Subscribed { subscriber, .. } | - State::ResubscribeAfterDelay { subscriber, .. } | - State::Unsubscribing { subscriber, .. } | - State::Unsubscribed { subscriber, .. } => Some(subscriber), + State::Idle(subscriber) + | State::Subscribed { subscriber, .. } + | State::ResubscribeAfterDelay { subscriber, .. } + | State::Unsubscribing { subscriber, .. } + | State::Unsubscribed { subscriber, .. } => Some(subscriber), State::Subscribing(fut) => fut.now_or_never().map(|(subscriber, _)| subscriber), State::Poisoned => None, } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index aac2d0c8..4089d3ac 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.79.0" +channel = "1.81.0" components = ["rust-src", "rust-analyzer", "clippy"] targets = ["wasm32-unknown-unknown"]