Skip to content

Commit 48f909a

Browse files
authored
hotfix-init-crashes (#1745)
1 parent f840f8b commit 48f909a

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
#### Changed
2020

2121
- Unknown entry point error when calling a contract counts as a panic
22+
- Cairo edition set to `2023_11`
2223

2324
#### Fixed
2425

crates/forge/src/init.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ use anyhow::{anyhow, Context, Ok, Result};
22

33
use include_dir::{include_dir, Dir};
44

5+
use forge::CAIRO_EDITION;
56
use scarb_api::ScarbCommand;
67
use std::fs::{self, OpenOptions};
78
use std::io::Write;
89
use std::path::Path;
910
use toml_edit::{value, ArrayOfTables, Document, Item, Table};
1011

11-
const CAIRO_EDITION: &str = "2023_10";
12-
1312
static TEMPLATE: Dir = include_dir!("starknet_forge_template");
1413

1514
fn overwrite_files_from_scarb_template(

crates/forge/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ use crate::test_filter::TestsFilter;
2020

2121
pub mod block_number_map;
2222
pub mod compiled_raw;
23+
2324
pub mod pretty_printing;
2425
pub mod scarb;
2526
pub mod shared_cache;
2627
pub mod test_filter;
2728
mod warn;
2829

30+
pub const CAIRO_EDITION: &str = "2023_11";
31+
2932
pub(crate) fn replace_id_with_params<'a>(
3033
raw_fork_config: &'a RawForkConfig,
3134
fork_targets: &'a [ForkTarget],

crates/forge/tests/e2e/running.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use crate::e2e::common::runner::{
22
get_current_branch, get_remote_url, runner, setup_package, test_runner,
33
};
4+
45
use assert_fs::fixture::{FileWriteStr, PathChild, PathCopy};
56
use camino::Utf8PathBuf;
7+
use forge::CAIRO_EDITION;
68
use indoc::{formatdoc, indoc};
79
use std::fs;
810
use std::{path::Path, str::FromStr};
@@ -749,7 +751,7 @@ fn init_new_project_test() {
749751
[package]
750752
name = "test_name"
751753
version = "0.1.0"
752-
edition = "2023_10"
754+
edition = "{}"
753755
754756
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html
755757
@@ -760,7 +762,8 @@ fn init_new_project_test() {
760762
[[target.starknet-contract]]
761763
casm = true
762764
"#,
763-
version
765+
CAIRO_EDITION,
766+
version,
764767
);
765768

766769
assert_eq!(generated_toml, expected_toml);

starknet_forge_template/src/lib.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[starknet::interface]
2-
trait IHelloStarknet<TContractState> {
2+
pub trait IHelloStarknet<TContractState> {
33
fn increase_balance(ref self: TContractState, amount: felt252);
44
fn get_balance(self: @TContractState) -> felt252;
55
}

starknet_forge_template/tests/test_contract.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn test_cannot_increase_balance_with_zero_value() {
3939

4040
#[feature("safe_dispatcher")]
4141
match safe_dispatcher.increase_balance(0) {
42-
Result::Ok(_) => panic_with_felt252('Should have panicked'),
42+
Result::Ok(_) => core::panic_with_felt252('Should have panicked'),
4343
Result::Err(panic_data) => {
4444
assert(*panic_data.at(0) == 'Amount cannot be 0', *panic_data.at(0));
4545
}

0 commit comments

Comments
 (0)