some minor changes

This commit is contained in:
Kevin Jue
2023-05-15 12:28:00 -07:00
parent f3bc38fd83
commit 06727934c3
5 changed files with 8 additions and 8 deletions

View File

@@ -13,5 +13,5 @@ num = { version = "0.4", default-features = false }
plonky2 = { git = "https://github.com/mir-protocol/plonky2.git", default-features = false } plonky2 = { git = "https://github.com/mir-protocol/plonky2.git", default-features = false }
[dev-dependencies] [dev-dependencies]
plonky2 = { git = "https://github.com/mir-protocol/plonky2.git", features = ["gate_testing"] } plonky2 = { git = "https://github.com/mir-protocol/plonky2.git", default-features = false, features = ["gate_testing"] }
rand = { version = "0.8.4", default-features = false, features = ["getrandom"] } rand = { version = "0.8.4", default-features = false, features = ["getrandom"] }

View File

@@ -1,7 +1,7 @@
use alloc::string::{String, ToString}; use alloc::string::{String, ToString};
use alloc::vec; use alloc::vec;
use alloc::vec::Vec; use alloc::vec::Vec;
use plonky2::util::serialization::{IoResult, Buffer, Read, Write}; use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
use core::marker::PhantomData; use core::marker::PhantomData;
use plonky2::field::extension::Extendable; use plonky2::field::extension::Extendable;
@@ -14,7 +14,7 @@ use plonky2::plonk::circuit_builder::CircuitBuilder;
use crate::gates::add_many_u32::U32AddManyGate; use crate::gates::add_many_u32::U32AddManyGate;
use crate::gates::arithmetic_u32::U32ArithmeticGate; use crate::gates::arithmetic_u32::U32ArithmeticGate;
use crate::gates::subtraction_u32::U32SubtractionGate; use crate::gates::subtraction_u32::U32SubtractionGate;
use crate::serialization::{WriteU32, ReadU32}; use crate::serialization::{ReadU32, WriteU32};
use crate::witness::GeneratedValuesU32; use crate::witness::GeneratedValuesU32;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
@@ -274,7 +274,6 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
out_buffer.set_u32_target(self.low, low); out_buffer.set_u32_target(self.low, low);
out_buffer.set_u32_target(self.high, high); out_buffer.set_u32_target(self.high, high);
} }
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -1,7 +1,7 @@
use alloc::format; use alloc::format;
use alloc::string::{String, ToString}; use alloc::string::{String, ToString};
use alloc::vec::Vec; use alloc::vec::Vec;
use plonky2::util::serialization::{IoResult, Buffer, Write, Read}; use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
use core::marker::PhantomData; use core::marker::PhantomData;
use itertools::unfold; use itertools::unfold;

View File

@@ -216,13 +216,13 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
} }
fn serialize(&self, dst: &mut Vec<u8>) -> IoResult<()> { fn serialize(&self, dst: &mut Vec<u8>) -> IoResult<()> {
dst.write_usize(self.row)?; self.gate.serialize(dst)?;
self.gate.serialize(dst) dst.write_usize(self.row)
} }
fn deserialize(src: &mut Buffer) -> IoResult<Self> { fn deserialize(src: &mut Buffer) -> IoResult<Self> {
let row = src.read_usize()?;
let gate = U32RangeCheckGate::deserialize(src)?; let gate = U32RangeCheckGate::deserialize(src)?;
let row = src.read_usize()?;
Ok(Self { row, gate }) Ok(Self { row, gate })
} }

View File

@@ -14,6 +14,7 @@ impl WriteU32 for Vec<u8> {
} }
} }
#[cfg(feature = "std")]
pub trait ReadU32 { pub trait ReadU32 {
fn read_target_u32(&mut self) -> IoResult<U32Target>; fn read_target_u32(&mut self) -> IoResult<U32Target>;
} }