Skip to content

bump to scarb 2.12.0 #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Getting scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.9.2"
scarb-version: "2.12.0"

- name: Verify all exercises
env:
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Getting scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.9.2"
scarb-version: "2.12.0"

- name: Format
run: ./bin/format_exercises.sh --check
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scarb 2.9.2
scarb 2.12.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ _Thoughtful suggestions will likely result faster & more enthusiastic responses

## Testing

Tests currently use Cairo v2.9.2 (included with Scarb v2.9.2).
Tests currently use Cairo v2.12.0 (included with Scarb v2.12.0).

To test all exercises, run `./bin/verify-exercises`.
This command will iterate over all exercises and check to see if their exemplar/example implementation passes all the tests.
Expand Down
2 changes: 2 additions & 0 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ for exercise_path in $exercises; do
tmp_dir=$(mktemp -d)
trap 'rm -rf $tmp_dir' EXIT INT TERM

cp ".tool-versions" "$tmp_dir"

# copy the exercise to the temporary directory
contents_to_copy=(
"src"
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/airport-robot/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/airport-robot/tests/airport_robot.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use airport_robot::{Italian, French, say_hello};
use airport_robot::{French, Italian, say_hello};

#[test]
fn test_say_hello_italian_name_without_spaces() {
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/annalyns-infiltration/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use annalyns_infiltration::{can_fast_attack, can_spy, can_signal_prisoner, can_free_prisoner};
use annalyns_infiltration::{can_fast_attack, can_free_prisoner, can_signal_prisoner, can_spy};

// The following tests are for the `can_fast_attack` function.

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/calculator-conundrum/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub impl ChronoChainImpl of ChronoChainTrait {
let mut span = arr.span();
while let Option::Some(value) = span.pop_back() {
chain = ChronoChain::Link((*value, BoxTrait::new(chain)));
};
}

chain
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/chrono-realms-chrono-chain/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chrono_realms_chrono_chain::{ChronoChainTrait, ChronoChain};
use chrono_realms_chrono_chain::{ChronoChain, ChronoChainTrait};

const U32_MAX: u32 = 0xFFFFFFFF;

Expand Down Expand Up @@ -139,7 +139,7 @@ fn build_large_array() {
assert_eq!(value, count);
count += 1;
chrono_chain = next.unbox();
};
}

match chrono_chain {
ChronoChain::End => (),
Expand Down Expand Up @@ -225,6 +225,6 @@ fn array_in_range(range: core::ops::Range<u32>) -> Array<u32> {
let mut arr = array![];
for elem in range {
arr.append(elem);
};
}
arr
}
2 changes: 1 addition & 1 deletion exercises/concept/chrono-realms/.meta/exemplar.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::traits::{Add, Sub, PartialOrd};
use core::traits::{Add, PartialOrd, Sub};

// Define the TimeShard struct
#[derive(Drop, Debug, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/chrono-realms/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/chrono-realms/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::traits::{Add, Sub, PartialOrd};
use core::traits::{Add, PartialOrd, Sub};

// Define the TimeShard struct
#[derive(Drop, Debug, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/cryptographer/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/election-day/.meta/exemplar.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::to_byte_array::AppendFormattedToByteArray;
use core::dict::Felt252Dict;
use core::to_byte_array::AppendFormattedToByteArray;

#[derive(Drop, Copy)]
pub struct VoteCounter {
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/election-day/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/election-day/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::to_byte_array::AppendFormattedToByteArray;
use core::dict::Felt252Dict;
use core::to_byte_array::AppendFormattedToByteArray;

#[derive(Drop, Copy)]
pub struct VoteCounter {
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/gross-store/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/health-statistics/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub impl EvensImpl<T, +Drop<T>, +Copy<T>> of EvensTrait<T> {
result.append(*self.at(i));
}
i += 2;
};
}
result
}
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/low-power-embedded-game/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/lucians-luscious-lasagna/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/magician-in-training/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ pub mod blue_remote_control_car_team {
}

pub mod combined {
use super::red_remote_control_car_team as Red;
use super::blue_remote_control_car_team as Blue;
use super::{blue_remote_control_car_team as Blue, red_remote_control_car_team as Red};

#[derive(Drop)]
pub struct CarBuilder {}
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/red-vs-blue-darwin-style/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/the-realm-of-echoes/.meta/exemplar.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::fmt::{Debug, Display, Formatter, Error};
use core::fmt::{Debug, Display, Error, Formatter};

pub fn format_magical_chant(chant1: ByteArray, chant2: ByteArray, chant3: ByteArray) -> ByteArray {
format!("{chant1}-{chant2}-{chant3}")
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/the-realm-of-echoes/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/the-realm-of-echoes/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::fmt::{Debug, Display, Formatter, Error};
use core::fmt::{Debug, Display, Error, Formatter};

pub fn format_magical_chant(chant1: ByteArray, chant2: ByteArray, chant3: ByteArray) -> ByteArray {
panic!("implement 'format_magical_chant'")
Expand Down
10 changes: 5 additions & 5 deletions exercises/concept/welcome-to-tech-palace/.meta/exemplar.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn add_border(welcome_msg: ByteArray, num_stars_per_line: u32) -> ByteArray
let mut border: ByteArray = "";
for _ in 0..num_stars_per_line {
border.append_byte('*');
};
}
border.clone() + "\n" + welcome_msg + "\n" + border
}

Expand All @@ -17,15 +17,15 @@ pub fn clean_up_message(old_msg: ByteArray) -> ByteArray {
let mut start = 0;
while is_whitespace(old_msg[start]) || old_msg[start] == '*' {
start += 1;
};
}
let mut end = old_msg.len();
while is_whitespace(old_msg[end - 1]) || old_msg[end - 1] == '*' {
end -= 1;
};
}
let mut clean_msg = "";
for i in start..end {
clean_msg.append_byte(old_msg[i]);
};
}
clean_msg
}

Expand All @@ -45,7 +45,7 @@ fn to_uppercase(input: u256) -> ByteArray {
while remaining_bytes != 0 {
uppercase_chars.append_byte(char_to_uppercase(get_last_byte(remaining_bytes)));
remaining_bytes = remove_last_byte(remaining_bytes);
};
}
uppercase_chars.rev()
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/welcome-to-tech-palace/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/concept/welcome-to-tech-palace/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn to_uppercase(input: u256) -> ByteArray {
while remaining_bytes != 0 {
uppercase_chars.append_byte(char_to_uppercase(get_last_byte(remaining_bytes)));
remaining_bytes = remove_last_byte(remaining_bytes);
};
}
uppercase_chars.rev()
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/acronym/.meta/example.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn abbreviate(phrase: ByteArray) -> ByteArray {
capture = false;
}
i += 1;
};
}

result
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/acronym/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
8 changes: 4 additions & 4 deletions exercises/practice/all-your-base/.meta/example.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn rebase(digits: Array<u32>, input_base: u32, output_base: u32) -> Result<A
break;
}
i += 1;
};
}

if response > 0 || i == 0 {
let x = *digits.at(i);
Expand All @@ -50,7 +50,7 @@ fn convert_to_base_10(digits: Array<u32>, input_base: u32) -> u32 {
let pow = input_base.pow(exp);
sum += *digit * pow;
i += 1;
};
}

sum
}
Expand All @@ -66,7 +66,7 @@ fn convert_from_base_10(mut digits: u32, output_base: u32) -> Array<u32> {
let remainder = digits % output_base;
digits /= output_base;
result.append(remainder);
};
}

reverse_array(result)
}
Expand All @@ -78,7 +78,7 @@ fn reverse_array(arr: Array<u32>) -> Array<u32> {
while i > 0 {
i -= 1;
reversed.append(*arr[i]);
};
}

reversed
}
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/tests/all_your_base.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use all_your_base::{rebase, Error};
use all_your_base::{Error, rebase};

#[test]
fn single_bit_one_to_decimal() {
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/allergies/.meta/example.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub impl AllergiesImpl of AllergiesTrait {
break;
}
index += 1;
};
}
found && (*self.score & 2_u32.pow(index)) != 0
}

Expand All @@ -49,7 +49,7 @@ pub impl AllergiesImpl of AllergiesTrait {
if self.is_allergic_to(allergen) {
result.append(*allergen);
}
};
}
result
}
}
2 changes: 1 addition & 1 deletion exercises/practice/allergies/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024_07"

[dev-dependencies]
cairo_test = "2.9.2"
cairo_test = "2.12.0"
Loading
Loading