From 0e7596865c2ad8e9249c93d86b9b1a1de1c192af Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 18 Oct 2024 20:33:55 -0400 Subject: [PATCH] feat: use upstream alloy-eips indexed blob hash --- Cargo.lock | 85 +++++++++------------ Cargo.toml | 12 +++ bin/client/Cargo.toml | 2 +- bin/client/src/l1/blob_provider.rs | 4 +- bin/client/src/l2/chain_provider.rs | 1 - bin/host/Cargo.toml | 1 - bin/host/src/fetcher/mod.rs | 9 ++- crates/derive/Cargo.toml | 2 +- crates/derive/src/batch/span_batch/batch.rs | 3 - crates/derive/src/sources/blobs.rs | 23 +----- crates/derive/src/sources/mod.rs | 2 +- crates/derive/src/stages/batch_queue.rs | 2 - crates/derive/src/traits/data_sources.rs | 4 +- crates/derive/src/traits/test_utils.rs | 3 +- crates/providers-alloy/src/beacon_client.rs | 5 +- crates/providers-alloy/src/blob_provider.rs | 18 ++--- crates/providers-alloy/src/test_utils.rs | 2 +- 17 files changed, 73 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86f0eba28..c2b48da4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,8 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8628f840dfddef51520dc2d5694e14e1d2098069de4ad9812964adb8309c1dc4" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-eips", "alloy-primitives", @@ -103,9 +102,8 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a888c285255f82a60acecd06a719b84057d233ae281220532a8633e9220574" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -121,9 +119,8 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "635d51aabd49374a3f2276acb4029fbc54c7436c69e4ee8a2c900ba7bbf03891" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-primitives", "alloy-serde", @@ -132,9 +129,8 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9e5a6ea33a1b9c83c699f1cb476196e003d3b25d5afdd00b582655486b02ff" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -146,9 +142,8 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1127a67e9995b8a33d06af5a06b79a87bc57e4f61276f21da5c5ed22afe3161" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -167,9 +162,8 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efde0a98f2bd155538273430d6a50888544fe7c0df53b37bf8acf68805f4aa2a" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -180,9 +174,8 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bcdf1fae99f4991dd5e843a49937d493573f2ccafa8e8ddb185b00042906c20" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -228,9 +221,8 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c67843e23cbf540e04cf5ea717f03d08d58299eaebaefbcc549f4e74b3e272" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-chains", "alloy-consensus", @@ -287,9 +279,8 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559c7a1056576ab63b2ba371ce8a066765509423531c0231a8a0d1c81457a5e7" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -310,9 +301,8 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff2186aa29bb0d5eb1e7239625b3553d0a6eff7194531c4a73210a284dbc2be" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -322,9 +312,8 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6bbb60e151977865c3edd9b9a27b50c292da66e286fae461053ff9b2c6175ef" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -338,9 +327,8 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7bc4a8d5a4a33168e35535ef261a408e0c72c17f469bcb1eae4c852734ba0f" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -357,9 +345,8 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b06099d7f448b55a418289d2d642f5e38c0207fc188c9cd7afe44382218a20" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-primitives", "serde", @@ -368,9 +355,8 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bea89fb419de02a0e5222c0452b77701c5b52af74ec35334ac59e7b2b1a86c0f" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-primitives", "async-trait", @@ -440,9 +426,8 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1c13d075c204fa4a3cba2a93555f9f5784a7412c1dbd3e4b652c29453d5dd2" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-json-rpc", "base64", @@ -460,9 +445,8 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0038d95aaef539d9aed586d662914b232bd49ba9b4133670e514f5bb6d432bb" +version = "0.5.2" +source = "git+https://github.com/refcell/alloy?branch=rf/feat/indexed-blob-hash#01db958caba52cffbdb86d4fa8f1967173700af0" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -2165,7 +2149,6 @@ dependencies = [ "futures", "kona-client", "kona-common", - "kona-derive", "kona-mpt", "kona-preimage", "kona-providers-alloy", @@ -3744,9 +3727,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.129" +version = "1.0.131" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbcf9b78a125ee667ae19388837dd12294b858d101fdd393cb9d5501ef09eb2" +checksum = "67d42a0bd4ac281beff598909bb56a86acaf979b84483e1c79c10dcaf98f8cf3" dependencies = [ "indexmap", "itoa", diff --git a/Cargo.toml b/Cargo.toml index 26fe27dc7..7d0ded258 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,18 @@ panic = "abort" codegen-units = 1 lto = "fat" +[patch.crates-io] +alloy-eips = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-serde = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-provider = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-consensus = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-transport = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-rpc-types = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-rpc-client = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-node-bindings = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-transport-http = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } +alloy-rpc-types-engine = { git = "https://github.com/refcell/alloy", branch = "rf/feat/indexed-blob-hash" } + [workspace.dependencies] # Workspace kona-mpt = { path = "crates/mpt", version = "0.0.3", default-features = false } diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index ffe47631d..ae1cdd4f8 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -27,7 +27,7 @@ revm.workspace = true alloy-primitives.workspace = true alloy-consensus.workspace = true alloy-rlp.workspace = true -alloy-eips.workspace = true +alloy-eips = { workspace = true, features = ["kzg-sidecar"] } op-alloy-consensus.workspace = true # General diff --git a/bin/client/src/l1/blob_provider.rs b/bin/client/src/l1/blob_provider.rs index 920d962c7..30f1b03a0 100644 --- a/bin/client/src/l1/blob_provider.rs +++ b/bin/client/src/l1/blob_provider.rs @@ -3,11 +3,11 @@ use crate::HintType; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use alloy_consensus::Blob; -use alloy_eips::eip4844::FIELD_ELEMENTS_PER_BLOB; +use alloy_eips::eip4844::{IndexedBlobHash, FIELD_ELEMENTS_PER_BLOB}; use alloy_primitives::keccak256; use anyhow::Result; use async_trait::async_trait; -use kona_derive::{sources::IndexedBlobHash, traits::BlobProvider}; +use kona_derive::traits::BlobProvider; use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType}; use op_alloy_protocol::BlockInfo; diff --git a/bin/client/src/l2/chain_provider.rs b/bin/client/src/l2/chain_provider.rs index b7d8ca972..8055d7c98 100644 --- a/bin/client/src/l2/chain_provider.rs +++ b/bin/client/src/l2/chain_provider.rs @@ -112,7 +112,6 @@ impl L2ChainProvider for OracleL2ChainProvider .rollup_config .is_canyon_active(timestamp) .then(Vec::new), - requests: None, }, }; Ok(optimism_block) diff --git a/bin/host/Cargo.toml b/bin/host/Cargo.toml index 9ba44974c..d0fc65d5a 100644 --- a/bin/host/Cargo.toml +++ b/bin/host/Cargo.toml @@ -15,7 +15,6 @@ workspace = true # Workspace kona-mpt.workspace = true kona-client.workspace = true -kona-derive.workspace = true kona-common.workspace = true kona-preimage.workspace = true kona-providers-alloy.workspace = true diff --git a/bin/host/src/fetcher/mod.rs b/bin/host/src/fetcher/mod.rs index ae5fe6eec..5062e5b05 100644 --- a/bin/host/src/fetcher/mod.rs +++ b/bin/host/src/fetcher/mod.rs @@ -3,7 +3,11 @@ use crate::{kv::KeyValueStore, util}; use alloy_consensus::{Header, TxEnvelope, EMPTY_ROOT_HASH}; -use alloy_eips::{eip2718::Encodable2718, eip4844::FIELD_ELEMENTS_PER_BLOB, BlockId}; +use alloy_eips::{ + eip2718::Encodable2718, + eip4844::{IndexedBlobHash, FIELD_ELEMENTS_PER_BLOB}, + BlockId, +}; use alloy_primitives::{address, keccak256, Address, Bytes, B256}; use alloy_provider::{Provider, ReqwestProvider}; use alloy_rlp::{Decodable, EMPTY_STRING_CODE}; @@ -12,7 +16,6 @@ use alloy_rpc_types::{ }; use anyhow::{anyhow, Result}; use kona_client::HintType; -use kona_derive::sources::IndexedBlobHash; use kona_preimage::{PreimageKey, PreimageKeyType}; use kona_providers_alloy::{OnlineBeaconClient, OnlineBlobProvider}; use op_alloy_protocol::BlockInfo; @@ -187,7 +190,7 @@ where let timestamp = u64::from_be_bytes(timestamp_data_bytes); let partial_block_ref = BlockInfo { timestamp, ..Default::default() }; - let indexed_hash = IndexedBlobHash { index: index as usize, hash }; + let indexed_hash = IndexedBlobHash { index, hash }; // Fetch the blob sidecar from the blob provider. let mut sidecars = self diff --git a/crates/derive/Cargo.toml b/crates/derive/Cargo.toml index 4a9b1655e..80640e140 100644 --- a/crates/derive/Cargo.toml +++ b/crates/derive/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] # Alloy -alloy-eips.workspace = true +alloy-eips = { workspace = true, features = ["kzg-sidecar"] } alloy-rlp = { workspace = true, features = ["derive"] } alloy-consensus = { workspace = true, features = ["k256"] } alloy-primitives = { workspace = true, features = ["rlp", "k256", "map"] } diff --git a/crates/derive/src/batch/span_batch/batch.rs b/crates/derive/src/batch/span_batch/batch.rs index 5795240aa..5cdfb5ef8 100644 --- a/crates/derive/src/batch/span_batch/batch.rs +++ b/crates/derive/src/batch/span_batch/batch.rs @@ -1459,7 +1459,6 @@ mod tests { transactions: Vec::new(), ommers: Vec::new(), withdrawals: None, - requests: None, }, }; let mut fetcher = TestL2ChainProvider { @@ -1534,7 +1533,6 @@ mod tests { transactions: Vec::new(), ommers: Vec::new(), withdrawals: None, - requests: None, }, }; let mut fetcher = TestL2ChainProvider { @@ -1611,7 +1609,6 @@ mod tests { transactions: Vec::new(), ommers: Vec::new(), withdrawals: None, - requests: None, }, }; let mut fetcher = TestL2ChainProvider { diff --git a/crates/derive/src/sources/blobs.rs b/crates/derive/src/sources/blobs.rs index 61363f59c..87187aced 100644 --- a/crates/derive/src/sources/blobs.rs +++ b/crates/derive/src/sources/blobs.rs @@ -6,8 +6,8 @@ use crate::{ }; use alloc::{boxed::Box, format, string::ToString, vec, vec::Vec}; use alloy_consensus::{Transaction, TxEip4844Variant, TxEnvelope, TxType}; -use alloy_eips::eip4844::{Blob, BYTES_PER_BLOB, VERSIONED_HASH_VERSION_KZG}; -use alloy_primitives::{Address, Bytes, B256}; +use alloy_eips::eip4844::{Blob, IndexedBlobHash, BYTES_PER_BLOB, VERSIONED_HASH_VERSION_KZG}; +use alloy_primitives::{Address, Bytes}; use async_trait::async_trait; use kona_providers::ChainProvider; use op_alloy_protocol::BlockInfo; @@ -22,22 +22,6 @@ pub(crate) const BLOB_MAX_DATA_SIZE: usize = (4 * 31 + 3) * 1024 - 4; // 130044 /// Blob Encoding/Decoding Rounds pub(crate) const BLOB_ENCODING_ROUNDS: usize = 1024; -/// A Blob hash -#[derive(Default, Clone, Debug)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct IndexedBlobHash { - /// The index of the blob - pub index: usize, - /// The hash of the blob - pub hash: B256, -} - -impl PartialEq for IndexedBlobHash { - fn eq(&self, other: &Self) -> bool { - self.index == other.index && self.hash == other.hash - } -} - /// The Blob Data #[derive(Default, Clone, Debug)] pub struct BlobData { @@ -287,7 +271,7 @@ where continue; }; for blob in blob_hashes { - let indexed = IndexedBlobHash { hash: blob, index: number as usize }; + let indexed = IndexedBlobHash { hash: blob, index: number }; hashes.push(indexed); data.push(BlobData::default()); number += 1; @@ -392,6 +376,7 @@ where pub(crate) mod tests { use super::*; use crate::{errors::PipelineErrorKind, traits::test_utils::TestBlobProvider}; + use alloy_primitives::B256; use alloy_rlp::Decodable; use kona_providers::test_utils::TestChainProvider; diff --git a/crates/derive/src/sources/mod.rs b/crates/derive/src/sources/mod.rs index 404b2992e..41e1b7748 100644 --- a/crates/derive/src/sources/mod.rs +++ b/crates/derive/src/sources/mod.rs @@ -4,7 +4,7 @@ mod ethereum; pub use ethereum::EthereumDataSource; mod blobs; -pub use blobs::{BlobData, BlobSource, IndexedBlobHash}; +pub use blobs::{BlobData, BlobSource}; mod calldata; pub use calldata::CalldataSource; diff --git a/crates/derive/src/stages/batch_queue.rs b/crates/derive/src/stages/batch_queue.rs index 8b1baf3cd..d20340c5b 100644 --- a/crates/derive/src/stages/batch_queue.rs +++ b/crates/derive/src/stages/batch_queue.rs @@ -1076,7 +1076,6 @@ mod tests { transactions: batch_txs, ommers: Vec::new(), withdrawals: None, - requests: None, }, }; let second = OpBlock { @@ -1085,7 +1084,6 @@ mod tests { transactions: second_batch_txs, ommers: Vec::new(), withdrawals: None, - requests: None, }, }; let fetcher = TestL2ChainProvider { diff --git a/crates/derive/src/traits/data_sources.rs b/crates/derive/src/traits/data_sources.rs index 6f29f6e74..c296809c5 100644 --- a/crates/derive/src/traits/data_sources.rs +++ b/crates/derive/src/traits/data_sources.rs @@ -1,9 +1,9 @@ //! Contains traits that describe the functionality of various data sources used in the derivation //! pipeline's stages. -use crate::{errors::PipelineResult, sources::IndexedBlobHash}; +use crate::errors::PipelineResult; use alloc::{boxed::Box, fmt::Debug, vec::Vec}; -use alloy_eips::eip4844::Blob; +use alloy_eips::eip4844::{Blob, IndexedBlobHash}; use alloy_primitives::Bytes; use async_trait::async_trait; use core::fmt::Display; diff --git a/crates/derive/src/traits/test_utils.rs b/crates/derive/src/traits/test_utils.rs index e723027b4..6da01d40e 100644 --- a/crates/derive/src/traits/test_utils.rs +++ b/crates/derive/src/traits/test_utils.rs @@ -2,11 +2,10 @@ use crate::{ errors::{BlobProviderError, PipelineError, PipelineResult}, - sources::IndexedBlobHash, traits::{AsyncIterator, BlobProvider, DataAvailabilityProvider}, }; use alloc::{boxed::Box, vec, vec::Vec}; -use alloy_eips::eip4844::Blob; +use alloy_eips::eip4844::{Blob, IndexedBlobHash}; use alloy_primitives::{map::HashMap, Address, Bytes, B256}; use anyhow::Result; use async_trait::async_trait; diff --git a/crates/providers-alloy/src/beacon_client.rs b/crates/providers-alloy/src/beacon_client.rs index b250146fe..0c734dcdf 100644 --- a/crates/providers-alloy/src/beacon_client.rs +++ b/crates/providers-alloy/src/beacon_client.rs @@ -1,9 +1,8 @@ //! Contains an online implementation of the `BeaconClient` trait. -use alloy_eips::eip4844::BlobTransactionSidecarItem; +use alloy_eips::eip4844::{BlobTransactionSidecarItem, IndexedBlobHash}; use alloy_primitives::FixedBytes; use async_trait::async_trait; -use kona_derive::sources::IndexedBlobHash; use reqwest::Client; /// The config spec engine api method. @@ -259,7 +258,7 @@ impl BeaconClient for OnlineBeaconClient { // Filter the sidecars by the hashes, in-order. hashes.iter().for_each(|hash| { if let Some(sidecar) = - raw_response.data.iter().find(|sidecar| sidecar.inner.index == hash.index as u64) + raw_response.data.iter().find(|sidecar| sidecar.inner.index == hash.index) { sidecars.push(sidecar.clone()); } diff --git a/crates/providers-alloy/src/blob_provider.rs b/crates/providers-alloy/src/blob_provider.rs index 99e584133..f7b9b2797 100644 --- a/crates/providers-alloy/src/blob_provider.rs +++ b/crates/providers-alloy/src/blob_provider.rs @@ -1,8 +1,8 @@ //! Contains an online implementation of the `BlobProvider` trait. -use alloy_eips::eip4844::{Blob, BlobTransactionSidecarItem}; +use alloy_eips::eip4844::{Blob, BlobTransactionSidecarItem, IndexedBlobHash}; use async_trait::async_trait; -use kona_derive::{errors::BlobProviderError, sources::IndexedBlobHash, traits::BlobProvider}; +use kona_derive::{errors::BlobProviderError, traits::BlobProvider}; use op_alloy_protocol::BlockInfo; use tracing::warn; @@ -97,7 +97,7 @@ impl OnlineBlobProvider { let sidecars = self.fetch_sidecars(slot, blob_hashes).await?; // Filter blob sidecars that match the indicies in the specified list. - let blob_hash_indicies = blob_hashes.iter().map(|b| b.index as u64).collect::>(); + let blob_hash_indicies = blob_hashes.iter().map(|b| b.index).collect::>(); let filtered = sidecars .into_iter() .filter(|s| blob_hash_indicies.contains(&s.inner.index)) @@ -158,10 +158,7 @@ where let hash = blob_hashes .get(i) .ok_or(BlobProviderError::Backend("Missing blob hash".to_string()))?; - match sidecar.verify_blob(&alloy_eips::eip1898::NumHash { - hash: hash.hash, - number: hash.index as u64, - }) { + match sidecar.verify_blob(hash) { Ok(_) => Ok(sidecar.blob), Err(e) => Err(BlobProviderError::Backend(e.to_string())), } @@ -260,7 +257,7 @@ impl OnlineBlobProviderWithFallback>(); + let blob_hash_indicies = blob_hashes.iter().map(|b| b.index).collect::>(); let filtered = sidecars .into_iter() .filter(|s| blob_hash_indicies.contains(&s.inner.index)) @@ -319,10 +316,7 @@ where let hash = blob_hashes.get(i).ok_or(BlobProviderError::Backend( "fallback: failed to get blob hash".to_string(), ))?; - match sidecar.verify_blob(&alloy_eips::eip1898::NumHash { - hash: hash.hash, - number: hash.index as u64, - }) { + match sidecar.verify_blob(hash) { Ok(_) => Ok(sidecar.blob), Err(e) => Err(BlobProviderError::Backend(e.to_string())), } diff --git a/crates/providers-alloy/src/test_utils.rs b/crates/providers-alloy/src/test_utils.rs index 1bc23b220..9600c48d9 100644 --- a/crates/providers-alloy/src/test_utils.rs +++ b/crates/providers-alloy/src/test_utils.rs @@ -1,12 +1,12 @@ //! Test Utilities for Online Providers use crate::{APIBlobSidecar, APIConfigResponse, APIGenesisResponse, APIGetBlobSidecarsResponse}; +use alloy_eips::eip4844::IndexedBlobHash; use alloy_node_bindings::{Anvil, AnvilInstance}; use alloy_provider::{network::Ethereum, ReqwestProvider}; use alloy_rpc_client::RpcClient; use alloy_transport_http::Http; use async_trait::async_trait; -use kona_derive::sources::IndexedBlobHash; use reqwest::Client; /// Spawns an Anvil instance and returns a provider and the instance.