Hi,
Is the purpose of the json to serialise the circuit representation? I am just thinking that it is rather unwieldy and difficult to read.
I was thinking that standard software abstractions in terms of standard circuit components is much easier to read and reason about.
Hence, my take on this is that it is more productive to define a json representation for gates and gate configs, rather than circuits.
I have been designing such an interface in Rust that can be converted into a json representation.
Here is a preliminary look via an example.
fn arith_gate() -> Gate {
gateCfgs = GateConfigRegistry::new()
.insert("mul".to_string(), [
("m", Field::one()),
("l", Field::zero()),
("r", Field::zero()),
("o", -Field::one())
])
.insert("add".to_string(), [
("m", Field::zero()),
("l", Field::one()),
("r", Field::one()),
("o", -Field::one()),
]);
monomials = vec![
GateMonomial{sel: vec!["m"], wit: vec![0, 1]},
GateMonomial{sel: vec!["l"], wit: vec![0]},
GateMonomial{sel: vec!["r"], wit: vec![1]},
GateMonomial{sel: vec!["o"], wit: vec![2]},
];
Gate {
deg: 3,
width: 3,
params: params,
selectorWires: from_list(["m", "l", "r", "o"]),
data: monomials,
cfgRegistry: gateCfgs,
}
}
fn circuit() {
let c = PlonkCircuit::new_with_expected_size(1 << 20);
c.register_gate("arith", std_gates::arith_gate());
c.add_constraint(ConstraintData {
gateName: "arith",
gateConfig: Some("mul"),
inputs: c.get_inputs(["x", "y", "z"]),
dynamicConfig: None,
}
);
}