Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/class-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,15 @@ pub fn prepare_json_contract_definition(
.context("Program attribute was not an object")?;

match vals.get_mut("accessible_scopes") {
Some(serde_json::Value::Array(array)) => {
if array.is_empty() {
vals.remove("accessible_scopes");
}
Some(serde_json::Value::Array(array)) if array.is_empty() => {
vals.remove("accessible_scopes");
}
Some(serde_json::Value::Array(_)) | None => {}
Some(_other) => {
anyhow::bail!(
r#"A program's attribute["accessible_scopes"] was not an array type."#
);
}
None => {}
}
// We don't know what this type is supposed to be, but if its missing it is
// null.
Expand Down
4 changes: 2 additions & 2 deletions crates/crypto/src/algebra/field/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub const fn const_adc(a: u64, b: u64, carry: u64) -> (u64, u64) {
#[inline(always)]
pub fn adc(a: &mut u64, b: u64, carry: u8) -> u8 {
#[cfg(target_arch = "x86_64")]
unsafe {
{
core::arch::x86_64::_addcarry_u64(carry, *a, b, a)
}

Expand Down Expand Up @@ -42,7 +42,7 @@ pub const fn const_sbb(a: u64, b: u64, borrow: u64) -> (u64, u64) {
#[inline(always)]
pub fn sbb(a: &mut u64, b: u64, borrow: u8) -> u8 {
#[cfg(target_arch = "x86_64")]
unsafe {
{
core::arch::x86_64::_subborrow_u64(borrow, *a, b, a)
}

Expand Down
8 changes: 3 additions & 5 deletions crates/executor/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ impl ConsensusPriceConverter {
pub fn eth_l2_gas_price(&self) -> u128 {
// Derive WEI price from the FRI price using the L1 gas price ratio.
// l2_gas_price_wei = l2_gas_price_fri * l1_gas_price_wei / l1_gas_price_fri
if self.l1_gas_price_fri == 0 {
0
} else {
self.l2_gas_price_fri * self.l1_gas_price_wei / self.l1_gas_price_fri
}
(self.l2_gas_price_fri * self.l1_gas_price_wei)
.checked_div(self.l1_gas_price_fri)
.unwrap_or_default()
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/p2p/src/core/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<C> Client<C> {
while let Some(partial_result) = receiver.recv().await {
let more_peers =
partial_result.with_context(|| format!("Getting closest peers to {peer}"))?;
peers.extend(more_peers.into_iter());
peers.extend(more_peers);
}

Ok(peers)
Expand Down
14 changes: 6 additions & 8 deletions crates/p2p/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,12 @@ where
}
kad::Event::RoutingUpdated {
peer, is_new_peer, ..
} => {
if is_new_peer {
send_test_event(
&self._test_event_sender,
TestEvent::PeerAddedToDHT { remote: peer },
)
.await
}
} if is_new_peer => {
send_test_event(
&self._test_event_sender,
TestEvent::PeerAddedToDHT { remote: peer },
)
.await
}
_ => {}
},
Expand Down
2 changes: 1 addition & 1 deletion crates/pathfinder/src/state/sync/l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ pub async fn download_new_classes(

let missing = new_classes
.into_iter()
.zip(exists.into_iter())
.zip(exists)
.filter_map(|(class, exist)| (!exist).then_some(class))
.collect::<HashSet<_>>();

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ mod tests {
mod rpc_error_subset {
use assert_matches::assert_matches;

use super::super::{generate_rpc_error_subset, ApplicationError};
use super::super::ApplicationError;

#[test]
fn no_variant() {
Expand Down
16 changes: 8 additions & 8 deletions crates/rpc/src/jsonrpc/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ where
indexed_results.push(indexed_result)
}

indexed_results.sort_by(|(index_a, _), (index_b, _)| index_a.cmp(index_b));
indexed_results.sort_by_key(|(index, _)| *index);

indexed_results.into_iter().map(|(_index, result)| result)
}
Expand Down Expand Up @@ -543,21 +543,21 @@ mod tests {
)]
#[case::invalid_request_object(
json!({"jsonrpc": "2.0", "method": 1, "params": "bar"}),
json!({"jsonrpc": "2.0", "id": null,
json!({"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "invalid type: integer `1`, expected a string at line 1 column 27"
}}}),
)]
#[case::empty_batch(
json!([]),
json!({"jsonrpc": "2.0", "id": null,
json!({"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "A batch request must contain at least one request"
}}}),
)]
#[case::invalid_batch_single(
json!([1]),
json!([{"jsonrpc": "2.0", "id": null,
json!([{"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "invalid type: integer `1`, expected struct Helper at line 1 column 1"
}}}
Expand All @@ -566,15 +566,15 @@ mod tests {
#[case::invalid_batch_multiple(
json!([1, 2, 3]),
json!([
{"jsonrpc": "2.0", "id": null,
{"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "invalid type: integer `1`, expected struct Helper at line 1 column 1"
}}},
{"jsonrpc": "2.0", "id": null,
{"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "invalid type: integer `2`, expected struct Helper at line 1 column 1"
}}},
{"jsonrpc": "2.0", "id": null,
{"jsonrpc": "2.0", "id": null,
"error": {"code": -32600, "message": "Invalid request", "data": {
"reason": "invalid type: integer `3`, expected struct Helper at line 1 column 1"
}}},
Expand All @@ -592,7 +592,7 @@ mod tests {
json!([
{"jsonrpc": "2.0", "result": 7, "id": "1"},
{"jsonrpc": "2.0", "result": 19, "id": "2"},
{"jsonrpc": "2.0", "id": null, "error":
{"jsonrpc": "2.0", "id": null, "error":
{"code": -32600, "message": "Invalid request", "data": {
"reason": "missing field `jsonrpc` at line 1 column 13"
}}},
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/method/trace_block_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub async fn trace_block_transactions(
let traces = trace
.traces
.into_iter()
.zip(transactions.into_iter())
.zip(transactions)
.map(|(trace, tx)| Ok((tx.hash, map_gateway_trace(tx, trace)?)))
.collect::<Result<Vec<_>, TraceBlockTransactionsError>>()?;
let output_format = if return_initial_reads {
Expand Down
10 changes: 5 additions & 5 deletions crates/storage/src/connection/state_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ impl Transaction<'_> {
// cater for them here. This works because the sql only updates the row
// if it is null.
let deployed = contract_updates
.iter()
.filter_map(|(_, update)| match update.class {
.values()
.filter_map(|update| match update.class {
Some(ContractClassUpdate::Deploy(x)) => Some(x),
_ => None,
});
Expand Down Expand Up @@ -266,7 +266,7 @@ impl Transaction<'_> {
const PREFIX: &str = r"
SELECT b1.number, b1.hash, b1.state_commitment, b2.state_commitment
FROM block_headers b1
LEFT OUTER JOIN block_headers b2
LEFT OUTER JOIN block_headers b2
ON b2.number = b1.number - 1
";

Expand Down Expand Up @@ -436,7 +436,7 @@ impl Transaction<'_> {
SELECT
ch1.hash AS class_hash,
ch1.compiled_class_hash AS casm_hash
FROM
FROM
casm_class_hashes ch1
LEFT OUTER JOIN
casm_class_hashes ch2 ON ch1.hash = ch2.hash AND ch2.block_number < ch1.block_number
Expand Down Expand Up @@ -504,7 +504,7 @@ impl Transaction<'_> {
pub fn highest_block_with_state_update(&self) -> anyhow::Result<Option<BlockNumber>> {
let mut stmt = self.inner().prepare_cached(
r"
SELECT max(storage_update.last_block, nonce_update.last_block, class_definition.last_block)
SELECT max(storage_update.last_block, nonce_update.last_block, class_definition.last_block)
FROM
(SELECT max(block_number) last_block FROM storage_updates) storage_update,
(SELECT max(block_number) last_block FROM nonce_updates) nonce_update,
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.91.1"
channel = "1.95.0"
components = ["rustfmt", "clippy"]
profile = "minimal"
Loading