Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing placeholders #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions lgn-messages/src/types/v1/query/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
use crate::types::v1::query::tasks::QueryInput;
use alloy_primitives::U256;
use derive_debug_plus::Dbg;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
use verifiable_db::query::computational_hash_ids::PlaceholderIdentifier;
use verifiable_db::query::universal_circuit::universal_circuit_inputs::Placeholders;

pub mod keys;
pub mod tasks;
Expand Down Expand Up @@ -36,41 +31,3 @@ pub enum WorkerTaskType {
#[serde(rename = "1")]
Query(QueryInput),
}

#[derive(Dbg, Clone, PartialEq, Deserialize, Serialize)]
pub struct PlaceHolderLgn(HashMap<String, U256>);

impl From<PlaceHolderLgn> for Placeholders {
fn from(ph: PlaceHolderLgn) -> Self {
let min_block = ph.0.get("0").cloned().unwrap();
let max_block = ph.0.get("1").cloned().unwrap();
let mut placeholders = Placeholders::new_empty(min_block, max_block);

for (k, v) in ph.0.into_iter() {
if k != "0" && k != "1" {
let index = k.parse::<usize>().unwrap();
placeholders.insert(PlaceholderIdentifier::Generic(index - 1), v);
}
}

placeholders
}
}

impl From<Placeholders> for PlaceHolderLgn {
fn from(ph: Placeholders) -> Self {
let min_block = ph.get(&PlaceholderIdentifier::MinQueryOnIdx1).unwrap();
let max_block = ph.get(&PlaceholderIdentifier::MaxQueryOnIdx1).unwrap();
let mut map = HashMap::new();
map.insert(0.to_string(), min_block);
map.insert(1.to_string(), max_block);

for (k, v) in ph.0.iter() {
if let PlaceholderIdentifier::Generic(i) = k {
map.insert((*i + 1).to_string(), *v);
}
}

PlaceHolderLgn(map)
}
}
10 changes: 5 additions & 5 deletions lgn-messages/src/types/v1/query/tasks.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::types::v1::preprocessing::db_keys;
use crate::types::v1::query::keys::ProofKey;
use crate::types::v1::query::{PlaceHolderLgn, WorkerTask, WorkerTaskType};
use crate::types::v1::query::{WorkerTask, WorkerTaskType};
use alloy_primitives::U256;
use derive_debug_plus::Dbg;
use serde_derive::{Deserialize, Serialize};
use verifiable_db::query::aggregation::{ChildPosition, NodeInfo};
use verifiable_db::query::universal_circuit::universal_circuit_inputs::RowCells;
use verifiable_db::query::universal_circuit::universal_circuit_inputs::{Placeholders, RowCells};

#[derive(Dbg, Clone, PartialEq, Deserialize, Serialize)]
pub struct QueryInput {
Expand Down Expand Up @@ -98,7 +98,7 @@ pub enum EmbeddedProofInputType {
pub struct RowsEmbeddedProofInput {
pub column_cells: RowCells,

pub placeholders: PlaceHolderLgn,
pub placeholders: Placeholders,

pub is_leaf: bool,
}
Expand Down Expand Up @@ -147,7 +147,7 @@ pub struct SinglePathLeafInput {

#[derive(Clone, PartialEq, Dbg, Deserialize, Serialize)]
pub struct RevelationInput {
pub placeholders: PlaceHolderLgn,
pub placeholders: Placeholders,

pub indexing_proof_location: db_keys::ProofKey,

Expand All @@ -164,7 +164,7 @@ pub struct RevelationInput {
pub struct NonExistenceInput {
pub column_ids: Vec<u64>,

pub placeholders: PlaceHolderLgn,
pub placeholders: Placeholders,

pub is_rows_tree_node: bool,

Expand Down
Loading