Skip to content

Commit

Permalink
feat(derive): use upstream op-alloy batch types (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Oct 29, 2024
1 parent 7914524 commit 069c3f1
Show file tree
Hide file tree
Showing 43 changed files with 58 additions and 4,302 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/client/src/l1/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use kona_mpt::{TrieHinter, TrieProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use op_alloy_consensus::OpTxType;
use op_alloy_genesis::RollupConfig;
use op_alloy_protocol::{BlockInfo, L2BlockInfo};
use op_alloy_protocol::{BatchValidationProvider, BlockInfo, L2BlockInfo};
use op_alloy_rpc_types_engine::OpAttributesWithParent;
use tracing::{error, info, warn};

Expand Down
7 changes: 5 additions & 2 deletions bin/client/src/l2/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use kona_mpt::{OrderedListWalker, TrieHinter, TrieProvider};
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
use op_alloy_consensus::{OpBlock, OpTxEnvelope};
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::{to_system_config, L2BlockInfo};
use op_alloy_protocol::{to_system_config, BatchValidationProvider, L2BlockInfo};

/// The oracle-backed L2 chain provider for the client program.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -71,7 +71,7 @@ impl<T: CommsClient> OracleL2ChainProvider<T> {
}

#[async_trait]
impl<T: CommsClient + Send + Sync> L2ChainProvider for OracleL2ChainProvider<T> {
impl<T: CommsClient + Send + Sync> BatchValidationProvider for OracleL2ChainProvider<T> {
type Error = anyhow::Error;

async fn l2_block_info_by_number(&mut self, number: u64) -> Result<L2BlockInfo> {
Expand Down Expand Up @@ -116,7 +116,10 @@ impl<T: CommsClient + Send + Sync> L2ChainProvider for OracleL2ChainProvider<T>
};
Ok(optimism_block)
}
}

#[async_trait]
impl<T: CommsClient + Send + Sync> L2ChainProvider for OracleL2ChainProvider<T> {
async fn system_config_by_number(
&mut self,
number: u64,
Expand Down
7 changes: 5 additions & 2 deletions crates/derive-alloy/src/alloy_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use kona_derive::traits::{ChainProvider, L2ChainProvider};
use lru::LruCache;
use op_alloy_consensus::OpBlock;
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::{to_system_config, BlockInfo, L2BlockInfo};
use op_alloy_protocol::{to_system_config, BatchValidationProvider, BlockInfo, L2BlockInfo};
use std::{boxed::Box, num::NonZeroUsize, sync::Arc, vec::Vec};

const CACHE_SIZE: usize = 16;
Expand Down Expand Up @@ -206,7 +206,7 @@ impl AlloyL2ChainProvider {
}

#[async_trait]
impl L2ChainProvider for AlloyL2ChainProvider {
impl BatchValidationProvider for AlloyL2ChainProvider {
type Error = RpcError<TransportErrorKind>;

async fn l2_block_info_by_number(&mut self, number: u64) -> Result<L2BlockInfo, Self::Error> {
Expand Down Expand Up @@ -234,7 +234,10 @@ impl L2ChainProvider for AlloyL2ChainProvider {
self.block_by_number_cache.put(number, block.clone());
Ok(block)
}
}

#[async_trait]
impl L2ChainProvider for AlloyL2ChainProvider {
async fn system_config_by_number(
&mut self,
number: u64,
Expand Down
1 change: 0 additions & 1 deletion crates/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ brotli.workspace = true
tracing.workspace = true
miniz_oxide.workspace = true
async-trait.workspace = true
unsigned-varint.workspace = true
alloc-no-stdlib.workspace = true
derive_more = { workspace = true, features = ["full"] }

Expand Down
67 changes: 0 additions & 67 deletions crates/derive/src/batch/batch_type.rs

This file was deleted.

130 changes: 0 additions & 130 deletions crates/derive/src/batch/mod.rs

This file was deleted.

Loading

0 comments on commit 069c3f1

Please sign in to comment.