Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ZkProgram name as required argument #1200

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Conversation

mitschabaude
Copy link
Member

@mitschabaude mitschabaude commented Oct 26, 2023

Adds name argument to ZkProgram.

  • name is required in the new non-experimental API, but still optional in the old Experimental.ZkProgram
  • the name is an arbitrary string
  • the name will be used for caching. when using the name in filenames, we'll need some way to remove unsupported letters. the caching PR will handle this.
  • all examples updated to non-experimental API and to having a name

@mitschabaude mitschabaude requested a review from a team as a code owner October 26, 2023 14:44
Copy link
Contributor

@MartinMinkov MartinMinkov left a comment

Choose a reason for hiding this comment

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

Just had one question, but approving nonetheless :D

@@ -273,7 +275,7 @@ function ZkProgram<
let publicInputType: ProvablePure<any> = config.publicInput! ?? Undefined;
let publicOutputType: ProvablePure<any> = config.publicOutput! ?? Void;

let selfTag = { name: `Program${i++}` };
let selfTag = { name: config.name };
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to sanitize this input in any way since this will be written to disk? Some thoughts that come to mind:

  1. Safe encoding (making sure only alphanumeric characters and separators are specified)
  2. String length

These are just some thoughts, it's entirely up to you if you find them appropriate :D

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes very appropriate! I'll figure it out in the caching PR, maybe serialize them before using as filename but leave the name string on the ZkProgram in original form

@mitschabaude mitschabaude merged commit c012c32 into main Oct 26, 2023
13 checks passed
@mitschabaude mitschabaude deleted the feature/zk-program-name branch October 26, 2023 16:04
@barriebyron
Copy link
Contributor

oh thanks to Maki for noticing!
@garwalsh We missed corresponding doc updates for the ZkProgram API, tracking in https://app.zenhub.com/workspaces/zkapps-product-eng-6130fedb3b0fc600123d8796/issues/gh/o1-labs/docs2/711

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.

None yet

3 participants