Circuit Types
Circuit Data Types
There are two types of values inside a circuit: CircuitValue
and CircuitValue256
. Due to some specifics of our ZK proving system, a CircuitValue
can be at most 253 bits. Since EVM slots are 256 bits, we've created a CircuitValue256
that represents values in hi-lo form (hi is the most significant 128 bits, lo is the 128 least significant bits).
Here are the methods available on a CircuitValue
object:
Here are the methods available on a CircuitValue256
object.
By default all data results return CircuitValue256
. To use these results in other circuit operations that take CircuitValue
s, you must call .toCircuitValue()
. If you know that the data you are querying is less than 253 bits (ie. block number, address, uint128, etc.), this is totally safe. For values which may overflow 253 bits (such as storage slots, bytes32), this will fail if the value actually overflows (in particular, if the hi CircuitValue
exceeds 125 bits).
Last updated