Skip to content

Commit

Permalink
chore: bump ark-ff to 0.4.2 (xJonathanLEI#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Apr 23, 2023
1 parent 38984ef commit 23ddc8a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 148 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,23 @@ jobs:

- name: Run starknet-ff tests
run: |
(cd ./starknet-ff && wasm-pack test --node)
(cd ./starknet-ff && wasm-pack test --release --node)
- name: Run starknet-crypto tests
run: |
(cd ./starknet-crypto && wasm-pack test --node)
(cd ./starknet-crypto && wasm-pack test --release --node)
- name: Run starknet-core tests
run: |
(cd ./starknet-core && wasm-pack test --node)
(cd ./starknet-core && wasm-pack test --release --node)
- name: Run starknet-signers tests
run: |
(cd ./starknet-signers && wasm-pack test --node)
(cd ./starknet-signers && wasm-pack test --release --node)
- name: Run starknet-macros tests
run: |
(cd ./starknet-macros && wasm-pack test --node)
(cd ./starknet-macros && wasm-pack test --release --node)
no-std-build:
name: no-std build
Expand Down
76 changes: 22 additions & 54 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion starknet-ff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ keywords = ["ethereum", "starknet", "web3", "no_std"]
all-features = true

[dependencies]
ark-ff = { version = "0.3.0", default-features = false }
ark-ff = { version = "0.4.2", default-features = false }
crypto-bigint = { version = "0.4.9", default-features = false }
hex = { version = "0.4.3", default-features = false }
serde = { version = "1.0.152", optional = true, default-features = false }
Expand Down
66 changes: 6 additions & 60 deletions starknet-ff/src/fr.rs
Original file line number Diff line number Diff line change
@@ -1,62 +1,8 @@
use ark_ff::{
biginteger::BigInteger256,
fields::{FftParameters, Fp256Parameters, FpParameters},
};
use ark_ff::fields::{Fp256, MontBackend, MontConfig};

pub struct FrParameters;
pub type Fr = Fp256<MontBackend<FrConfig, 4>>;

impl Fp256Parameters for FrParameters {}

impl FftParameters for FrParameters {
type BigInt = BigInteger256;

const TWO_ADICITY: u32 = 192;

const TWO_ADIC_ROOT_OF_UNITY: BigInteger256 = BigInteger256::new([
0x4106bccd64a2bdd8,
0xaaada25731fe3be9,
0xa35c5be60505574,
0x7222e32c47afc26,
]);
}

impl FpParameters for FrParameters {
const MODULUS: BigInteger256 = BigInteger256::new([0x1, 0x0, 0x0, 0x800000000000011]);

const MODULUS_BITS: u32 = 252;

const CAPACITY: u32 = Self::MODULUS_BITS - 1;

const REPR_SHAVE_BITS: u32 = 4;

const R: BigInteger256 = BigInteger256::new([
0xffffffffffffffe1,
0xffffffffffffffff,
0xffffffffffffffff,
0x7fffffffffffdf0,
]);

const R2: BigInteger256 = BigInteger256::new([
0xfffffd737e000401,
0x1330fffff,
0xffffffffff6f8000,
0x7ffd4ab5e008810,
]);

const INV: u64 = 0xffffffffffffffff;

const GENERATOR: BigInteger256 = BigInteger256::new([
0xffffffffffffffa1,
0xffffffffffffffff,
0xffffffffffffffff,
0x7fffffffffff9b0,
]);

const MODULUS_MINUS_ONE_DIV_TWO: BigInteger256 =
BigInteger256::new([0x0, 0x0, 0x8000000000000000, 0x400000000000008]);

const T: BigInteger256 = BigInteger256::new([0x800000000000011, 0x0, 0x0, 0x0]);

const T_MINUS_ONE_DIV_TWO: BigInteger256 =
BigInteger256::new([0x400000000000008, 0x0, 0x0, 0x0]);
}
#[derive(MontConfig)]
#[modulus = "3618502788666131213697322783095070105623107215331596699973092056135872020481"]
#[generator = "3"]
pub struct FrConfig;
Loading

0 comments on commit 23ddc8a

Please sign in to comment.