Skip to main content

Halo2 Circuits

Troubleshooting Sindri errors with Halo2 (Axiom v0.3.0) circuits.

When using Sindri to create and prove Halo2 circuits, you may encounter an error response from your request. The following list shows common errors at each API endpoint.

Circuit Detail​

Errorno function or associated item named default found for struct
Status Code200
Circuit StatusFailed
CauseYour circuit input definition does not include the default constructor.
Resolution

Ensure that your struct either inherits this function or implement a custom definition of the default function. An example definition can be found in the Axiom v0.3.0 API Tutorial.

Example Response Body "error"

{
"error": "cmd: cargo --quiet build --release stdout: stderr: error[E0599]: no function or associated item named `default` found for struct `CircuitInput` in the current scope\n --> src/bin/prover.rs:225:73\n |\n225 | let input = quadratic_circuit::circuit_def::CircuitInput::<Fr>::default(); \n | ^^^^^^^ function or associated item not found in `CircuitInput<Fr>`\n\nerror[E0599]: no function or associated item named `default` found for struct `CircuitInput` in the current scope\n --> src/bin/prover.rs:246:73\n |\n246 | let input = quadratic_circuit::circuit_def::CircuitInput::<Fr>::default(); \n | ^^^^^^^ function or associated item not found in `CircuitInput<Fr>`\n\nerror[E0599]: no function or associated item named `default` found for struct `CircuitInput` in the current scope\n --> src/bin/prover.rs:284:73\n |\n284 | let input = quadratic_circuit::circuit_def::CircuitInput::<Fr>::default();\n | ^^^^^^^ function or associated item not found in `CircuitInput<Fr>`\n\nerror[E0599]: no function or associated item named `default` found for struct `CircuitInput` in the current scope\n --> src/bin/prover.rs:343:73\n |\n343 | let input = quadratic_circuit::circuit_def::CircuitInput::<Fr>::default(); \n | ^^^^^^^ function or associated item not found in `CircuitInput<Fr>`\n\nFor more information about this error, try `rustc --explain E0599`.\nerror: could not compile `prover` due to 4 previous errors\n"
}
Error

no function or associated item named from_json found for struct

Status Code200
Circuit StatusFailed
Cause

You have not implemented a constructor which allows the Sindri prover to instantiate your struct from JSON.

Resolution

Implement a method called from_json which accepts the path of a JSON file and returns an instance of your circuit input struct. An example of this function can be found in the Axiom v0.3.0 API Tutorial.

Example Response Body "error"

{
"error": "cmd: cargo --quiet build --release stdout: stderr: error[E0599]: no function or associated item named `from_json` found for struct `CircuitInput` in the current scope\n --> src/bin/prover.rs:279:73\n |\n279 | let input = quadratic_circuit::circuit_def::CircuitInput::<Fr>::from_json(&input_fn);\n | ^^^^^^^^^ function or associated item not found in `CircuitInput<Fr>`\n\nFor more information about this error, try `rustc --explain E0599`.\nerror: could not compile `prover` due to previous error\n"
}
Error

no method named break_points found for struct

Status Code200
Circuit StatusFailed
Cause

You have not implemented a function which retrieves the break points from a circuit for serialization and loading during a proof.

Resolution

Your circuit should implement the break_points function. See the Axiom v0.3.0 API Tutorial for an example implementation.

Example Response Body "error"

{
"error": "cmd: cargo --quiet build --release stdout: stderr: error[E0599]: no method named `break_points` found for struct `QuadraticCircuitBuilder` in the current scope\n --> src/bin/prover.rs:256:36\n |\n256 | let break_points = circuit.break_points();\n | ^^^^^^^^^^^^ method not found in `QuadraticCircuitBuilder<Fr>`\n |\nhelp: one of the expressions' fields has a method of the same name\n |\n256 | let break_points = circuit.0.break_points();\n | ++\n\nerror[E0599]: no method named `instance` found for struct `QuadraticCircuitBuilder` in the current scope\n --> src/bin/prover.rs:281:32\n |\n281 | let instance = circuit.instance();\n | ^^^^^^^^ method not found in `QuadraticCircuitBuilder<Fr>`\n |\nhelp: one of the expressions' fields has a method of the same name\n |\n281 | let instance = circuit.0.instance();\n | ++\n\nFor more information about this error, try `rustc --explain E0599`.\nerror: could not compile `prover` due to 2 previous errors\n"
}
Error

associated function create_circuit is private

Status Code200
Circuit StatusFailed
Cause

You have implemented one of the required functions, but not specified that it should be public. Hence, the external Sindri prover cannot use this function.

Resolution

Insert the pub specifier before any required function definition.

Example Response Body "error"

{
"error": "cmd: cargo --quiet build --release stdout: stderr: error[E0624]: associated function `create_circuit` is private\n --> src/bin/prover.rs:226:29\n |\n226 | let circuit = input.create_circuit(GateThreadBuilder::keygen(), None);\n | ^^^^^^^^^^^^^^ private associated function\n |\n ::: /tmp/circuits/45b431e2-0a9d-4058-8f48-3c613d58f9a6_1693252455920175/circuit/src/circuit_def.rs:48:5\n |\n48 | / fn create_circuit(\n49 | | self,\n50 | | mut builder: GateThreadBuilder<F>,\n51 | | break_points: Option<MultiPhaseThreadBreakPoints>,\n52 | | ) -> QuadraticCircuitBuilder<F> {\n | |___________________________________- private associated function defined here\n\nerror[E0624]: associated function `create_circuit` is private\n --> src/bin/prover.rs:247:29\n |\n247 | let circuit = input.create_circuit(GateThreadBuilder::keygen(), None);\n | ^^^^^^^^^^^^^^ private associated function\n |\n ::: /tmp/circuits/45b431e2-0a9d-4058-8f48-3c613d58f9a6_1693252455920175/circuit/src/circuit_def.rs:48:5\n |\n48 | / fn create_circuit(\n49 | | self,\n50 | | mut builder: GateThreadBuilder<F>,\n51 | | break_points: Option<MultiPhaseThreadBreakPoints>,\n52 | | ) -> QuadraticCircuitBuilder<F> {\n | |___________________________________- private associated function defined here\n\nerror[E0624]: associated function `create_circuit` is private\n --> src/bin/prover.rs:280:29\n |\n280 | let circuit = input.create_circuit(GateThreadBuilder::prover(), Some(break_points));\n | ^^^^^^^^^^^^^^ private associated function\n |\n ::: /tmp/circuits/45b431e2-0a9d-4058-8f48-3c613d58f9a6_1693252455920175/circuit/src/circuit_def.rs:48:5\n |\n48 | / fn create_circuit(\n49 | | self,\n50 | | mut builder: GateThreadBuilder<F>,\n51 | | break_points: Option<MultiPhaseThreadBreakPoints>,\n52 | | ) -> QuadraticCircuitBuilder<F> {\n | |___________________________________- private associated function defined here\n\nerror[E0624]: associated function `create_circuit` is private\n --> src/bin/prover.rs:285:36\n |\n285 | ... let loader_circuit = input.create_circuit(GateThreadBuilder::keygen(), None); let pk : ProvingKey<G1Affine> = custom_read_pk...\n | ^^^^^^^^^^^^^^ private associated function\n |\n ::: /tmp/circuits/45b431e2-0a9d-4058-8f48-3c613d58f9a6_1693252455920175/circuit/src/circuit_def.rs:48:5\n |\n48 | / fn create_circuit(\n49 | | self,\n50 | | mut builder: GateThreadBuilder<F>,\n51 | | break_points: Option<MultiPhaseThreadBreakPoints>,\n52 | | ) -> QuadraticCircuitBuilder<F> {\n | |___________________________________- private associated function defined here\n\nerror[E0624]: associated function `create_circuit` is private\n --> src/bin/prover.rs:344:29\n |\n344 | let circuit = input.create_circuit(GateThreadBuilder::keygen(), None);\n | ^^^^^^^^^^^^^^ private associated function\n |\n ::: /tmp/circuits/45b431e2-0a9d-4058-8f48-3c613d58f9a6_1693252455920175/circuit/src/circuit_def.rs:48:5\n |\n48 | / fn create_circuit(\n49 | | self,\n50 | | mut builder: GateThreadBuilder<F>,\n51 | | break_points: Option<MultiPhaseThreadBreakPoints>,\n52 | | ) -> QuadraticCircuitBuilder<F> {\n | |___________________________________- private associated function defined here\n\nFor more information about this error, try `rustc --explain E0624`.\nerror: could not compile `prover` due to 5 previous errors\n"
}