support longer arrays in vec_ref (#367)

Support arrays up to 256 elements (hardcoded maximum just to avoid abuse) by combining multiple random_accesses.
The index is now split into low and high parts. It's a bit more inconvenient than using a single Target but this allows avoiding bit decomposition.
This commit is contained in:
Eduard S. 2025-07-30 16:07:25 -07:00 committed by GitHub
parent bde35369d3
commit 4fa285d9fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 175 additions and 61 deletions

View file

@ -828,8 +828,8 @@ impl Params {
Self::predicate_size() + STATEMENT_ARG_F_LEN * self.max_statement_args
}
pub fn operation_size(&self) -> usize {
Self::operation_type_size() + OPERATION_ARG_F_LEN * self.max_operation_args
pub fn operation_size(&self, operation_arg_f_len: usize) -> usize {
Self::operation_type_size() + operation_arg_f_len * self.max_operation_args
}
pub const fn statement_tmpl_size(&self) -> usize {
@ -844,6 +844,14 @@ impl Params {
self.max_custom_batch_size * self.custom_predicate_size()
}
/// Total size of the statement table including None, input statements from signed pods and
/// input recursive pods and new statements (public & private)
pub fn statement_table_size(&self) -> usize {
1 + self.max_input_signed_pods * self.max_signed_pod_values
+ self.max_input_recursive_pods * self.max_input_pods_public_statements
+ self.max_statements
}
/// Parameters that define how the id is calculated
pub fn id_params(&self) -> Vec<usize> {
vec![