Cairo 1.0 — changes, features, release date
Introduction
Cairo 1.0 is not just an iteration over Cairo 0. It is a full rewrite in Rust, whereas Cairo 0 has been written in a pythonic DSL. New Cairo at its core is very similar to Rust. It is meant to be backward compatible with Cairo 0.10 but this is at the bytecode level.
Why such a big change? Cairo 0 had many problems, it was created as StarkWare’s internal tool which wasn’t designed to be released to the public. Cairo 1.0 is an improvement on literally every possible level. Let’s go through them:
Improved syntax and features
- Variables with no revoked references. No
tempvar
orlocal
anymore. Cairo 1.0 is completely abstracting away the non-deterministic read-only memory model of Cairo. Variable allocation is handled by the compiler. - Native boolean expressions and conditions.
- Improved Error handling.
- Libraries for array, dictionary and other collections with easier manipulation
- Algebraic data types like
Option
andResult
Sierra
Cairo 1 compiles first to Sierra and then Sierra Assembly compiles into bytecode. Sierra stands for Safe IntErmdiate RepResentAtion. The benefits of this approach are huge.
Cairo 1 transactions are always provable. In Cairo 0 failed transactions have been not provable so transaction fees couldn’t be collected on them…