Skip to content

Commit

Permalink
Update to latest Cairo version
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmilson committed Oct 14, 2024
1 parent d54e719 commit a7f7f68
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cairo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "nightly-2024-06-01"
scarb-version: "nightly-2024-08-31"
- run: scarb fmt --check
- run: scarb test

Expand Down
3 changes: 2 additions & 1 deletion stwo_cairo_verifier/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
scarb nightly-2024-06-15
scarb nightly-2024-08-31
starknet-foundry 0.30.0
8 changes: 6 additions & 2 deletions stwo_cairo_verifier/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[package]
name = "stwo_cairo_verifier"
version = "0.1.0"
edition = "2023_11"
edition = "2024_07"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html
[lib]
casm = true

[dependencies]

[dev-dependencies]
cairo_test = "2.8.0"
4 changes: 2 additions & 2 deletions stwo_cairo_verifier/src/circle.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub const CIRCLE_ORDER_BIT_MASK: u32 = 0x7fffffff;
pub const U32_BIT_MASK: u64 = 0xffffffff;

/// A point on the complex circle. Treated as an additive group.
#[derive(Drop, Copy, Debug, PartialEq, Eq)]
#[derive(Drop, Copy, Debug, PartialEq)]
pub struct CirclePoint<F> {
pub x: F,
pub y: F
Expand Down Expand Up @@ -106,7 +106,7 @@ pub impl ComplexConjugateImpl of ComplexConjugateTrait {
}

/// Represents the coset `initial + <step>`.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Drop)]
#[derive(Copy, Clone, Debug, PartialEq, Drop)]
pub struct Coset {
// This is an index in the range [0, 2^31)
pub initial_index: usize,
Expand Down
2 changes: 1 addition & 1 deletion stwo_cairo_verifier/src/fields/cm31.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::num::traits::{One, Zero};
use super::m31::{M31, m31, M31Trait};

#[derive(Copy, Drop, Debug, PartialEq, Eq)]
#[derive(Copy, Drop, Debug, PartialEq)]
pub struct CM31 {
pub a: M31,
pub b: M31,
Expand Down
2 changes: 1 addition & 1 deletion stwo_cairo_verifier/src/fields/m31.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub const P: u32 = 0x7fffffff;
const P32NZ: NonZero<u32> = 0x7fffffff;
const P64NZ: NonZero<u64> = 0x7fffffff;

#[derive(Copy, Drop, Debug, PartialEq, Eq)]
#[derive(Copy, Drop, Debug, PartialEq)]
pub struct M31 {
pub inner: u32
}
Expand Down
2 changes: 1 addition & 1 deletion stwo_cairo_verifier/src/fields/qm31.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::num::traits::one::One;

pub const R: CM31 = CM31 { a: M31 { inner: 2 }, b: M31 { inner: 1 } };

#[derive(Copy, Drop, Debug, PartialEq, Eq)]
#[derive(Copy, Drop, Debug, PartialEq)]
pub struct QM31 {
pub a: CM31,
pub b: CM31,
Expand Down
1 change: 1 addition & 0 deletions stwo_cairo_verifier/src/fri.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::dict::Felt252Dict;
use stwo_cairo_verifier::fields::m31::M31Trait;
use stwo_cairo_verifier::circle::{Coset, CosetImpl};
use stwo_cairo_verifier::poly::line::{LineDomain, LineDomainImpl};
Expand Down
4 changes: 2 additions & 2 deletions stwo_cairo_verifier/src/poly/circle.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use core::num::traits::ops::wrapping::WrappingSub;
///
/// Valid domains are a disjoint union of two conjugate cosets: `+-C + <G_n>`.
/// The ordering defined on this domain is `C + iG_n`, and then `-C - iG_n`.
#[derive(Debug, Copy, Drop, PartialEq, Eq)]
#[derive(Debug, Copy, Drop, PartialEq)]
pub struct CircleDomain {
pub half_coset: Coset
}
Expand Down Expand Up @@ -61,7 +61,7 @@ pub impl CircleDomainImpl of CircleDomainTrait {
/// An evaluation defined on a [CircleDomain].
///
/// The values are ordered according to the [CircleDomain] ordering.
#[derive(Debug, Drop, Clone, PartialEq, Eq)]
#[derive(Debug, Drop, Clone, PartialEq)]
pub struct CircleEvaluation {
pub values: Array<QM31>,
pub domain: CircleDomain,
Expand Down
2 changes: 1 addition & 1 deletion stwo_cairo_verifier/src/queries.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use stwo_cairo_verifier::sort::MinimumToMaximumSortedIterator;


/// An ordered set of query indices over a bit reversed [CircleDomain].
#[derive(Drop, Clone, Debug, PartialEq, Eq)]
#[derive(Drop, Clone, Debug, PartialEq)]
pub struct Queries {
pub positions: Array<usize>,
pub log_domain_size: u32,
Expand Down
1 change: 1 addition & 0 deletions stwo_cairo_verifier/src/utils.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::array::SpanTrait;
use core::dict::Felt252Dict;
use core::traits::PanicDestruct;
use core::option::OptionTrait;
use core::box::BoxTrait;
Expand Down

0 comments on commit a7f7f68

Please sign in to comment.