Scarb 0.2.0-alpha.0
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.
Note: Compilation outputs will now land in target/dev/
directory by default. This is a result of introducing profiles to Scarb, and our decision to set dev
as the default one instead of release
.
Welcome to the release notes for Scarb v0.2.0-alpha.0! This is the first preview release in Scarb v0.2 release cycle. The main focus was to quickly deliver Cairo Alpha 7 to our users, but it already includes several features that we work on for the next version of Scarb:
- Profiles - Profiles provide a way to alter the compiler settings.
- CASM contract classes - Everything is awesome.
- Starknet compiler plugin enabled for
[lib]
target
Profiles
Profiles provide a way to alter the compiler settings, influencing things like optimizations and debugging information. When running Scarb commands, like scarb build
, you can specify a profile to use with the --profile
(-P
) flag. Scarb has now 2 built-in profiles: dev
and release
. The profile defaults to dev
if a profile is not specified on the command-line. In addition to the built-in profiles, custom user-defined profiles can also be specified.
For example, to replace all names in generated Sierra code with dummy counterparts, but only in dev
profile, you can now write in your Scarb.toml:
[profile.dev.cairo]
sierra-replace-ids = true
See Defining Custom Profiles guide and Profiles reference page for more information.
CASM contract classes
Historically, contract classes have been defined in terms of Cairo assembly, or CASM for short (the class definition also included more information needed for execution, e.g., hint data). The novelty of Cairo 1.0 is the introduction of Sierra, an intermediate layer between Cairo 1.0 and CASM.
If there is a need to compile Sierra contract to CASM locally, Scarb can now do that by adding casm = true
under [[targets.starknet-contract]]
. Scarb will emit then the CASM Contract Class file in the target directory to a file named: [package name]_[contract name].casm.json
.
See the expanded Starknet Contract Target reference page for more information.
Starknet compiler plugin enabled for [lib]
target
As a temporary measure, Scarb v0.2 now explicitly enables the StarknetPlugin
and Starknet specific implicits precedence for the generic [lib]
target. This enables mixing lib
and starknet-contract
targets in a single package, which in Scarb v0.1 would almost always cause compilation errors, due to pure Cairo compiler not being able to expand the Starknet-specific #[contract]
attribute.
In simpler words: it is now feasible to develop contract libraries!
Cairo version
This version of Scarb comes with Cairo v1.0.0-alpha.7
.
Pull requests
- Enable
StarknetPlugin
onlib
targets by @mkaput in #232 - Generate CasmContractClass in starknet-contract target by @mkaput in #235
- State how targets influence dependencies in docs by @mkaput in #243
- Add manifest profiles definition by @maciektr in #211
- Docs for manifest profiles by @maciektr in #246
- Allow tool metadata overriding with profiles by @maciektr in #253
Full Changelog: v0.1.0...v0.2.0-alpha.0