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

storage: refactor and rocksdb implementation #123

Merged
merged 20 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
158 changes: 157 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ members = [
"crates/groth16",
"crates/errors",
"crates/sp1",
"crates/storage",
"crates/da",
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
]
default-members = [
"crates/prism",
"crates/common",
"crates/nova",
"crates/groth16",
"crates/errors",
"crates/storage",
]
resolver = "2"

Expand Down Expand Up @@ -78,10 +81,14 @@ bincode = "1.3.3"
sp1-zkvm = { version = "1.2.0" }
sp1-sdk = { version = "1.2.0" }
prism-common = { path = "crates/common" }
prism-storage = { path = "crates/storage" }
prism-nova = { path = "crates/nova" }
prism-da = { path = "crates/da" }
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
prism-errors = { path = "crates/errors" }
prism-main = { path = "crates/prism" }
prism-groth16 = { path = "crates/groth16" }
rocksdb = {version = "0.21.0", features = ["multi-threaded-cf"]}

distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved

[patch.crates-io]
sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8" }
Expand Down
1 change: 1 addition & 0 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ hex.workspace = true
sha2.workspace = true
celestia-types.workspace = true
bincode.workspace = true
ed25519.workspace = true
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions crates/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod hashchain;
pub mod operation;
pub mod tree;
pub mod signedcontent;
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions crates/common/src/signedcontent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use ed25519::Signature;
use anyhow::Result;


pub trait SignedContent {
fn get_signature(&self) -> Result<Signature>;
fn get_plaintext(&self) -> Result<Vec<u8>>;
fn get_public_key(&self) -> Result<String>;
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
}

53 changes: 53 additions & 0 deletions crates/da/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
name = "prism-da"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
readme.workspace = true
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved

[dependencies]
axum = { workspace = true }
borsh = { workspace = true }
tower-http = { workspace = true }
utoipa = { workspace = true }
utoipa-swagger-ui = { workspace = true }
async-trait = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
redis = { workspace = true }
ed25519-dalek = { workspace = true }
ed25519 = { workspace = true }
base64 = { workspace = true }
tokio = { workspace = true }
bellman = { workspace = true }
bincode = { workspace = true }
bls12_381 = { workspace = true }
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
rand = { workspace = true }
hex = { workspace = true }
ff = { workspace = true }
log = { workspace = true }
pretty_env_logger = { workspace = true }
clap = { workspace = true }
config = { workspace = true }
thiserror = { workspace = true }
indexed-merkle-tree = { workspace = true }
dotenvy = { workspace = true }
celestia-rpc = { workspace = true }
celestia-types = { workspace = true }
mockall = { workspace = true }
keystore-rs = { workspace = true }
toml = { workspace = true }
dirs = { workspace = true }
anyhow = { workspace = true }
jmt = { workspace = true }
sha2 = { workspace = true }
auto_impl = { workspace = true }
prism-common = { workspace = true }
prism-errors = { workspace = true }
prism-groth16 = { workspace = true }
sp1-sdk = { workspace = true }
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 22 additions & 2 deletions crates/prism/src/da/celestia.rs → crates/da/src/celestia.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use crate::{
cfg::CelestiaConfig,
consts::CHANNEL_BUFFER_SIZE,
da::{DataAvailabilityLayer, FinalizedEpoch},
{DataAvailabilityLayer, FinalizedEpoch},
};
use anyhow::{anyhow, bail, Context, Result};
use async_trait::async_trait;
use celestia_rpc::{BlobClient, Client, HeaderClient};
use celestia_types::{blob::GasPrice, nmt::Namespace, Blob};
use log::{debug, trace, warn};
use prism_common::operation::Operation;
use prism_errors::{DataAvailabilityError, GeneralError};
use serde::{Deserialize, Serialize};
use std::{self, sync::Arc};
use tokio::{
sync::{
Expand All @@ -30,6 +31,25 @@ impl TryFrom<&Blob> for FinalizedEpoch {
}
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CelestiaConfig {
pub connection_string: String,
pub start_height: u64,
pub snark_namespace_id: String,
pub operation_namespace_id: Option<String>,
}
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved

distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved
impl Default for CelestiaConfig {
fn default() -> Self {
CelestiaConfig {
connection_string: "ws://localhost:26658".to_string(),
start_height: 0,
snark_namespace_id: "00000000000000de1008".to_string(),
operation_namespace_id: Some("00000000000000de1009".to_string()),
}
}
}
distractedm1nd marked this conversation as resolved.
Show resolved Hide resolved

pub struct CelestiaConnection {
pub client: celestia_rpc::Client,
pub snark_namespace: Namespace,
Expand Down
File renamed without changes.
Loading