Skip to content

Commit

Permalink
test: abort signal
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Nov 1, 2024
1 parent 78c89db commit d4d68f8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ num-traits = "0.2.19"
nunny = "0.2.1"
once_cell = "1.19.0"
# TODO: update when paladin is released to 0.4.4 with abort signal support
paladin-core = { git = "https://github.com/0xPolygonZero/paladin.git", branch = "feat/abort-signal" }
paladin-core = { git = "https://github.com/0xPolygonZero/paladin.git", branch = "test_abort_signal" }
parking_lot = "0.12.3"
pest = "2.7.10"
pest_derive = "2.7.10"
Expand Down
2 changes: 2 additions & 0 deletions evm_arithmetization/src/fixed_recursive_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,7 @@ where
)?;
}

tracing::log::info!(">>>>>>>>>>>>>>>>>>> calling check_abort_signal from `prove_segment_with_all_proofs`: {abort_signal:?}");
check_abort_signal(abort_signal.clone())?;
}

Expand Down Expand Up @@ -2184,6 +2185,7 @@ where
)?;
}

tracing::log::info!(">>>>>>>>>>>>>>>>>>> calling check_abort_signal from `prove_segment_after_initial_stark`: {abort_signal:?}");
check_abort_signal(abort_signal.clone())?;
}

Expand Down
9 changes: 9 additions & 0 deletions evm_arithmetization/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ where
{
features_check(&inputs);

tracing::log::info!(">>>>>>>>>>>>>>>>>>> prove {abort_signal:?}");

// Sanity check on the provided config
assert_eq!(DEFAULT_CAP_LEN, 1 << config.fri_config.cap_height);

Expand All @@ -53,6 +55,7 @@ where
generate_traces(all_stark, &inputs, config, segment_data, timing)?
);

tracing::log::info!(">>>>>>>>>>>>>>>>>>> calling check_abort_signal from `prove`: {abort_signal:?}");
check_abort_signal(abort_signal.clone())?;

let proof = prove_with_traces(
Expand Down Expand Up @@ -85,6 +88,8 @@ where
let rate_bits = config.fri_config.rate_bits;
let cap_height = config.fri_config.cap_height;

tracing::info!(">>>>>>>>>>>>>>>>>>> PROVE WITH TRACES abort signal {abort_signal:?}");

// For each STARK, we compute the polynomial commitments for the polynomials
// interpolating its trace.
let trace_commitments = timed!(
Expand Down Expand Up @@ -314,6 +319,7 @@ where
C: GenericConfig<D, F = F>,
S: Stark<F, D>,
{
tracing::info!(">>>>>>> PROVING SINGLE TABLE abort signal {abort_signal:?}");
check_abort_signal(abort_signal.clone())?;

// Clear buffered outputs.
Expand Down Expand Up @@ -342,8 +348,10 @@ where
/// the workers, which will result in an early abort for all the other processes
/// involved in the same set of transactions.
pub fn check_abort_signal(abort_signal: Option<Arc<AtomicBool>>) -> Result<()> {
tracing::info!(">>>>>>>>>>>>>>>>>>> check abort signal {abort_signal:?}");
if let Some(signal) = abort_signal {
if signal.load(Ordering::Relaxed) {
tracing::info!(">>>>>>>>>>>>>>>>>>> STOPING JOB WITH ABORT SIGNAL!!!");
return Err(anyhow!("Stopping job from abort signal."));
}
}
Expand Down Expand Up @@ -399,6 +407,7 @@ pub mod testing {
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
{
tracing::log::info!(">>>>>>>>>>>>>>>>>>> prove_all_segments {abort_signal:?}");
let segment_data_iterator = SegmentDataIterator::<F>::new(&inputs, Some(max_cpu_len_log));
let inputs = inputs.trim();
let mut proofs = vec![];
Expand Down
4 changes: 2 additions & 2 deletions zero/src/prover_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ impl ProverStateManager {
input,
segment_data,
&mut TimingTree::default(),
abort_signal,
abort_signal.clone(),
)?;

let table_circuits = self.load_table_circuits(&config, &all_proof)?;

let proof_with_pvs =
p_state()
.state
.prove_segment_after_initial_stark(all_proof, &table_circuits, None)?;
.prove_segment_after_initial_stark(all_proof, &table_circuits, abort_signal)?;

Ok(proof_with_pvs)
}
Expand Down

0 comments on commit d4d68f8

Please sign in to comment.