ZoKrates
ZoKrates copied to clipboard
Add `u128`
It is often useful to transfer multibit values where the values of bits matter. If I want to transfer a 1024 bit value now, for example, I need to use 32 inputs, because the widest value is u32.
It would be cheaper if I could send a u128
(and only need 8 of them), or even a u256
(and only need 4 of them).
Right! The main advantage here is when passing public inputs. One alternative way to solve the same problem could be to automatically "pack" public inputs: (field, u32, u32[3])
could for example fit in 2 public inputs. This is a knapsack problem, but we could go for a simplified solution.
Also need to consider the in-circuit costs of unpacking, but for uint it seems pretty much linear, so it would be a net gain to pack them.