Expand description
Hasher chiplet trace constants and types.
This module defines the structure of the hasher chiplet’s execution trace, including:
- Trace selectors that determine which hash operation is being performed
- State layout for the Poseidon2 permutation (12 field elements: 8 rate + 4 capacity)
- Column ranges and indices for accessing trace data
The hasher chiplet supports several operations:
- Linear hashing (absorbing arbitrary-length inputs)
- 2-to-1 hashing (Merkle tree node computation)
- Merkle path verification
- Merkle root updates (for authenticated data structure modifications)
Structs§
- Hasher
- Implementation of the Poseidon2 hash function with 256-bit output.
- Word
- A unit of data consisting of 4 field elements.
Constants§
- CAPACITY_
COL_ RANGE - The capacity portion of the hasher state in the execution trace, located in columns 11..15. With LE sponge state layout [RATE0, RATE1, CAP], capacity comes last.
- CAPACITY_
DOMAIN_ IDX - The index in the hasher state where the domain is set when initializing the hasher.
- CAPACITY_
LEN - Number of field elements in the capacity portion of the hasher’s state.
- DIGEST_
LEN - DIGEST_
RANGE - The output portion of the hash state, located in the first rate word (RATE0).
- HASH_
CYCLE_ LEN - The number of rows in the execution trace required to compute a permutation of Poseidon2. This is equal to 32.
- HASH_
CYCLE_ LEN_ FELT - LAST_
CYCLE_ ROW - Index of the last row in a permutation cycle (0-based).
- LAST_
CYCLE_ ROW_ FELT - LINEAR_
HASH - Specifies a start of a new linear hash computation or absorption of new elements into an executing linear hash computation. These selectors can also be used for a simple 2-to-1 hash computation.
- LINEAR_
HASH_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 1, 0, 0],flag = rev(selector) + 1 = [0, 0, 1 | 0] + 1 = 3 - MP_
VERIFY - Specifies a start of Merkle path verification computation or absorption of a new path node into the hasher state.
- MP_
VERIFY_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 1, 0, 1],flag = rev(selector) + 1 = [1, 0, 1 | 0] + 1 = 11 - MR_
UPDATE_ NEW - Specifies a start of Merkle path verification or absorption of a new path node into the hasher state for the “new” node value during Merkle root update computation.
- MR_
UPDATE_ NEW_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 1, 1, 1],flag = rev(selector) + 1 = [1, 1, 1 | 0] + 1 = 15 - MR_
UPDATE_ OLD - Specifies a start of Merkle path verification or absorption of a new path node into the hasher state for the “old” node value during Merkle root update computation.
- MR_
UPDATE_ OLD_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 1, 1, 0],flag = rev(selector) + 1 = [0, 1, 1 | 0] + 1 = 7 - NUM_
ROUNDS - Number of round steps used to complete a single permutation.
- NUM_
SELECTORS - Number of selector columns in the trace.
- P1_
COL_ IDX - Index of the auxiliary trace column tracking the state of the sibling table.
- RATE_
COL_ RANGE - The rate portion of the hasher state in the execution trace, located in columns 3..11. With LE sponge state layout [RATE0, RATE1, CAP], rate comes first.
- RATE_
LEN - Number of field elements in the rate portion of the hasher’s state.
- RETURN_
HASH - Specifies a completion of a computation such that only the hash result (values in h0, h1, h2 h3) is returned.
- RETURN_
HASH_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 0, 0, 0],flag = rev(selector) + 1 = [0, 0, 0 | 0] + 1 = 1 - RETURN_
STATE - Specifies a completion of a computation such that the entire hasher state (values in h0 through h11) is returned.
- RETURN_
STATE_ LABEL - Unique label computed as 1 plus the full chiplet selector with the bits reversed.
selector = [0 | 0, 0, 1],flag = rev(selector) + 1 = [1, 0, 0 | 0] + 1 = 9 - STATE_
COL_ RANGE - The hasher state portion of the execution trace, located in columns 3..15.
- STATE_
WIDTH - Number of field element needed to represent the sponge state for the hash function.
- TRACE_
WIDTH - Number of columns in Hasher execution trace. There is one additional column for the node index.
Type Aliases§
- Hasher
State - Type for the Hasher’s state.
- Selectors
- Type for Hasher trace selector. These selectors are used to define which transition function is to be applied at a specific row of the hasher execution trace.