Skip to content

Commit

Permalink
Update Cairo (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr committed Jul 19, 2024
1 parent 88bf935 commit 60f5cb0
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 140 deletions.
173 changes: 72 additions & 101 deletions Cargo.lock

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = [
"resolver" = "2"

[workspace.package]
version = "2.7.0-rc.4"
version = "2.6.4"
edition = "2021"

authors = ["Software Mansion <contact@swmansion.com>"]
Expand All @@ -35,30 +35,30 @@ anyhow = "1"
assert_fs = "1"
async-trait = "0.1"
axum = { version = "0.6", features = ["http2"] }
cairo-lang-casm = "2.7.0-rc.3"
cairo-lang-compiler = "2.7.0-rc.3"
cairo-lang-debug = "2.7.0-rc.3"
cairo-lang-defs = "2.7.0-rc.3"
cairo-lang-diagnostics = "2.7.0-rc.3"
cairo-lang-doc = "2.7.0-rc.3"
cairo-lang-filesystem = "2.7.0-rc.3"
cairo-lang-formatter = "2.7.0-rc.3"
cairo-lang-language-server = "2.7.0-rc.3"
cairo-lang-lowering = "2.7.0-rc.3"
cairo-lang-parser = "2.7.0-rc.3"
cairo-lang-project = "2.7.0-rc.3"
cairo-lang-runner = "2.7.0-rc.3"
cairo-lang-semantic = "2.7.0-rc.3"
cairo-lang-sierra = "2.7.0-rc.3"
cairo-lang-sierra-generator = "2.7.0-rc.3"
cairo-lang-sierra-to-casm = "2.7.0-rc.3"
cairo-lang-sierra-type-size = "2.7.0-rc.3"
cairo-lang-starknet = "2.7.0-rc.3"
cairo-lang-starknet-classes = "2.7.0-rc.3"
cairo-lang-syntax = "2.7.0-rc.3"
cairo-lang-test-plugin = "2.7.0-rc.3"
cairo-lang-test-runner = "2.7.0-rc.3"
cairo-lang-utils = { version = "2.7.0-rc.3", features = ["env_logger"] }
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-doc = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "d0273bcc88a14c39fe61d76da7860eb25857ea83", features = ["env_logger"] }
camino = { version = "1", features = ["serde1"] }
cargo_metadata = ">=0.18"
clap = { version = "4", features = ["derive", "env", "string"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/dependencies/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ version = "0.1.0"
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git" }

[dev-dependencies]
cairo_test = "2.7.0-rc.3"
cairo_test = "2.6.4"
2 changes: 1 addition & 1 deletion examples/hello_world/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ edition = "2023_10"
[dependencies]

[dev-dependencies]
cairo_test = "2.7.0-rc.3"
cairo_test = "2.6.4"
4 changes: 2 additions & 2 deletions examples/starknet_hello_world/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ version = "0.1.0"
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet = "2.7.0-rc.3"
starknet = "2.6.4"

[dev-dependencies]
cairo_test = "2.7.0-rc.3"
cairo_test = "2.6.4"

[[target.starknet-contract]]
4 changes: 2 additions & 2 deletions examples/starknet_multiple_contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ version = "0.1.0"
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet = "2.7.0-rc.3"
starknet = "2.6.4"

[dev-dependencies]
cairo_test = "2.7.0-rc.3"
cairo_test = "2.6.4"

[[target.starknet-contract]]
4 changes: 2 additions & 2 deletions examples/workspaces/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ test = "snforge"
exit_first = true

[workspace.dependencies]
cairo_test = "2.7.0-rc.3"
starknet = "2.7.0-rc.3"
cairo_test = "2.6.4"
starknet = "2.6.4"

[workspace.package]
version = "0.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn insert_lib_entrypoint_content_into_db(
let module_id = ModuleId::CrateRoot(main_crate_id);
let file_id = db.module_main_file(module_id).unwrap();
db.as_files_group_mut()
.override_file_content(file_id, Some(Arc::from(lib_content)));
.override_file_content(file_id, Some(Arc::new(lib_content.to_string())));

main_crate_id
}
Expand Down
3 changes: 2 additions & 1 deletion scarb/src/compiler/compilers/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ impl Compiler for TestCompiler {
.compiler_config
.unstable_add_statements_functions_debug_info,
};
compile_test_prepared_db(db, config, main_crate_ids, test_crate_ids)?
let allow_warnings = unit.compiler_config.allow_warnings;
compile_test_prepared_db(db, config, main_crate_ids, test_crate_ids, allow_warnings)?
};

{
Expand Down
2 changes: 1 addition & 1 deletion scarb/src/compiler/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn inject_virtual_wrapper_lib(db: &mut RootDatabase, unit: &CairoCompilationUnit
let file_id = db.module_main_file(module_id).unwrap();
// Inject virtual lib file wrapper.
db.as_files_group_mut()
.override_file_content(file_id, Some(Arc::from(content.as_str())));
.override_file_content(file_id, Some(Arc::new(content)));
}

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions scarb/tests/build_starknet_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ fn compile_starknet_contract_without_starknet_dep() {
fn constructor(ref self: ContractState, value_: u128) {
^***********^
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapWriteAccess::write and StoragePointerWriteAccess::write. Consider adding type annotations or explicitly refer to the impl function.
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapWriteAccessTrait::write and StoragePointerWriteAccess::write. Consider adding type annotations or explicitly refer to the impl function.
--> [..]src/lib.cairo:20:20
self.value.write(value_);
^***^
Expand All @@ -402,7 +402,7 @@ fn compile_starknet_contract_without_starknet_dep() {
fn get(self: @ContractState) -> u128 {
^***********^
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapReadAccess::read and StoragePointerReadAccess::read. Consider adding type annotations or explicitly refer to the impl function.
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapReadAccessTrait::read and StoragePointerReadAccess::read. Consider adding type annotations or explicitly refer to the impl function.
--> [..]src/lib.cairo:26:24
self.value.read()
^**^
Expand All @@ -412,7 +412,7 @@ fn compile_starknet_contract_without_starknet_dep() {
fn increase(ref self: ContractState, a: u128) {
^***********^
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapWriteAccess::write and StoragePointerWriteAccess::write. Consider adding type annotations or explicitly refer to the impl function.
error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: StorageMapWriteAccessTrait::write and StoragePointerWriteAccess::write. Consider adding type annotations or explicitly refer to the impl function.
--> [..]src/lib.cairo:29:24
self.value.write( self.value.read() + a );
^***^
Expand Down

0 comments on commit 60f5cb0

Please sign in to comment.