v2.7.0-rc.0
Pre-releaseWelcome to the release notes for Scarb v2.7.0-rc.0
!
Warning
This version is not supported on Starknet! If you want to develop contracts deployable to the current Starknet, please stick with Scarb v2.6.5
This Scarb release includes multiple new developments:
- Testing without gas calculation - If your package disables gas calculation with
enable-gas
flag on compiler config, no gas calculations will be performed incairo-test
. - Additional resource usage info while testing - You can now use new flag
--print-resource-usage
when testing package withcairo-test
to print more verbose usage info. - Cairo profiler support - statement-function mappings - Scarb can now emit annotations that can be consumed by
cairo-profiler
to trace resource usage. - Diagnostic error codes - Compiler diagnostics (both errors and warnings) are now printed with numerical error code, which makes identification and understanding of root cause easier.
- Stop overwriting existing git checkouts - Checkouts of git dependencies are not anymore overwriten on each Scarb run.
- Stop enabling
cfg(test)
in package tested with integration tests - integration tests (fromtests
directory) incairo-test
should not rely on
But also, the introduction of few new features:
Conditional compilation with Scarb features
Features in Scarb provide a way to conditionally compile specific parts of the code during the build process.
A package defines a set of named features in the [features]
section of the Scarb.toml
file. Each defined feature can list other features that should be enabled with it. For example, a package supporting various hash functions might define features like this:
[features]
poseidon = []
pedersen = []
keccak = []
With these features set, conditional compilation (cfg) attributes can be used to selectively include code to support requested features during compile time, for example: #[cfg(feature: 'poseidon')]
.
You can read more on features in our conditional compilation docs.
Cairo test dependency
Since this release, all packages using cairo-test
as a test runner have to define a dependency on cairo_test
package, with version matching the Scarb version (similarly to the starknet
package). The cairo_test
package should be put in the dev-dependencies
section of Scarb manifest file.
Example of dependency declaration:
[dev-dependencies]
cairo_test = "2.7.0-rc.0"
If you choose to replace cairo-test
with another test runner (like starknet-foundry
) you should remove the cairo_test
package from your dependencies.
Forge project template
If you intend to use Starknet Foundry Forge to test your contracts, you can create an already set up Starknet Foundry project by running:
scarb new hello_world --snforge
This will create a Starknet package, with Forge already set up as your test runner. You can then execute Forge tests by
simply running:
scarb test
You can also build your package, like a regular Starknet package.
Scarb expand command
Before the actual compilation of your Cairo code, the Cairo compiler runs multiple pre-processing steps on it (these are usually called plugins).
Each of these steps takes parsed Cairo code as an input, modifies it and returns modified Cairo code back to the compiler.
Since this Scarb release, you can use scarb expand
to see the Cairo code generated after all preprocessing steps. The expanded Cairo will be saved in a file in target directory.
Choose cairo-run function to execute
Until this release, scarb cairo-run
would always look for a function called main
to execute.
Since this release, a function to run can be specified with --function
argument.
If your build does not include debug names (sierra-replace-ids
set to false), you can now choose function to run by annotating it with #[main]
attribute.
To use the attribute, you need to add cairo_run
with version equal to Scarb version to your dependencies.
You can read more on cairo-run
in our docs.
Merge manifest tool definitions recursively
Tool metadata (defined in the manifest [tool]
section) can be overridden by a profile.
Since this release, merge strategy can be changed with merge-strategy
property.
For example:
[tool.some-tool]
local = false
debug = false
[profile.dev.tool.some-tool]
merge-strategy = "merge"
debug = true
Would be translated to:
[tool.some-tool]
merge-strategy = "merge"
local = false
debug = true
Note, that before introduction of merge-strategy
propery, this would translate to:
[tool.some-tool]
debug = true
You can read more on tool metadata in our docs.
Cairo Version
This version of Scarb comes with Cairo v2.7.0-rc.0
.
What's Changed
- Store file path and file id in token stream metadata by @maciektr in #1192
- Refactor: move cairo-lang-macro types to submodule by @maciektr in #1194
- Register macro expansion capabilities by @maciektr in #1195
- Allow defining multiple macros per package by @maciektr in #1200
- Update Cairo by @maciektr in #1210
- Allow testing without gas calculation by @maciektr in #1211
- Upgrade Vitepress to 1.0.1 by @mkaput in #1223
- Rust update - fix build and clippy erorrs by @maciektr in #1213
- Fix nightlies pipeline after rust package id spec update by @maciektr in #1222
- Downstream cairo-test option to print used resources for tests (cairo… by @maciektr in #1221
- Rename aux data collection to post processing by @maciektr in #1214
- Rewrite cairo-lang-macro docs by @maciektr in #1215
- Fix linkme call for multiple callback definitions by @maciektr in #1216
- Fix: expand with actual expansion name instead of package name by @maciektr in #1217
- Add test case with multiple macros by @maciektr in #1218
- Handle multiple aux data returns from code expansion by @maciektr in #1219
- Add tests for macro name validations by @maciektr in #1220
- Bump deno_task_shell from 0.14.4 to 0.15.0 by @dependabot in #1227
- Consider a case when the test fn return types are actually an empty vec by @Arcticae in #1224
- Bump katex from 0.16.9 to 0.16.10 in /website by @dependabot in #1228
- Fix cairo-lang-macro doctest by @maciektr in #1225
- Update deps by @maciektr in #1229
- Enforce
fuzzer_runs
>= 1 insnforge-test-collector
by @Draggu in #1231 - Bump actions/configure-pages from 4 to 5 by @dependabot in #1237
- Bump the non-critical group with 5 updates by @dependabot in #1238
- Update deno_task_shell by @maciektr in #1240
- Support for rust-like features by @fmkra in #1236
- Bump vite from 5.2.3 to 5.2.8 in /website by @dependabot in #1242
- Fix asserts with time units by @maciektr in #1243
- Add option to generate statements <> functions mapping in compilation by @piotmag769 in #1233
- Implement inline macros expansion by @maciektr in #1235
- Bump h2 from 0.3.24 to 0.3.26 by @dependabot in #1246
- Resolve full path markers by @maciektr in #1244
- Bump the non-critical group with 2 updates by @dependabot in #1250
- Read ui verbosity from env var by @maciektr in #1245
- Prepare scarb-ui release
0.1.4
by @maciektr in #1251 - Prepare scarb-metadata release
1.12.0
by @maciektr in #1252 - Run doc tests in CI by @maciektr in #1253
- Add statements mappings to snforge test artifacts by @piotmag769 in #1241
- Fix log verbosity calculation by @maciektr in #1255
- Update Cairo revision by @maciektr in #1263
- Replace result enum with single struct by @maciektr in #1261
- Refactor proc macro test project builder by @maciektr in #1262
- Implement derive macros by @maciektr in #1258
- Parse attr arguments by @maciektr in #1264
- Add From trait for Diagnostic -> Diagnostics by @maciektr in #1265
- Bump the non-critical group with 2 updates by @dependabot in #1267
- Remove unused flag by @maciektr in #1269
- Add cairolike features to test collector by @piotmag769 in #1271
- Support diagnostic error codes by @maciektr in #1268
- Scarb UI to_env_vars trait by @maciektr in #1272
- Replace
Cairo 1.0
->Cairo
by @mkaput in #1274 - Replace all GitHub Discussions links with chats or doc links by @mkaput in #1275
- Document features by @fmkra in #1257
- Bump rustls from 0.21.10 to 0.21.11 by @dependabot in #1276
- Bump the non-critical group with 8 updates by @dependabot in #1277
- Fix SCARB_LOG setup for subcommands by @maciektr in #1278
- Do not override git checkout on each execution by @maciektr in #1279
- Prepare scarb-ui release
0.1.5
by @maciektr in #1280 - Fix year in footer by @tomek0123456789 in #1282
- Revert "Fix year in footer (#1282)" by @maciektr in #1284
- Add option to choose function to run by name by @maciektr in #1283
- Warn about unmatched external contracts selectors by @maciektr in #1286
- Bump the non-critical group with 2 updates by @dependabot in #1288
- [scarb-doc] Add crate + initial CLI by @drknzz in #1273
- Fix ci after rust update by @maciektr in #1291
- Bump the non-critical group with 3 updates by @dependabot in #1292
- Bump slackapi/slack-github-action from 1.25.0 to 1.26.0 by @dependabot in #1290
- Update Cairo by @maciektr in #1293
- Update Cairo to include executables by @maciektr in #1294
- Add warning on no-executables & no-debug lib target build by @maciektr in #1295
- Add LS E2E test by @mkaput in #1297
- Add executable attributes API by @maciektr in #1296
- Do not add new ast item, for last proc macro with no generated code by @maciektr in #1298
- Fix cfg set for integration test by @maciektr in #1299
cargo update
by @mkaput in #1302- [scarb-doc] Fix
trait_item_names
by @drknzz in #1304 - Refactor: extract cairo compilation unit for target to separate function by @maciektr in #1300
- [scarb-doc] Scarb packages by @drknzz in #1289
- Bump the non-critical group with 12 updates by @dependabot in #1310
- Add forge template to
scarb new
andscarb init
under separate flag by @Draggu in #1308 - Update Cairo by @maciektr in #1316
- Fix felt serialization in
snforge-test-collector
by @Draggu in #1318 - Bump cairo by @piotmag769 in #1319
- Bump gix from 0.62.0 to 0.63.0 by @dependabot in #1320
- Add
group_id
to target props by @maciektr in #1311 - Allow multiple targets on single Compilation unit component by @maciektr in #1312
- Resolve to grouped compilation units by @maciektr in #1313
- Bump cairo by @piotmag769 in #1321
- Bump the non-critical group with 3 updates by @dependabot in #1322
- fix: propose consistent usage of debug from tracing by @glihm in #1324
- Update MAINTAINING.md by @mkaput in #1327
- Update CODEOWNERS by @maciektr in #1325
- Add derives for
Severity
andDiagnostics
by @Draggu in #1323 - Increase timeout on flock test by @maciektr in #1331
- Ignore
dependencies
example project from build tests by @maciektr in #1330 - Update Cairo by @maciektr in #1329
- Run Cargo update by @maciektr in #1333
- Do not enable cfg(test) in main package for integration tests by @maciektr in #1334
- Make Scarb smarter when searching for Cargo binary by @mkaput in #1338
- [scarb-doc] Add initial crate structures by @drknzz in #1309
- Bump cairo by @piotmag769 in #1340
- Quick update of ARCHITECTURE.md by @maciektr in #1339
- Print Cargo logs with SpinnerBar::println by @maciektr in #1337
- Website: Update dependencies by @mkaput in #1342
- Website: Set up our GoatCounter instance by @mkaput in #1343
- Bump the non-critical group with 7 updates by @dependabot in #1346
- Scarb expand initial impl by @maciektr in #1344
- Add target selector by @maciektr in #1347
- Add test cases for expand by @maciektr in #1348
- Update CONTRIBUTING.md by @maciektr in #1355
- Fix clippy errors after Rust update by @maciektr in #1361
- Rename test plugin to
cairo_test
by @maciektr in #1358 - Allow expanding erroneous code by @maciektr in #1356
- Update Cairo by @maciektr in #1360
- Add option to emit expand result to stdout by @maciektr in #1357
- Require explicit dependence on
cairo_test
(i.e.test_plugin
)" by @maciektr in #1359 - Merge tools definition recursively by @maciektr in #1353
- Update Cairo by @maciektr in #1363
- Ignore starknet types in dependabot rules, update deps by @maciektr in #1366
- Bump include_dir from 0.7.3 to 0.7.4 in the non-critical group by @dependabot in #1367
- Split TestCompilation into program and metadata by @maciektr in #1362
- Warn if cairo-test plugin is missing by @maciektr in #1364
- Add code mappings to plugin generated code by @maciektr in #1371
- Add cairo-test plugin to Scarb.toml manifest on new by @maciektr in #1372
- Update statements mappings docs by @piotmag769 in #1375
- Pass pkg parent to snforge init by @maciektr in #1374
- Update Cairo by @maciektr in #1389
- Allow main function executable in cairo-run by @maciektr in #1385
- Bump deno_task_shell from 0.16.1 to 0.17.0 by @dependabot in #1392
- Bump the non-critical group with 5 updates by @dependabot in #1391
- Create cairo-run executable plugin by @maciektr in #1387
- Add cairo-run function selection tests by @maciektr in #1388
- Prepare release
2.7.0-rc.0
by @maciektr in #1394
New Contributors
Full Changelog: v2.6.5...v2.7.0-rc.0