From 189ad7f02dfe8efc9451bb4e9a4958b0d85ba815 Mon Sep 17 00:00:00 2001 From: Wisdom Ogwu Date: Fri, 12 Jul 2024 11:14:22 +0100 Subject: [PATCH] rename uint_new back to uint --- singer-pro/src/basic_block/bb_final.rs | 2 +- singer-pro/src/basic_block/bb_start.rs | 2 +- singer-pro/src/instructions/add.rs | 2 +- singer-pro/src/instructions/gt.rs | 2 +- singer-pro/src/instructions/mstore.rs | 2 +- singer-pro/src/instructions/ret.rs | 2 +- singer-utils/src/chip_handler.rs | 2 +- singer-utils/src/chip_handler/range.rs | 2 +- singer-utils/src/lib.rs | 2 +- singer-utils/src/structs.rs | 4 ++-- singer-utils/src/{uint_new.rs => uint.rs} | 0 .../src/{uint_new => uint}/arithmetic.rs | 16 ++++++++-------- singer-utils/src/{uint_new => uint}/cmp.rs | 2 +- singer-utils/src/{uint_new => uint}/constants.rs | 2 +- singer-utils/src/{uint_new => uint}/uint.rs | 4 ++-- singer-utils/src/{uint_new => uint}/util.rs | 2 +- .../src/{uint_new => uint}/witness_extractors.rs | 4 ++-- singer/src/instructions/add.rs | 4 ++-- singer/src/instructions/calldataload.rs | 2 +- singer/src/instructions/dup.rs | 2 +- singer/src/instructions/gt.rs | 2 +- singer/src/instructions/jump.rs | 2 +- singer/src/instructions/jumpdest.rs | 2 +- singer/src/instructions/jumpi.rs | 2 +- singer/src/instructions/mstore.rs | 2 +- singer/src/instructions/pop.rs | 2 +- singer/src/instructions/push.rs | 2 +- singer/src/instructions/ret.rs | 2 +- singer/src/instructions/swap.rs | 2 +- singer/src/test.rs | 2 +- 30 files changed, 40 insertions(+), 40 deletions(-) rename singer-utils/src/{uint_new.rs => uint.rs} (100%) rename singer-utils/src/{uint_new => uint}/arithmetic.rs (98%) rename singer-utils/src/{uint_new => uint}/cmp.rs (98%) rename singer-utils/src/{uint_new => uint}/constants.rs (98%) rename singer-utils/src/{uint_new => uint}/uint.rs (98%) rename singer-utils/src/{uint_new => uint}/util.rs (99%) rename singer-utils/src/{uint_new => uint}/witness_extractors.rs (93%) diff --git a/singer-pro/src/basic_block/bb_final.rs b/singer-pro/src/basic_block/bb_final.rs index 48d13259c..7d3b1fef6 100644 --- a/singer-pro/src/basic_block/bb_final.rs +++ b/singer-pro/src/basic_block/bb_final.rs @@ -4,7 +4,7 @@ use gkr::structs::Circuit; use itertools::Itertools; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ GlobalStateChipOperations, OAMOperations, ROMOperations, RangeChipOperations, diff --git a/singer-pro/src/basic_block/bb_start.rs b/singer-pro/src/basic_block/bb_start.rs index 1c031e044..2616b9076 100644 --- a/singer-pro/src/basic_block/bb_start.rs +++ b/singer-pro/src/basic_block/bb_start.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ GlobalStateChipOperations, OAMOperations, ROMOperations, RangeChipOperations, diff --git a/singer-pro/src/instructions/add.rs b/singer-pro/src/instructions/add.rs index d61d33356..b9fa98d25 100644 --- a/singer-pro/src/instructions/add.rs +++ b/singer-pro/src/instructions/add.rs @@ -2,7 +2,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::CircuitBuilder; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::ROMOperations, chips::IntoEnumIterator, diff --git a/singer-pro/src/instructions/gt.rs b/singer-pro/src/instructions/gt.rs index 080fc3b96..ea55a3dc6 100644 --- a/singer-pro/src/instructions/gt.rs +++ b/singer-pro/src/instructions/gt.rs @@ -2,7 +2,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::CircuitBuilder; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::ROMOperations, chips::IntoEnumIterator, diff --git a/singer-pro/src/instructions/mstore.rs b/singer-pro/src/instructions/mstore.rs index 1cfec2c75..31110f067 100644 --- a/singer-pro/src/instructions/mstore.rs +++ b/singer-pro/src/instructions/mstore.rs @@ -10,7 +10,7 @@ use singer_utils::{ constants::{OpcodeType, EVM_STACK_BYTE_WIDTH}, register_witness, structs::{ChipChallenges, InstOutChipType, RAMHandler, ROMHandler, StackUInt, TSUInt}, - uint_new::constants::AddSubConstants, + uint::constants::AddSubConstants, }; use std::{mem, sync::Arc}; diff --git a/singer-pro/src/instructions/ret.rs b/singer-pro/src/instructions/ret.rs index b51fc7769..84ea49685 100644 --- a/singer-pro/src/instructions/ret.rs +++ b/singer-pro/src/instructions/ret.rs @@ -3,7 +3,7 @@ use gkr::structs::Circuit; use gkr_graph::structs::{CircuitGraphBuilder, NodeOutputType, PredType}; use paste::paste; use simple_frontend::structs::CircuitBuilder; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{OAMOperations, ROMOperations}, chips::{IntoEnumIterator, SingerChipBuilder}, diff --git a/singer-utils/src/chip_handler.rs b/singer-utils/src/chip_handler.rs index 2f3ca29bc..b8cb096ad 100644 --- a/singer-utils/src/chip_handler.rs +++ b/singer-utils/src/chip_handler.rs @@ -1,7 +1,7 @@ use ff_ext::ExtensionField; use simple_frontend::structs::{CellId, ChallengeId, CircuitBuilder, MixedCell, WitnessId}; -use crate::{constants::OpcodeType, error::UtilError, structs::ChipChallenges, uint_new::UInt}; +use crate::{constants::OpcodeType, error::UtilError, structs::ChipChallenges, uint::UInt}; pub mod bytecode; pub mod calldata; diff --git a/singer-utils/src/chip_handler/range.rs b/singer-utils/src/chip_handler/range.rs index 45e2f70fe..1f6f37896 100644 --- a/singer-utils/src/chip_handler/range.rs +++ b/singer-utils/src/chip_handler/range.rs @@ -6,7 +6,7 @@ use crate::{ constants::{RANGE_CHIP_BIT_WIDTH, STACK_TOP_BIT_WIDTH}, error::UtilError, structs::{PCUInt, ROMHandler, TSUInt}, - uint_new::UInt, + uint::UInt, }; use super::{ROMOperations, RangeChipOperations}; diff --git a/singer-utils/src/lib.rs b/singer-utils/src/lib.rs index 26cda104e..5e98a75b6 100644 --- a/singer-utils/src/lib.rs +++ b/singer-utils/src/lib.rs @@ -5,7 +5,7 @@ pub mod chips; pub mod constants; pub mod error; pub mod structs; -pub mod uint_new; +pub mod uint; #[macro_use] pub mod macros; diff --git a/singer-utils/src/structs.rs b/singer-utils/src/structs.rs index 27eb507b5..6730710f4 100644 --- a/singer-utils/src/structs.rs +++ b/singer-utils/src/structs.rs @@ -1,10 +1,10 @@ use ff_ext::ExtensionField; use simple_frontend::structs::{CellId, ChallengeId, ExtCellId}; use strum_macros::EnumIter; -use uint_new::UInt; +use uint::UInt; use crate::constants::{EVM_STACK_BIT_WIDTH, VALUE_BIT_WIDTH}; -use crate::uint_new; +use crate::uint; #[derive(Clone, Debug, Copy, EnumIter)] pub enum RAMType { diff --git a/singer-utils/src/uint_new.rs b/singer-utils/src/uint.rs similarity index 100% rename from singer-utils/src/uint_new.rs rename to singer-utils/src/uint.rs diff --git a/singer-utils/src/uint_new/arithmetic.rs b/singer-utils/src/uint/arithmetic.rs similarity index 98% rename from singer-utils/src/uint_new/arithmetic.rs rename to singer-utils/src/uint/arithmetic.rs index 55bbf3000..bf753f5e4 100644 --- a/singer-utils/src/uint_new/arithmetic.rs +++ b/singer-utils/src/uint/arithmetic.rs @@ -1,4 +1,4 @@ -use crate::{chip_handler::RangeChipOperations, error::UtilError, uint_new::uint::UInt}; +use crate::{chip_handler::RangeChipOperations, error::UtilError, uint::uint::UInt}; use ff::Field; use ff_ext::ExtensionField; use simple_frontend::structs::{Cell, CellId, CircuitBuilder}; @@ -292,7 +292,7 @@ impl UInt { #[cfg(test)] mod tests { - use crate::uint_new::{constants::AddSubConstants, UInt}; + use crate::uint::{constants::AddSubConstants, UInt}; use gkr::structs::{Circuit, CircuitWitness}; use goldilocks::{Goldilocks, GoldilocksExt2}; use itertools::Itertools; @@ -328,8 +328,8 @@ mod tests { let (carry_id, carry_cells) = circuit_builder.create_witness_in(AddSubConstants::::N_CARRY_CELLS); - let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint_new"); - let addend_1 = UInt20::try_from(addend_1_cells).expect("should build uint_new"); + let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint"); + let addend_1 = UInt20::try_from(addend_1_cells).expect("should build uint"); // update circuit builder with circuit instructions let result = @@ -403,7 +403,7 @@ mod tests { let (carry_id, carry_cells) = circuit_builder.create_witness_in(AddSubConstants::::N_CARRY_CELLS); - let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint_new"); + let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint"); // update circuit builder let result = UInt20::add_const_unsafe( @@ -477,7 +477,7 @@ mod tests { let (carry_id, carry_cells) = circuit_builder.create_witness_in(AddSubConstants::::N_CARRY_CELLS); - let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint_new"); + let addend_0 = UInt20::try_from(addend_0_cells).expect("should build uint"); // update circuit builder let result = UInt20::add_cell_unsafe( @@ -555,8 +555,8 @@ mod tests { let (borrow_id, borrow_cells) = circuit_builder.create_witness_in(AddSubConstants::::N_CARRY_CELLS); - let minuend = UInt20::try_from(minuend_cells).expect("should build uint_new"); - let subtrahend = UInt20::try_from(subtrahend_cells).expect("should build uint_new"); + let minuend = UInt20::try_from(minuend_cells).expect("should build uint"); + let subtrahend = UInt20::try_from(subtrahend_cells).expect("should build uint"); // update the circuit builder let result = diff --git a/singer-utils/src/uint_new/cmp.rs b/singer-utils/src/uint/cmp.rs similarity index 98% rename from singer-utils/src/uint_new/cmp.rs rename to singer-utils/src/uint/cmp.rs index 2bcf4ed0c..d38e0b741 100644 --- a/singer-utils/src/uint_new/cmp.rs +++ b/singer-utils/src/uint/cmp.rs @@ -1,7 +1,7 @@ use crate::{ chip_handler::RangeChipOperations, error::UtilError, - uint_new::{constants::AddSubConstants, uint::UInt}, + uint::{constants::AddSubConstants, uint::UInt}, }; use ff::Field; use ff_ext::ExtensionField; diff --git a/singer-utils/src/uint_new/constants.rs b/singer-utils/src/uint/constants.rs similarity index 98% rename from singer-utils/src/uint_new/constants.rs rename to singer-utils/src/uint/constants.rs index 29747176e..6f2345bcd 100644 --- a/singer-utils/src/uint_new/constants.rs +++ b/singer-utils/src/uint/constants.rs @@ -1,6 +1,6 @@ use super::uint::UInt; use crate::constants::RANGE_CHIP_BIT_WIDTH; -use crate::uint_new::util::const_min; +use crate::uint::util::const_min; use std::marker::PhantomData; impl UInt { diff --git a/singer-utils/src/uint_new/uint.rs b/singer-utils/src/uint/uint.rs similarity index 98% rename from singer-utils/src/uint_new/uint.rs rename to singer-utils/src/uint/uint.rs index 5f85a12e2..37fa4043e 100644 --- a/singer-utils/src/uint_new/uint.rs +++ b/singer-utils/src/uint/uint.rs @@ -1,7 +1,7 @@ use crate::{ constants::{BYTE_BIT_WIDTH, RANGE_CHIP_BIT_WIDTH}, error::UtilError, - uint_new::util::{add_one_to_big_num, convert_decomp, pad_cells}, + uint::util::{add_one_to_big_num, convert_decomp, pad_cells}, }; use ff_ext::ExtensionField; use goldilocks::SmallField; @@ -134,7 +134,7 @@ impl TryFrom<&[CellId]> for UInt { #[cfg(test)] mod tests { - use crate::uint_new::uint::UInt; + use crate::uint::uint::UInt; use gkr::structs::{Circuit, CircuitWitness}; use goldilocks::{Goldilocks, GoldilocksExt2}; use itertools::Itertools; diff --git a/singer-utils/src/uint_new/util.rs b/singer-utils/src/uint/util.rs similarity index 99% rename from singer-utils/src/uint_new/util.rs rename to singer-utils/src/uint/util.rs index b761f63d9..6db465e76 100644 --- a/singer-utils/src/uint_new/util.rs +++ b/singer-utils/src/uint/util.rs @@ -107,7 +107,7 @@ pub fn add_one_to_big_num(limb_modulo: F, limbs: &[F]) -> Vec #[cfg(test)] mod tests { - use crate::uint_new::util::{add_one_to_big_num, const_min, convert_decomp, pad_cells}; + use crate::uint::util::{add_one_to_big_num, const_min, convert_decomp, pad_cells}; use gkr::structs::{Circuit, CircuitWitness}; use goldilocks::{Goldilocks, GoldilocksExt2}; use itertools::Itertools; diff --git a/singer-utils/src/uint_new/witness_extractors.rs b/singer-utils/src/uint/witness_extractors.rs similarity index 93% rename from singer-utils/src/uint_new/witness_extractors.rs rename to singer-utils/src/uint/witness_extractors.rs index a055e2d47..ee0029d2c 100644 --- a/singer-utils/src/uint_new/witness_extractors.rs +++ b/singer-utils/src/uint/witness_extractors.rs @@ -1,5 +1,5 @@ -use crate::uint_new::constants::AddSubConstants; -use crate::uint_new::uint::UInt; +use crate::uint::constants::AddSubConstants; +use crate::uint::uint::UInt; use simple_frontend::structs::CellId; // TODO: split this into different impls, constrained by specific contexts diff --git a/singer/src/instructions/add.rs b/singer/src/instructions/add.rs index 48b86045b..6bdef4942 100644 --- a/singer/src/instructions/add.rs +++ b/singer/src/instructions/add.rs @@ -11,7 +11,7 @@ use singer_utils::{ constants::OpcodeType, register_witness, structs::{PCUInt, RAMHandler, ROMHandler, StackUInt, TSUInt}, - uint_new::constants::AddSubConstants, + uint::constants::AddSubConstants, }; use std::sync::Arc; @@ -190,7 +190,7 @@ mod test { use singer_utils::{ constants::RANGE_CHIP_BIT_WIDTH, structs::{StackUInt, TSUInt}, - uint_new::constants::AddSubConstants, + uint::constants::AddSubConstants, }; use std::{collections::BTreeMap, time::Instant}; use transcript::Transcript; diff --git a/singer/src/instructions/calldataload.rs b/singer/src/instructions/calldataload.rs index 9a0dc6859..6d65d74cf 100644 --- a/singer/src/instructions/calldataload.rs +++ b/singer/src/instructions/calldataload.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, CalldataChipOperations, GlobalStateChipOperations, OAMOperations, diff --git a/singer/src/instructions/dup.rs b/singer/src/instructions/dup.rs index b7dd83f9c..f69637c3c 100644 --- a/singer/src/instructions/dup.rs +++ b/singer/src/instructions/dup.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/gt.rs b/singer/src/instructions/gt.rs index 726bcf3d9..7e0be45dd 100644 --- a/singer/src/instructions/gt.rs +++ b/singer/src/instructions/gt.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/jump.rs b/singer/src/instructions/jump.rs index b043ef930..7a13838f1 100644 --- a/singer/src/instructions/jump.rs +++ b/singer/src/instructions/jump.rs @@ -5,7 +5,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/jumpdest.rs b/singer/src/instructions/jumpdest.rs index c95cc21d6..f21874575 100644 --- a/singer/src/instructions/jumpdest.rs +++ b/singer/src/instructions/jumpdest.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/jumpi.rs b/singer/src/instructions/jumpi.rs index c8e07bbbd..b007d4f76 100644 --- a/singer/src/instructions/jumpi.rs +++ b/singer/src/instructions/jumpi.rs @@ -12,7 +12,7 @@ use singer_utils::{ constants::OpcodeType, register_witness, structs::{PCUInt, RAMHandler, ROMHandler, StackUInt, TSUInt}, - uint_new::constants::AddSubConstants, + uint::constants::AddSubConstants, }; use std::sync::Arc; diff --git a/singer/src/instructions/mstore.rs b/singer/src/instructions/mstore.rs index 0c864371e..14f515933 100644 --- a/singer/src/instructions/mstore.rs +++ b/singer/src/instructions/mstore.rs @@ -13,7 +13,7 @@ use singer_utils::{ constants::{OpcodeType, EVM_STACK_BYTE_WIDTH}, register_witness, structs::{PCUInt, RAMHandler, ROMHandler, StackUInt, TSUInt}, - uint_new::constants::AddSubConstants, + uint::constants::AddSubConstants, }; use std::{mem, sync::Arc}; diff --git a/singer/src/instructions/pop.rs b/singer/src/instructions/pop.rs index 6a117ebfc..c82bd6bc6 100644 --- a/singer/src/instructions/pop.rs +++ b/singer/src/instructions/pop.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/push.rs b/singer/src/instructions/push.rs index 487761713..e42661b5a 100644 --- a/singer/src/instructions/push.rs +++ b/singer/src/instructions/push.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/ret.rs b/singer/src/instructions/ret.rs index 835f011a0..4a160031f 100644 --- a/singer/src/instructions/ret.rs +++ b/singer/src/instructions/ret.rs @@ -4,7 +4,7 @@ use gkr::structs::Circuit; use gkr_graph::structs::{CircuitGraphBuilder, NodeOutputType, PredType}; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/instructions/swap.rs b/singer/src/instructions/swap.rs index 3bda993fe..c3c0878ee 100644 --- a/singer/src/instructions/swap.rs +++ b/singer/src/instructions/swap.rs @@ -3,7 +3,7 @@ use ff_ext::ExtensionField; use gkr::structs::Circuit; use paste::paste; use simple_frontend::structs::{CircuitBuilder, MixedCell}; -use singer_utils::uint_new::constants::AddSubConstants; +use singer_utils::uint::constants::AddSubConstants; use singer_utils::{ chip_handler::{ BytecodeChipOperations, GlobalStateChipOperations, OAMOperations, ROMOperations, diff --git a/singer/src/test.rs b/singer/src/test.rs index d0fd8e1f6..30c775fb7 100644 --- a/singer/src/test.rs +++ b/singer/src/test.rs @@ -7,7 +7,7 @@ use gkr::utils::MultilinearExtensionFromVectors; use goldilocks::SmallField; use itertools::Itertools; use simple_frontend::structs::CellId; -use singer_utils::uint_new::UInt; +use singer_utils::uint::UInt; use std::collections::BTreeMap; use crate::instructions::InstCircuit;