diff --git a/devenv.lock b/devenv.lock index e8c3e821c..0111c0850 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1728993896, + "lastModified": 1729857292, "owner": "cachix", "repo": "devenv", - "rev": "dc7ebaf872306526ea6dcbb2122acca792680701", + "rev": "d9156ba99fed6f4bc4d84b8ff1b442f04a98210a", "type": "github" }, "original": { @@ -24,10 +24,10 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1728973961, + "lastModified": 1729838036, "owner": "nix-community", "repo": "fenix", - "rev": "d6a9ff4d1e60c347a23bc96ccdb058d37a810541", + "rev": "c9f079dab2456bd75da8539b7129f8aaea9d4a2d", "type": "github" }, "original": { @@ -88,10 +88,10 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1728740863, + "lastModified": 1729691686, "owner": "NixOS", "repo": "nixpkgs", - "rev": "a3f9ad65a0bf298ed5847629a57808b97e6e8077", + "rev": "32e940c7c420600ef0d1ef396dc63b04ee9cad37", "type": "github" }, "original": { @@ -111,10 +111,10 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1728778939, + "lastModified": 1729104314, "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ff68f91754be6f3427e4986d7949e6273659be1d", + "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", "type": "github" }, "original": { @@ -134,10 +134,10 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1728921748, + "lastModified": 1729792465, "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "0319586ef2a2636f6d6b891690b7ebebf4337c85", + "rev": "6a67a4d3cd480dbbc3b1dec461a31b1bea1dfba4", "type": "github" }, "original": { diff --git a/mp2-v1/tests/common/cases/query.rs b/mp2-v1/tests/common/cases/query.rs index 5737161d4..9ebaba6a5 100644 --- a/mp2-v1/tests/common/cases/query.rs +++ b/mp2-v1/tests/common/cases/query.rs @@ -567,7 +567,7 @@ where // closure performing all the operations necessary beofre jumping to the next iteration let mut end_iteration = |proven_nodes: &mut HashSet| -> Result<()> { proven_nodes.insert(k.clone()); - workplan.done(&wk)?; + workplan.done(wk.k())?; Ok(()) }; // since epoch starts at genesis now, we can directly give the value of the block diff --git a/mp2-v1/tests/common/celltree.rs b/mp2-v1/tests/common/celltree.rs index 9dc856bab..0d6bf7e04 100644 --- a/mp2-v1/tests/common/celltree.rs +++ b/mp2-v1/tests/common/celltree.rs @@ -178,7 +178,7 @@ impl TestContext { .unwrap() ) ); - workplan.done(&wk).unwrap(); + workplan.done(wk.k()).unwrap(); } let root = tree.root().await.unwrap(); let root_data = tree.root_data().await.unwrap(); diff --git a/mp2-v1/tests/common/index_tree.rs b/mp2-v1/tests/common/index_tree.rs index 481d6aeb7..c7451c7d2 100644 --- a/mp2-v1/tests/common/index_tree.rs +++ b/mp2-v1/tests/common/index_tree.rs @@ -200,7 +200,7 @@ impl TestContext { .store_proof(ProofKey::Index(proof_key), proof) .expect("unable to store index tree proof"); - workplan.done(&wk).unwrap(); + workplan.done(wk.k()).unwrap(); } let root = t.root().await.unwrap(); let root_proof_key = IndexProofIdentifier { diff --git a/mp2-v1/tests/common/rowtree.rs b/mp2-v1/tests/common/rowtree.rs index d0123e3c0..cddb14132 100644 --- a/mp2-v1/tests/common/rowtree.rs +++ b/mp2-v1/tests/common/rowtree.rs @@ -238,7 +238,7 @@ impl TestContext { new_proof_key, hex::encode(extract_hash_from_proof(&proof).unwrap().to_bytes()) ); - workplan.done(&wk).unwrap(); + workplan.done(wk.k()).unwrap(); } let root = t.root().await.unwrap(); let row = table.row.fetch(&root).await; diff --git a/recursion-framework/src/circuit_builder.rs b/recursion-framework/src/circuit_builder.rs index 0ebb0668c..13d727989 100644 --- a/recursion-framework/src/circuit_builder.rs +++ b/recursion-framework/src/circuit_builder.rs @@ -386,7 +386,6 @@ pub(crate) mod tests { } impl< - 'a, F: SerializableRichField, const D: usize, const NUM_VERIFIERS: usize, @@ -457,7 +456,6 @@ pub(crate) mod tests { } impl< - 'a, F: SerializableRichField, const D: usize, const NUM_VERIFIERS: usize, diff --git a/ryhope/src/lib.rs b/ryhope/src/lib.rs index a091bdd4c..240f812ae 100644 --- a/ryhope/src/lib.rs +++ b/ryhope/src/lib.rs @@ -166,7 +166,7 @@ where let mut payload = self.storage.data().fetch(item.k()).await; payload.aggregate(child_data.into_iter()); - plan.done(&item)?; + plan.done(item.k())?; self.storage .data_mut() .store(item.k().to_owned(), payload) diff --git a/ryhope/src/storage/updatetree.rs b/ryhope/src/storage/updatetree.rs index 32d34cc3e..0c7e2f411 100644 --- a/ryhope/src/storage/updatetree.rs +++ b/ryhope/src/storage/updatetree.rs @@ -383,6 +383,22 @@ impl WorkplanItem { WorkplanItem::Subtree { k, .. } | WorkplanItem::Node { k, .. } => k, } } + + pub fn as_subtree(&self) -> &UpdateTree { + if let WorkplanItem::Subtree { subtree, .. } = self { + subtree + } else { + unreachable!() + } + } + + pub fn as_node(&self) -> bool { + if let WorkplanItem::Node { is_path_end, .. } = self { + *is_path_end + } else { + unreachable!() + } + } } /// An update plan to recompute all the hashes of the touched nodes stored in a @@ -419,15 +435,11 @@ impl UpdatePlan { /// Mark the given item as having been completed. Its dependent will not be /// generated by the iterator until the item has been marked as completed. - pub fn done(&mut self, item: &WorkplanItem) -> Result<()> { - let i = *self - .t - .idx - .get(item.k()) - .ok_or_else(|| anyhow!("unknwown key"))?; + pub fn done(&mut self, k: &T) -> Result<()> { + let i = *self.t.idx.get(k).ok_or_else(|| anyhow!("unknwown key"))?; // May happen when restarting a plan - self.anchors.retain(|k| k != item.k()); + self.anchors.retain(|_k| _k != k); // Root node is hardcoded to 0 if i == 0 { @@ -541,14 +553,14 @@ mod tests { loop { let mut done = vec![]; - while let Some(Next::Ready(k)) = workplan.next() { - println!("Doing {}", k.k()); - done.push(k); + while let Some(Next::Ready(item)) = workplan.next() { + println!("Doing {}", item.k()); + done.push(item); workplan.t.print(); } for d in done.iter() { - workplan.done(d).unwrap(); + workplan.done(d.k()).unwrap(); } if done.is_empty() { break; @@ -599,7 +611,7 @@ mod tests { count_done += 1; } } - workplan.done(&item).unwrap(); + workplan.done(item.k()).unwrap(); } assert_eq!(count_done, mt.nodes.len());