Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2022_09_10" }
lazy_static = "1.4.0"
thiserror = "1.0"
bitvec = "0.22"
bitvec = "1"

[patch."https://github.com/privacy-scaling-explorations/halo2.git"]
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "halo2-ecc-snark-verifier-0220" }
Expand All @@ -24,10 +24,6 @@ poseidon = { git = "https://github.com/scroll-tech/poseidon.git", branch = "halo
[patch."https://github.com/privacy-scaling-explorations/halo2curves.git"]
halo2curves = { git = "https://github.com/scroll-tech/halo2curves.git", branch = "halo2-ecc-snark-verifier-0220" }

[patch.crates-io]
# temporary solution to funty@1.2.0 being yanked, tracking issue: https://github.com/ferrilab/funty/issues/7
funty = { git = "https://github.com/ferrilab/funty/", rev = "7ef0d890fbcd8b3def1635ac1a877fc298488446" }

[features]
# printout the layout of circuits for demo and some unittests
# print_layout = ["halo2_proofs/dev-graph"]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
nightly-2022-12-10
31 changes: 21 additions & 10 deletions spec/hash-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

## Interface Table

The hash circuit exposes a table containing multiple inputs/output pairs. This table can be looked up by the MPT and codehash circuits. The table has four columns: 2 inputs, 1 digest output, and 1 for control flags.
The hash circuit exposes a table containing multiple inputs/output pairs. This table can be looked up by the MPT and codehash circuits. The table has four columns: 2 inputs, 1 digest output, 2 for control flags and additional marking.

| 0: Hash index | 1: Message | 2: Message | 3: Control flag |
| --------------- | ---------------- | --------------- | --------------- |
| MPT digest | MPT input 1 | MPT input 2 | 0 |
| | | | |
| var-len digest | word 0 | word 1 | 2000 |
| var-len digest | word 2 | word 3 | 1968 |
| ... | ... | ... | ... |
| var-len digest | word W-2 | word W-1 | 16 |
| | | | |
| 0: Hash index | 1: Message | 2: Message | 3: Control flag | 4: Head flag |
| --------------- | ---------------- | --------------- | --------------- | ------------ |
| MPT digest | MPT input 1 | MPT input 2 | 0 | 1 |
| | | | | |
| var-len digest | word 0 | word 1 | 2000 | 1 |
| var-len digest | word 2 | word 3 | 1968 | 0 |
| ... | ... | ... | ... | 0 |
| var-len digest | word W-2 | word W-1 | 16 | 0 |
| | | | | |


The hash circuit supports two modes:
Expand All @@ -49,6 +49,17 @@ Compute the digest of a variable-length message. One such entry is composed of c

Specifically, `STEP = 32`.

### Head flag

The head flag is set at each beginning of message, i.e each row under MPT mode and the first row of message in Var-Len mode would be set to 1

### Custom row

2 Additional row is put at the beginning of hash table:

1. A row being filled with 0 for any lookup which is not enabled
2. A row with `control` and `Message` field being set to 0 and the hash is set to a customed value for representing
the hash of empty message. Currently it is set to equal to `keccak256(nil)` and the indexed hash value must be properly set under challenge API

## Internal Table (hash_table_aux)

Expand Down
Loading