Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>
This commit is contained in:
Alonso González 2024-01-10 13:55:09 +01:00 committed by GitHub
parent 1715573c22
commit 92aaa404da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -41,7 +41,7 @@ continue:
proof_ok:
// stack: i, ctx, final_pos, retdest
// We already know final pos is a jumpdest
// We already know final_pos is a jumpdest
%stack (i, ctx, final_pos) -> (ctx, @SEGMENT_JUMPDEST_BITS, i)
%build_address
PUSH 1
@ -99,7 +99,7 @@ code_bytes_to_skip:
%endrep
// A proof attesting that jumpdest is a valid jump destinations is
// A proof attesting that jumpdest is a valid jump destination is
// either 0 or an index 0 < i <= jumpdest - 32.
// A proof is valid if:
// - i == 0 and we can go from the first opcode to jumpdest and code[jumpdest] = 0x5b

View File

@ -364,7 +364,7 @@ fn simulate_cpu_between_labels_and_get_user_jumps<F: Field>(
log::debug!("Simulating CPU for jumpdest analysis.");
loop {
// skip jumdest table validations in simulations
// skip jumpdest table validations in simulations
if state.registers.program_counter == KERNEL.global_labels["jumpdest_analysis"] {
state.registers.program_counter = KERNEL.global_labels["jumpdest_analysis_end"]
}

View File

@ -247,7 +247,8 @@ impl<F: Field> GenerationState<F> {
_ => Err(ProgramError::ProverInputError(InvalidInput)),
}
}
/// Return the next used jump addres
/// Returns the next used jump address.
fn run_next_jumpdest_table_address(&mut self) -> Result<U256, ProgramError> {
let context = self.registers.context;
let code_len = u256_to_usize(self.get_code_len()?.into());
@ -299,7 +300,6 @@ impl<F: Field> GenerationState<F> {
let code = self.get_current_code()?;
// We need to set the simulated jumpdest bits to one as otherwise
// the simulation will fail.
// self.set_jumpdest_bits(&code);
// Simulate the user's code and (unnecessarily) part of the kernel code, skipping the validate table call
let Some(jumpdest_table) = simulate_cpu_between_labels_and_get_user_jumps(
@ -383,7 +383,7 @@ impl<F: Field> GenerationState<F> {
/// this function searches for a proof. A proof is the closest address
/// for which none of the previous 32 bytes in the code (including opcodes
/// and pushed bytes are PUSHXX and the address is in its range. It returns
/// a vector of even size containing proofs followed by their addresses
/// a vector of even size containing proofs followed by their addresses.
fn get_proofs_and_jumpdests(
code: &[u8],
largest_address: usize,

View File

@ -169,7 +169,7 @@ impl<F: Field> GenerationState<F> {
.collect()
}
/// Clone everything but the traces
/// Clones everything but the traces.
pub(crate) fn soft_clone(&self) -> GenerationState<F> {
Self {
inputs: self.inputs.clone(),