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:
parent
bde35369d3
commit
4fa285d9fb
5 changed files with 175 additions and 61 deletions
|
|
@ -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![
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ pub const KEY_SIGNER: &str = "_signer";
|
|||
// hash(KEY_TYPE) = [17948789436443445142, 12513915140657440811, 15878361618879468769, 938231894693848619]
|
||||
pub const KEY_TYPE: &str = "_type";
|
||||
pub const STATEMENT_ARG_F_LEN: usize = 8;
|
||||
pub const OPERATION_ARG_F_LEN: usize = 1;
|
||||
pub const OPERATION_AUX_F_LEN: usize = 2;
|
||||
|
||||
#[derive(Clone, Copy, Debug, FromRepr, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||
pub enum NativePredicate {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue