mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: make more block types generic (#12812)
This commit is contained in:
@ -5,7 +5,7 @@ use alloy_primitives::U64;
|
||||
use alloy_rpc_types_engine::{ForkchoiceState, PayloadId, TransitionConfiguration};
|
||||
use jsonrpsee::core::client::{ClientT, SubscriptionClientT};
|
||||
use reth_ethereum_engine_primitives::EthEngineTypes;
|
||||
use reth_primitives::Block;
|
||||
use reth_primitives::{Block, BlockExt};
|
||||
use reth_rpc_api::clients::EngineApiClient;
|
||||
use reth_rpc_layer::JwtSecret;
|
||||
use reth_rpc_types_compat::engine::payload::{
|
||||
|
||||
@ -17,8 +17,8 @@ use reth_evm::{
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{
|
||||
proofs::calculate_transaction_root, Block, BlockBody, Receipt, SealedBlockWithSenders,
|
||||
SealedHeader, TransactionSignedEcRecovered,
|
||||
proofs::calculate_transaction_root, Block, BlockBody, BlockExt, Receipt,
|
||||
SealedBlockWithSenders, SealedHeader, TransactionSignedEcRecovered,
|
||||
};
|
||||
use reth_provider::{
|
||||
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,
|
||||
|
||||
@ -315,7 +315,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
|
||||
{
|
||||
async move {
|
||||
if let Some(block) = self.block_with_senders(block_id).await? {
|
||||
if let Some(tx) = block.transactions().nth(index) {
|
||||
if let Some(tx) = block.transactions().get(index) {
|
||||
return Ok(Some(tx.encoded_2718().into()))
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ pub fn from_block_with_tx_hashes<T>(
|
||||
block_hash: Option<B256>,
|
||||
) -> Block<T> {
|
||||
let block_hash = block_hash.unwrap_or_else(|| block.header.hash_slow());
|
||||
let transactions = block.body.transactions().map(|tx| tx.hash()).collect();
|
||||
let transactions = block.body.transactions.iter().map(|tx| tx.hash()).collect();
|
||||
|
||||
from_block_with_transactions(
|
||||
block.length(),
|
||||
|
||||
@ -15,7 +15,7 @@ use alloy_rpc_types_engine::{
|
||||
};
|
||||
use reth_primitives::{
|
||||
proofs::{self},
|
||||
Block, BlockBody, SealedBlock, TransactionSigned,
|
||||
Block, BlockBody, BlockExt, SealedBlock, TransactionSigned,
|
||||
};
|
||||
|
||||
/// Converts [`ExecutionPayloadV1`] to [`Block`]
|
||||
@ -363,6 +363,7 @@ mod tests {
|
||||
CancunPayloadFields, ExecutionPayload, ExecutionPayloadSidecar, ExecutionPayloadV1,
|
||||
ExecutionPayloadV2, ExecutionPayloadV3,
|
||||
};
|
||||
use reth_primitives::BlockExt;
|
||||
|
||||
#[test]
|
||||
fn roundtrip_payload_to_block() {
|
||||
|
||||
@ -18,7 +18,7 @@ use reth_evm::{
|
||||
execute::{BlockExecutorProvider, Executor},
|
||||
ConfigureEvmEnv,
|
||||
};
|
||||
use reth_primitives::{Block, SealedBlockWithSenders};
|
||||
use reth_primitives::{Block, BlockExt, SealedBlockWithSenders};
|
||||
use reth_provider::{
|
||||
BlockReaderIdExt, ChainSpecProvider, HeaderProvider, StateProofProvider, StateProviderFactory,
|
||||
TransactionVariant,
|
||||
|
||||
Reference in New Issue
Block a user