github software-mansion/scarb v2.12.0-rc.2

latest releases: cairo-lang-macro/v0.2.1, cairo-lang-macro-attributes/v0.2.1, v2.12.1...
pre-releaseone month ago

Cairo release notes ➡️

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

Full Changelog: v2.12.0-rc.1...v2.12.0-rc.2

Don't miss a new scarb release

NewReleases is sending notifications on new releases.