Skip to content

Commit

Permalink
version update toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
ManojJiSharma committed Dec 16, 2024
1 parent 0b11669 commit cbd1efa
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 71 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ members = [
"chains/binance",
"chains/avalanche",
"chains/rosetta-chain-testing",
"chains/base", "chains/linea",
"chains/base",
"chains/linea",
]
resolver = "2"

Expand Down
8 changes: 4 additions & 4 deletions chains/astar/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() !=
&ethereum_block.header().header().parent_hash.0
if actual_eth_block.header.parent_hash.as_fixed_bytes()
!= &ethereum_block.header().header().parent_hash.0
{
anyhow::bail!("ethereum block hash mismatch");
}
Expand Down
4 changes: 2 additions & 2 deletions chains/ethereum/backend/src/jsonrpsee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
4 changes: 2 additions & 2 deletions chains/ethereum/server/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions chains/ethereum/server/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
Expand Down
4 changes: 2 additions & 2 deletions chains/ethereum/server/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ fn estimate_priority_fee<F: FeeEstimatorConfig>(rewards: &[Vec<U256>]) -> 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 {
Expand Down
4 changes: 2 additions & 2 deletions chains/ethereum/types/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions chains/ethereum/types/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions chains/ethereum/types/src/i256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 12 additions & 16 deletions chains/linea/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions rosetta-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ impl GenericClient {
) -> Result<Self> {
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)
},
Expand Down
5 changes: 3 additions & 2 deletions rosetta-crypto/src/bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ impl SecretKey {
fn tweak_add(&self, secret_key: &Self) -> Result<Option<Self>> {
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<NonZeroScalar<_>> =
Expand Down
14 changes: 7 additions & 7 deletions rosetta-utils/src/jsonrpsee/auto_subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -94,11 +94,11 @@ where
/// Consume the subscription and return the inner subscriber.
pub fn into_subscriber(self) -> Option<F> {
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,
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.79.0"
channel = "1.81.0"
components = ["rust-src", "rust-analyzer", "clippy"]
targets = ["wasm32-unknown-unknown"]

0 comments on commit cbd1efa

Please sign in to comment.