Git Product home page Git Product logo

starklings-cairo1's Introduction

STARKLINGS

An interactive tutorial to get you up and running with Cairo and Starknet


Setup and run

Make sure you have Rust and Cargo installed with the default toolchain.
With rustup curl https://sh.rustup.rs -sSf | sh -s

  1. Clone the repo and go in the directory,
    git clone https://github.com/shramee/starklings-cairo1.git && cd starklings-cairo1.
  2. Run cargo run -r --bin starklings, this might take a while the first time.
  3. You should see this intro message, run cargo run -r --bin starklings watch when you are ready!

Start at a specific exercise NEW

To start watch at a specific exercise pass the name of the exercise to watch command. For example, to start at starknet1,

cargo run -r --bin starklings watch starknet1

Welcome message and instructions

starklings - An interactive tutorial to get started with Cairo and Starknet

       _             _    _ _
      | |           | |  | (_)
   ___| |_ __ _ _ __| | _| |_ _ __   __ _ ___
  / __| __/ _` | '__| |/ / | | '_ \ / _` / __|
  \__ \ || (_| | |  |   <| | | | | | (_| \__ \
  |___/\__\__,_|_|  |_|\_\_|_|_| |_|\__, |___/
                                     __/ |
                                    |___/

Thanks for installing starklings!

Is this your first time? Don't worry, starklings is made for beginners! We are
going to teach you a bunch of stuff about StarkNet and Cairo.

Here's how starklings works,

1. To start starklings run `cargo run -r --bin starklings watch`
2. It'll automatically start with the first exercise. Don't get confused by
error message popping up as soon as you run starklings! This is part of the
exercise that you're supposed to solve, so open the exercise file in an editor
and start your detective work!
3. If you're stuck on an exercise, there is a helpful hint you can view by
typing `hint` (in watch mode), or running `cargo run -r --bin starklings hint
exercise_name`.
4. When you have solved the exercise successfully, Remove `// I AM NOT DONE`
comment to move on to the next exercise.
5. If an exercise doesn't make sense to you, please open an issue on GitHub!
(https://github.com/shramee/starklings-cairo1/issues/new).

Got all that? Great! To get started, run `starklings watch` in order to get the
first exercise. Make sure to have your editor open!

VSCode extension & language server

In order to have syntax highlighting and language server features, you will need to install the Cairo Language Server. The instructions available in the Cairo repository

Inspiration

Testing

For Cairo related tests

cargo test cairo

For all tests

cargo test

Contributing

Thanks for your interest in the project. You can fork the repo, create a branch with a descriptive name (maybe the issue number and a word or two to describe it) and submit a pull request.

Adding new exercises

Here's what an exercise looks like,

  1. An exercise is pretty much a single well commented Cairo file.
  2. Exercises are organised into modules and are placed in ./exercises/<module_name>/<exercise_name>.cairo
  3. Exercise accompanies some metadata describing it in ./info.toml
  4. When introducing a concept for the first time, try to start minimally.
  5. Subsequent exercises for the same concept can grow in complexity.

Contributing with a new exercise

  1. Add the exercise file in the ./exercises directory.
  2. Insert information about the exercise in ./info.toml file. For example
    [[exercises]]
    name = "new_exercise"
    path = "exercises/new_module/new_exercise.cairo"
    mode = "test"
    hint = """
    Try the Harlem shake
    """
  3. Run your exercise with starklings run as you write
cargo run -r --bin starklings run new_exercise
  1. Check that the tests pass.
  2. Send your PR!

Updating Rust logic/Cairo version

  1. Test your changes.
  2. Make sure you have solutions to all the exercises in ./solutions directory.
  3. Run cargo run -r --bin starklings compile_solutions to confirm all exercise solutions still compile.
  4. Make your pull request.

starklings-cairo1's People

Contributors

0xchqrles avatar antiyro avatar barretodavid avatar chachaleo avatar clexmond avatar countrycousin avatar devival avatar eckmoule avatar enitrat avatar fakefraud avatar ftupas avatar glihm avatar hollygrimm avatar julienbrs avatar karasakalmt avatar kfastov avatar kongtaoxing avatar lambda-0x avatar printfjoby avatar ptisserand avatar realjohnnytime avatar remedcu avatar shramee avatar sraver avatar tadev0 avatar thelordgiveth avatar trangnv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

starklings-cairo1's Issues

Exercices on primitive types

The different types can be confusing for the user. These exercises will teach him how to convert one type to another, how to use type literals, etc.

I will implement this

Answer provided in first part of exercise options1.cairo

The first part of exercise ask to complete the function body of maybe_icecream(time_of_day: felt) function but it's already complete with good answer !
https://github.com/shramee/starklings-cairo1/blob/main/exercises/options/options1.cairo

Links in the Hints Not working

Most of the links pointing to medium articles which are found if you you run cargo run --bin starklings hint are not working

Speed up starklings run

The running/verification step of a cairo program takes too much time when called by starklings run program.cairo compared to natively call cairo-tester run program.cairo. We need to find a way to make it faster

sum_big_numbers in primitive_types4.cairo

fn sum_big_numbers(x: u8, y: u8) -> u16 {
    x + y
}

I changed the return value, hoping that it would automatically use the correct code path for adding u8 + u8 = u16, but the compiler doesn't seem to understand.

I get that I can first convert x and y to u16 and then sum them, but wouldn't that be inefficient (a waste of memory)? I haven't found a doc on how the uX types are actually mapped to felts and how they work.

Contract interactions

These exercises will teach how to perform interactions with other contracts and libraries on Starknet.

They will cover

  • Contract Dispatcher and Library Dispatchers
  • call_contract syscall

Build fails with nightly rust

But works with stable.

$cd starklings-cairo1/
$cargo run --bin starklings
    Updating crates.io index
    Updating git repository `https://github.com/starkware-libs/cairo`
  Downloaded iana-time-zone v0.1.53
  Downloaded bigdecimal v0.3.0
  Downloaded cc v1.0.79
  Downloaded dirs-sys-next v0.1.2
  Downloaded fixedbitset v0.4.2
  Downloaded inotify-sys v0.1.5
  Downloaded lazy_static v1.4.0
  Downloaded precomputed-hash v0.1.1
  Downloaded phf_shared v0.10.0
  Downloaded lalrpop-util v0.19.8
  Downloaded new_debug_unreachable v1.0.4
  Downloaded siphasher v0.3.10
  Downloaded atty v0.2.14
  Downloaded pico-args v0.4.2
  Downloaded same-file v1.0.6
  Downloaded crunchy v0.2.2
  Downloaded crypto-common v0.1.6
  Downloaded clap_lex v0.3.2
  Downloaded clap_lex v0.2.4
  Downloaded filetime v0.2.20
  Downloaded block-buffer v0.10.4
  Downloaded dirs-next v2.0.0
  Downloaded crypto-mac v0.11.1
  Downloaded rustc_version v0.3.3
  Downloaded cfg-if v1.0.0
  Downloaded walkdir v2.3.2
  Downloaded version_check v0.9.4
  Downloaded rand_chacha v0.3.1
  Downloaded argh v0.1.10
  Downloaded tiny-keccak v2.0.2
  Downloaded cfg-if v0.1.10
  Downloaded semver v0.11.0
  Downloaded scopeguard v1.1.0
  Downloaded strsim v0.10.0
  Downloaded bit-vec v0.6.3
  Downloaded num-integer v0.1.45
  Downloaded rustc_version v0.4.0
  Downloaded autocfg v1.1.0
  Downloaded bitflags v1.3.2
  Downloaded fnv v1.0.7
  Downloaded unicode-ident v1.0.8
  Downloaded crossbeam-deque v0.8.3
  Downloaded convert_case v0.6.0
  Downloaded argh_derive v0.1.10
  Downloaded either v1.8.1
  Downloaded colored v2.0.0
  Downloaded time v0.1.45
  Downloaded ena v0.14.1
  Downloaded digest v0.9.0
  Downloaded cpufeatures v0.2.5
  Downloaded inotify v0.7.1
  Downloaded log v0.4.17
  Downloaded clap_derive v3.2.18
  Downloaded proc-macro-error v1.0.4
  Downloaded iovec v0.1.4
  Downloaded heck v0.3.3
  Downloaded proc-macro-error-attr v1.0.4
  Downloaded bincode v1.3.3
  Downloaded digest v0.10.6
  Downloaded console v0.15.5
  Downloaded crossbeam-utils v0.8.15
  Downloaded parking_lot v0.12.1
  Downloaded crypto-bigint v0.3.2
  Downloaded clap_derive v4.1.8
  Downloaded num-traits v0.2.15
  Downloaded term v0.7.0
  Downloaded ucd-trie v0.1.5
  Downloaded crossbeam-epoch v0.9.14
  Downloaded env_logger v0.9.3
  Downloaded diff v0.1.13
  Downloaded indicatif v0.16.2
  Downloaded derivative v2.2.0
  Downloaded memchr v2.5.0
  Downloaded rand_core v0.6.4
  Downloaded memoffset v0.8.0
  Downloaded block-buffer v0.9.0
  Downloaded heck v0.4.1
  Downloaded rand v0.8.5
  Downloaded lock_api v0.4.9
  Downloaded hashbrown v0.12.3
  Downloaded xshell-macros v0.2.3
  Downloaded rawpointer v0.2.1
  Downloaded proc-macro2 v1.0.51
  Downloaded opaque-debug v0.3.0
  Downloaded mimalloc v0.1.34
  Downloaded itertools v0.10.5
  Downloaded num-bigint v0.4.3
  Downloaded aho-corasick v0.7.20
  Downloaded unicode-xid v0.2.4
  Downloaded crossbeam-channel v0.5.7
  Downloaded pretty_assertions v1.3.0
  Downloaded mio v0.6.23
  Downloaded number_prefix v0.4.0
  Downloaded itoa v1.0.6
  Downloaded keccak v0.1.3
  Downloaded home v0.5.4
  Downloaded chrono v0.4.23
  Downloaded clap v4.1.8
  Downloaded clap v3.2.23
  Downloaded regex v1.7.1
  Downloaded lalrpop v0.19.8
  Downloaded zeroize_derive v1.3.3
  Downloaded oorandom v11.1.3
  Downloaded instant v0.1.12
  Downloaded linux-raw-sys v0.1.4
  Downloaded utf8-width v0.1.6
  Downloaded libmimalloc-sys v0.1.30
  Downloaded is-terminal v0.4.4
  Downloaded id-arena v2.2.1
  Downloaded indoc v1.0.9
  Downloaded io-lifetimes v1.0.6
  Downloaded cairo-felt v0.1.3
  Downloaded argh_shared v0.1.10
  Downloaded bit-set v0.5.3
  Downloaded ark-ff-asm v0.4.1
  Downloaded ark-serialize v0.3.0
  Downloaded ark-ff-macros v0.4.1
  Downloaded ark-ff-asm v0.3.0
  Downloaded assert_matches v1.5.0
  Downloaded ark-ff-macros v0.3.0
  Downloaded ark-serialize v0.4.1
  Downloaded ark-std v0.3.0
  Downloaded ascii-canvas v3.0.0
  Downloaded slab v0.4.8
  Downloaded serde_bytes v0.11.9
  Downloaded const-fnv1a-hash v1.1.0
  Downloaded ark-std v0.4.0
  Downloaded semver-parser v0.10.2
  Downloaded ark-ff v0.3.0
  Downloaded num-traits v0.1.43
  Downloaded mio-extras v2.0.6
  Downloaded sha2 v0.9.9
  Downloaded sha2 v0.10.6
  Downloaded thiserror v1.0.39
  Downloaded lazycell v1.3.0
  Downloaded termcolor v1.2.0
  Downloaded rustc-hash v1.1.0
  Downloaded yansi v0.5.1
  Downloaded os_str_bytes v6.4.1
  Downloaded humantime v2.1.0
  Downloaded synstructure v0.12.6
  Downloaded percent-encoding v2.2.0
  Downloaded unescaper v0.1.1
  Downloaded hmac v0.11.0
  Downloaded subtle v2.4.1
  Downloaded html-escape v0.2.13
  Downloaded num_cpus v1.15.0
  Downloaded generic-array v0.14.6
  Downloaded unicode-width v0.1.10
  Downloaded ark-ff v0.4.1
  Downloaded string_cache v0.8.7
  Downloaded getrandom v0.2.8
  Downloaded ppv-lite86 v0.2.17
  Downloaded zeroize v1.5.7
  Downloaded quote v1.0.23
  Downloaded xshell v0.2.3
  Downloaded path-clean v0.1.0
  Downloaded smol_str v0.1.24
  Downloaded starknet-crypto-codegen v0.1.0
  Downloaded starknet-ff v0.2.0
  Downloaded starknet-crypto v0.2.0
  Downloaded rfc6979 v0.1.0
  Downloaded starknet-curve v0.1.0
  Downloaded glob v0.3.1
  Downloaded relative-path v1.8.0
  Downloaded hex v0.4.3
  Downloaded matrixmultiply v0.2.4
  Downloaded smallvec v1.10.0
  Downloaded parking_lot_core v0.8.6
  Downloaded parking_lot_core v0.9.7
  Downloaded parking_lot v0.11.2
  Downloaded typenum v1.16.0
  Downloaded num-complex v0.2.4
  Downloaded salsa-macros v0.16.0
  Downloaded ryu v1.0.13
  Downloaded cairo-vm v0.1.3
  Downloaded once_cell v1.17.1
  Downloaded paste v1.0.12
  Downloaded good_lp v1.3.3
  Downloaded genco-macros v0.17.3
  Downloaded net2 v0.2.38
  Downloaded indexmap v1.9.2
  Downloaded thiserror-impl v1.0.39
  Downloaded toml v0.5.11
  Downloaded textwrap v0.16.0
  Downloaded serde_derive v1.0.154
  Downloaded notify v4.0.17
  Downloaded rayon-core v1.11.0
  Downloaded semver v1.0.16
  Downloaded anyhow v1.0.69
  Downloaded toml v0.4.10
  Downloaded minilp v0.2.2
  Downloaded parse-hyperlinks v0.23.4
  Downloaded genco v0.17.3
  Downloaded unicode-segmentation v1.10.1
  Downloaded sprs v0.7.1
  Downloaded minimal-lexical v0.2.1
  Downloaded serde v1.0.154
  Downloaded pest v2.5.6
  Downloaded nom v7.1.3
  Downloaded serde_json v1.0.94
  Downloaded rayon v0.9.0
  Downloaded petgraph v0.6.3
  Downloaded ndarray v0.13.1
  Downloaded syn v1.0.109
  Downloaded rustix v0.36.9
  Downloaded regex-syntax v0.6.28
  Downloaded salsa v0.16.1
  Downloaded libc v0.2.139
  Downloaded sha3 v0.10.6
  Downloaded 210 crates (12.6 MB) in 4.38s (largest was `libmimalloc-sys` at 1.1 MB)
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.51
   Compiling cfg-if v1.0.0
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.23
   Compiling syn v1.0.109
   Compiling libc v0.2.139
   Compiling version_check v0.9.4
   Compiling typenum v1.16.0
   Compiling serde_derive v1.0.154
   Compiling serde v1.0.154
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling memchr v2.5.0
   Compiling thiserror v1.0.39
   Compiling indexmap v1.9.2
   Compiling generic-array v0.14.6
   Compiling log v0.4.17
   Compiling hashbrown v0.12.3
   Compiling scopeguard v1.1.0
   Compiling aho-corasick v0.7.20
   Compiling regex-syntax v0.6.28
   Compiling smallvec v1.10.0
   Compiling either v1.8.1
   Compiling unicode-xid v0.2.4
   Compiling lock_api v0.4.9
   Compiling atty v0.2.14
   Compiling termcolor v1.2.0
   Compiling crossbeam-utils v0.8.15
   Compiling num-bigint v0.4.3
   Compiling itertools v0.10.5
   Compiling time v0.1.45
   Compiling iana-time-zone v0.1.53
   Compiling humantime v2.1.0
   Compiling chrono v0.4.23
   Compiling unicode-segmentation v1.10.1
   Compiling ppv-lite86 v0.2.17
   Compiling parking_lot_core v0.8.6
   Compiling regex v1.7.1
   Compiling instant v0.1.12
   Compiling heck v0.3.3
   Compiling oorandom v11.1.3
   Compiling rustc-hash v1.1.0
   Compiling getrandom v0.2.8
   Compiling parking_lot v0.11.2
   Compiling ucd-trie v0.1.5
   Compiling rand_core v0.6.4
   Compiling diff v0.1.13
   Compiling once_cell v1.17.1
   Compiling env_logger v0.9.3
   Compiling synstructure v0.12.6
   Compiling lazy_static v1.4.0
   Compiling parking_lot_core v0.9.7
   Compiling cairo-lang-utils v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling dirs-sys-next v0.1.2
   Compiling cairo-lang-debug v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling crunchy v0.2.2
   Compiling digest v0.10.6
   Compiling dirs-next v2.0.0
   Compiling tiny-keccak v2.0.2
   Compiling path-clean v0.1.0
   Compiling subtle v2.4.1
   Compiling siphasher v0.3.10
   Compiling paste v1.0.12
   Compiling parking_lot v0.12.1
   Compiling phf_shared v0.10.0
   Compiling term v0.7.0
   Compiling rand_chacha v0.3.1
   Compiling num-complex v0.2.4
   Compiling proc-macro-error-attr v1.0.4
   Compiling fixedbitset v0.4.2
   Compiling bit-vec v0.6.3
   Compiling new_debug_unreachable v1.0.4
   Compiling precomputed-hash v0.1.1
   Compiling petgraph v0.6.3
   Compiling string_cache v0.8.7
   Compiling bit-set v0.5.3
   Compiling ascii-canvas v3.0.0
   Compiling rand v0.8.5
   Compiling ena v0.14.1
   Compiling lalrpop-util v0.19.8
   Compiling proc-macro-error v1.0.4
   Compiling thiserror-impl v1.0.39
   Compiling derivative v2.2.0
   Compiling salsa-macros v0.16.0
   Compiling zeroize_derive v1.3.3
   Compiling genco-macros v0.17.3
   Compiling bitflags v1.3.2
   Compiling ndarray v0.13.1
   Compiling rawpointer v0.2.1
   Compiling pico-args v0.4.2
   Compiling relative-path v1.8.0
   Compiling xshell-macros v0.2.3
   Compiling lalrpop v0.19.8
   Compiling matrixmultiply v0.2.4
   Compiling genco v0.17.3
   Compiling xshell v0.2.3
   Compiling salsa v0.16.1
   Compiling pest v2.5.6
   Compiling ark-ff-macros v0.3.0
   Compiling ark-ff-asm v0.3.0
   Compiling semver-parser v0.10.2
   Compiling digest v0.9.0
   Compiling keccak v0.1.3
   Compiling sha3 v0.10.6
   Compiling semver v0.11.0
   Compiling rustc_version v0.3.3
   Compiling cairo-lang-syntax-codegen v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling zeroize v1.5.7
   Compiling ark-ff v0.3.0
   Compiling colored v2.0.0
   Compiling num-traits v0.1.43
   Compiling io-lifetimes v1.0.6
   Compiling heck v0.4.1
   Compiling os_str_bytes v6.4.1
   Compiling ark-std v0.3.0
   Compiling convert_case v0.6.0
   Compiling const-fnv1a-hash v1.1.0
   Compiling rustix v0.36.9
   Compiling hex v0.4.3
   Compiling yansi v0.5.1
   Compiling pretty_assertions v1.3.0
   Compiling ark-serialize v0.3.0
   Compiling unescaper v0.1.1
   Compiling cairo-lang-proc-macros v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling linux-raw-sys v0.1.4
   Compiling indoc v1.0.9
   Compiling id-arena v2.2.1
   Compiling sprs v0.7.1
   Compiling crypto-bigint v0.3.2
   Compiling bigdecimal v0.3.0
   Compiling minilp v0.2.2
   Compiling memoffset v0.8.0
   Compiling smol_str v0.1.24
   Compiling cc v1.0.79
   Compiling anyhow v1.0.69
   Compiling cairo-lang-filesystem v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling good_lp v1.3.3
   Compiling cairo-lang-syntax v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling cairo-lang-diagnostics v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling libmimalloc-sys v0.1.30
   Compiling cairo-lang-eq-solver v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling is-terminal v0.4.4
   Compiling clap_lex v0.3.2
   Compiling clap_derive v4.1.8
   Compiling crypto-mac v0.11.1
   Compiling slab v0.4.8
   Compiling crossbeam-epoch v0.9.14
   Compiling cpufeatures v0.2.5
   Compiling serde_json v1.0.94
   Compiling hmac v0.11.0
   Compiling cairo-felt v0.1.3
   Compiling toml v0.4.10
   Compiling block-buffer v0.9.0
   Compiling ryu v1.0.13
   Compiling itoa v1.0.6
   Compiling opaque-debug v0.3.0
   Compiling cfg-if v0.1.10
   Compiling minimal-lexical v0.2.1
   Compiling utf8-width v0.1.6
   Compiling html-escape v0.2.13
   Compiling nom v7.1.3
   Compiling clap v4.1.8
   Compiling cairo-lang-project v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling net2 v0.2.38
   Compiling sha2 v0.9.9
   Compiling cairo-lang-parser v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling cairo-lang-defs v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling starknet-ff v0.2.0
   Compiling starknet-curve v0.1.0
   Compiling starknet-crypto-codegen v0.1.0
   Compiling rfc6979 v0.1.0
   Compiling cairo-lang-semantic v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling cairo-lang-casm v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling clap_lex v0.2.4
   Compiling clap_derive v3.2.18
   Compiling ark-std v0.4.0
   Compiling cairo-lang-sierra v1.0.0-alpha.4 (https://github.com/starkware-libs/cairo?rev=v1.0.0-alpha.4#b0abcbaa)
   Compiling iovec v0.1.4
   Compiling rayon-core v1.11.0
   Compiling percent-encoding v2.2.0
   Compiling textwrap v0.16.0
   Compiling assert_matches v1.5.0
   Compiling parse-hyperlinks v0.23.4
   Compiling starknet-crypto v0.2.0
   Compiling mio v0.6.23
   Compiling ark-serialize v0.4.1
   Compiling crossbeam-deque v0.8.3
   Compiling mimalloc v0.1.34
   Compiling sha2 v0.10.6
   Compiling serde_bytes v0.11.9
   Compiling bincode v1.3.3
error: internal compiler error: /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/compiler/rustc_infer/src/infer/outlives/env.rs:145:26: add_outlives_bounds: unexpected regions

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7ff2f896750a - std::backtrace_rs::backtrace::libunwind::trace::hca5b94e57c77ccf5
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ff2f896750a - std::backtrace_rs::backtrace::trace_unsynchronized::h5b5fce74d82f8778
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff2f896750a - std::sys_common::backtrace::_print_fmt::ha47e7aaa1d2225ec
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ff2f896750a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha1aaba92be89501b
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff2f89cab3e - core::fmt::write::h750a8e721825859f
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/core/src/fmt/mod.rs:1232:17
   5:     0x7ff2f895a375 - std::io::Write::write_fmt::hbf6015e32697f7ba
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/io/mod.rs:1684:15
   6:     0x7ff2f89672d5 - std::sys_common::backtrace::_print::h301c6b6cac7c0a3a
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7ff2f89672d5 - std::sys_common::backtrace::print::h7f921f37b0542aab
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7ff2f896a04f - std::panicking::default_hook::{{closure}}::ha1e8e5c596b5be71
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/panicking.rs:271:22
   9:     0x7ff2f8969d8b - std::panicking::default_hook::hb0497d64ba7aeb9b
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/panicking.rs:290:9
  10:     0x7ff2fbc65475 - rustc_driver_impl[190cb2184ae08abb]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7ff2f896a88d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5fe0c368b54c8ed7
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/alloc/src/boxed.rs:2002:9
  12:     0x7ff2f896a88d - std::panicking::rust_panic_with_hook::hde905c542c1ea61a
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/panicking.rs:696:13
  13:     0x7ff2fc1ca161 - std[75e4c6f671155ce4]::panicking::begin_panic::<rustc_errors[bdf389fe3f70d25b]::ExplicitBug>::{closure#0}
  14:     0x7ff2fc1c5876 - std[75e4c6f671155ce4]::sys_common::backtrace::__rust_end_short_backtrace::<std[75e4c6f671155ce4]::panicking::begin_panic<rustc_errors[bdf389fe3f70d25b]::ExplicitBug>::{closure#0}, !>
  15:     0x7ff2fc1c26e6 - std[75e4c6f671155ce4]::panicking::begin_panic::<rustc_errors[bdf389fe3f70d25b]::ExplicitBug>
  16:     0x7ff2fc217606 - std[75e4c6f671155ce4]::panic::panic_any::<rustc_errors[bdf389fe3f70d25b]::ExplicitBug>
  17:     0x7ff2fc213e26 - <rustc_errors[bdf389fe3f70d25b]::HandlerInner>::bug::<&alloc[dd66e831cb8c4684]::string::String>
  18:     0x7ff2fc213af0 - <rustc_errors[bdf389fe3f70d25b]::Handler>::bug::<&alloc[dd66e831cb8c4684]::string::String>
  19:     0x7ff2fc1fff9b - rustc_middle[d8dcb3e1f9b6a1d3]::util::bug::opt_span_bug_fmt::<rustc_span[e39f9d1da20fb520]::span_encoding::Span>::{closure#0}
  20:     0x7ff2fc1fe8ea - rustc_middle[d8dcb3e1f9b6a1d3]::ty::context::tls::with_opt::<rustc_middle[d8dcb3e1f9b6a1d3]::util::bug::opt_span_bug_fmt<rustc_span[e39f9d1da20fb520]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7ff2fc1fe8b6 - rustc_middle[d8dcb3e1f9b6a1d3]::ty::context::tls::with_context_opt::<rustc_middle[d8dcb3e1f9b6a1d3]::ty::context::tls::with_opt<rustc_middle[d8dcb3e1f9b6a1d3]::util::bug::opt_span_bug_fmt<rustc_span[e39f9d1da20fb520]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7ff2fc1ffee6 - rustc_middle[d8dcb3e1f9b6a1d3]::util::bug::opt_span_bug_fmt::<rustc_span[e39f9d1da20fb520]::span_encoding::Span>
  23:     0x7ff2fa2c34b3 - rustc_middle[d8dcb3e1f9b6a1d3]::util::bug::bug_fmt
  24:     0x7ff2fa480b45 - <rustc_infer[4cb97a789990ae8c]::infer::outlives::env::OutlivesEnvironment>::with_bounds::<core[86d79cd3dd753e85]::iter::adapters::flatten::Flatten<core[86d79cd3dd753e85]::iter::adapters::map::Map<indexmap[6bbb46ee84024ff5]::set::IntoIter<rustc_middle[d8dcb3e1f9b6a1d3]::ty::Ty>, <rustc_infer[4cb97a789990ae8c]::infer::InferCtxt as rustc_trait_selection[834a42ea12cf8990]::traits::outlives_bounds::InferCtxtExt>::implied_bounds_tys::{closure#0}>>>
  25:     0x7ff2fa77d580 - rustc_hir_analysis[60e36e2803dc18bc]::check::compare_impl_item::compare_method_predicate_entailment
  26:     0x7ff2fa7776bb - rustc_hir_analysis[60e36e2803dc18bc]::check::compare_impl_item::compare_impl_method
  27:     0x7ff2fa76ff1c - rustc_hir_analysis[60e36e2803dc18bc]::check::check::check_impl_items_against_trait
  28:     0x7ff2fa7672b8 - rustc_hir_analysis[60e36e2803dc18bc]::check::check::check_mod_item_types
  29:     0x7ff2fb2982be - rustc_query_system[1a66d6a5882ef44d]::query::plumbing::try_execute_query::<rustc_query_impl[9c3c364151da071f]::queries::check_mod_item_types, rustc_query_impl[9c3c364151da071f]::plumbing::QueryCtxt>
  30:     0x7ff2fb297e43 - <rustc_query_impl[9c3c364151da071f]::Queries as rustc_middle[d8dcb3e1f9b6a1d3]::ty::query::QueryEngine>::check_mod_item_types
  31:     0x7ff2fb30927c - <rustc_middle[d8dcb3e1f9b6a1d3]::hir::map::Map>::for_each_module::<rustc_hir_analysis[60e36e2803dc18bc]::check_crate::{closure#6}::{closure#0}>
  32:     0x7ff2f9e6e6b8 - rustc_hir_analysis[60e36e2803dc18bc]::check_crate
  33:     0x7ff2f9e65d25 - rustc_interface[c60781b202b529bb]::passes::analysis
  34:     0x7ff2fb473b9c - rustc_query_system[1a66d6a5882ef44d]::query::plumbing::try_execute_query::<rustc_query_impl[9c3c364151da071f]::queries::analysis, rustc_query_impl[9c3c364151da071f]::plumbing::QueryCtxt>
  35:     0x7ff2fb473890 - <rustc_query_impl[9c3c364151da071f]::Queries as rustc_middle[d8dcb3e1f9b6a1d3]::ty::query::QueryEngine>::analysis
  36:     0x7ff2fb29d899 - <rustc_middle[d8dcb3e1f9b6a1d3]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[190cb2184ae08abb]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>
  37:     0x7ff2fae29dc8 - rustc_span[e39f9d1da20fb520]::with_source_map::<core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>, rustc_interface[c60781b202b529bb]::interface::run_compiler<core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>, rustc_driver_impl[190cb2184ae08abb]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  38:     0x7ff2fae218e0 - <scoped_tls[3baa4ec3dd04ff72]::ScopedKey<rustc_span[e39f9d1da20fb520]::SessionGlobals>>::set::<rustc_interface[c60781b202b529bb]::interface::run_compiler<core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>, rustc_driver_impl[190cb2184ae08abb]::run_compiler::{closure#1}>::{closure#0}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>
  39:     0x7ff2fae20fc2 - std[75e4c6f671155ce4]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c60781b202b529bb]::util::run_in_thread_pool_with_globals<rustc_interface[c60781b202b529bb]::interface::run_compiler<core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>, rustc_driver_impl[190cb2184ae08abb]::run_compiler::{closure#1}>::{closure#0}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>
  40:     0x7ff2fae20d6a - <<std[75e4c6f671155ce4]::thread::Builder>::spawn_unchecked_<rustc_interface[c60781b202b529bb]::util::run_in_thread_pool_with_globals<rustc_interface[c60781b202b529bb]::interface::run_compiler<core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>, rustc_driver_impl[190cb2184ae08abb]::run_compiler::{closure#1}>::{closure#0}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[86d79cd3dd753e85]::result::Result<(), rustc_span[e39f9d1da20fb520]::ErrorGuaranteed>>::{closure#1} as core[86d79cd3dd753e85]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7ff2f8974783 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3341c80cf784afb0
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/alloc/src/boxed.rs:1988:9
  42:     0x7ff2f8974783 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6a4397435c8c4587
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/alloc/src/boxed.rs:1988:9
  43:     0x7ff2f8974783 - std::sys::unix::thread::Thread::new::thread_start::h4d87276efd9893f6
                               at /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/library/std/src/sys/unix/thread.rs:108:17
   Compiling ark-ff-asm v0.4.1
   Compiling ark-ff-macros v0.4.1
  44:     0x7ff2f8690402 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  45:     0x7ff2f871f590 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  46:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.70.0-nightly (ab654863c 2023-03-15) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_mod_item_types] checking item types in module `de`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `bincode` (lib)
warning: build failed, waiting for other jobs to finish...

Exercices with `if` statements

We should cover if statements in exercises, something simple just to get the starkling familiar with the syntax

I will take this one

Implement test runner

Starklings needs to be able to run Cairo tests for more complex exercises. I'll take it

Excercise structs1 - types in hint

Currently hint states:

#[derive(Copy, Drop)]
struct Person {
    name: felt,
    age: felt,
}

Type of members of struct Person should be updated to felt252.

Describes the expected results for each exercise

For example, in the exercise options3.cairo what is the expected result.

I think it is Alice A, B, C, A Bob A, No grade, B, C, No grade

but my result is:
Alice , Bob, A, A, B, No grade, C, B, A, C, No grade

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.