Currently calldata_read_counts must be manually updated simultaneously with each calldata lookup gate. This is error prone. The polynomial calldata_read_counts should be computed all at once either in finalize or in the composer. One way to do this: Iterate through all databus lookup gates (looking for q_busread == 1), extract the read_index (stored in w_r), call get_variable on that index, convert the resulting field element to a size_t or uint32_t, then increment calldata_read_counts at the resulting index.
Currently
calldata_read_countsmust be manually updated simultaneously with each calldata lookup gate. This is error prone. The polynomialcalldata_read_countsshould be computed all at once either infinalizeor in the composer. One way to do this: Iterate through all databus lookup gates (looking forq_busread == 1), extract the read_index (stored inw_r), call get_variable on that index, convert the resulting field element to asize_toruint32_t, then incrementcalldata_read_countsat the resulting index.