chore: make block field private (#13628)

This commit is contained in:
Matthias Seitz
2025-01-03 16:10:32 +01:00
committed by GitHub
parent 82013f46da
commit dbd4f0c4fe
67 changed files with 317 additions and 291 deletions

View File

@ -88,7 +88,7 @@ pub trait EthBlocks: LoadBlock {
.provider()
.pending_block()
.map_err(Self::Error::from_eth_err)?
.map(|block| block.body.transactions().len()))
.map(|block| block.body().transactions().len()))
}
let block_hash = match self
@ -105,7 +105,7 @@ pub trait EthBlocks: LoadBlock {
.get_sealed_block_with_senders(block_hash)
.await
.map_err(Self::Error::from_eth_err)?
.map(|b| b.body.transactions().len()))
.map(|b| b.body().transactions().len()))
}
}
@ -188,7 +188,7 @@ pub trait EthBlocks: LoadBlock {
self.provider()
.pending_block()
.map_err(Self::Error::from_eth_err)?
.and_then(|block| block.body.ommers().map(|o| o.to_vec()))
.and_then(|block| block.body().ommers().map(|o| o.to_vec()))
} else {
self.provider().ommers_by_id(block_id).map_err(Self::Error::from_eth_err)?
}

View File

@ -314,11 +314,11 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
let mut replay_block_txs = true;
let num_txs =
transaction_index.index().unwrap_or_else(|| block.body.transactions().len());
transaction_index.index().unwrap_or_else(|| block.body().transactions().len());
// but if all transactions are to be replayed, we can use the state at the block itself,
// however only if we're not targeting the pending block, because for pending we can't
// rely on the block's state being available
if !is_block_target_pending && num_txs == block.body.transactions().len() {
if !is_block_target_pending && num_txs == block.body().transactions().len() {
at = block.hash();
replay_block_txs = false;
}

View File

@ -185,7 +185,7 @@ pub trait EthFees: LoadFee {
percentiles,
header.gas_used(),
header.base_fee_per_gas().unwrap_or_default(),
block.body.transactions(),
block.body().transactions(),
&receipts,
)
.unwrap_or_default(),

View File

@ -320,7 +320,7 @@ pub trait Trace:
let Some(block) = block else { return Ok(None) };
if block.body.transactions().is_empty() {
if block.body().transactions().is_empty() {
// nothing to trace
return Ok(Some(Vec::new()))
}
@ -350,7 +350,7 @@ pub trait Trace:
// prepare transactions, we do everything upfront to reduce time spent with open
// state
let max_transactions =
highest_index.map_or(block.body.transactions().len(), |highest| {
highest_index.map_or(block.body().transactions().len(), |highest| {
// we need + 1 because the index is 0-based
highest as usize + 1
});

View File

@ -94,7 +94,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
self.cache()
.get_sealed_block_with_senders(block)
.await
.map(|b| b.map(|b| b.body.transactions().to_vec()))
.map(|b| b.map(|b| b.body().transactions().to_vec()))
.map_err(Self::Error::from_eth_err)
}
}