Skip to content

Zokrates DSL update#400

Merged
jtcoolen merged 7 commits intomasterfrom
julian@dsl-update
Jul 1, 2025
Merged

Zokrates DSL update#400
jtcoolen merged 7 commits intomasterfrom
julian@dsl-update

Conversation

@jtcoolen
Copy link
Copy Markdown
Contributor

@jtcoolen jtcoolen commented May 23, 2025

This PR fixes #388

@jtcoolen jtcoolen self-assigned this May 23, 2025
@jtcoolen jtcoolen force-pushed the julian@dsl-update branch 14 times, most recently from 8fdc005 to f0e245a Compare May 30, 2025 08:52
@jtcoolen jtcoolen force-pushed the julian@dsl-update branch 14 times, most recently from a7d422c to cbff56d Compare June 3, 2025 16:08
Comment thread src/codeGenerators/circuit/zokrates/toCircuit.ts

zokrates:
image: ghcr.io/eyblockchain/zokrates-worker-updated:latest
image: ghcr.io/jtcoolen/zokrates-worker-api:latest
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to push a new image under the EYBlockchain domain

@lydiagarms lydiagarms self-requested a review June 10, 2025 14:20
Comment thread src/transformers/toCircuit.ts Outdated
//generate the circuit files from the newly created circuit AST:
logger.verbose('Generating files from the .zok AST...');
const circuitFileData = codeGenerator(newAST);
let circuitFileData = codeGenerator(newAST, state);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, is there a reason the information needs to be stored in state as opposed to inside the circuit AST?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well one could annotate functions' nodes in the AST with the whether they are called from other functions, but this requires one full AST traversal to identify which functions are internal function calls. Storing the internal function calls during one AST traversal in a global state is convenient.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the state is to store information for use later in the AST traversal in toCircuitVisitor. The purpose of the newly generated circuit AST is to be used in the toCircuit code generation. I don't think it should affect the number of AST traversals, because it could be done where it currently is done, inside the toCircuitVisitor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I reckon we could store the info of whether a particular function is used in an internal function call in the function's node, this approach of storing this info in the global state structure is convenient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the usage of state in toCircuitVisitor but couldn't in toCircuit because we need to store the wrapper functions during the code generation to later introduce the new .zok files for the wrapper functions. Instead of passing the state to the codeGenerator function used global variables.


zokrates2:
image: ghcr.io/eyblockchain/zokrates-worker-updated:latest
image: ghcr.io/jtcoolen/zokrates-worker-api:latest
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure to push the new version before we merge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up the branch https://github.com/EYBlockchain/zokrates-worker/tree/julian/swati/starlight which is used to build the Docker image

@EYBlockchain EYBlockchain deleted a comment from lydiagarms Jun 16, 2025
@jtcoolen jtcoolen force-pushed the julian@dsl-update branch 17 times, most recently from 9e50680 to df45a6c Compare June 26, 2025 11:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 1, 2025

🎉 This PR is included in version 1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZoKrates DSL syntax update

2 participants