KeccakSponge proof
The purpose of this Stark is to prove integrity of sponge operations as a part of building Keccak. KeccakSponge proof via zk-STARKs enables efficient verification of sponge operations as a part of building Keccak hashes that included in Patricia Merkle Trie and connect with other STARKs as Logic, Keccak, Data while proving using CTL's.
Circuit
Private inputs include data fields about each value:
inputincludes bytes for hashingtimestampat which inputs are read
Columns that are used in trace rows generation:
is_full_input_block1 if this row represents a full input block, i.e. one in which each byte is an input byte, not a padding byte; 0 otherwise.timestampthe timestamp at which inputs should be read from memory.lenThe length of the original input, in bytes.already_absorbed_bytesthe number of input bytes that have already been absorbed prior to this block,is_final_input_lenIf this row represents a final block row, the i-th entry should be 1 if the final chunk of input has length i (in other words iflen-already_absorbed_bytes== i), otherwise 0. If this row represents a full input block, this should contain all 0s.original_rate_u32sthe initial rate part of the sponge, at the start of this step.original_capacity_u32s: the capacity part of the sponge, encoded as 32-bit chunks, at the start of this step,block_bytesthe block being absorbed, which may contain input bytes and/or padding bytes,xored_rate u32sthe rate part of the sponge, encoded as 32-bit chunks, after the current block is xor’d in,but before the permutation is applied.,updated_state_u32sthe entire state (rate + capacity) of the sponge, encoded as 32-bit chunks, after the permutation is applied.updated_state_bytesthe entire state of the sponge as 32 bytes.
Constraints
The KeccakSponge Stark aims to constrain the following aspects:
Each flag (full-input block, final block or implied dummy flag) must be boolean.
Ensure that full-input block and final block flags are not set to 1 at the same time.
If this is the first row, the original sponge state should be 0 and
already_absorbed_bytesis equal to 0.If this is a final block, the next row’s original sponge state should be 0 and
already_absorbed_bytes= 0.If this is a full-input block, the next row’s ”before” should match our ”after” state.
If this is a full-input block, the next row’s
already_absorbed_bytesshould be ours plus 136.A dummy row is always followed by another dummy row, so the prover can’t put dummy rows ”in between” to avoid the above checks.
If this is a final block, is final input len implies
len-already_absorbed_bytes== i.
The functions are used in proving STARK using CTL:
ctl_data_block_bytes()using filter when we have leaf, node, root data in Data table is equal to concatenation columns ofxored_rate_u32s,original_capacity_u32s,updated_state_u32sfor input block in KeccakSponge table.ctl_keccak sponge():typed_dataof child hash in Data table have to be equal toupdated_state_bytesin KeccakSponge table when it’s the final input block.ctl_keccak()prove that concatenation columns ofxored_rate_u32s,original_capacity_u32s,updated_state_u32sin KeccakSpongeStark equal to concatenated permutation input and output in KeccakStark.ctl_logic()prove that concatenation columns oforiginal_rate_u32s,block_bytes,xored_rate_u32sand flag of xor operation in KeccakSponge table is equal to concatenation ofinput0(256 bits),input1(256 bits) and flag of xor operation. This function guarantees that xor operation of state andblock_bytesis correct.
Last updated