Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Alexey Tsvetkov
    @aitsvet
    i have u8[256] pi = [ \ ...
    and i want output[i] = pi[input[i]]
    in def main(u8[64] input) -> u8[64]: ...
    sadly i get Expression input[i] of type u8 cannot be used as type field
    is there any trick to convert u8 to field in ZoKrates ?
    ah, here it is
    Alexey Tsvetkov
    @aitsvet
    well, it's not in the EMBED, had to import that .zok, got stack overflow when called u8_to_bits
    copied the function from the link to my .zok, still got stack overflow
    Thibaut Schaeffer
    @Schaeff
    @aitsvet would you mind opening an issue about this with steps to reproduce?
    Alexey Tsvetkov
    @aitsvet
    then i added -- --test-threads=1 to my cargo test ... and it fixed the SO
    Thibaut Schaeffer
    @Schaeff
    are you running it with --release ?
    Alexey Tsvetkov
    @aitsvet
    no, i just name a specific test, i'll try with --release
    runs faster with same result, thanks!
    Chaitanya Konda
    @ChaitanyaKonda
    Hi, is there a way to optimise memory consumption during compilation? I have a circuit that requires more than a whopping 512GB of memory and so compilation gets killed when it reaches this maximum. Don't think even setup would require this memory
    Alexey Tsvetkov
    @aitsvet
    i double this, a test for one of my functions requires 36 Gb to run, on a 32 Gb host it needs an hour to pass due to swap IO. more of it, i need to stack and loop calls of that function, so would one call require a day to process?
    any ideas on where to look at in core ?
    Thibaut Schaeffer
    @Schaeff
    Hey @ChaitanyaKonda sorry to hear that, we're working on a number of improvements on memory consumption, do you also have the issue when running zokrates check? In the past the optimiser has been the main cause of issues like this
    Michael Connor
    @iAmMichaelConnor

    Hi all, it's been a while :)
    What's the most efficient way to check for underflows / overflows?
    E.g. If I have a = b + c, what's the neatest way to ensure b + c doesn't overflow the field modulus?
    E.g. If I have a = b - c, what's the neatest way to ensure b > c?
    E.g. If I have a = b * c, what's the neatest way to ensure b * c doesn't overflow the field modulus?
    E.g. If I have a = b / c, is there a way to ensure c 'divides' b in the 'integer' sense? Like passing a, b, c as inputs and asserting that c * a == b and ensuring c * a doesn't overflow the field modulus (somehow)?

    Presumably I'd need to do the calculations in bits, to check for bits 'carrying over' 2**253?
    Does anyone have any neat implementations? :)

    Paul Etscheit
    @petscheit
    Hi, i've switched to using the develop version to make use of the embedded sha256 libraries. I just realized that the develop includes unconstrained variable checks now which is kind of a problem for my usecase. Is there a way to deactivate them?
    Paul Etscheit
    @petscheit
    Update:
    Disabling this was easy enough and tests still pass so I guess that's fine. I am wondering if this can be disabled when compiling (a .zok) though, as it can be limiting for some use-cases. For example, I'm working on a program that batch checks and updates a merkle tree. Depending on the position of the leafs I have a different number leafs and proof hashes. By using some booleans and padding I was able to build this in a way that works for a large number of leaf combinations all in the same program. However, this required passing variables which are never used, which is prevented by the unconstrained variable checks. Maybe that's something to consider.
    Michael Connor
    @iAmMichaelConnor
    ^^^ It would be useful if the "unconstrained private parameters" error could be 'turned off' sometimes. To debug a circuit, I used to comment-out lots of lines of code, to hone in on the bug. But now the "unconstrained private parameters" error prevents me from using this debugging technique. I end up having to create lots of dummy constraints, just so that the test will run.
    Duncan Westland
    @Westlad
    ^^^ There's an issue about this already, we just need someone with time to work on it Zokrates/ZoKrates#686
    Thibaut Schaeffer
    @Schaeff
    Hey everyone thanks for flagging this again, the develop now has a flag to disable unused parameter checks at compile time
    Duncan Westland
    @Westlad
    @Schaeff @dark64 Addition of this flag is brilliant! Thank you so much for doing that!
    Paul Etscheit
    @petscheit
    @Schaeff Nice! Thanks for the quick response
    Paul Etscheit
    @petscheit
    Hi, I think there is a problem with the current develop branch. I'm getting errors when executing, that I dont get when I compile with the current master release, and I feel like it has to do with the unconstrained variable checks. I made a repo outlining the problem, maybe someone can reproduce it. https://github.com/petscheit/zok_dev_unused_vari
    smithsen
    @smithsen
    Hi, I had a few questions in Zokrates. First, I wanted to know if I want to run an image through a circuit is that possible? Last time I asked this question, I was told that this is difficult and complicated, next I think I would like to use an ASCII file in a circuit, is that possible? Also, I was wondering, if importing a file in current directory for instance "from "./mycode" import foo
    ", in "https://zokrates.github.io/language/imports.html" mean that I can import an ASCII file, if so can I perform a hash on it as well ? Also if it is possible to give some sample code which can help in this regard. Hoping to hear soon.
    Thibaut Schaeffer
    @Schaeff
    @petscheit thanks, looking into it
    Thibaut Schaeffer
    @Schaeff
    @petscheit We pushed a fix to develop
    Paul Etscheit
    @petscheit
    Wow, impressive speed! Thanks a lot!
    Chaitanya Konda
    @ChaitanyaKonda

    Hi all,

    I’m working on a bit of an edge case where I need to check if a field is a positive number by doing either assert(field > 0) or assert(field < (field_prime-1)/2). The problem here is that ZoKrates implements comparison operators such that the operands have to be strictly less than biggest power of 2 lower than p/2. Let’s take the example of Bn128, the operands here will have to be lower than 2^252 even though the field elements can be greater than 2^252 and lower than bn128_prime of 2592827839077369332604021086610909215435616943586837466384278596745456903517. So assert(field > 0) would fail during compute witness stage if field passed into witness is greater than 2^252 but less than bn128_prime. Andassert(field < (bn128_prime-1)/2) would fail at compile stage because (bn128_prime-1)/2 is already greater than 2^252. Can this limitation be worked on in ZoKrates’s rust code ? Thank you

    Thibaut Schaeffer
    @Schaeff
    Hi @ChaitanyaKonda yes there is actually a cheaper and complete (works for any x) x < constant check, the one we have now is x < y for x and y both variables. We already use it internally (here https://github.com/Zokrates/ZoKrates/blob/master/zokrates_core/src/flatten/mod.rs#L204)
    We'll add it soon and that should fix the issue you're having
    Chaitanya Konda
    @ChaitanyaKonda
    @Schaeff That's very efficient and helpful! When do you expect to add this into master or develop?
    Thibaut Schaeffer
    @Schaeff
    It should be on develop before the end of next week
    Chaitanya Konda
    @ChaitanyaKonda
    Brilliant !
    eyooooo
    @eyooooo
    hi
    any of the Zokrates devs used to go by @zokrates in SNX discord?
    smithsen
    @smithsen
    Hi, I just wanted to know if I have for instance a data of 15232 bits and do the hash over it, is it possible ? Also how does one take a text file as input values to a code while making a circuit ?
    Thibaut Schaeffer
    @Schaeff
    @eyooooo No
    eyooooo
    @eyooooo
    hey this is a total long shot - a friend of mine is having an issue with deploying a contract where he gets Warning! Error encountered during contract execution [execution reverted] and were having trouble troubleshooting the tx
    tenderly doesnt really provide any details
    if anyone has any suggestions on how to tshoot this that would be awesome
    Thibaut Schaeffer
    @Schaeff
    Hey @eyooooo if you feel this is related to ZoKrates, please open an issue with all steps to reproduce, cheers!
    smithsen
    @smithsen

    I made some small adjustments to get_hask.zok and please find attached my part of code, "import "hashes/sha256/512bit" as sha256

    def main(u32[192] hashMe) -> u32[96] result:
    for field i in 0..12 do
    u32[8] h = sha256(hashMe[16i..16i+8], hashMe[16i+8..16i+16])
    result[8i..8i+8] = h
    endfor
    return result"

    I get an error message "zokrates compile -i get_hash.zok -o get_hash --light
    Compiling get_hash.zok

    Compilation failed:

    get_hash.zok: --> 3:36
    |
    3 | def main(u32[192] hashMe) -> u32[96] result:␊
    | ^---
    |
    = expected op_or, op_and, op_bit_xor, op_bit_and, op_bit_or, op_equal, op_not_equal, op_lt, op_lte, op_gt, op_gte, op_add, op_sub, op_mul, op_div, op_pow, op_left_shift, or op_right_shift"

    I do not quite understand where I am going wrong. If anyone can please help me. I will be really grateful
    MunimShabir
    @MunimShabir
    Hi, I am a PhD student in SDN and just starting with Zokrates. I have a question which may sound extremely stupid and I am sorry about that, but could anyone help me understand how can I provide proof for a program or module written outside ZoKrates, I have a middleware which reads data off the blockchain and hop it on to the SDN APIs. I need to prove that middleware is doing its honestly. Is there a workaround to that?
    smithsen
    @smithsen

    I get an error message "zokrates compile -i get_hash.zok -o get_hash --light
    Compiling get_hash.zok

    Compilation failed:

    get_hash.zok: --> 3:36
    |
    3 | def main(u32[192] hashMe) -> u32[96] result:␊
    | ^---
    |
    = expected op_or, op_and, op_bit_xor, op_bit_and, op_bit_or, op_equal, op_not_equal, op_lt, op_lte, op_gt, op_gte, op_add, op_sub, op_mul, op_div, op_pow, op_left_shift, or op_right_shift"

    Hi, Please let me know what I am doing wrong, I really need to know, it is important for me. Thanks !!

    Darko Macesic
    @dark64

    I get an error message "zokrates compile -i get_hash.zok -o get_hash --light
    Compiling get_hash.zok

    Compilation failed:

    get_hash.zok: --> 3:36
    |
    3 | def main(u32[192] hashMe) -> u32[96] result:␊
    | ^---
    |
    = expected op_or, op_and, op_bit_xor, op_bit_and, op_bit_or, op_equal, op_not_equal, op_lt, op_lte, op_gt, op_gte, op_add, op_sub, op_mul, op_div, op_pow, op_left_shift, or op_right_shift"

    Hi, Please let me know what I am doing wrong, I really need to know, it is important for me. Thanks !!

    omit the name of the return value def main(u32[192] hashMe) -> u32[96]: