forked from op-rs/kona
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
394 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[package] | ||
name = "kona-derive" | ||
description = "A no_std derivation pipeline implementation for the OP Stack" | ||
version = "0.1.0" | ||
edition.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
homepage.workspace = true | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
# Alloy | ||
alloy-eips.workspace = true | ||
alloy-rpc-types-engine.workspace = true | ||
alloy-rlp = { workspace = true, features = ["derive"] } | ||
alloy-consensus = { workspace = true, features = ["k256"] } | ||
alloy-primitives = { workspace = true, features = ["rlp", "k256", "map"] } | ||
|
||
# Op Alloy | ||
op-alloy-genesis.workspace = true | ||
op-alloy-protocol.workspace = true | ||
op-alloy-rpc-types-engine.workspace = true | ||
op-alloy-consensus = { workspace = true, features = ["k256"] } | ||
|
||
# General | ||
tracing.workspace = true | ||
async-trait.workspace = true | ||
thiserror.workspace = true | ||
|
||
# `serde` feature dependencies | ||
serde = { workspace = true, optional = true, features = ["derive"] } | ||
|
||
# `test-utils` feature dependencies | ||
spin = { workspace = true, optional = true } | ||
tracing-subscriber = { workspace = true, optional = true, features = ["fmt"] } | ||
|
||
[dev-dependencies] | ||
spin.workspace = true | ||
proptest.workspace = true | ||
serde_json.workspace = true | ||
op-alloy-registry.workspace = true | ||
tokio = { workspace = true, features = ["full"] } | ||
tracing-subscriber = { workspace = true, features = ["fmt"] } | ||
alloy-primitives = { workspace = true, features = ["rlp", "k256", "map", "arbitrary"] } | ||
|
||
[features] | ||
default = ["serde"] | ||
serde = [ | ||
"dep:serde", | ||
"alloy-primitives/serde", | ||
"alloy-consensus/serde", | ||
"op-alloy-consensus/serde", | ||
"op-alloy-protocol/serde", | ||
"op-alloy-genesis/serde", | ||
"op-alloy-rpc-types-engine/serde", | ||
] | ||
test-utils = [ | ||
"dep:spin", | ||
"dep:tracing-subscriber", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
use crate::alloc::string::ToString; | ||
use alloc::boxed::Box; | ||
use alloc::sync::Arc; | ||
use alloy_primitives::Bytes; | ||
use async_trait::async_trait; | ||
use kona_preimage::CommsClient; | ||
use crate::errors::OracleProviderError; | ||
use super::OracleEigenDAProvider; | ||
#[derive(Debug, Clone)] | ||
pub struct OracleAltDAProvider<T: CommsClient> { | ||
/// The oracle eigenda provider. | ||
eigenda_provider: OracleEigenDAProvider<T>, | ||
} | ||
impl<T: CommsClient> OracleAltDAProvider<T> { | ||
/// Constructs a new oracle-backed AltDA provider. | ||
pub fn new(eigenda_provider: OracleEigenDAProvider<T>) -> Self { | ||
Self { eigenda_provider } | ||
} | ||
/// Constructs a new oracle-backed AltDA provider by constructing | ||
/// the respective altda providers using the oracle. | ||
pub fn new_from_oracle(oracle: Arc<T>) -> Self { | ||
Self { eigenda_provider: OracleEigenDAProvider::new(oracle) } | ||
} | ||
} | ||
#[async_trait] | ||
impl<T: CommsClient + Send + Sync> AltDAProvider for OracleAltDAProvider<T> { | ||
type Error = OracleProviderError; | ||
/// Retrieves a blob from the oracle. | ||
/// | ||
/// ## Takes | ||
/// - `commitment`: The commitment to the blob (specific to each AltDA provider). | ||
/// | ||
/// ## Returns | ||
/// - `Ok(Bytes)`: The blob. | ||
/// - `Err(e)`: The blob could not be retrieved. | ||
async fn get_blob(&self, commitment: AltDACommitment) -> Result<Bytes, OracleProviderError> { | ||
match commitment { | ||
AltDACommitment::Keccak(_) => Err(OracleProviderError::AltDA( | ||
"keccak commitments are not implemented yet".to_string(), | ||
)), | ||
AltDACommitment::EigenDAV1(cert) => self.eigenda_provider.get_blob_v1(cert).await, | ||
AltDACommitment::EigenDAV2(cert) => self.eigenda_provider.get_blob_v2(cert).await, | ||
AltDACommitment::Avail(_) => Err(OracleProviderError::AltDA( | ||
"avail commitments are not implemented yet".to_string(), | ||
)), | ||
AltDACommitment::Celestia(_) => Err(OracleProviderError::AltDA( | ||
"celestia commitments are not implemented yet".to_string(), | ||
)), | ||
} | ||
} | ||
} | ||
*/ |
Oops, something went wrong.