github software-mansion/scarb v0.4.0
0.4.0

latest releases: v2.12.2, cairo-lang-macro/v0.2.1, cairo-lang-macro-attributes/v0.2.1...
2 years ago

Scarb 0.4.0

Welcome to release notes for Scarb v0.4.0! This is a significant release, bringing two new highly requested features.

NOTE: This release has not been published to crates.io, because we had to backport a few commits to Cairo 1.1.0. We're sorry for the inconvenience.

scarb test

The scarb test command executes all unit and integration tests of a local package. It is not a test runner by itself, but rather delegates work to a testing solution of choice. Scarb comes with preinstalled scarb cairo-test extension, which bundles Cairo's native test runner. It is the default test runner used by scarb test.

Our examples in the repository now contain several tests, and you can check out this feature by quickly running scarb test over them:

$ cd examples/starknet_hello_world
$ scarb test
testing starknet_hello_world ...
running 1 tests
test starknet_hello_world::tests::test_flow ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 filtered out;

The behaviour of the scarb test command can be changed by developers. To do so, provide a script named explicitly test in the current workspace Scarb.toml:

[scripts]
test = "protostar test"

For more information, check out the dedicated Testing documentation page.

Allowed libfuncs validation for Starknet contracts

Not all Sierra libfuncs emitted by the Cairo compiler can be deployed to Starknet, as some are not audited yet, or others are meant for development use and would be unsafe when run in contract context. The Starknet contract target runs now a pass after compilation that checks if every emitted libfunc is present in a provided allowed libfuncs list. By default, this pass emits compilation warnings when it spots unexpected libfuncs.

$ scarb build
   Compiling starknet_hello_world v0.1.0 [..]
warn: libfunc `bool_eq` is not allowed in the libfuncs list `Default libfunc list`
 --> contract: Balance
help: try compiling with the `experimental_v0.1.0` list
 --> Scarb.toml
    [[target.starknet-contract]]
    allowed-libfuncs-list.name = "experimental_v0.1.0"

    Finished release target(s) in 8 seconds

For more information, check out relevant documentation.

Cairo version

This version of Scarb comes with Cairo v1.1.0 with patches kept on this branch, commit 0e81e72.

What's Changed

  • Truncate when overwriting artifacts by @tarrencev in #388
  • Scarb Test Runner 🚀 by @mkaput in #382
  • Bump fs4 from 0.6.4 to 0.6.5 by @dependabot in #396
  • Bump proc-macro2 from 1.0.58 to 1.0.59 by @dependabot in #392
  • Bump once_cell from 1.17.1 to 1.17.2 by @dependabot in #393
  • Bump tokio from 1.28.1 to 1.28.2 by @dependabot in #395
  • Bump quote from 1.0.27 to 1.0.28 by @dependabot in #394
  • Replace deprecated Rust's SipHasher with XXH3 by @mkaput in #397
  • Replace manual Default impls with derive for UI enums by @mkaput in #399
  • Rename starknet_artifacts.json to <package>.starknet_artifacts.json to avoid collisions in workspaces by @mkaput in #398
  • Add logging initialization in cairo-ls binary by @maciektr in #400
  • Add a short notice about Scarb's LS to docs by @mkaput in #404
  • Add missing diagnostics reporting to the test runner by @mkaput in #405
  • Validate libfuncs in contracts compiler by @mkaput in #402

Full Changelog: v0.3.0...v0.4.0

Don't miss a new scarb release

NewReleases is sending notifications on new releases.