Skip to content

Conversation

@hecmas
Copy link
Collaborator

@hecmas hecmas commented Mar 18, 2025

Related to #22 and #18.

Add a utility function getOutput that takes a witness and a map where the keys represent the desired output names and the values indicate the number of elements to retrieve. It returns the corresponding circuit outputs from the witness.

For example:

let output = await circuit.getOutput(witness, { a_inv: 5, b_inv: 5 });

gives back:

{
  a_inv: [
    18015910124504391758n,
    10263769591271306743n,
    17554040121178085313n,
    8619307900730399718n,
    11898114031726211586n
  ],
  b_inv: [ 0n, 0n, 0n, 0n, 0n ]
}

It is perfectly fine to specify fewer outputs than the total available, as well as to request fewer elements than the full output size. For example:

let output = await circuit.getOutput(witness, { a_inv: 3 });

would produce the following output:

{
  a_inv: [ 18015910124504391758n, 10263769591271306743n, 17554040121178085313n ]
}

@hecmas hecmas requested a review from OBrezhniev March 18, 2025 17:24
@hecmas hecmas self-assigned this Mar 18, 2025
@OBrezhniev OBrezhniev merged commit 888f7dd into main Mar 20, 2025
2 checks passed
@OBrezhniev OBrezhniev deleted the feature/get-output branch March 20, 2025 17:21
@hecmas hecmas restored the feature/get-output branch May 29, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants