Skip to content

Commit

Permalink
Merge branch 'main' into add-ensure_no_std-to-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand committed Jun 15, 2023
2 parents b18db22 + 80dd475 commit 6629e4f
Show file tree
Hide file tree
Showing 24 changed files with 1,137 additions and 1,315 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ bench/results
cairo-rs-env/*
cairo-rs-pypy-env/*
cairo/

ensure-no_std/Cargo.lock
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

#### Upcoming Changes

* perf: accumulate `min` and `max` instruction offsets during run to speed up range check [#1080](https://github.com/lambdaclass/cairo-rs/pull/)
BREAKING: `Cairo_runner::get_perm_range_check_limits` no longer returns an error when called without trace enabled, as it no longer depends on it

* perf: process reference list on `Program` creation only [#1214](https://github.com/lambdaclass/cairo-rs/pull/1214)
Also keep them in a `Vec<_>` instead of a `HashMap<_, _>` since it will be continuous anyway.
BREAKING:
* `HintProcessor::compile_hint` now receies a `&[HintReference]` rather than `&HashMap<usize, HintReference>`
* Public `CairoRunner::get_reference_list` has been removed

#### [0.5.2] - 2023-6-12

* BREAKING: Compute `ExecutionResources.n_steps` without requiring trace [#1222](https://github.com/lambdaclass/cairo-rs/pull/1222)
Expand All @@ -20,7 +29,9 @@

* move the vm in it's own directory and crate, different from the workspace

* add a `ensure_no_std` crate that will be used by the CI to check that new changes are not reverting `no_std` support
* add a `ensure-no_std` crate that will be used by the CI to check that new changes are not reverting `no_std` support

* replace the use of `num-prime::is_prime` by a custom implementation, therefore restoring `no_std` compatibility

#### [0.5.1] - 2023-6-7

Expand Down
63 changes: 12 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
"hint_accountant",
"./deps/parse-hyperlinks",
]
exclude = ["ensure_no_std"]
exclude = ["ensure-no_std"]

[workspace.dependencies]
mimalloc = { version = "0.1.29", default-features = false }
Expand All @@ -17,12 +17,6 @@ num-bigint = { version = "0.4", default-features = false, features = [
rand = { version = "0.8.3", features = ["small_rng"], default-features = false }
num-traits = { version = "0.2", default-features = false }
num-integer = { version = "0.1.45", default-features = false }
num-prime = { git = " https://github.com/tdelabro/num-prime.git", rev = "70bfd81292929d694cadff82f43ba223df9225f1", default-features = false, features = [
"big-int",
] }
original-num-prime = { package = "num-prime", version = "0.4.3", default-features = false, features = [
"big-int",
] }
serde = { version = "1.0", features = ["derive"], default-features = false }
serde_bytes = { version = "0.11.9", default-features = false, features = [
"alloc",
Expand All @@ -48,9 +42,7 @@ nom = { version = "7", default-features = false }
sha2 = { version = "0.10.2", features = ["compress"], default-features = false }
generic-array = { version = "0.14.6", default-features = false }
keccak = { version = "0.1.2", default-features = false }
hashbrown = { version = "0.13.2", features = [
"serde",
] }
hashbrown = { version = "0.13.2", features = ["serde"] }
anyhow = { version = "1.0.69", default-features = false }
thiserror = { version = "1.0.32", default-features = false }
thiserror-no-std = { version = "2.0.2", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions bench/criterion_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn parse_program(c: &mut Criterion) {
//Picked the biggest one at the time of writing
let program = include_bytes!("../cairo_programs/benchmarks/keccak_integration_benchmark.json");
c.bench_function("parse program", |b| {
b.iter(|| {
b.iter_with_large_drop(|| {
_ = Program::from_bytes(black_box(program.as_slice()), black_box(Some("main")))
.unwrap();
})
Expand All @@ -29,7 +29,7 @@ fn build_many_runners(c: &mut Criterion) {
let program = include_bytes!("../cairo_programs/benchmarks/keccak_integration_benchmark.json");
let program = Program::from_bytes(program.as_slice(), Some("main")).unwrap();
c.bench_function("build runner", |b| {
b.iter(|| {
b.iter_with_large_drop(|| {
_ = black_box(
CairoRunner::new(
black_box(&program),
Expand Down
9 changes: 5 additions & 4 deletions bench/iai_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use iai_callgrind::{black_box, main};
use core::hint::black_box;
use iai_callgrind::main;

use cairo_vm::{
types::program::Program,
Expand All @@ -18,7 +19,7 @@ fn parse_program() {
let program = include_bytes!("../cairo_programs/benchmarks/keccak_integration_benchmark.json");
let program =
Program::from_bytes(black_box(program.as_slice()), black_box(Some("main"))).unwrap();
let _ = black_box(program);
core::mem::drop(black_box(program));
}

#[export_name = "helper::parse_program"]
Expand All @@ -33,7 +34,7 @@ fn parse_program_helper() -> Program {
fn build_runner() {
let program = parse_program_helper();
let runner = CairoRunner::new(black_box(&program), "starknet_with_keccak", false).unwrap();
let _ = black_box(runner);
core::mem::drop(black_box(runner));
}

#[export_name = "helper::build_runner"]
Expand All @@ -54,6 +55,6 @@ fn load_program_data() {
}

main!(
callgrind_args = "toggle-collect=helper::*";
callgrind_args = "toggle-collect=helper::*,core::mem::drop";
functions = parse_program, build_runner, load_program_data
);
File renamed without changes.
2 changes: 1 addition & 1 deletion ensure_no_std/Cargo.toml → ensure-no_std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ensure_no_std"
name = "ensure-no_std"
version = "0.1.0"
edition = "2021"

Expand Down
5 changes: 2 additions & 3 deletions ensure_no_std/src/main.rs → ensure-no_std/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_std]
#![no_main]
#![allow(unused_imports)]

use core::panic::PanicInfo;

Expand All @@ -18,5 +17,5 @@ pub extern "C" fn _start() -> ! {
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

use cairo_felt;
use cairo_vm;
#[allow(unused_imports)]
use {cairo_felt, cairo_vm};
Loading

0 comments on commit 6629e4f

Please sign in to comment.