v2.3.0-rc0
Pre-releaseScarb and Cairo releases are getting synchronized
We are happy to announce that starting with this release, Scarb will follow Cairo version numbering! From now on, Scarb vX.Y.Z
will always ship with matching Cairo vX.Y
release. It is possible that we will make patch releases for Scarb that will not come with compiler updates.
BREAKING: New artifacts extensions convention
This Scarb release starts and implements a new convention of file extensions in Cairo & Starknet ecosystems:
- Textual Sierra representation, meant for debugging use and compiler tests, stays as:
crate.sierra
- Textual CASM code of compiled Sierra, executable in Cairo VM, stays as:
crate.casm
- JSON representation of Sierra, used to be much more reliable than textual dump becomes:
crate.sierra.json
- alternative serialization formats will naturally be
crate.sierra.X
- alternative serialization formats will naturally be
- JSON containing Sierra code of Starknet contract class becomes:
contract.contract_class.json
- JSON containing CASM code of Starknet contract class becomes:
contract.compiled_contract_class.json
See the related proposal in Cairo discussions for more elaborate description.
BREAKING: [lib]
target now emits Sierra in new JSON format
The default [lib]
target now by default emits Sierra in a new JSON format (.sierra.json
), that is derived from Cairo compiler data structures instead of textual Sierra (.sierra
).
If you want to emit old format in your packages, add the following to your Scarb.toml
:
[lib]
sierra-text = true
Important
We ask though to migrate your tools & workflows to .sierra.json
immediately, as .sierra
files parser is known to misread programs and the JSON format does not have this issue.
BREAKING: Package names must be lowercase
Starting with this release, Scarb will refuse to work on packages that contain uppercase letters. Technically this is a breaking change, but we have not detected such packages existing in the open-source world, so we expect no affected users.
Moving tests compilation from cairo-test
to scarb build
scarb cairo-test
does not bundle the entire Cairo compiler now, and instead calls scarb build
in order to build Cairo tests. This is now possible thanks to the addition of a new Scarb target: [[test]]
.
This feature is currently mostly behind the scenes. We plan to iterate on it, and make it publicly documented when we'll ensure it is rock solid. As part of this effort, our plan is to standardize generated artefacts for tests, and therefore allow Starknet Foundry to also delegate their build process entirely to Scarb. This will also make it much easier to implement other custom Cairo test runners, as we'll effectively decouple Cairo compilation from actual testing.
The tests
directory
This improvement also allows Scarb to kill two birds with one stone:
- Starknet Foundry's
tests
directory is now properly handled byscarb cairo-language-server
. scarb cairo-test
got support for running tests from thetests
directory.
We will be polishing and documenting this feature in future Scarb releases.
Note
These improvements are only available in Scarb's distributions of cairo-test
and Cairo LS. The low-level binaries generated by Cairo compiler team do not have such capabilities.
Sorting imports in Cairo code
scarb fmt
can now sort use
statements etc. in Cairo code. This feature tends to generate big diffs, so it is disabled by default. To enable it, add the following to your Scarb.toml
:
[tool.fmt]
sort-module-level-items = true
See relevant documentation for more information
Wildcard support in build-external-contracts
The build-external-contracts
property of the starknet-contract
target allows asking Scarb to build contracts from package dependencies as part of proper package build, for example for use in tests. This release adds a possibility to request building many contracts from a module tree at once. For example, the following snippet:
[[target.starknet-contract]]
build-external-contracts = [
"dojo_erc::erc721::components::Balance",
"dojo_erc::erc721::components::OperatorApproval",
"dojo_erc::erc721::components::Owner",
"dojo_erc::erc721::components::TokenApproval",
"dojo_erc::erc721::erc721::ERC721",
"dojo_erc::erc721::systems::erc721_approve",
"dojo_erc::erc721::systems::erc721_burn",
"dojo_erc::erc721::systems::erc721_mint",
"dojo_erc::erc721::systems::erc721_set_approval_for_all",
"dojo_erc::erc721::systems::erc721_transfer_from",
]
can now be written as:
[[target.dojo]]
build-external-contracts = [
"dojo_erc::erc721::*",
]
Thanks to @ametel01 for contribution!
Minor changes
- Commands executed via Scarb scripts may now use coloured output in some cases.
scarb clean
refuses to work if it's executed outside Scarb workspace.- On Linux and macOS, Scarb now uses the
exec(3)
syscall for running subcommands, which means that subcommands now replacescarb
process instead of being wrapped by it. Alongside this, we have improved the corresponding implementation on Windows, which should, among others, improve handling of killing processes. scarb new
/init
now show an error or a warning if created package's name is a Cairo keyword or other ecosystem reserved name.- Added an internal support for target-specific dependencies.
test
targets will now depend on a new magic package:test_plugin
, which providescairo-test
compiler plugin.- This change will manifest itself in
scarb metadata
output.
- Scarb will now attempt to infer the value of
package.readme
field if missing, but a readme file is present.
Cairo Version
This version of Scarb comes with Cairo v2.3.0-rc0
.
What's Changed
- Fix formatting / clippy warning for 1.72 by @maciektr in #613
- Remove
packages_filter
feature fromscarb-metadata
by @mkaput in #605 - Add source-path argument to TomlTarget by @maciektr in #595
- Make inline plugins loadable via CairoPluginRepository by @szymmis in #620
- Set Cargo resolver version to 2 by @maciektr in #618
- Reduce number of scarb build calls in tests by @MrDenkoV in #616
- Bump the non-critical group with 5 updates by @dependabot in #622
- Upgrade Vitepress by @mkaput in #621
- Fix
errors_when_missing_script_and_cairo
test by @szymmis in #625 - Add [[test]] target definition by @maciektr in #596
- Disallow uppercase letters in package name by @MrDenkoV in #632
- Bump the non-critical group with 3 updates by @dependabot in #638
- Cross init templates off the roadmap by @mkaput in #639
- Remove example dependency comment from the template by @mkaput in #641
- Fix logo urls by @mkaput in #642
- Support import sorting via manifest configuration by @szymmis in #633
- Use SerDe to save sierra program by @MrDenkoV in #610
- Add textual Sierra artifact support by @MrDenkoV in #637
- Add reserved and special package names handling by @MrDenkoV in #640
- Run check release tests with ci profile by @szymmis in #648
- Implement wild card contracts selector by @ametel01 in #606
- Add target kind info to manifest dependency by @maciektr in #611
- Fix macos failing on cairo run extensions test by @szymmis in #653
- Adapt
windows_test
test to error wording changes by @szymmis in #656 - Bump the non-critical group with 5 updates by @dependabot in #663
- Bump website dependencies by @mkaput in #665
- Fix init test on windows by @maciektr in #664
- Set cairo version to latest main commit explicitly in nightly workflow by @szymmis in #661
- Update cairo to main by @maciektr in #668
- Update Vitepress by @mkaput in #670
- Ensure scarb clean only works in a workspace by @maciektr in #672
- Infer readme by @MrDenkoV in #655
- Read scarb profile argument from env by @maciektr in #678
- Build dependency resolution with target_kind filter by @maciektr in #612
- Store target kinds on manifest summary by @maciektr in #659
- Update CONTRIBUTING.md by @mkaput in #680
- Bump the non-critical group with 7 updates by @dependabot in #683
- Update cairo dependency by @maciektr in #681
- Update Vitepress by @mkaput in #684
- Update CONTRIBUTING.md by @mkaput in #685
- Fix
runtime_manifest
field not working with Scarb <0.5.0 by @mkaput in #686 - Skip reading workspace for external if no manifest found by @maciektr in #690
- Fix tests assertions for non-Unix platforms by @mkaput in #691
- Notify on nightly fail by @MrDenkoV in #692
- Synchronize Scarb and Cairo versions by @mkaput in #687
- Revert accidental breaking change introduced in #655 by @mkaput in #694
- Fix all cases when std canonicalization was used instead of dunce by @mkaput in #695
- Fix colours in subcommands by @MrDenkoV in #666
- Fix exec_replace by @MrDenkoV in #658
- Update cairo by @maciektr in #699
- Add test compilation unit component for integration test targets by @maciektr in #597
- Use ws solution per target kind by @maciektr in #615
- Move invalid dep warning to resolver by @maciektr in #660
- Bump the non-critical group with 5 updates by @dependabot in #702
- Bump semver from 1.0.18 to 1.0.19 by @dependabot in #703
- Compile test targets, integrate with test runner by @maciektr in #628
- Add a changelog to
scarb-metadata
by @mkaput in #705 - Skip test target compilation without --test flag by @maciektr in #649
- Auto-detect test targets by @maciektr in #651
- Add test type prop on test targets by @maciektr in #679
- Compile lib-style integration tests by @maciektr in #688
- Update internal restricted package names by @maciektr in #706
- Use UTF-8 paths for
source-path
field by @mkaput in #707 - Fix
TomlTargetKind
parsing rules by @mkaput in #712 - Change default test target name by @maciektr in #714
- Execute cairo-test as script instead of exec_replace when testing pkg by @maciektr in #713
- Loosen dependency requirements and bump some by @mkaput in #716
- Prepare release
2.3.0-rc0
by @mkaput in #718
Full Changelog: v0.7.0...v2.3.0-rc0