pub fn read_query_responses_and_decommit(
    ctx: & mut Vec<Uint256>, 
    n_total_columns: usize, 
    n_columns: usize, 
    proof_data_idx: usize, 
    merkle_root: Uint256
) {
    assert!( n_columns <= stark_params::N_COLUMNS_IN_MASK + stark_params::CONSTRAINTS_DEGREE_BOUND ); //Too many columns

    let n_unique_queries = ctx[map::MM_N_UNIQUE_QUERIES].clone();
    let channel_idx = map::MM_CHANNEL;
    let mut fri_queue = map::MM_FRI_QUEUE;
    let fri_queue_end = fri_queue + uint256_ops::to_usize(&n_unique_queries) * 3;
    let mut merkle_ptr = map::MM_MERKLE_QUEUE;
    let l_hash_mask = get_hash_mask();
    let proof_data_skip_bytes = n_total_columns - n_columns;
    let mut proof_data_i = proof_data_idx; 
    let mut proof_idx = uint256_ops::to_usize(&ctx[channel_idx]);

    while fri_queue < fri_queue_end {
        let mut combined_data: Vec<u8> = vec![0; 32*(n_columns+1)];
        for i in proof_idx..=proof_idx+n_columns {
            let bytes = uint256_ops::to_fixed_bytes( &ctx[i] );
            for j in 0..bytes.len() {
                combined_data[ 32*(i-proof_idx) + j] = bytes[j];
            }
        }
        let mut merkle_leaf = uint256_ops::bitwise_and( &l_hash_mask, &uint256_ops::keccak_256(&combined_data) );

        // If a leaf contains only 1 field element we don't hash it.
        if n_columns == 1 {
            merkle_leaf = ctx[proof_idx].clone();
        }

        // push(queryIdx, hash(row)) to merkleQueue.
        ctx[merkle_ptr] = ctx[fri_queue].clone();
        ctx[merkle_ptr+1] = merkle_leaf;
        merkle_ptr += 2;

        // Copy query responses to proofData array.
        // This array will used in OODS
        let end = proof_idx + n_columns;
        while proof_idx < end {
            ctx[proof_data_i] = ctx[proof_idx].clone();
            proof_data_i += 1;
            proof_idx += 1;
        }

        proof_data_i += proof_data_skip_bytes;
        fri_queue += 3;
    }

    ctx[channel_idx] = uint256_ops::from_usize(proof_idx);

    verify_merkle(channel_idx, ctx, merkle_ptr, merkle_root,  uint256_ops::to_usize(&n_unique_queries));
}
/*
    Reads query responses for n_columns from the channel with the corresponding authentication
    paths. Verifies the consistency of the authentication paths with respect to the given
    merkle_root, and stores the query values in proofDataPtr.

    n_total_columns is the total number of columns represented in proofDataPtr (which should be
    an array of n_unique_queries rows of size n_total_columns). n_columns is the number of columns
    for which data will be read by this function.
    The change to the proofDataPtr array will be as follows:
    * The first n_columns cells will be set,
    * The next n_total_columns - n_columns will be skipped,
    * The next n_columns cells will be set,
    * The next n_total_columns - n_columns will be skipped,
    * ...

    To set the last columns for each query simply add an offset to proofDataPtr before calling the
    function.
*/
Reads query responses for n_columns from the channel with the corresponding authentication
paths. Verifies the consistency of the authentication paths with respect to the given
merkle_root, and stores the query values in proofDataPtr.

n_total_columns is the total number of columns represented in proofDataPtr (which should be
an array of n_unique_queries rows of size n_total_columns). n_columns is the number of columns
for which data will be read by this function.
The change to the proofDataPtr array will be as follows:
The first n_columns cells will be set,
The next n_total_columns - n_columns will be skipped,
The next n_columns cells will be set,
The next n_total_columns - n_columns will be skipped.

To set the last columns for each query simply add an offset to proofDataPtr before calling the
function.
Reads query responses for n_columns from the channel with the corresponding authentication paths . Verifies the consistency of the authentication paths with respect to the given merkle_root and stores the query values in proofDataPtr . n_total_columns is the total number of columns represented in proofDataPtr ( which should be an array of n_unique_queries rows of size n_total_columns ) . n_columns is the number of columns for which data will be read by this function . The change to the proofDataPtr array will be as follows : The first n_columns cells will be set The next n_total_columns - n_columns will be skipped The next n_columns cells will be set The next n_total_columns - n_columns will be skipped . To set the last columns for each query simply add an offset to proofDataPtr before calling the function .
pub fn read_query_responses_and_decommit(
    ctx: & mut Vec<Uint256>, 
    n_total_columns: usize, 
    n_columns: usize, 
    proof_data_idx: usize, 
    merkle_root: Uint256
) {
    assert!( n_columns <= stark_params::N_COLUMNS_IN_MASK + stark_params::CONSTRAINTS_DEGREE_BOUND ); //Too many columns
    let n_unique_queries = ctx[map::MM_N_UNIQUE_QUERIES].clone();
    let channel_idx = map::MM_CHANNEL;
    let mut fri_queue = map::MM_FRI_QUEUE;
    let fri_queue_end = fri_queue + uint256_ops::to_usize(&n_unique_queries) * 3;
    let mut merkle_ptr = map::MM_MERKLE_QUEUE;
    let l_hash_mask = get_hash_mask();
    let proof_data_skip_bytes = n_total_columns - n_columns;
    let mut proof_data_i = proof_data_idx; 
    let mut proof_idx = uint256_ops::to_usize(&ctx[channel_idx]);
    while fri_queue < fri_queue_end {
        let mut combined_data: Vec<u8> = vec![0; 32*(n_columns+1)];
        for i in proof_idx..=proof_idx+n_columns {
            let bytes = uint256_ops::to_fixed_bytes( &ctx[i] );
            for j in 0..bytes.len() {
                combined_data[ 32*(i-proof_idx) + j] = bytes[j];
            }
        }
        let mut merkle_leaf = uint256_ops::bitwise_and( &l_hash_mask, &uint256_ops::keccak_256(&combined_data) );
        // If a leaf contains only 1 field element we don't hash it.
        if n_columns == 1 {
            merkle_leaf = ctx[proof_idx].clone();
        }
        // push(queryIdx, hash(row)) to merkleQueue.
        ctx[merkle_ptr] = ctx[fri_queue].clone();
        ctx[merkle_ptr+1] = merkle_leaf;
        merkle_ptr += 2;
        // Copy query responses to proofData array.
        // This array will used in OODS
        let end = proof_idx + n_columns;
        while proof_idx < end {
            ctx[proof_data_i] = ctx[proof_idx].clone();
            proof_data_i += 1;
            proof_idx += 1;
        }
        proof_data_i += proof_data_skip_bytes;
        fri_queue += 3;
    }
    ctx[channel_idx] = uint256_ops::from_usize(proof_idx);
    verify_merkle(channel_idx, ctx, merkle_ptr, merkle_root,  uint256_ops::to_usize(&n_unique_queries));
}
pub fn read_query_responses_and_decommit ( ctx : & mut Vec < Uint256 > , n_total_columns : usize , n_columns : usize , proof_data_idx : usize , merkle_root : Uint256 ) { assert ! ( n_columns stark_params N_COLUMNS_IN_MASK stark_params CONSTRAINTS_DEGREE_BOUND ) ; //Too many columns let n_unique_queries = ctx [ map :: MM_N_UNIQUE_QUERIES ] . clone ( ) ; let channel_idx = map :: MM_CHANNEL ; let mut fri_queue = map :: MM_FRI_QUEUE ; let fri_queue_end = fri_queue + uint256_ops :: to_usize ( & n_unique_queries ) * 3 ; let mut merkle_ptr = map :: MM_MERKLE_QUEUE ; let l_hash_mask = get_hash_mask ( ) ; let proof_data_skip_bytes = n_total_columns - n_columns ; let mut proof_data_i = proof_data_idx ; let mut proof_idx = uint256_ops :: to_usize ( & ctx [ channel_idx ] ) ; while fri_queue < fri_queue_end { let mut combined_data : Vec < u8 > = vec ! [ 0 32 ( n_columns 1 ) ] ; for i in proof_idx ..= proof_idx + n_columns { let bytes = uint256_ops :: to_fixed_bytes ( & ctx [ i ] ) ; for j in 0 .. bytes . len ( ) { combined_data [ 32 * ( i - proof_idx ) + j ] = bytes [ j ] ; } } let mut merkle_leaf = uint256_ops :: bitwise_and ( & l_hash_mask , & uint256_ops :: keccak_256 ( & combined_data ) ) ; // If a leaf contains only 1 field element we don't hash it. if n_columns == 1 { merkle_leaf = ctx [ proof_idx ] . clone ( ) ; } // push(queryIdx, hash(row)) to merkleQueue. ctx [ merkle_ptr ] = ctx [ fri_queue ] . clone ( ) ; ctx [ merkle_ptr + 1 ] = merkle_leaf ; merkle_ptr += 2 ; // Copy query responses to proofData array. // This array will used in OODS let end = proof_idx + n_columns ; while proof_idx < end { ctx [ proof_data_i ] = ctx [ proof_idx ] . clone ( ) ; proof_data_i += 1 ; proof_idx += 1 ; } proof_data_i += proof_data_skip_bytes ; fri_queue += 3 ; } ctx [ channel_idx ] = uint256_ops :: from_usize ( proof_idx ) ; verify_merkle ( channel_idx , ctx , merkle_ptr , merkle_root , uint256_ops :: to_usize ( & n_unique_queries ) ) ; }
Reads query responses for n_columns from the channel with the corresponding authentication
paths.
Reads query responses for n_columns from the channel with the corresponding authentication paths .
ctx
& mut Vec<Uint256>
n_total_columns
usize
n_columns
usize
proof_data_idx
usize
merkle_root
Uint256
ctx
& mut Vec<Uint256>
n_total_columns
usize
n_columns
usize
proof_data_idx
usize
merkle_root
Uint256