Skip to content

Commit

Permalink
refactor: rename proofs to proof-of-sql and proofs-sql to `proo…
Browse files Browse the repository at this point in the history
…f-of-sql-parser` (#6)

# Rationale for this change
We need to make our crate names line up with the name of the repo

# What changes are included in this PR?
- rename `proofs` to `proof-of-sql` and `proofs-sql` to
`proof-of-sql-parser`
- rename the respective directories as well

# Are these changes tested?
Existing tests should pass
  • Loading branch information
iajoiner authored Jun 12, 2024
1 parent 789ab89 commit e85945d
Show file tree
Hide file tree
Showing 262 changed files with 131 additions and 125 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
run: cargo check --all-targets
- name: Run cargo check (all features)
run: cargo check --all-targets --all-features
- name: Run cargo check (proofs) (no features)
run: cargo check -p proofs --no-default-features
- name: Run cargo check (proofs) (all features)
run: cargo check -p proofs --all-features
- name: Run cargo check (proofs) (just "test" feature)
run: cargo check -p proofs --no-default-features --features="test"
- name: Run cargo check (proofs) (just "blitzar" feature)
run: cargo check -p proofs --no-default-features --features="blitzar"
- name: Run cargo check (proof-of-sql) (no features)
run: cargo check -p proof-of-sql --no-default-features
- name: Run cargo check (proof-of-sql) (all features)
run: cargo check -p proof-of-sql --all-features
- name: Run cargo check (proof-of-sql) (just "test" feature)
run: cargo check -p proof-of-sql --no-default-features --features="test"
- name: Run cargo check (proof-of-sql) (just "blitzar" feature)
run: cargo check -p proof-of-sql --no-default-features --features="blitzar"

test:
name: Test Suite
Expand All @@ -73,18 +73,18 @@ jobs:
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld
- name: Run cargo test
run: cargo test --all-features
- name: Dry run cargo test (proofs) (test feature only)
run: cargo test -p proofs --no-run --no-default-features --features="test"
- name: Dry run cargo test (proofs) (blitzar feature only)
run: cargo test -p proofs --no-run --no-default-features --features="blitzar"
- name: Dry run cargo test (proofs) (no features)
run: cargo test -p proofs --no-run --no-default-features
- name: Dry run cargo test (proof-of-sql) (test feature only)
run: cargo test -p proof-of-sql --no-run --no-default-features --features="test"
- name: Dry run cargo test (proof-of-sql) (blitzar feature only)
run: cargo test -p proof-of-sql --no-run --no-default-features --features="blitzar"
- name: Dry run cargo test (proof-of-sql) (no features)
run: cargo test -p proof-of-sql --no-run --no-default-features
- name: Run cargo test (proof primitives - Dory) (no features - i.e. not using blitzar)
run: cargo test proof_primitive::dory::dory_compute_commitments_test --no-default-features
- name: Run hello_world example
run: cargo run --example hello_world --features="blitzar test"
- name: Run posql_db example
run: bash crates/proofs/examples/posql_db/run_example.sh
run: bash crates/proof-of-sql/examples/posql_db/run_example.sh

clippy:
name: Clippy
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center" style="border-bottom: none;">Contributing to our Proofs Repository</h1>
<h1 align="center" style="border-bottom: none;">Contributing to our Proof of SQL Repository</h1>
<p align="center">
<a href="https://www.conventionalcommits.org/en/v1.0.0/">
<img alt="semantic-release: conventional-commits" src="https://img.shields.io/badge/semantic--release-conventional--commits-blueviolet">
Expand Down Expand Up @@ -103,9 +103,9 @@ Before you submit your Pull Request (PR) consider the following guidelines:
git push origin my-feature-branch
```

7. In GitHub, send a pull request to `proofs:main`.
7. In GitHub, send a pull request to `sxt-proof-of-sql:main`.

Our proofs repository triggers automatically a workflow to test the code whenever a Pull Request is submitted or a commit is pushed to an existing PR. Before closing the PR, always verify that those tests are indeed passing.
Our proof of SQL repository triggers automatically a workflow to test the code whenever a Pull Request is submitted or a commit is pushed to an existing PR. Before closing the PR, always verify that those tests are indeed passing.

Also, to ease this process of using git, you can try to use [vscode](https://code.visualstudio.com/). Vscode has some nice extensions to manage your git workflow.

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[workspace]
resolver = "2"
members = ["crates/proofs", "crates/proofs-sql"]
members = ["crates/proof-of-sql", "crates/proof-of-sql-parser"]

[workspace.package]
edition = "2021"
exclude = ["**/.gitignore", ".gitignore"]
repository = "https://github.com/spaceandtimelabs/proofs"
repository = "https://github.com/spaceandtimelabs/sxt-proof-of-sql"
version = "0.0.0" # DO NOT CHANGE THIS LINE! This will be automatically updated

[workspace.dependencies]
Expand Down Expand Up @@ -44,8 +44,8 @@ opentelemetry = { version = "0.23.0" }
opentelemetry-jaeger = { version = "0.20.0" }
polars = { version = "0.33.1", default-features = false, features = ["dtype-i16"] }
postcard = { version = "1.0" }
proofs = { path = "crates/proofs" } # We automatically update this line during release. So do not modify it!
proofs-sql = { path = "crates/proofs-sql" } # We automatically update this line during release. So do not modify it!
proof-of-sql = { path = "crates/proof-of-sql" } # We automatically update this line during release. So do not modify it!
proof-of-sql-parser = { path = "crates/proof-of-sql-parser" } # We automatically update this line during release. So do not modify it!
rand = { version = "0.8" }
rand_core = { version = "0.6" }
rayon = { version = "1.5" }
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn main() {

## Examples

Proof of SQL comes with example code demonstrating its usage. You can find the examples in the `crates/proofs/examples` folder. Below are explainations of how to run some of these examples:
Proof of SQL comes with example code demonstrating its usage. You can find the examples in the `crates/proof-of-sql/examples` folder. Below are explainations of how to run some of these examples:

### "Hello World" Example

Expand Down Expand Up @@ -92,7 +92,7 @@ Valid proof!
Query result: OwnedTable { table: {Identifier { name: "b" }: VarChar(["hello", "world"])} }
```

For a detailed explanation of the example and its implementation, refer to the [README](crates/proofs/examples/hello_world/README.md) and source code in [hello_world/main.rs](crates/proofs/examples/hello_world/main.rs).
For a detailed explanation of the example and its implementation, refer to the [README](crates/proof-of-sql/examples/hello_world/README.md) and source code in [hello_world/main.rs](crates/proof-of-sql/examples/hello_world/main.rs).

### CSV Database Example

Expand All @@ -101,10 +101,10 @@ The CSV Database example demonstrates an implementation of a simple CSV-backed d
To install the example:

```bash
cargo install --example posql_db --path crates/proofs #TODO: update once this is published to crates.io
cargo install --example posql_db --path crates/proof-of-sql #TODO: update once this is published to crates.io
```

For detailed usage instructions and examples of how to create, append to, prove, and verify queries in the CSV-backed database, refer to the [README](crates/proofs/examples/posql_db/README.md) and source code in [posql_db/main.rs](crates/proofs/examples/posql_db/main.rs).
For detailed usage instructions and examples of how to create, append to, prove, and verify queries in the CSV-backed database, refer to the [README](crates/proof-of-sql/examples/posql_db/README.md) and source code in [posql_db/main.rs](crates/proof-of-sql/examples/posql_db/main.rs).

## Benchmarks

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
publish = true
name = "proofs-sql"
name = "proof-of-sql-parser"
version = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Identifier {
impl Identifier {
/// Constructor for [Identifier]
///
/// Note: this constructor should be private within the proofs_sql crate.
/// Note: this constructor should be private within the proof_of_sql_parser crate.
/// This is necessary to guarantee that no one outside the crate
/// can create Names, thus securing that ResourceIds and Identifiers
/// are always valid postgresql identifiers.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A parser conforming to standard postgreSQL to parse the precision and scale
//! from a decimal token obtained from the lalrpop lexer. This module
//! exists to resolve a cyclic dependency between proofs
//! and proofs-sql.
//! exists to resolve a cyclic dependency between proof-of-sql
//! and proof-of-sql-parser.
//!
//! A decimal must have a decimal point. The lexer does not route
//! whole integers to this contructor.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/proofs/Cargo.toml → crates/proof-of-sql/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
publish = true
name = "proofs"
name = "proof-of-sql"
version = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
Expand Down Expand Up @@ -40,7 +40,7 @@ num-traits = { workspace = true }
num-bigint = { workspace = true, default-features = false }
polars = { workspace = true, features = ["lazy", "bigidx", "dtype-decimal", "serde-lazy"] }
postcard = { workspace = true, features = ["alloc"] }
proofs-sql = { workspace = true }
proof-of-sql-parser = { workspace = true }
rand = { workspace = true, optional = true }
rayon = { workspace = true }
serde = { workspace = true, features = ["serde_derive"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run benchmarks with Jaeger, you need to do the following
```
2. Run the benchmark.
```bash
cargo bench -p proofs --bench jaeger_benches
cargo bench -p proof-of-sql --bench jaeger_benches
```
3. Navigate to http://localhost:16686/ to see the results.
4. To end the Jaeger service, run
Expand All @@ -24,6 +24,6 @@ To run benchmarks with Criterion, you need to do the following

1. Run the benchmarks. (Warning: this takes a very long time.)
```bash
cargo bench -p proofs --bench criterion_benches
cargo bench -p proof-of-sql --bench criterion_benches
```
2. Navigate to `target/criterion/report/index.html` to see the results.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Benchmarking using the `criterion` crate.
//! To run, execute the following command:
//! ```bash
//! cargo bench -p proofs --bench criterion_benches
//! cargo bench -p proof-of-sql --bench criterion_benches
//! ```
#![allow(missing_docs)]
use blitzar::proof::InnerProductProof;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! To run, execute the following commands:
//! ```bash
//! docker run --rm -d --name jaeger -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one:latest
//! cargo bench -p proofs --bench jaeger_benches
//! cargo bench -p proof-of-sql --bench jaeger_benches
//! ```
//! Then, navigate to http://localhost:16686 to view the traces.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use proofs::base::{
use proof_of_sql::base::{
commitment::Commitment,
database::{
Column, ColumnRef, ColumnType, CommitmentAccessor, DataAccessor, MetadataAccessor,
SchemaAccessor, TableRef,
},
};
use proofs_sql::Identifier;
use proof_of_sql_parser::Identifier;
use std::collections::HashMap;

#[derive(Default)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use blitzar::compute::init_backend;
use bumpalo::Bump;
use criterion::{AxisScale, Criterion, PlotConfiguration};
use proofs::{
use proof_of_sql::{
base::{commitment::CommitmentEvaluationProof, database::ColumnType},
sql::{parse::QueryExpr, proof::VerifiableQueryResult},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::OptionalRandBound;
use proofs::base::database::ColumnType;
use proof_of_sql::base::database::ColumnType;

const SINGLE_COLUMN_FILTER_TITLE: &str = "Single Column Filter";
const SINGLE_COLUMN_FILTER_SQL: &str = "SELECT b FROM table WHERE a = 0";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use bumpalo::Bump;
use proofs::base::{
use proof_of_sql::base::{
database::{Column, ColumnType},
scalar::Scalar,
};
use proofs_sql::Identifier;
use proof_of_sql_parser::Identifier;
use rand::Rng;

pub type OptionalRandBound = Option<fn(usize) -> i64>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![doc = include_str!("README.md")]

use blitzar::{compute::init_backend, proof::InnerProductProof};
use proofs::{
use proof_of_sql::{
base::database::{owned_table_utility::*, OwnedTableTestAccessor, TestAccessor},
sql::{parse::QueryExpr, proof::QueryProof},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Example demonstrating an implementation of a simple csv-backed database with Proof of SQL capabilities.

## Install
Run `cargo install --example posql_db --path crates/proofs` to install the example.
Run `cargo install --example posql_db --path crates/proof-of-sql` to install the example.

## Quick Start Exmaple
Run the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use proofs::base::{
use proof_of_sql::base::{
commitment::{Commitment, QueryCommitments, TableCommitment},
database::{CommitmentAccessor, MetadataAccessor, SchemaAccessor, TableRef},
};
Expand Down Expand Up @@ -36,32 +36,35 @@ impl<C: Commitment + Serialize + for<'a> Deserialize<'a>> CommitAccessor<C> {
}

impl<C: Commitment> CommitmentAccessor<C> for CommitAccessor<C> {
fn get_commitment(&self, column: proofs::base::database::ColumnRef) -> C {
fn get_commitment(&self, column: proof_of_sql::base::database::ColumnRef) -> C {
self.inner.get_commitment(column)
}
}
impl<C: Commitment> MetadataAccessor for CommitAccessor<C> {
fn get_length(&self, table_ref: proofs::base::database::TableRef) -> usize {
fn get_length(&self, table_ref: proof_of_sql::base::database::TableRef) -> usize {
self.inner.get_length(table_ref)
}

fn get_offset(&self, table_ref: proofs::base::database::TableRef) -> usize {
fn get_offset(&self, table_ref: proof_of_sql::base::database::TableRef) -> usize {
self.inner.get_offset(table_ref)
}
}
impl<C: Commitment> SchemaAccessor for CommitAccessor<C> {
fn lookup_column(
&self,
table_ref: proofs::base::database::TableRef,
column_id: proofs_sql::Identifier,
) -> Option<proofs::base::database::ColumnType> {
table_ref: proof_of_sql::base::database::TableRef,
column_id: proof_of_sql_parser::Identifier,
) -> Option<proof_of_sql::base::database::ColumnType> {
self.inner.lookup_column(table_ref, column_id)
}

fn lookup_schema(
&self,
table_ref: proofs::base::database::TableRef,
) -> Vec<(proofs_sql::Identifier, proofs::base::database::ColumnType)> {
table_ref: proof_of_sql::base::database::TableRef,
) -> Vec<(
proof_of_sql_parser::Identifier,
proof_of_sql::base::database::ColumnType,
)> {
self.inner.lookup_schema(table_ref)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::record_batch_accessor::RecordBatchAccessor;
use arrow::{datatypes::Schema, record_batch::RecordBatch};
use arrow_csv::{ReaderBuilder, WriterBuilder};
use proofs::base::{
use proof_of_sql::base::{
database::{Column, ColumnRef, DataAccessor, MetadataAccessor, SchemaAccessor, TableRef},
scalar::Scalar,
};
Expand Down Expand Up @@ -96,14 +96,17 @@ impl SchemaAccessor for CsvDataAccessor {
fn lookup_column(
&self,
table_ref: TableRef,
column_id: proofs_sql::Identifier,
) -> Option<proofs::base::database::ColumnType> {
column_id: proof_of_sql_parser::Identifier,
) -> Option<proof_of_sql::base::database::ColumnType> {
self.inner.lookup_column(table_ref, column_id)
}
fn lookup_schema(
&self,
table_ref: TableRef,
) -> Vec<(proofs_sql::Identifier, proofs::base::database::ColumnType)> {
) -> Vec<(
proof_of_sql_parser::Identifier,
proof_of_sql::base::database::ColumnType,
)> {
self.inner.lookup_schema(table_ref)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use commit_accessor::CommitAccessor;
use csv_accessor::{read_record_batch_from_csv, CsvDataAccessor};
use curve25519_dalek::RistrettoPoint;
use itertools::Itertools;
use proofs::{
use proof_of_sql::{
base::{
commitment::TableCommitment,
database::{SchemaAccessor, TableRef},
},
sql::{parse::QueryExpr, proof::VerifiableQueryResult},
};
use proofs_sql::{Identifier, SelectStatement};
use proof_of_sql_parser::{Identifier, SelectStatement};
use std::{
fs,
io::{prelude::Write, stdout},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use arrow::record_batch::RecordBatch;
use bumpalo::Bump;
use proofs::base::{
use proof_of_sql::base::{
database::{
ArrayRefExt, Column, ColumnRef, ColumnType, DataAccessor, MetadataAccessor, SchemaAccessor,
TableRef,
},
scalar::Scalar,
};
use proofs_sql::Identifier;
use proof_of_sql_parser::Identifier;
use std::collections::HashMap;

#[derive(Default)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cd crates/proofs/examples/posql_db
cd crates/proof-of-sql/examples/posql_db
cargo run --example posql_db create -t sxt.table -c a,b -d BIGINT,VARCHAR
cargo run --example posql_db append -t sxt.table -f hello_world.csv
cargo run --example posql_db prove -q "SELECT b FROM sxt.table WHERE a = 2" -f hello.proof
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{
};
use crate::base::database::ColumnField;
use indexmap::IndexMap;
use proofs_sql::Identifier;
use proof_of_sql_parser::Identifier;
use thiserror::Error;

/// Mapping of column identifiers to column metadata used to associate metadata with commitments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::{
ColumnCommitmentMetadataMapExt, ColumnCommitmentsMismatch, VecCommitmentExt,
};
use crate::base::database::{ColumnField, ColumnRef, CommitmentAccessor, TableRef};
use proofs_sql::Identifier;
use proof_of_sql_parser::Identifier;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use thiserror::Error;
Expand Down
File renamed without changes.
Loading

0 comments on commit e85945d

Please sign in to comment.