Skip to content

Commit e70dc23

Browse files
release: upgrade to rust 1.91.1 (#10468)
* release: upgrade to rust 1.91.1 Signed-off-by: Dori Medini <dori@starkware.co> * chore: clippy --fix Signed-off-by: Dori Medini <dori@starkware.co> * chore: update SIGABRT error pattern in test Signed-off-by: Dori Medini <dori@starkware.co> --------- Signed-off-by: Dori Medini <dori@starkware.co>
1 parent 67d3163 commit e70dc23

File tree

11 files changed

+21
-32
lines changed

11 files changed

+21
-32
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_compile_to_casm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ apollo_compilation_utils = { workspace = true, features = ["testing"] }
3232
apollo_infra_utils.workspace = true
3333
assert_matches.workspace = true
3434
mempool_test_utils.workspace = true
35+
regex.workspace = true
3536

3637
[build-dependencies]
3738
apollo_compilation_utils.workspace = true

crates/apollo_compile_to_casm/src/compile_test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use cairo_lang_starknet_classes::allowed_libfuncs::{
1616
use cairo_lang_starknet_classes::contract_class::ContractClass as CairoLangContractClass;
1717
use mempool_test_utils::{FAULTY_ACCOUNT_CLASS_FILE, TEST_FILES_FOLDER};
1818
use pretty_assertions::assert_eq;
19+
use regex::Regex;
1920
use starknet_api::contract_class::ContractClass;
2021
use starknet_api::state::SierraContractClass;
2122

@@ -161,8 +162,9 @@ fn test_max_memory_usage() {
161162
audited_libfuncs_only: false,
162163
});
163164
let compilation_result = compiler.compile(contract_class);
165+
let expected_error_pattern = Regex::new(r"memory allocation .* fail").unwrap();
164166
assert_matches!(compilation_result, Err(CompilationUtilError::CompilationError(string))
165-
if string.contains("memory allocation failure")
167+
if expected_error_pattern.is_match(&string)
166168
);
167169
}
168170

crates/apollo_consensus/src/single_height_consensus_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async fn proposer() {
133133
Ok(ShcReturn::Tasks(vec![timeout_prevote_task(0), precommit_task(Some(BLOCK.id.0), 0),]))
134134
);
135135

136-
let precommits = vec![
136+
let precommits = [
137137
precommit(Some(BLOCK.id.0), 0, 0, *VALIDATOR_ID_1),
138138
precommit(Some(Felt::TWO), 0, 0, *VALIDATOR_ID_3),
139139
precommit(Some(BLOCK.id.0), 0, 0, *VALIDATOR_ID_2),
@@ -218,7 +218,7 @@ async fn validator(repeat_proposal: bool) {
218218
Ok(ShcReturn::Tasks(vec![timeout_prevote_task(0), precommit_task(Some(BLOCK.id.0), 0)]))
219219
);
220220

221-
let precommits = vec![
221+
let precommits = [
222222
precommit(Some(BLOCK.id.0), HEIGHT.0, 0, *PROPOSER_ID),
223223
precommit(Some(BLOCK.id.0), HEIGHT.0, 0, *VALIDATOR_ID_2),
224224
precommit(Some(BLOCK.id.0), HEIGHT.0, 0, *VALIDATOR_ID_1),
@@ -413,7 +413,7 @@ async fn repropose() {
413413
Ok(ShcReturn::Tasks(vec![timeout_prevote_task(0), precommit_task(Some(BLOCK.id.0), 0),]))
414414
);
415415
// Advance to the next round.
416-
let precommits = vec![
416+
let precommits = [
417417
precommit(None, 0, 0, *VALIDATOR_ID_1),
418418
precommit(None, 0, 0, *VALIDATOR_ID_2),
419419
precommit(None, 0, 0, *VALIDATOR_ID_3),
@@ -433,7 +433,7 @@ async fn repropose() {
433433
shc.handle_vote(&mut context, precommits[2].clone()).await.unwrap();
434434
shc.handle_event(&mut context, StateMachineEvent::TimeoutPrecommit(0)).await.unwrap();
435435

436-
let precommits = vec![
436+
let precommits = [
437437
precommit(Some(BLOCK.id.0), 0, 1, *VALIDATOR_ID_1),
438438
precommit(Some(BLOCK.id.0), 0, 1, *VALIDATOR_ID_2),
439439
precommit(Some(BLOCK.id.0), 0, 1, *VALIDATOR_ID_3),

crates/apollo_l1_provider/tests/flow_test_consumed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async fn l1_handler_tx_consumed_txs() {
8484
// First we get the message sent. Then we get the consumed event (should be scraped on the
8585
// second iteration of the scraper loop). On the third iteration, we get the second consumed
8686
// event (to trigger deletion on the provider records).
87-
let all_events = vec![
87+
let all_events = [
8888
message_to_l2_event.clone(),
8989
message_consumed_event.clone(),
9090
message_consumed_event_2.clone(),

crates/apollo_p2p_sync/src/client/state_diff_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async fn state_diff_basic_flow() {
4646
let value1 = ascii_as_felt("value1").unwrap();
4747
let nonce0 = Nonce(ascii_as_felt("nonce0").unwrap());
4848

49-
let state_diffs_and_chunks = vec![
49+
let state_diffs_and_chunks = [
5050
(
5151
ThinStateDiff {
5252
deployed_contracts: indexmap!(address0 => class_hash0),

crates/apollo_staking/src/staking_manager_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ async fn get_proposer_success(
209209
// - [7000–8999] → STAKER_2
210210
// - [9000–9999] → STAKER_1
211211

212-
set_stakers(&mut state, &block_context, &vec![STAKER_1, STAKER_2, STAKER_3, STAKER_4]);
212+
set_stakers(&mut state, &block_context, &[STAKER_1, STAKER_2, STAKER_3, STAKER_4]);
213213

214214
let mut random_generator = MockBlockRandomGenerator::new();
215215
random_generator.expect_generate().returning(move |_, _, _, _| random_value);
@@ -259,7 +259,7 @@ async fn get_proposer_random_value_exceeds_total_weight(
259259
block_context: Context,
260260
) {
261261
// Stakers with total weight 10000.
262-
set_stakers(&mut state, &block_context, &vec![STAKER_1, STAKER_2, STAKER_3, STAKER_4]);
262+
set_stakers(&mut state, &block_context, &[STAKER_1, STAKER_2, STAKER_3, STAKER_4]);
263263

264264
// Random value is out of range. Valid range is [0, 10000).
265265
let mut random_generator = MockBlockRandomGenerator::new();

crates/blockifier/src/blockifier/transaction_executor_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ fn test_stack_overflow(#[values(true, false)] concurrency_enabled: bool) {
568568
// Run.
569569
let config = TransactionExecutorConfig::create_for_testing(concurrency_enabled);
570570
let mut executor = TransactionExecutor::new(state, block_context, config);
571-
let results = executor.execute_txs(&vec![account_tx.into()], None);
571+
let results = executor.execute_txs(&[account_tx.into()], None);
572572

573573
let (tx_execution_info, _state_diff) = results[0].as_ref().unwrap();
574574
assert!(tx_execution_info.is_reverted());

crates/blockifier_test_utils/src/cairo_versions.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
use starknet_api::transaction::TransactionVersion;
22
use strum_macros::EnumIter;
33

4-
#[derive(Clone, Hash, PartialEq, EnumIter, Eq, Copy, Debug)]
4+
#[derive(Clone, Default, Hash, PartialEq, EnumIter, Eq, Copy, Debug)]
55
pub enum RunnableCairo1 {
6+
#[default]
67
Casm,
78
#[cfg(feature = "cairo_native")]
89
Native,
910
}
1011

11-
impl Default for RunnableCairo1 {
12-
fn default() -> Self {
13-
Self::Casm
14-
}
15-
}
16-
1712
impl RunnableCairo1 {
1813
pub fn is_cairo_native(&self) -> bool {
1914
match self {
@@ -27,18 +22,13 @@ impl RunnableCairo1 {
2722

2823
// TODO(Aviv, 14/7/2024): Move from test utils module, and use it in ContractClassVersionMismatch
2924
// error.
30-
#[derive(Clone, Hash, PartialEq, Eq, Copy, Debug)]
25+
#[derive(Clone, Default, Hash, PartialEq, Eq, Copy, Debug)]
3126
pub enum CairoVersion {
27+
#[default]
3228
Cairo0,
3329
Cairo1(RunnableCairo1),
3430
}
3531

36-
impl Default for CairoVersion {
37-
fn default() -> Self {
38-
Self::Cairo0
39-
}
40-
}
41-
4232
impl CairoVersion {
4333
// A declare transaction of the given version, can be used to declare contracts of the returned
4434
// cairo version.

crates/starknet_api/src/data_availability.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ use crate::StarknetApiError;
77
#[derive(
88
Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, SizeOf,
99
)]
10+
#[cfg_attr(any(test, feature = "testing"), derive(Default))]
1011
#[serde(try_from = "Deserializer")]
1112
pub enum DataAvailabilityMode {
13+
#[cfg_attr(any(test, feature = "testing"), default)]
1214
L1 = 0,
1315
L2 = 1,
1416
}
1517

16-
#[cfg(any(test, feature = "testing"))]
17-
impl Default for DataAvailabilityMode {
18-
fn default() -> Self {
19-
Self::L1
20-
}
21-
}
22-
2318
/// Deserialize a `DataAvailabilityMode` from a given `Deserializer`.
2419
///
2520
/// This implementation supports deserializing the `DataAvailabilityMode` enum from both numerical

0 commit comments

Comments
 (0)