Skip to content

Commit

Permalink
small change to ad elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 10, 2024
1 parent d7da5c1 commit d436eab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/derive/src/traits/data_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub trait EigenDABlobProvider {
type Error: Display + ToString + Into<PipelineErrorKind>;

async fn get_blob(&mut self, cert: &Bytes) -> Result<Bytes, Self::Error>;

async fn get_element(&mut self, cert: &Bytes, element: &Bytes) -> Result<Bytes, Self::Error>;
}


Expand Down
20 changes: 20 additions & 0 deletions crates/proof-sdk/proof/src/altda/eigenda_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,24 @@ impl<T: CommsClient + Sync + Send> EigenDABlobProvider for OracleEigenDAProvider
.map_err(OracleProviderError::Preimage)?;
Ok(data.into())
}

async fn get_element(&mut self, cert: &Bytes, element: &Bytes) -> Result<Bytes, Self::Error> {
self.oracle
.write(&HintType::AltDACommitment.encode_with(&[&cert]))
.await
.map_err(OracleProviderError::Preimage)?;

let cert_point_key = Bytes::copy_from_slice(&[cert.to_vec(), element.to_vec()].concat());

self.oracle
.write(&HintType::AltDACommitment.encode_with(&[&cert_point_key]))
.await
.map_err(OracleProviderError::Preimage)?;
let data = self
.oracle
.get(PreimageKey::new(*keccak256(cert_point_key), PreimageKeyType::GlobalGeneric))
.await
.map_err(OracleProviderError::Preimage)?;
Ok(data.into())
}
}

0 comments on commit d436eab

Please sign in to comment.