Skip to content

Commit

Permalink
replace involved argument for clock jump differences with 3 Lookup Args
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Feb 3, 2023
1 parent 567efc0 commit 04bb5c4
Show file tree
Hide file tree
Showing 8 changed files with 526 additions and 673 deletions.
22 changes: 12 additions & 10 deletions triton-vm/src/table/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub trait TableChallenges: Clone + Debug {
+ IntoEnumIterator
+ Into<usize>
+ PartialEq
+ Eq
+ Hash;

fn count() -> usize {
Expand Down Expand Up @@ -97,8 +96,9 @@ impl AllChallenges {
jump_stack_table_jso_weight: weights.pop().unwrap(),
jump_stack_table_jsd_weight: weights.pop().unwrap(),

unique_clock_jump_differences_eval_indeterminate: weights.pop().unwrap(),
all_clock_jump_differences_multi_perm_indeterminate: weights.pop().unwrap(),
clock_jump_difference_lookup_op_stack_indeterminate: weights.pop().unwrap(),
clock_jump_difference_lookup_ram_indeterminate: weights.pop().unwrap(),
clock_jump_difference_lookup_jump_stack_indeterminate: weights.pop().unwrap(),

hash_table_ci_weight: weights.pop().unwrap(),
hash_state_weight0: weights.pop().unwrap(),
Expand Down Expand Up @@ -144,8 +144,8 @@ impl AllChallenges {
ib1_weight: processor_table_challenges.op_stack_table_ib1_weight,
osv_weight: processor_table_challenges.op_stack_table_osv_weight,
osp_weight: processor_table_challenges.op_stack_table_osp_weight,
all_clock_jump_differences_multi_perm_indeterminate: processor_table_challenges
.all_clock_jump_differences_multi_perm_indeterminate,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_op_stack_indeterminate,
};

let ram_table_challenges = RamTableChallenges {
Expand All @@ -156,8 +156,8 @@ impl AllChallenges {
ramv_weight: processor_table_challenges.ram_table_ramv_weight,
previous_instruction_weight: processor_table_challenges
.ram_table_previous_instruction_weight,
all_clock_jump_differences_multi_perm_indeterminate: processor_table_challenges
.all_clock_jump_differences_multi_perm_indeterminate,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_ram_indeterminate,
};

let jump_stack_table_challenges = JumpStackTableChallenges {
Expand All @@ -167,8 +167,8 @@ impl AllChallenges {
jsp_weight: processor_table_challenges.jump_stack_table_jsp_weight,
jso_weight: processor_table_challenges.jump_stack_table_jso_weight,
jsd_weight: processor_table_challenges.jump_stack_table_jsd_weight,
all_clock_jump_differences_multi_perm_indeterminate: processor_table_challenges
.all_clock_jump_differences_multi_perm_indeterminate,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_jump_stack_indeterminate,
};

let hash_table_challenges = HashTableChallenges {
Expand Down Expand Up @@ -226,7 +226,9 @@ impl AllChallenges {
hash_digest_weight: weights.pop().unwrap(),
sponge_weight: weights.pop().unwrap(),
processor_to_u32_weight: weights.pop().unwrap(),
all_clock_jump_differences_weight: weights.pop().unwrap(),
clock_jump_difference_lookup_op_stack_weight: weights.pop().unwrap(),
clock_jump_difference_lookup_ram_weight: weights.pop().unwrap(),
clock_jump_difference_lookup_jump_stack_weight: weights.pop().unwrap(),
input_to_processor_weight: weights.pop().unwrap(),
processor_to_output_weight: weights.pop().unwrap(),
};
Expand Down
54 changes: 39 additions & 15 deletions triton-vm/src/table/cross_table_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ use crate::table::table_column::RamExtTableColumn;
use crate::table::table_column::U32ExtTableColumn;

pub const NUM_PUBLIC_EVAL_ARGS: usize = 2; // for public input and output
pub const NUM_PRIVATE_PERM_ARGS: usize = PROCESSOR_TABLE_NUM_PERMUTATION_ARGUMENTS;
pub const NUM_PRIVATE_EVAL_ARGS: usize =
PROCESSOR_TABLE_NUM_EVALUATION_ARGUMENTS - NUM_PUBLIC_EVAL_ARGS;
pub const NUM_CROSS_TABLE_ARGS: usize = NUM_PRIVATE_PERM_ARGS + NUM_PRIVATE_EVAL_ARGS;
pub const NUM_PRIVATE_PERM_ARGS: usize = PROCESSOR_TABLE_NUM_PERMUTATION_ARGUMENTS;
pub const NUM_LOOKUP_ARGS: usize = 4;
pub const NUM_CROSS_TABLE_ARGS: usize =
NUM_PRIVATE_PERM_ARGS + NUM_PRIVATE_EVAL_ARGS + NUM_LOOKUP_ARGS;
pub const NUM_CROSS_TABLE_WEIGHTS: usize = NUM_CROSS_TABLE_ARGS + NUM_PUBLIC_EVAL_ARGS;

pub trait CrossTableArg {
Expand Down Expand Up @@ -151,7 +153,9 @@ pub struct CrossTableChallenges {
pub hash_digest_weight: XFieldElement,
pub sponge_weight: XFieldElement,
pub processor_to_u32_weight: XFieldElement,
pub all_clock_jump_differences_weight: XFieldElement,
pub clock_jump_difference_lookup_op_stack_weight: XFieldElement,
pub clock_jump_difference_lookup_ram_weight: XFieldElement,
pub clock_jump_difference_lookup_jump_stack_weight: XFieldElement,
pub input_to_processor_weight: XFieldElement,
pub processor_to_output_weight: XFieldElement,
}
Expand All @@ -169,7 +173,9 @@ pub enum CrossTableChallengeId {
HashDigestWeight,
SpongeWeight,
ProcessorToU32Weight,
AllClockJumpDifferencesWeight,
ClockJumpDifferenceLookupOpStackWeight,
ClockJumpDifferenceLookupRamWeight,
ClockJumpDifferenceLookupJumpStackWeight,
InputToProcessorWeight,
ProcessorToOutputWeight,
}
Expand All @@ -196,7 +202,13 @@ impl TableChallenges for CrossTableChallenges {
HashDigestWeight => self.hash_digest_weight,
SpongeWeight => self.sponge_weight,
ProcessorToU32Weight => self.processor_to_u32_weight,
AllClockJumpDifferencesWeight => self.all_clock_jump_differences_weight,
ClockJumpDifferenceLookupOpStackWeight => {
self.clock_jump_difference_lookup_op_stack_weight
}
ClockJumpDifferenceLookupRamWeight => self.clock_jump_difference_lookup_ram_weight,
ClockJumpDifferenceLookupJumpStackWeight => {
self.clock_jump_difference_lookup_jump_stack_weight
}
InputToProcessorWeight => self.input_to_processor_weight,
ProcessorToOutputWeight => self.processor_to_output_weight,
}
Expand Down Expand Up @@ -268,14 +280,21 @@ impl Evaluable for GrandCrossTableArg {
let processor_to_u32 = ext_row
[ProcessorExtTableColumn::U32TablePermArg.master_ext_table_index()]
- ext_row[U32ExtTableColumn::ProcessorPermArg.master_ext_table_index()];
let all_clock_jump_differences = ext_row
[ProcessorExtTableColumn::AllClockJumpDifferencesPermArg.master_ext_table_index()]
- ext_row
[OpStackExtTableColumn::AllClockJumpDifferencesPermArg.master_ext_table_index()]
* ext_row
[RamExtTableColumn::AllClockJumpDifferencesPermArg.master_ext_table_index()]
* ext_row[JumpStackExtTableColumn::AllClockJumpDifferencesPermArg
.master_ext_table_index()];
let clock_jump_difference_lookup_op_stack = ext_row
[ProcessorExtTableColumn::ClockJumpDifferenceLookupServerLogDerivativeOpStack
.master_ext_table_index()]
- ext_row[OpStackExtTableColumn::ClockJumpDifferenceLookupClientLogDerivative
.master_ext_table_index()];
let clock_jump_difference_lookup_ram = ext_row
[ProcessorExtTableColumn::ClockJumpDifferenceLookupServerLogDerivativeRam
.master_ext_table_index()]
- ext_row[RamExtTableColumn::ClockJumpDifferenceLookupClientLogDerivative
.master_ext_table_index()];
let clock_jump_difference_lookup_jump_stack = ext_row
[ProcessorExtTableColumn::ClockJumpDifferenceLookupServerLogDerivativeJumpStack
.master_ext_table_index()]
- ext_row[JumpStackExtTableColumn::ClockJumpDifferenceLookupClientLogDerivative
.master_ext_table_index()];

let non_linear_sum = challenges.get_challenge(ProcessorToProgramWeight)
* instruction_lookup
Expand All @@ -288,7 +307,12 @@ impl Evaluable for GrandCrossTableArg {
+ challenges.get_challenge(HashDigestWeight) * hash_digest
+ challenges.get_challenge(SpongeWeight) * sponge
+ challenges.get_challenge(ProcessorToU32Weight) * processor_to_u32
+ challenges.get_challenge(AllClockJumpDifferencesWeight) * all_clock_jump_differences;
+ challenges.get_challenge(ClockJumpDifferenceLookupOpStackWeight)
* clock_jump_difference_lookup_op_stack
+ challenges.get_challenge(ClockJumpDifferenceLookupRamWeight)
* clock_jump_difference_lookup_ram
+ challenges.get_challenge(ClockJumpDifferenceLookupJumpStackWeight)
* clock_jump_difference_lookup_jump_stack;
vec![non_linear_sum]
}
}
Expand Down Expand Up @@ -330,7 +354,7 @@ impl Quotientable for GrandCrossTableArg {

fn terminal_quotient_degree_bounds(interpolant_degree: Degree) -> Vec<Degree> {
let zerofier_degree = 1 as Degree;
let max_columns_involved_in_one_cross_table_argument = 3;
let max_columns_involved_in_one_cross_table_argument = 1;
vec![
interpolant_degree * max_columns_involved_in_one_cross_table_argument - zerofier_degree,
]
Expand Down
Loading

0 comments on commit 04bb5c4

Please sign in to comment.