Skip to content

Commit

Permalink
fix: lifetime issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-sun committed Jan 9, 2025
1 parent ec1a578 commit d3b8e78
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
29 changes: 18 additions & 11 deletions extensions/native/compiler/src/ir/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ impl<C: Config> Builder<C> {

pub fn zipped_iter<'a>(
&'a mut self,
arrays: &'a [Box<dyn ArrayLike<C>>],
arrays: &'a [Box<dyn ArrayLike<C> + 'a>],
) -> ZippedPointerIteratorBuilder<'a, C> {
assert!(!arrays.is_empty());
if arrays.iter().all(|array| array.is_fixed()) {
Expand Down Expand Up @@ -528,16 +528,23 @@ impl<C: Config> Builder<C> {
let arr = self.dyn_array(vlen);

// Write the content hints directly into the array memory.
self.iter(&arr).for_each(|val, builder| {
let index = MemIndex {
index: 0.into(),
offset: 0,
size: 1,
};
builder
.operations
.push(DslIr::StoreHintWord(Ptr { address: val }, index));
});
self.zipped_iter(&[Box::new(arr.clone()) as Box<dyn ArrayLike<C>>])
.for_each(|ptr_vec, builder| {
let index = MemIndex {
index: 0.into(),
offset: 0,
size: 1,
};
builder.operations.push(DslIr::StoreHintWord(
Ptr {
address: match ptr_vec[0] {
RVar::Const(_) => unreachable!(),
RVar::Val(v) => v,
},
},
index,
));
});

arr
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/native/recursion/src/fri/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub mod witness;
/// Reference: <https://github.com/Plonky3/Plonky3/blob/4809fa7bedd9ba8f6f5d3267b1592618e3776c57/fri/src/verifier.rs#L101>
#[allow(clippy::too_many_arguments)]
#[allow(unused_variables)]
pub fn verify_query<C: Config + 'static>(
pub fn verify_query<C: Config>(
builder: &mut Builder<C>,
config: &FriConfigVariable<C>,
commit_phase_commits: &Array<C, DigestVariable<C>>,
Expand Down Expand Up @@ -141,7 +141,7 @@ pub enum NestedOpenedValues<C: Config> {
/// Reference: <https://github.com/Plonky3/Plonky3/blob/4809fa7bedd9ba8f6f5d3267b1592618e3776c57/merkle-tree/src/mmcs.rs#L92>
#[allow(clippy::type_complexity)]
#[allow(unused_variables)]
pub fn verify_batch<C: Config + 'static>(
pub fn verify_batch<C: Config>(
builder: &mut Builder<C>,
commit: &DigestVariable<C>,
dimensions: Array<C, DimensionsVariable<C>>,
Expand Down
4 changes: 2 additions & 2 deletions extensions/native/recursion/src/fri/two_adic_pcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{
/// <https://github.com/Plonky3/Plonky3/blob/27b3127dab047e07145c38143379edec2960b3e1/merkle-tree/src/mmcs.rs#L87>
/// <https://github.com/Plonky3/Plonky3/blob/27b3127dab047e07145c38143379edec2960b3e1/merkle-tree/src/merkle_tree.rs#L100>
/// <https://github.com/Plonky3/Plonky3/blob/784b7dd1fa87c1202e63350cc8182d7c5327a7af/fri/src/verifier.rs#L22>
pub fn verify_two_adic_pcs<C: Config + 'static>(
pub fn verify_two_adic_pcs<C: Config>(
builder: &mut Builder<C>,
config: &FriConfigVariable<C>,
rounds: Array<C, TwoAdicPcsRoundVariable<C>>,
Expand Down Expand Up @@ -330,7 +330,7 @@ pub struct TwoAdicFriPcsVariable<C: Config> {
pub config: FriConfigVariable<C>,
}

impl<C: Config + 'static> PcsVariable<C> for TwoAdicFriPcsVariable<C>
impl<C: Config> PcsVariable<C> for TwoAdicFriPcsVariable<C>
where
C::F: TwoAdicField,
C::EF: TwoAdicField,
Expand Down
2 changes: 1 addition & 1 deletion extensions/native/recursion/src/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl VecAutoHintable for Vec<Vec<AdjacentOpenedValues<InnerChallenge>>> {}
impl VecAutoHintable for AirProofData<BabyBearPoseidon2Config> {}
impl VecAutoHintable for Proof<BabyBearPoseidon2Config> {}

impl<C: Config + 'static, I: VecAutoHintable + Hintable<C> + 'static> Hintable<C> for Vec<I> {
impl<C: Config, I: VecAutoHintable + Hintable<C>> Hintable<C> for Vec<I> {
type HintVariable = Array<C, I::HintVariable>;

fn read(builder: &mut Builder<C>) -> Self::HintVariable {
Expand Down
2 changes: 1 addition & 1 deletion extensions/native/recursion/src/stark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub struct StarkVerifier<C: Config> {
_phantom: PhantomData<C>,
}

impl<C: Config + 'static> StarkVerifier<C>
impl<C: Config> StarkVerifier<C>
where
C::F: TwoAdicField,
{
Expand Down

0 comments on commit d3b8e78

Please sign in to comment.