-
Notifications
You must be signed in to change notification settings - Fork 661
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
Support for Static Strings #435
Comments
Some initial design questions [with comments in brackets] about this feature for DP3:
|
I think we want to avoid bringing the Unicode tables into the R1CS. What are the operations that are most needed? And then what is the representation that will make that work efficiently? For example, if a common operation is |
I had a look at string support in Solidity. In short: There are string literals, but they really are just another way to denote byte arrays of various kinds, and there seem to be no operations on strings as such. A bit more detail: There is a Besides the There are two kinds of string literals: one without prefix that denotes ASCII, and one prefixed by |
Here are some more string ideas. No attempt to be complete, but some things to think about.
Motivating example of string search. Let's say that you log transactions to a confidential database, and you publish the hashes of the logs The Leo program takes a public hash of the log, a public string (or regex), and a private copy of the log, You would run the program, and prove to the verifier that the program got answer 2: the string How big are these logs, and how big would the resulting circuit be? This could be challenging. More observations. If a string is a byte array in UTF-8, then the meaning of a byte is context-dependent. Adapters: it would be good if the definition of a Leo program could include some additional |
Here is a summary of the preliminary and tentative design ideas discussed at today's weekly sync, with some additional thoughts, just so that we have a record of what was discussed. Please add anything I may have forgotten. Programmer's view (largely independent from R1CS compilation):
Compilation to R1CS:
|
Variable-length arrays that are implemented by a fixed, larger array and a fill pointer would be especially useful for concatenating strings. Max had a related proposal. It would be good to have library routines for
|
Would it make sense for this kind of variable-length arrays/strings to be realized via (library) circuit types? |
I suggest we use the exact syntax for Rust character and string escapes in literal characters and strings. https://doc.rust-lang.org/reference/tokens.html#character-and-string-literals Possibly we could remove the thing where spaces after backslash newline I see on Asana that casting is a P1 for DP3a. Another thing on chars potentially representing code points not part of any Unicode encoding: |
Added to Leo in #974 |
🚀 Feature
Support for Static Strings
Motivation
Usage of strings is common in web programming and is table stakes
The text was updated successfully, but these errors were encountered: