Skip to content

Commit

Permalink
merge the 3 servers for clock jump difference Lookup Arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Feb 5, 2023
1 parent 123d51f commit 9c2f3c0
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 293 deletions.
16 changes: 6 additions & 10 deletions triton-vm/src/table/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct AllChallenges {
}

impl AllChallenges {
pub const TOTAL_CHALLENGES: usize = 47 + NUM_CROSS_TABLE_WEIGHTS;
pub const TOTAL_CHALLENGES: usize = 45 + NUM_CROSS_TABLE_WEIGHTS;

pub fn create_challenges(
mut weights: Vec<XFieldElement>,
Expand Down Expand Up @@ -96,9 +96,7 @@ impl AllChallenges {
jump_stack_table_jso_weight: weights.pop().unwrap(),
jump_stack_table_jsd_weight: 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(),
clock_jump_difference_lookup_indeterminate: weights.pop().unwrap(),

hash_table_ci_weight: weights.pop().unwrap(),
hash_state_weight0: weights.pop().unwrap(),
Expand Down Expand Up @@ -145,7 +143,7 @@ impl AllChallenges {
osv_weight: processor_table_challenges.op_stack_table_osv_weight,
osp_weight: processor_table_challenges.op_stack_table_osp_weight,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_op_stack_indeterminate,
.clock_jump_difference_lookup_indeterminate,
};

let ram_table_challenges = RamTableChallenges {
Expand All @@ -157,7 +155,7 @@ impl AllChallenges {
previous_instruction_weight: processor_table_challenges
.ram_table_previous_instruction_weight,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_ram_indeterminate,
.clock_jump_difference_lookup_indeterminate,
};

let jump_stack_table_challenges = JumpStackTableChallenges {
Expand All @@ -168,7 +166,7 @@ impl AllChallenges {
jso_weight: processor_table_challenges.jump_stack_table_jso_weight,
jsd_weight: processor_table_challenges.jump_stack_table_jsd_weight,
clock_jump_difference_lookup_indeterminate: processor_table_challenges
.clock_jump_difference_lookup_jump_stack_indeterminate,
.clock_jump_difference_lookup_indeterminate,
};

let hash_table_challenges = HashTableChallenges {
Expand Down Expand Up @@ -226,9 +224,7 @@ impl AllChallenges {
hash_digest_weight: weights.pop().unwrap(),
sponge_weight: weights.pop().unwrap(),
processor_to_u32_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(),
clock_jump_difference_lookup_weight: weights.pop().unwrap(),
input_to_processor_weight: weights.pop().unwrap(),
processor_to_output_weight: weights.pop().unwrap(),
};
Expand Down
36 changes: 8 additions & 28 deletions triton-vm/src/table/cross_table_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub const NUM_PUBLIC_EVAL_ARGS: usize = 2; // for public input and output
pub const NUM_PRIVATE_EVAL_ARGS: usize =
PROCESSOR_TABLE_NUM_EVALUATION_ARGUMENTS - NUM_PUBLIC_EVAL_ARGS;
pub const NUM_PRIVATE_PERM_ARGS: usize = PROCESSOR_TABLE_NUM_PERMUTATION_ARGUMENTS;
pub const NUM_LOOKUP_ARGS: usize = 4;
pub const NUM_LOOKUP_ARGS: usize = 2;
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;
Expand Down Expand Up @@ -153,9 +153,7 @@ pub struct CrossTableChallenges {
pub hash_digest_weight: XFieldElement,
pub sponge_weight: XFieldElement,
pub processor_to_u32_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 clock_jump_difference_lookup_weight: XFieldElement,
pub input_to_processor_weight: XFieldElement,
pub processor_to_output_weight: XFieldElement,
}
Expand All @@ -173,9 +171,7 @@ pub enum CrossTableChallengeId {
HashDigestWeight,
SpongeWeight,
ProcessorToU32Weight,
ClockJumpDifferenceLookupOpStackWeight,
ClockJumpDifferenceLookupRamWeight,
ClockJumpDifferenceLookupJumpStackWeight,
ClockJumpDifferenceLookupWeight,
InputToProcessorWeight,
ProcessorToOutputWeight,
}
Expand All @@ -202,13 +198,7 @@ impl TableChallenges for CrossTableChallenges {
HashDigestWeight => self.hash_digest_weight,
SpongeWeight => self.sponge_weight,
ProcessorToU32Weight => self.processor_to_u32_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
}
ClockJumpDifferenceLookupWeight => self.clock_jump_difference_lookup_weight,
InputToProcessorWeight => self.input_to_processor_weight,
ProcessorToOutputWeight => self.processor_to_output_weight,
}
Expand Down Expand Up @@ -280,18 +270,12 @@ 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 clock_jump_difference_lookup_op_stack = ext_row
[ProcessorExtTableColumn::ClockJumpDifferenceLookupServerLogDerivativeOpStack
let clock_jump_difference_lookup = ext_row
[ProcessorExtTableColumn::ClockJumpDifferenceLookupServerLogDerivative
.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()];
Expand All @@ -307,12 +291,8 @@ 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(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;
+ challenges.get_challenge(ClockJumpDifferenceLookupWeight)
* clock_jump_difference_lookup;
vec![non_linear_sum]
}
}
Expand Down
Loading

0 comments on commit 9c2f3c0

Please sign in to comment.