From 375111825153683311d803ee0ac0242b33133ea9 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:39:21 -0700 Subject: [PATCH] chore: remove axiom-tools submodule --- .gitmodules | 3 -- axiom-codec/axiom-tools | 1 - axiom-codec/build.rs.bak | 84 ---------------------------------------- 3 files changed, 88 deletions(-) delete mode 160000 axiom-codec/axiom-tools delete mode 100644 axiom-codec/build.rs.bak diff --git a/.gitmodules b/.gitmodules index 6a742040c..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "axiom-codec/axiom-tools"] - path = axiom-codec/axiom-tools - url = git@github.com:axiom-crypto/axiom-tools.git diff --git a/axiom-codec/axiom-tools b/axiom-codec/axiom-tools deleted file mode 160000 index 43891b2d9..000000000 --- a/axiom-codec/axiom-tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 43891b2d93228cb12d48b5612c4256f4d2ed9af7 diff --git a/axiom-codec/build.rs.bak b/axiom-codec/build.rs.bak deleted file mode 100644 index a9a153396..000000000 --- a/axiom-codec/build.rs.bak +++ /dev/null @@ -1,84 +0,0 @@ -use std::fs::File; -use std::io::Write; -use std::path::{Path, PathBuf}; - -// Helper function to convert camelCase to UPPER_SNAKE_CASE -fn to_upper_snake_case(s: &str) -> String { - let mut result = String::new(); - for (i, ch) in s.chars().enumerate() { - if ch.is_uppercase() && i != 0 { - result.push('_'); - } - result.push(ch.to_ascii_uppercase()); - } - result -} - -fn main() { - println!("cargo:rerun-if-changed=axiom-tools/src/constants/v2/circuit.json"); - println!("cargo:rerun-if-changed=axiom-tools/src/constants/v2/fieldValues.json"); - - if std::env::var("AXIOM_SKIP_CONSTANT_GEN").unwrap_or("0".to_string()) == "1" { - return; - } - let special_values_path: PathBuf = - ["axiom-tools", "src", "constants", "v2", "fieldValues.json"].into_iter().collect(); - - // Read the JSON file - let json = - std::fs::read_to_string(special_values_path).expect("Unable to read special_values.json"); - - // Parse the JSON into a serde_json::Value - let data: serde_json::Value = serde_json::from_str(&json).expect("Error parsing the JSON"); - - // Begin generating the Rust code - let mut output = String::new(); - - for (section_name, section) in data.as_object().unwrap() { - for (key, value) in section.as_object().unwrap() { - if let Some(value) = value.as_number() { - let const_name = - format!("{}_{}", to_upper_snake_case(section_name), to_upper_snake_case(key)); - output += &format!("pub const {}: usize = {};\n", const_name, value); - } - } - } - - // Determine the output directory - let dest_path = Path::new("src").join("special_values.rs"); - - // Write the generated Rust code to a file - let mut f = File::create(dest_path).expect("Could not create file"); - f.write_all(output.as_bytes()).expect("Could not write data"); - - // Print a message for debugging purposes - println!("Generated src/special_values.rs"); - - // Read the JSON file - let constants_path: PathBuf = - ["axiom-tools", "src", "constants", "v2", "circuit.json"].into_iter().collect(); - let json = std::fs::read_to_string(constants_path).expect("Unable to read constants.json"); - - // Parse the JSON into a serde_json::Value - let data: serde_json::Value = serde_json::from_str(&json).expect("Error parsing the JSON"); - - // Begin generating the Rust code - let mut output = String::new(); - - for (key, value) in data.as_object().unwrap() { - if let Some(value) = value.as_number() { - let const_name = to_upper_snake_case(key); - output += &format!("pub const {}: usize = {};\n", const_name, value); - } - } - - // Determine the output directory - let dest_path = Path::new("src").join("constants.rs"); - - // Write the generated Rust code to a file - let mut f = File::create(dest_path).expect("Could not create file"); - f.write_all(output.as_bytes()).expect("Could not write data"); - - // Print a message for debugging purposes - println!("Generated src/constants.rs"); -}