Cairo v2.8.0 is out!

TL;DR

Closely following v2.7.0, v2.8.0 is a version focusing on stability and bug-fixes. Most importantly, in a recent joint effort by the Scarb and compiler teams, we addressed many issues in the language server, improving its stability and performance, thus significantly improving the developer experience.

This version affects only the high level compiler, Cairo → Sierra, which means contracts written with the new version can be deployed on testnet or mainnet without delay.

In addition to the language server improvements, a few new features were added to the language, which we’ll cover below. As always, for a comprehensive review of the changes, see the release notes.

Finally, we’d like to remind everyone that the Cairo package registry scarbs.xyz is live. Uploading is still whitelisted, but you can browse through the popular packages.

Language server improvements

Following community feedback, over the past few weeks we have significantly increased the attention given to the language server to give the best DevX possible.

Thanks to the great work of the Scarb & compiler team, you should now notice that it’s now:

  • Much more stable, many crashing-related issues were solved
  • Much more performant, less to no waiting for it to analyze your files

To enjoy the latest improvements, make sure you’re using scarb 2.8.0 (ideally installed via asdf), and in case you’re using VSCode, the latest version of the extension.

To ensure things keep running smoothly, please report any LS-related issues on the TG support group.

The Cairo package registry

We’re happy to announce the official cairo package-registry scarbs.xyz. Uploading packages is still whitelisted at the moment, but is expected to open in the upcoming weeks.

Thanks to the registry, you no longer have to use github tags when specifying your dependencies, but can instead use package versions.

Before:

[dependencies]
starknet = "2.8.0"
openzeppelin = { git = "<https://github.com/openzeppelin/cairo-contracts>", tag = "v0.10.0"}

[dev-dependencies]
snforge_std = { git = "<https://github.com/foundry-rs/starknet-foundry.git>", tag = "v0.25.0" }

Now

[dependencies]
starknet = "2.8.0"
openzeppelin = "0.15.1"

[dev-dependencies]
snforge_std = "0.28.0"

Having issues uploading? Think a critical package is missing? Join the registry TG group and share your issues and suggestions.

Range operator

The range operator .. is introduced to Cairo, currently implemented for all integer types:

for i in 1_u32..10_u32 {
   println!("{i}");
}

To support custom types, one needs to implement IntoIterator<Range<T>>. For more details, see range.cairo in the corelib.

supporting crate:: in path names

When importing items from your own package, you no longer have to use the explicit name, but instead can write:

use crate::path::in::the_crate;