Skip to content

Commit

Permalink
build: introduce support for felt package
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelabro committed Feb 10, 2023
1 parent 3cf1c2f commit 6c25adf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions felt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ license = "Apache-2.0"
description = "Field elements representation for the Cairo VM"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["std"]
std = ["no-std-compat/std"]

[dependencies]
num-integer = "0.1.45"
num-bigint = { version = "0.4", features = ["serde"] }
num-traits = "0.2.15"
lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"] }
no-std-compat = { version = "0.4.1", features = [
"alloc",
"compat_macros",
"std",
] }

[dev-dependencies]
proptest = "1.0.0"
1 change: 1 addition & 0 deletions felt/src/bigint_felt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use num_bigint::{BigInt, BigUint, ToBigInt, U64Digits};
use num_integer::Integer;
use num_traits::{Bounded, FromPrimitive, Num, One, Pow, Signed, ToPrimitive, Zero};
use serde::{Deserialize, Serialize};
use std::prelude::v1::*;
use std::{
convert::Into,
fmt,
Expand Down
6 changes: 6 additions & 0 deletions felt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#![no_std]

extern crate no_std_compat as std;

mod bigint_felt;

use bigint_felt::FeltBigInt;
use num_bigint::{BigInt, BigUint, U64Digits};
use num_integer::Integer;
use num_traits::{Bounded, FromPrimitive, Num, One, Pow, Signed, ToPrimitive, Zero};
use serde::{Deserialize, Serialize};

use std::{
convert::Into,
fmt,
Expand All @@ -13,6 +18,7 @@ use std::{
Add, AddAssign, BitAnd, BitOr, BitXor, Div, Mul, MulAssign, Neg, Rem, Shl, Shr, ShrAssign,
Sub, SubAssign,
},
prelude::v1::*,
};

pub const PRIME_STR: &str = "0x800000000000011000000000000000000000000000000000000000000000001"; // in decimal, this is equal to 3618502788666131213697322783095070105623107215331596699973092056135872020481
Expand Down

0 comments on commit 6c25adf

Please sign in to comment.