Welcome to the release notes for Scarb v2.12.0-rc.2!
Incremental compilation
This release of Scarb brings incremental compilation support to the Cairo ecosystem.
Incremental compilation means, that Scarb can now cache some steps of your compilation process and reuse this cache in subsequent builds. Hence after initial build, following builds should complete faster. If you build your Scarb project now, you can notice two new directories in the target directory - incremental
and .fingerprint
- which contain the caches. This means, that to use the cache, you need to preserve the target
directory between the runs. The cache is saved on a package level and it will only be used, if a whole package did not change.
Oracles (experimental)
An oracle is an external process (like a script, binary, or web service) that exposes custom logic or data to a Cairo program. You use it to perform tasks the Cairo VM can't, such as accessing real-world data or executing complex, non-provable computations. This Scarb release brings initial support for oracles in scarb execute
with a new --experimental-oracles
flag.
To use oracles, you need to add a dependency on the oracle package:
[dependencies]
oracle = "0.1.0-dev.4"
Then, in your Cairo program, write a module that wraps the oracle in an idiomatic API:
mod my_oracle {
pub fn funny_hash(x: u64) -> oracle::Result<u64> {
oracle::invoke("stdio:cargo -q run --manifest-path my_oracle/Cargo.toml", 'funny_hash', (x,))
}
}
#[executable]
fn main() {
let x = my_oracle::funny_hash(42);
println!("Funny hash of 42 is: {:?}", x);
}
We also build a Rust crate that eases implementing oracles in this language. We plan to build similar SDKs for other languages depending on community demands.
use cairo_oracle_server::Oracle;
use std::process::ExitCode;
fn main() -> ExitCode {
Oracle::new()
.provide("funny_hash", |value: u64| {
Ok((value.rotate_left(13) ^ 0x517cc1b727220a95).rotate_right(7) + value)
})
.run()
}
To run this executable, you must now explicitly enable oracle support. We plan to remove this flag once oracles will become stabilised.
scarb execute --experimental-oracles
You can read more about oracles in the oracle package documentation and in Scarb docs. We will be happy to hear feedback on this feature and see what ideas this enables!
Cairo Version
This version of Scarb comes with Cairo v2.12.0-rc.2
.
What's Changed
- implement example oracle to be used in future tests by @mkaput in #2380
- Fix incremental cache file name, update test case by @maciektr in #2371
- Include component dependencies in fingerprint digest by @maciektr in #2340
- fix selector short string parsing by @mkaput in #2387
- Update CI snippets by @mkaput in #2393
- Bump deno_task_shell from 0.24.0 to 0.25.1 by @dependabot[bot] in #2398
- Bump the non-critical group with 4 updates by @dependabot[bot] in #2400
- Bump starknet-types-core from 0.1.8 to 0.1.9 by @dependabot[bot] in #2399
- add minimal JSON-RPC types implementation by @mkaput in #2386
- implement
StdioJsonRpcConnection
by @mkaput in #2381 - make
oracle_json_rpc_smoke_test
work on Windows by @mkaput in #2395 - use
shell-words
crate to parse connection strings and in place of custom shlex join by @mkaput in #2394 - pipe stderr to logs in
StdioJsonRpcConnection
by @mkaput in #2396 - Calculate source checksums in fingerprint by @maciektr in #2369
- Disallow calling profile
execute
orprove
by @maciektr in #2407 - pipe oracle stderr as debug level instead of trace by @mkaput in #2408
- Prepare
scarb-ui
release0.1.6
by @maciektr in #2389 - Fix flaky test cases by @maciektr in #2410
- fix oracle result encoding by @mkaput in #2409
- Fix variable interpolation in docs by @maciektr in #2412
- Authenticate github API requests in website CI by @maciektr in #2413
- Fix docs: elvish completions by @DelevoXDG in #2414
- Only lookup full path markers when any declared by macros by @maciektr in #2420
- Do not run diagnostics reporter check on all crates in test contract compilation by @maciektr in #2418
- Add dependency cfg_set to fingerprint id by @maciektr in #2419
- Warn on compiler config specified in ws member manifest by @maciektr in #2411
- Add docs for patch and features by @maciektr in #2417
- Include all component deps in fingerprint id by @maciektr in #2426
- Bump dependencies by @maciektr in #2430
Full Changelog: v2.12.0-rc.1...v2.12.0-rc.2