Skip to content

Commit

Permalink
tmp: removed all harness artifacts, increased nextest timeout, custom…
Browse files Browse the repository at this point in the history
… encoding for ecpairing fsm
  • Loading branch information
NikitaMasych committed Dec 11, 2024
1 parent 920c6ed commit a76e983
Show file tree
Hide file tree
Showing 76 changed files with 84 additions and 17,554 deletions.
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[profile.default]
slow-timeout = { period = "180s", terminate-after = 5, grace-period = "30s" }
slow-timeout = { period = "5h", terminate-after = 5, grace-period = "30s" }

76 changes: 74 additions & 2 deletions crates/zkevm_circuits/src/bn254/ec_pairing/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ use serde::{Deserialize, Serialize};
Derivative,
CSAllocatable,
CSSelectable,
CSVarLengthEncodable,
WitnessHookable,
WitVarLengthEncodable,
)]
#[derivative(Clone, Debug)]
#[DerivePrettyComparison("true")]
Expand All @@ -41,6 +39,80 @@ pub struct EcPairingFunctionFSM<F: SmallField> {
pub precompile_call_params: EcPairingPrecompileCallParams<F>,
}

impl<F: SmallField> CircuitVarLengthEncodable<F> for EcPairingFunctionFSM<F> {
#[inline(always)]
fn encoding_length(&self) -> usize {
let mut total_len = 0;
total_len += CircuitVarLengthEncodable::<F>::encoding_length(&self.read_precompile_call);
total_len += CircuitVarLengthEncodable::<F>::encoding_length(&self.read_words_for_round);
total_len += CircuitVarLengthEncodable::<F>::encoding_length(&self.completed);
// total_len += CircuitVarLengthEncodable::<F>::encoding_length(&self.pairing_inner_state);
total_len +=
CircuitVarLengthEncodable::<F>::encoding_length(&self.timestamp_to_use_for_read);
total_len +=
CircuitVarLengthEncodable::<F>::encoding_length(&self.timestamp_to_use_for_write);
total_len += CircuitVarLengthEncodable::<F>::encoding_length(&self.precompile_call_params);
total_len
}
fn encode_to_buffer<CS: ConstraintSystem<F>>(&self, cs: &mut CS, dst: &mut Vec<Variable>) {
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.read_precompile_call, cs, dst);
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.read_words_for_round, cs, dst);
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.completed, cs, dst);
// CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.pairing_inner_state, cs, dst);
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.timestamp_to_use_for_read, cs, dst);
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.timestamp_to_use_for_write, cs, dst);
CircuitVarLengthEncodable::<F>::encode_to_buffer(&self.precompile_call_params, cs, dst);
}
}

impl<F: SmallField> WitnessVarLengthEncodable<F> for EcPairingFunctionFSM<F> {
fn witness_encoding_length(witness: &Self::Witness) -> usize {
let mut total_len = 0;
total_len += <Boolean<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(
&witness.read_precompile_call,
);
total_len += <Boolean<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(
&witness.read_words_for_round,
);
total_len += <Boolean<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(
&witness.completed,
);
// total_len += <BN256Fq12NNField<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(&witness. pairing_inner_state);
total_len += <UInt32<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(
&witness.timestamp_to_use_for_read,
);
total_len += <UInt32<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(
&witness.timestamp_to_use_for_write,
);
total_len += <EcPairingPrecompileCallParams<F> as WitnessVarLengthEncodable<F>>::witness_encoding_length(&witness. precompile_call_params);
total_len
}
fn encode_witness_to_buffer(witness: &Self::Witness, dst: &mut Vec<F>) {
<Boolean<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(
&witness.read_precompile_call,
dst,
);
<Boolean<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(
&witness.read_words_for_round,
dst,
);
<Boolean<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(
&witness.completed,
dst,
);
// <BN256Fq12NNField<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(&witness. pairing_inner_state, dst);
<UInt32<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(
&witness.timestamp_to_use_for_read,
dst,
);
<UInt32<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(
&witness.timestamp_to_use_for_write,
dst,
);
<EcPairingPrecompileCallParams<F> as WitnessVarLengthEncodable<F>>::encode_witness_to_buffer(&witness. precompile_call_params, dst);
}
}

impl<F: SmallField> CSPlaceholder<F> for EcPairingFunctionFSM<F> {
fn placeholder<CS: ConstraintSystem<F>>(cs: &mut CS) -> Self {
let boolean_false = Boolean::allocated_constant(cs, false);
Expand Down
Binary file not shown.
188 changes: 0 additions & 188 deletions crates/zkevm_test_harness/setup/base_layer/finalization_hint_1.json

This file was deleted.

Loading

0 comments on commit a76e983

Please sign in to comment.