-
Notifications
You must be signed in to change notification settings - Fork 18
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
Da nomos core #390
Da nomos core #390
Changes from 6 commits
ec98fa2
3d42ba9
9f9aa82
bb15638
2baa92b
6521278
e97ec14
20c9148
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use crate::da::blob::Blob; | ||
use bytes::Bytes; | ||
|
||
pub trait Attestation { | ||
type Blob: Blob; | ||
fn blob(&self) -> <Self::Blob as Blob>::Hash; | ||
fn as_bytes(&self) -> Bytes; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub trait Certificate {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::da::attestation::Attestation; | ||
use crate::da::blob::Blob; | ||
use crate::da::certificate::Certificate; | ||
use bytes::Bytes; | ||
use futures::Stream; | ||
use serde::de::Error; | ||
|
||
pub mod attestation; | ||
pub mod blob; | ||
pub mod certificate; | ||
|
||
pub trait DaProtocol { | ||
type Blob: Blob; | ||
type Attestation: Attestation; | ||
type Certificate: Certificate; | ||
|
||
fn encode<T: AsRef<[u8]>>(&self, data: T) -> Box<dyn Stream<Item = Self::Blob>>; | ||
fn decode<S: Stream<Item = Self::Blob>>(&self, s: S) -> Result<Bytes, Box<dyn Error>>; | ||
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Rust lints (libp2p)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Check (libp2p)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test Suite (libp2p, ubuntu-latest)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test Suite (libp2p, macos-latest)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test Suite (waku, ubuntu-latest)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test Suite (libp2p, windows-latest)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test Suite (waku, macos-latest)
Check failure on line 18 in nomos-core/src/da/mod.rs GitHub Actions / Test
|
||
fn validate_attestation(&self, blob: &Self::Blob, attestation: &Self::Attestation) -> bool; | ||
|
||
fn certificate_dispersal<S: Stream<Item = Self::Attestation>>( | ||
&self, | ||
attestations: S, | ||
) -> Self::Certificate; | ||
} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to validate a single attestation or the full proof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the attestation for an specific blob. We should probably add a trait method to create a certificate over the set of attestations. I'll add now as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also a method to validate said certificate?