2023-10-25 18:12:26 +02:00
|
|
|
|
|
|
|
|
Storage proof `circom` circuit
|
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
|
|
See the [README in the parent dir](../README.md) for the (draft) specification.
|
|
|
|
|
|
|
|
|
|
### Organization of the circuit code
|
|
|
|
|
|
2024-03-12 11:48:13 +01:00
|
|
|
- `codex` - the storage proof circuit
|
|
|
|
|
- `poseidon2` - Poseidon2 hash function
|
|
|
|
|
- `lib` - general purpose, reusable circom templates ("circuit library")
|
|
|
|
|
|
|
|
|
|
In `codex`:
|
|
|
|
|
|
2023-12-15 22:12:37 +01:00
|
|
|
- `sample_cells.circom` - compute cell indices to sample, and prove those cells
|
2023-10-25 18:12:26 +02:00
|
|
|
- `single_cell.circom` - prove a single cell
|
2023-12-15 22:12:37 +01:00
|
|
|
- `merkle.circom` - Merkle inclusion proof (using our custom Merkle tree convention)
|
2024-03-12 11:48:13 +01:00
|
|
|
|
|
|
|
|
In `poseidon2`
|
|
|
|
|
|
|
|
|
|
- `poseidon2_hash.circom` - compute Poseidon2 hash with sponge construction
|
|
|
|
|
- `poseidon2_sponge.circom` - generic sponge construction
|
|
|
|
|
- `poseidon2_perm.circom` - the Poseidon2 permutation
|
2024-03-12 12:08:06 +01:00
|
|
|
- `poseidon2_compr.circom` - the compression function
|
2024-03-12 11:48:13 +01:00
|
|
|
|
|
|
|
|
In `lib`:
|
|
|
|
|
|
2023-10-25 18:12:26 +02:00
|
|
|
- `extract_bits.circom` - extract lower bits of the *standard representation* of a field element
|
|
|
|
|
- `binary_compare.circom` - compare numbers given in binary representation (the point is that they can be bigger than the field size!)
|
2023-12-15 22:12:37 +01:00
|
|
|
- `log2.circom` - circom code for computing base 2 logarithm
|
2023-10-25 18:12:26 +02:00
|
|
|
- `misc.circom` - miscellaneous helper funtions
|
2024-03-12 11:48:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### Main component
|
2023-10-25 18:12:26 +02:00
|
|
|
|
2023-12-15 22:12:37 +01:00
|
|
|
Note: the main component is not included in the above, as it depends on the
|
|
|
|
|
parameters. You can use one of the reference input generators to create one;
|
2024-03-12 11:48:13 +01:00
|
|
|
if you want to do manually, it should look like this:
|
|
|
|
|
|
|
|
|
|
pragma circom 2.0.0;
|
|
|
|
|
include "sample_cells.circom";
|
|
|
|
|
|
|
|
|
|
// argument conventions:
|
|
|
|
|
// SampleAndProven( maxDepth, maxLog2NSlots, blockTreeDepth, nFieldElemsPerCell, nSamples )
|
|
|
|
|
component main {public [entropy,dataSetRoot,slotIndex]} = SampleAndProve(32, 8, 5, 67, 100);
|
2023-10-25 18:12:26 +02:00
|
|
|
|
|
|
|
|
|