From 93282e00b925fd3d61ea32c0f48fd8385f385b51 Mon Sep 17 00:00:00 2001 From: Rute Figueiredo Date: Wed, 8 May 2024 22:32:35 +0100 Subject: [PATCH] Rutefig/237 fix python front end (#240) --- src/frontend/dsl/mod.rs | 3 - src/frontend/python/chiquito/cb.py | 4 +- src/frontend/python/chiquito/chiquito_ast.py | 2 +- src/frontend/python/chiquito/dsl.py | 4 +- src/frontend/python/chiquito/expr.py | 4 +- src/frontend/python/chiquito/query.py | 2 +- src/frontend/python/chiquito/util.py | 12 +- src/frontend/python/chiquito/wit_gen.py | 2 +- src/frontend/python/mod.rs | 292 ++++++++++--------- 9 files changed, 162 insertions(+), 163 deletions(-) diff --git a/src/frontend/dsl/mod.rs b/src/frontend/dsl/mod.rs index ce93ca46..e52313b5 100644 --- a/src/frontend/dsl/mod.rs +++ b/src/frontend/dsl/mod.rs @@ -600,15 +600,12 @@ mod tests { } #[test] - #[ignore] #[should_panic(expected = "Signal not found")] fn test_expose_non_existing_signal() { let mut context = setup_circuit_context::(); let non_existing_signal = Queriable::Forward(ForwardSignal::new_with_phase(0, "".to_owned()), false); // Create a signal not added to the circuit context.expose(non_existing_signal, ExposeOffset::First); - - todo!("remove the ignore after fixing the check for non existing signals") } #[test] diff --git a/src/frontend/python/chiquito/cb.py b/src/frontend/python/chiquito/cb.py index 6d25d920..5828fe09 100644 --- a/src/frontend/python/chiquito/cb.py +++ b/src/frontend/python/chiquito/cb.py @@ -1,7 +1,7 @@ from __future__ import annotations from dataclasses import dataclass, field from enum import Enum, auto -from typing import List, Dict, Optional +from typing import List, Dict, Optional, Union from chiquito.util import F, uuid from chiquito.expr import Expr, Const, Neg, to_expr, ToExpr @@ -205,7 +205,7 @@ def table() -> LookupTable: return LookupTable() -ToConstraint = Constraint | Expr | int | F +ToConstraint = Union[Constraint, Expr, int, F] def to_constraint(v: ToConstraint) -> Constraint: diff --git a/src/frontend/python/chiquito/chiquito_ast.py b/src/frontend/python/chiquito/chiquito_ast.py index fc6e6d0b..3b44505a 100644 --- a/src/frontend/python/chiquito/chiquito_ast.py +++ b/src/frontend/python/chiquito/chiquito_ast.py @@ -126,7 +126,7 @@ def __json__(self: ASTCircuit): "last_step": self.last_step, "num_steps": self.num_steps, "q_enable": self.q_enable, - "id": self.id, + "id": self.id.__str__(), } def add_forward(self: ASTCircuit, name: str, phase: int) -> ForwardSignal: diff --git a/src/frontend/python/chiquito/dsl.py b/src/frontend/python/chiquito/dsl.py index ee41004f..51f089c7 100644 --- a/src/frontend/python/chiquito/dsl.py +++ b/src/frontend/python/chiquito/dsl.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import List, Dict +from typing import List, Dict, Union from enum import Enum from typing import Callable, Any @@ -295,4 +295,4 @@ def add_lookup(self: StepType, lookup_builder: LookupBuilder): self.step_type.lookups.append(lookup) -LookupBuilder = LookupTableBuilder | InPlaceLookupBuilder +LookupBuilder = Union[LookupTableBuilder, InPlaceLookupBuilder] diff --git a/src/frontend/python/chiquito/expr.py b/src/frontend/python/chiquito/expr.py index 22e11396..41f4d93f 100644 --- a/src/frontend/python/chiquito/expr.py +++ b/src/frontend/python/chiquito/expr.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import List +from typing import List, Union from dataclasses import dataclass from chiquito.util import F @@ -141,7 +141,7 @@ def __json__(self): return {"Pow": [self.expr.__json__(), self.pow]} -ToExpr = Expr | int | F +ToExpr = Union[Expr, int, F] def to_expr(v: ToExpr) -> Expr: diff --git a/src/frontend/python/chiquito/query.py b/src/frontend/python/chiquito/query.py index 9dafb6c2..0eeb52e7 100644 --- a/src/frontend/python/chiquito/query.py +++ b/src/frontend/python/chiquito/query.py @@ -134,5 +134,5 @@ def __str__(self: ASTStepType) -> str: def __json__(self): return { - "StepTypeNext": {"id": self.step_type.id, "annotation": self.step_type.name} + "StepTypeNext": {"id": f"{self.step_type.id}", "annotation": self.step_type.name} } diff --git a/src/frontend/python/chiquito/util.py b/src/frontend/python/chiquito/util.py index 0533fd6f..a9621acb 100644 --- a/src/frontend/python/chiquito/util.py +++ b/src/frontend/python/chiquito/util.py @@ -14,11 +14,9 @@ def __json__(self: F): # Convert the integer to a byte array montgomery_form = self.n * R % F.field_modulus byte_array = montgomery_form.to_bytes(32, "little") - # Split into four 64-bit integers - ints = [ - int.from_bytes(byte_array[i * 8 : i * 8 + 8], "little") for i in range(4) - ] - return ints + + # return the hex string + return byte_array.hex() class CustomEncoder(json.JSONEncoder): @@ -29,5 +27,5 @@ def default(self, obj): # int field is the u128 version of uuid. -def uuid() -> int: - return uuid1(node=int.from_bytes([10, 10, 10, 10, 10, 10], byteorder="little")).int +def uuid() -> str: + return uuid1(node=int.from_bytes([10, 10, 10, 10, 10, 10], byteorder="little")).int.__str__() diff --git a/src/frontend/python/chiquito/wit_gen.py b/src/frontend/python/chiquito/wit_gen.py index cec59905..2ab1bf39 100644 --- a/src/frontend/python/chiquito/wit_gen.py +++ b/src/frontend/python/chiquito/wit_gen.py @@ -41,7 +41,7 @@ def __str__(self: StepInstance): # For assignments, return "uuid: (Queriable, F)" rather than "Queriable: F", because JSON doesn't accept Dict as key. def __json__(self: StepInstance): return { - "step_type_uuid": self.step_type_uuid, + "step_type_uuid": self.step_type_uuid.__str__(), "assignments": { lhs.uuid(): [lhs, rhs] for (lhs, rhs) in self.assignments.items() }, diff --git a/src/frontend/python/mod.rs b/src/frontend/python/mod.rs index 1a752878..32a25726 100644 --- a/src/frontend/python/mod.rs +++ b/src/frontend/python/mod.rs @@ -2,6 +2,7 @@ use pyo3::{ prelude::*, types::{PyDict, PyList, PyLong, PyString}, }; +use serde_json::{from_str, Value}; use crate::{ frontend::dsl::{StepTypeHandler, SuperCircuitContext}, @@ -47,8 +48,10 @@ thread_local! { /// as the key. Return the Rust UUID to Python. The last field of the tuple, `TraceWitness`, is left /// as None, for `chiquito_add_witness_to_rust_id` to insert. pub fn chiquito_ast_to_halo2(ast_json: &str) -> UUID { + let value: Value = from_str(ast_json).expect("Invalid JSON"); + // Attempt to convert `Value` into `SBPIR` let circuit: SBPIR = - serde_json::from_str(ast_json).expect("Json deserialization to Circuit failed."); + serde_json::from_value(value).expect("Deserialization to Circuit failed."); let config = config(SingleRowCellManager {}, SimpleStepSelectorBuilder {}); let (chiquito, assignment_generator) = compile(config, &circuit); @@ -212,13 +215,18 @@ impl<'de> Visitor<'de> for CircuitVisitor { let mut q_enable = None; let mut id = None; + println!("------ Visiting map -------"); + while let Some(key) = map.next_key::()? { + println!("key = {}", key); match key.as_str() { "step_types" => { + println!("------ Visiting step_types -------"); if step_types.is_some() { return Err(de::Error::duplicate_field("step_types")); } step_types = Some(map.next_value::>>()?); + println!("step_types = {:#?}", step_types); } "forward_signals" => { if forward_signals.is_some() { @@ -261,13 +269,33 @@ impl<'de> Visitor<'de> for CircuitVisitor { if first_step.is_some() { return Err(de::Error::duplicate_field("first_step")); } - first_step = Some(map.next_value::>()?); + let first_step_opt: Option = map.next_value()?; // Deserialize the value as an optional string + first_step = Some(first_step_opt.map_or(Ok(None), |first_step_str| { + StepTypeUUID::from_str_radix(&first_step_str, 10) + .map(Some) + .map_err(|e| { + de::Error::custom(format!( + "Failed to parse first_step '{}': {}", + first_step_str, e + )) + }) + })?); } "last_step" => { if last_step.is_some() { return Err(de::Error::duplicate_field("last_step")); } - last_step = Some(map.next_value::>()?); + let last_step_opt: Option = map.next_value()?; // Deserialize the value as an optional string + last_step = Some(last_step_opt.map_or(Ok(None), |last_step_str| { + StepTypeUUID::from_str_radix(&last_step_str, 10) + .map(Some) + .map_err(|e| { + de::Error::custom(format!( + "Failed to parse last_step '{}': {}", + last_step_str, e + )) + }) + })?); } "num_steps" => { if num_steps.is_some() { @@ -285,7 +313,10 @@ impl<'de> Visitor<'de> for CircuitVisitor { if id.is_some() { return Err(de::Error::duplicate_field("id")); } - id = Some(map.next_value()?); + let id_str: String = map.next_value()?; + id = Some(id_str.parse::().map_err(|e| { + de::Error::custom(format!("Failed to parse id '{}': {}", id_str, e)) + })?); } _ => { return Err(de::Error::unknown_field( @@ -376,7 +407,10 @@ impl<'de> Visitor<'de> for StepTypeVisitor { if id.is_some() { return Err(de::Error::duplicate_field("id")); } - id = Some(map.next_value()?); + let id_str: String = map.next_value()?; + id = Some(id_str.parse::().map_err(|e| { + de::Error::custom(format!("Failed to parse id '{}': {}", id_str, e)) + })?); } "name" => { if name.is_some() { @@ -629,6 +663,7 @@ impl<'de> Visitor<'de> for QueriableVisitor { let key: String = map .next_key()? .ok_or_else(|| de::Error::custom("map is empty"))?; + match key.as_str() { "Internal" => map.next_value().map(Queriable::Internal), "Forward" => map @@ -637,9 +672,11 @@ impl<'de> Visitor<'de> for QueriableVisitor { "Shared" => map .next_value() .map(|(signal, rotation)| Queriable::Shared(signal, rotation)), - "Fixed" => map - .next_value() - .map(|(signal, rotation)| Queriable::Fixed(signal, rotation)), + "Fixed" => { + println!("Processing Fixed"); + map.next_value() + .map(|(signal, rotation)| Queriable::Fixed(signal, rotation)) + } "StepTypeNext" => map.next_value().map(Queriable::StepTypeNext), _ => Err(de::Error::unknown_variant( &key, @@ -703,7 +740,10 @@ macro_rules! impl_visitor_internal_fixed_steptypehandler { if id.is_some() { return Err(de::Error::duplicate_field("id")); } - id = Some(map.next_value()?); + let id_str: String = map.next_value()?; // Get the UUID as a string + id = Some(id_str.parse::().map_err(|e| { + de::Error::custom(format!("Failed to parse id '{}': {}", id_str, e)) + })?); } "annotation" => { if annotation.is_some() { @@ -759,7 +799,10 @@ macro_rules! impl_visitor_forward_shared { if id.is_some() { return Err(de::Error::duplicate_field("id")); } - id = Some(map.next_value()?); + let id_str: String = map.next_value()?; // Get the UUID as a string + id = Some(id_str.parse::().map_err(|e| { + de::Error::custom(format!("Failed to parse id '{}': {}", id_str, e)) + })?); } "phase" => { if phase.is_some() { @@ -848,7 +891,12 @@ impl<'de> Visitor<'de> for StepInstanceVisitor { if step_type_uuid.is_some() { return Err(de::Error::duplicate_field("step_type_uuid")); } - step_type_uuid = Some(map.next_value()?); + let uuid_str: String = map.next_value()?; // Get the UUID as a string + step_type_uuid = Some( + uuid_str + .parse::() // Assuming the string is in decimal format + .map_err(de::Error::custom)?, + ); } "assignments" => { if assignments.is_some() { @@ -920,119 +968,89 @@ impl<'de> Deserialize<'de> for SBPIR { mod tests { use super::*; - #[ignore] #[test] + #[ignore] fn test_trace_witness() { let json = r#" { "step_instances": [ { - "step_type_uuid": 270606747459021742275781620564109167114, + "step_type_uuid": "270606747459021742275781620564109167114", "assignments": { "270606737951642240564318377467548666378": [ { "Forward": [ { - "id": 270606737951642240564318377467548666378, + "id": "270606737951642240564318377467548666378", "phase": 0, "annotation": "a" }, false ] }, - [ - 55, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000055" ], "270606743497613616562965561253747624458": [ { "Forward": [ { - "id": 270606743497613616562965561253747624458, + "id": "270606743497613616562965561253747624458", "phase": 0, "annotation": "b" }, false ] }, - [ - 89, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000089" ], "270606753004993118272949371872716917258": [ { "Internal": { - "id": 270606753004993118272949371872716917258, + "id": "270606753004993118272949371872716917258", "annotation": "c" } }, - [ - 144, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000144" ] } }, { - "step_type_uuid": 270606783111694873693576112554652600842, + "step_type_uuid": "270606783111694873693576112554652600842", "assignments": { "270606737951642240564318377467548666378": [ { "Forward": [ { - "id": 270606737951642240564318377467548666378, + "id": "270606737951642240564318377467548666378", "phase": 0, "annotation": "a" }, false ] }, - [ - 89, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000089" ], "270606743497613616562965561253747624458": [ { "Forward": [ { - "id": 270606743497613616562965561253747624458, + "id": "270606743497613616562965561253747624458", "phase": 0, "annotation": "b" }, false ] }, - [ - 144, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000144" ], "270606786280821374261518951164072823306": [ { "Internal": { - "id": 270606786280821374261518951164072823306, + "id": "270606786280821374261518951164072823306", "annotation": "c" } }, - [ - 233, - 0, - 0, - 0 - ] + "0000000000000000000000000000000000000000000000000000000000000233" ] } } @@ -1065,18 +1083,17 @@ mod tests { let _: ExposeOffset = serde_json::from_str(json).unwrap(); } - #[ignore] #[test] fn test_circuit() { let json = r#" { "step_types": { "258869595755756204079859764249309612554": { - "id": 258869595755756204079859764249309612554, + "id": "258869595755756204079859764249309612554", "name": "fibo_first_step", "signals": [ { - "id": 258869599717164329791616633222308956682, + "id": "258869599717164329791616633222308956682", "annotation": "c" } ], @@ -1088,7 +1105,7 @@ mod tests { { "Forward": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, @@ -1097,12 +1114,7 @@ mod tests { }, { "Neg": { - "Const": [ - 1, - 0, - 0, - 0 - ] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" } } ] @@ -1115,7 +1127,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1124,12 +1136,7 @@ mod tests { }, { "Neg": { - "Const": [ - 1, - 0, - 0, - 0 - ] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" } } ] @@ -1142,7 +1149,7 @@ mod tests { { "Forward": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, @@ -1152,7 +1159,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1162,7 +1169,7 @@ mod tests { { "Neg": { "Internal": { - "id": 258869599717164329791616633222308956682, + "id": "258869599717164329791616633222308956682", "annotation": "c" } } @@ -1179,7 +1186,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1190,7 +1197,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, @@ -1207,7 +1214,7 @@ mod tests { "Sum": [ { "Internal": { - "id": 258869599717164329791616633222308956682, + "id": "258869599717164329791616633222308956682", "annotation": "c" } }, @@ -1215,7 +1222,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1233,7 +1240,7 @@ mod tests { { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1244,7 +1251,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1262,11 +1269,11 @@ mod tests { } }, "258869628239302834927102989021255174666": { - "id": 258869628239302834927102989021255174666, + "id": "258869628239302834927102989021255174666", "name": "fibo_step", "signals": [ { - "id": 258869632200710960639812650790420089354, + "id": "258869632200710960639812650790420089354", "annotation": "c" } ], @@ -1278,7 +1285,7 @@ mod tests { { "Forward": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, @@ -1288,7 +1295,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1298,7 +1305,7 @@ mod tests { { "Neg": { "Internal": { - "id": 258869632200710960639812650790420089354, + "id": "258869632200710960639812650790420089354", "annotation": "c" } } @@ -1315,7 +1322,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1326,7 +1333,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, @@ -1343,7 +1350,7 @@ mod tests { "Sum": [ { "Internal": { - "id": 258869632200710960639812650790420089354, + "id": "258869632200710960639812650790420089354", "annotation": "c" } }, @@ -1351,7 +1358,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1369,7 +1376,7 @@ mod tests { { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1380,7 +1387,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1398,7 +1405,7 @@ mod tests { } }, "258869646461780213207493341245063432714": { - "id": 258869646461780213207493341245063432714, + "id": "258869646461780213207493341245063432714", "name": "padding", "signals": [], "constraints": [], @@ -1410,7 +1417,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1421,7 +1428,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1439,7 +1446,7 @@ mod tests { { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1450,7 +1457,7 @@ mod tests { "Neg": { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1468,17 +1475,17 @@ mod tests { }, "forward_signals": [ { - "id": 258869580702405326369584955980151130634, + "id": "258869580702405326369584955980151130634", "phase": 0, "annotation": "a" }, { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" } @@ -1490,7 +1497,7 @@ mod tests { { "Forward": [ { - "id": 258869587040658327507391136965088381450, + "id": "258869587040658327507391136965088381450", "phase": 0, "annotation": "b" }, @@ -1505,7 +1512,7 @@ mod tests { { "Forward": [ { - "id": 258869589417503202934383108674030275082, + "id": "258869589417503202934383108674030275082", "phase": 0, "annotation": "n" }, @@ -1526,31 +1533,30 @@ mod tests { "258869646461780213207493341245063432714": "padding" }, "fixed_assignments": null, - "first_step": 258869595755756204079859764249309612554, - "last_step": 258869646461780213207493341245063432714, + "first_step": "258869595755756204079859764249309612554", + "last_step": "258869646461780213207493341245063432714", "num_steps": 10, "q_enable": true, - "id": 258867373405797678961444396351437277706 + "id": "258867373405797678961444396351437277706" } "#; let circuit: SBPIR = serde_json::from_str(json).unwrap(); println!("{:?}", circuit); } - #[ignore] #[test] fn test_step_type() { let json = r#" { - "id":1, + "id":"1", "name":"fibo", "signals":[ { - "id":1, + "id":"1", "annotation":"a" }, { - "id":2, + "id":"2", "annotation":"b" } ], @@ -1560,18 +1566,18 @@ mod tests { "expr":{ "Sum":[ { - "Const":[1, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" }, { "Mul":[ { "Internal":{ - "id":3, + "id":"3", "annotation":"c" } }, { - "Const":[3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" } ] } @@ -1583,14 +1589,14 @@ mod tests { "expr":{ "Sum":[ { - "Const":[1, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" }, { "Mul":[ { "Shared":[ { - "id":4, + "id":"4", "phase":2, "annotation":"d" }, @@ -1598,7 +1604,7 @@ mod tests { ] }, { - "Const":[3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" } ] } @@ -1612,14 +1618,14 @@ mod tests { "expr":{ "Sum":[ { - "Const":[1, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" }, { "Mul":[ { "Forward":[ { - "id":5, + "id":"5", "phase":1, "annotation":"e" }, @@ -1627,7 +1633,7 @@ mod tests { ] }, { - "Const":[3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" } ] } @@ -1639,21 +1645,21 @@ mod tests { "expr":{ "Sum":[ { - "Const":[1, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000001" }, { "Mul":[ { "Fixed":[ { - "id":6, + "id":"6", "annotation":"e" }, 2 ] }, { - "Const":[3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" } ] } @@ -1673,7 +1679,6 @@ mod tests { println!("{:?}", step_type); } - #[ignore] #[test] fn test_constraint() { let json = r#" @@ -1683,14 +1688,14 @@ mod tests { "Sum": [ { "Internal": { - "id": 27, + "id": "27", "annotation": "a" } }, { "Fixed": [ { - "id": 28, + "id": "28", "annotation": "b" }, 1 @@ -1699,7 +1704,7 @@ mod tests { { "Shared": [ { - "id": 29, + "id": "29", "phase": 1, "annotation": "c" }, @@ -1709,7 +1714,7 @@ mod tests { { "Forward": [ { - "id": 30, + "id": "30", "phase": 2, "annotation": "d" }, @@ -1718,32 +1723,32 @@ mod tests { }, { "StepTypeNext": { - "id": 31, + "id": "31", "annotation": "e" } }, { - "Const": [3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" }, { "Mul": [ { - "Const": [4, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000004" }, { - "Const": [5, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000005" } ] }, { "Neg": { - "Const": [2, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000002" } }, { "Pow": [ { - "Const": [3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" }, 4 ] @@ -1757,7 +1762,6 @@ mod tests { println!("{:?}", transition_constraint); } - #[ignore] #[test] fn test_expr() { let json = r#" @@ -1765,14 +1769,14 @@ mod tests { "Sum": [ { "Internal": { - "id": 27, + "id": "27", "annotation": "a" } }, { "Fixed": [ { - "id": 28, + "id": "28", "annotation": "b" }, 1 @@ -1781,7 +1785,7 @@ mod tests { { "Shared": [ { - "id": 29, + "id": "29", "phase": 1, "annotation": "c" }, @@ -1791,7 +1795,7 @@ mod tests { { "Forward": [ { - "id": 30, + "id": "30", "phase": 2, "annotation": "d" }, @@ -1800,32 +1804,32 @@ mod tests { }, { "StepTypeNext": { - "id": 31, + "id": "31", "annotation": "e" } }, { - "Const": [3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" }, { "Mul": [ { - "Const": [4, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000004" }, { - "Const": [5, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000005" } ] }, { "Neg": { - "Const": [2, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000002" } }, { "Pow": [ { - "Const": [3, 0, 0, 0] + "Const": "0000000000000000000000000000000000000000000000000000000000000003" }, 4 ]