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

Add node type to api + proofs #225

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions firewood/src/v2/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ pub enum Error {
/// A range proof, consisting of a proof of the first key and the last key,
/// and a vector of all key/value pairs
#[derive(Debug)]
pub struct RangeProof<K: KeyType, V: ValueType> {
pub first_key: Proof<V>,
pub last_key: Proof<V>,
pub struct RangeProof<K: KeyType, V: ValueType, N: AsRef<[u8]> + Send> {
rkuris marked this conversation as resolved.
Show resolved Hide resolved
pub first_key: Proof<N>,
pub last_key: Proof<N>,
pub middle: Vec<(K, V)>,
}

Expand Down Expand Up @@ -147,12 +147,12 @@ pub trait DbView {
/// * `last_key` - If None, continue to the end of the database
/// * `limit` - The maximum number of keys in the range proof
///
async fn range_proof<K: KeyType, V: ValueType>(
async fn range_proof<K: KeyType, V: ValueType, N: AsRef<[u8]> + Send>(
rkuris marked this conversation as resolved.
Show resolved Hide resolved
&self,
first_key: Option<K>,
last_key: Option<K>,
limit: usize,
) -> Result<Option<RangeProof<K, V>>, Error>;
) -> Result<Option<RangeProof<K, V, N>>, Error>;
}

/// A proposal for a new revision of the database.
Expand Down
4 changes: 2 additions & 2 deletions firewood/src/v2/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ impl api::DbView for DbView {
todo!()
}

async fn range_proof<K: KeyType, V: ValueType>(
async fn range_proof<K: KeyType, V: ValueType, N: AsRef<[u8]> + Send>(
rkuris marked this conversation as resolved.
Show resolved Hide resolved
&self,
_first_key: Option<K>,
_last_key: Option<K>,
_limit: usize,
) -> Result<Option<api::RangeProof<K, V>>, api::Error> {
) -> Result<Option<api::RangeProof<K, V, N>>, api::Error> {
todo!()
}
}
4 changes: 2 additions & 2 deletions firewood/src/v2/emptydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ impl DbView for HistoricalImpl {
Ok(None)
}

async fn range_proof<K: KeyType, V: ValueType>(
async fn range_proof<K: KeyType, V: ValueType, N: AsRef<[u8]> + Send>(
rkuris marked this conversation as resolved.
Show resolved Hide resolved
&self,
_first_key: Option<K>,
_last_key: Option<K>,
_limit: usize,
) -> Result<Option<RangeProof<K, V>>, Error> {
) -> Result<Option<RangeProof<K, V, N>>, Error> {
Ok(None)
}
}
Expand Down
4 changes: 2 additions & 2 deletions firewood/src/v2/propose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ impl<T: api::DbView + Send + Sync> api::DbView for Proposal<T> {
todo!()
}

async fn range_proof<KT: KeyType, VT: ValueType>(
async fn range_proof<KT: KeyType, VT: ValueType, NT: AsRef<[u8]> + Send>(
rkuris marked this conversation as resolved.
Show resolved Hide resolved
&self,
_first_key: Option<KT>,
_last_key: Option<KT>,
_limit: usize,
) -> Result<Option<api::RangeProof<KT, VT>>, api::Error> {
) -> Result<Option<api::RangeProof<KT, VT, NT>>, api::Error> {
todo!()
}
}
Expand Down
Loading