Skip to content

Commit b835214

Browse files
prestwichclaude
andcommitted
fix: adapt host-reth to async AliasOracle and BlockAndReceipts API
- Update RethAliasOracle::should_alias to async RPITIT signature - Update RethChain::blocks_and_receipts to return BlockAndReceipts - Remove orphan alias.rs from signet-node (now in host-reth) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 197e1c6 commit b835214

3 files changed

Lines changed: 15 additions & 121 deletions

File tree

crates/host-reth/src/alias.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloy::{consensus::constants::KECCAK_EMPTY, primitives::Address};
2-
use core::fmt;
2+
use core::{fmt, future::{self, Future}};
33
use eyre::OptionExt;
44
use reth::providers::{StateProviderBox, StateProviderFactory};
55
use signet_block_processor::{AliasOracle, AliasOracleFactory};
@@ -16,9 +16,9 @@ impl fmt::Debug for RethAliasOracle {
1616
}
1717
}
1818

19-
impl AliasOracle for RethAliasOracle {
20-
fn should_alias(&self, address: Address) -> eyre::Result<bool> {
21-
// No account at this address.
19+
impl RethAliasOracle {
20+
/// Synchronously check whether the given address should be aliased.
21+
fn check_alias(&self, address: Address) -> eyre::Result<bool> {
2222
let Some(acct) = self.0.basic_account(&address)? else { return Ok(false) };
2323
// Get the bytecode hash for this account.
2424
let bch = match acct.bytecode_hash {
@@ -41,6 +41,12 @@ impl AliasOracle for RethAliasOracle {
4141
}
4242
}
4343

44+
impl AliasOracle for RethAliasOracle {
45+
fn should_alias(&self, address: Address) -> impl Future<Output = eyre::Result<bool>> + Send {
46+
future::ready(self.check_alias(address))
47+
}
48+
}
49+
4450
/// An [`AliasOracleFactory`] backed by a `Box<dyn StateProviderFactory>`.
4551
///
4652
/// Creates [`RethAliasOracle`] instances from the latest host chain state.

crates/host-reth/src/chain.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use alloy::{consensus::Block, consensus::BlockHeader};
22
use reth::primitives::{EthPrimitives, RecoveredBlock};
33
use reth::providers::Chain;
44
use signet_blobber::RecoveredBlockShim;
5-
use signet_extract::Extractable;
5+
use signet_extract::{BlockAndReceipts, Extractable};
66
use signet_types::primitives::TransactionSigned;
77
use std::sync::Arc;
88

@@ -27,15 +27,17 @@ impl Extractable for RethChain {
2727
type Block = RecoveredBlockShim;
2828
type Receipt = reth::primitives::Receipt;
2929

30-
fn blocks_and_receipts(&self) -> impl Iterator<Item = (&Self::Block, &Vec<Self::Receipt>)> {
30+
fn blocks_and_receipts(
31+
&self,
32+
) -> impl Iterator<Item = BlockAndReceipts<'_, Self::Block, Self::Receipt>> {
3133
self.inner.blocks_and_receipts().map(|(block, receipts)| {
3234
// SAFETY: `RecoveredBlockShim` is `#[repr(transparent)]` over
3335
// `RethRecovered`, so these types have identical memory layouts.
3436
// The lifetime of the reference is tied to `self.inner` (the
3537
// `Arc<Chain>`), which outlives the returned iterator.
3638
let block =
3739
unsafe { std::mem::transmute::<&RethRecovered, &RecoveredBlockShim>(block) };
38-
(block, receipts)
40+
BlockAndReceipts { block, receipts }
3941
})
4042
}
4143

crates/node/src/alias.rs

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)