0.2.0-alpha.1
Pre-releaseScarb 0.2.0-alpha.1
Note: This version is not yet supported on Starknet! Scarb v0.2 will target Starknet v0.12. If you want to develop contracts deployable to current Starknet v0.11, please stick with Scarb v0.1.
Welcome to the release notes for Scarb v0.2! Here's what has changed these two weeks:
- Cairo
1.0.0-rc0
- we have updated Cairo to the latest release - Cairo LS now comes bundled with Scarb - editor plugins now get access to the always-working revision of the LSP
- Conditional compilation -
#[cfg(target: 'starknet-contract')]
- Work towards compiler plugins
- Breaking change: the
Compiler
interface has been redone
- Breaking change: the
Cairo LS now comes bundled with Scarb
The cairo-lang-language-server
crate from Starkware implements a language server (refered to as Cairo LS) used by the Cairo extension for Visual Studio Code.
Since this release, the Cairo LS comes bundled into Scarb as a subcommand under cairo-language-server
name (see Subcommands for more information). The Cairo extension is now capable of detecting and using the bundled Cairo LS binary. This allows Scarb to ensure both the extension and itself work with the same version of Cairo language, providing more consistent developer experience to extension users. There is no longer need to install the language server separately from Scarb.
Conditional compilation
Conditionally compiled source code is source code that may or may not be considered a part of the source code depending on certain conditions. Source code can be conditionally compiled using the cfg
attribute.
The cfg
attribute conditionally includes the thing it is attached to based on a configuration predicate. If the predicate is true, the item is rewritten to not have the cfg
attribute on it. Otherwise, the item is removed from the source code.
For example, this attribute can be used to provide different implementations of a function depending on current Scarb target:
#[cfg(target: 'lib')]
fn example() -> felt252 {
42
}
#[cfg(target: 'starknet-contract')]
fn example() -> felt252 {
512
}
Which configuration options are set is determined statically during the compilation of the compilation unit of the compiled package. It is not possible to set a configuration option from within the source code of the package being compiled.
See Conditional Compilation reference page for more information.
Work towards compiler plugins
As part of our roadmap, we plan to support user defined Cairo compiler plugins, ideally distributed outside of Scarb source code and required as package dependencies. While this feature is not fully implemented yet, this release includes some ground work required to make this goal achievable in the future.
Cairo plugin is a special Scarb package that defines a cairo-plugin
target and provides additional interface for instantiating compiler Semantic plugins. When using Scarb as a library, Cairo plugins can now be defined with configuration builder. If not specified otherwise, Scarb comes with predefined StarkNet Cairo plugin. The mechanism for requiring Cairo plugins as package dependencies or compiling them in Scarb runtime is not implemented yet.
See RFC: Scarb compiler plugins for more information.
Minor changes
- We have added a documentation page about using Scarb in CI workflows. It starts with a template usage for GitHub Actions, GitLab CI and CircleCI.
scarb --version
will now explicitly tell you if you're running a published Cairo version pulled from crates.io.
Cairo version
This version of Scarb comes with Cairo v1.0.0-rc0
.
What's Changed
- Update various sub-dependencies by @mkaput in #256
- Change references to
quirenox
in our website toquaireaux_math
by @4rgorok in #257 - Fix invalid regex for package names in docs by @mkaput in #259
- Bump snapbox from 0.4.10 to 0.4.11 by @dependabot in #262
- Bump clap from 4.2.1 to 4.2.2 by @dependabot in #263
- Bump assert_fs from 1.0.12 to 1.0.13 by @dependabot in #264
- Bump predicates from 3.0.2 to 3.0.3 by @dependabot in #261
- Conditional compilation by @mkaput in #266
- Docs: Add section about ignoring files in fmt by @maciektr in #267
- Fix recent CI issues by @mkaput in #275
- Add link to Cairo compiler crate if commit hash is unknown by @mkaput in #276
- Search directory containing Scarb binary for subcommands by @maciektr in #277
- Add github actions example to docs by @maciektr in #279
- Bump dunce from 1.0.3 to 1.0.4 by @dependabot in #281
- Bump libc from 0.2.141 to 0.2.142 by @dependabot in #282
- Bump tracing-subscriber from 0.3.16 to 0.3.17 by @dependabot in #283
- Bump clap from 4.2.2 to 4.2.4 by @dependabot in #284
- Add cairo-language-server binary by @maciektr in #260
- List subcommands from Scarb exe dir by @maciektr in #289
- Bump clap from 4.2.4 to 4.2.5 by @dependabot in #291
- Bump anyhow from 1.0.70 to 1.0.71 by @dependabot in #293
- Bump directories from 5.0.0 to 5.0.1 by @dependabot in #294
- Bump tokio from 1.27.0 to 1.28.0 by @dependabot in #292
- Prepare for compiler plugins packages by @mkaput in #297
- Update Cairo to
1.0.0-rc0
by @mkaput in #298
New Contributors
Full Changelog: v0.2.0-alpha.0...v0.2.0-alpha.1