Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = [""]
compiler_version = ">=0.30.0"

[dependencies]
bigint = {tag = "v0.3.1", git = "https://github.com/noir-lang/noir-bignum" }
bigint = {tag = "v0.3.2", git = "https://github.com/noir-lang/noir-bignum" }
43 changes: 19 additions & 24 deletions noir-projects/noir-protocol-circuits/crates/blob/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ unconstrained fn __field_to_bytes(x: Field) -> [u8; 32] {
unconstrained fn __field_to_bignum(x: Field) -> F {
let x_bytes = __field_to_bytes(x);

BigNum::from_byte_be(x_bytes)
// TODO: use this once the name has been updated in the bignum lib:
// BigNum::from_be_bytes(x_bytes)
BigNum::from_be_bytes(x_bytes)
}

unconstrained fn __field_to_bignum_limbs(x: Field) -> [Field; 3] {
Expand Down Expand Up @@ -516,38 +514,35 @@ fn barycentric_evaluate_blob_at_z(z: F, ys: [F; FIELDS_PER_BLOB]) -> F {
y
}

// Need to wait for https://github.com/noir-lang/noir-bignum/pull/9 for this to work.
// nargo test --show-output test_main
// #[test]
// fn test_main() {
// let mut blob: [F; FIELDS_PER_BLOB] = [BigNum::new(); FIELDS_PER_BLOB];
#[test]
fn test_main() {
let mut blob: [F; FIELDS_PER_BLOB] = [BigNum::new(); FIELDS_PER_BLOB];

// blob[0] = BigNum { limbs: [0x1234, 0, 0] };
// blob[1] = BigNum { limbs: [0xabcd, 0, 0] };
// blob[2] = BigNum { limbs: [0x69, 0, 0] };
blob[0] = BigNum { limbs: [0x1234, 0, 0] };
blob[1] = BigNum { limbs: [0xabcd, 0, 0] };
blob[2] = BigNum { limbs: [0x69, 0, 0] };

// let kzg_commitment_in = [1, 2]; // this is made-up nonsense.
let kzg_commitment_in = [1, 2]; // this is made-up nonsense.

// let (challenge_z, y, kzg_commitment) = main(blob, kzg_commitment_in);
let (challenge_z, y, kzg_commitment) = main(blob, kzg_commitment_in);

// println(challenge_z);
// println(y);
// println(kzg_commitment);
// }
println(challenge_z);
println(y);
println(kzg_commitment);
}

#[test]
fn test_print() {
let x = 4;
println(f"x: {x}");
}

// Need to wait for https://github.com/noir-lang/noir-bignum/pull/9 for this to work.
// #[test]
// fn test_bignum_conversions() {
// let x = 1000;
// let x_bignum = __field_to_bignum(x);
// println(f"x_bignum: {x_bignum}");
// }
#[test]
fn test_bignum_conversions() {
let x = 1000;
let x_bignum = __field_to_bignum(x);
println(f"x_bignum: {x_bignum}");
}

// nargo test --show-output test_barycentric
#[test]
Expand Down