diff --git a/chain/ethereum/src/data_source.rs b/chain/ethereum/src/data_source.rs index 709884496e8..317c960fdbd 100644 --- a/chain/ethereum/src/data_source.rs +++ b/chain/ethereum/src/data_source.rs @@ -804,7 +804,24 @@ impl DataSource { // and is not a special zero hash, implying a real transaction associated with this log. block .transaction_for_log(&log) - .context("Found no transaction for event")? + .with_context(|| { + let (tx_format, tx_count) = match block.transactions() { + Some(txs) => ("full", txs.len()), + None => ("hashes_or_empty", 0), + }; + let first_tx = block.transactions().and_then(|t| t.first()).map(|t| t.tx_hash()); + let last_tx = block.transactions().and_then(|t| t.last()).map(|t| t.tx_hash()); + format!( + "Found no transaction for event. \ + log_tx_hash={:?}, log_block_hash={:?}, \ + block_hash={:?}, block_number={}, \ + block_tx_format={}, block_tx_count={}, \ + first_tx={:?}, last_tx={:?}", + log.transaction_hash, log.block_hash, + block.hash(), block.number_u64(), + tx_format, tx_count, first_tx, last_tx + ) + })? }; let logging_extras = Arc::new(o! { diff --git a/chain/ethereum/src/ethereum_adapter.rs b/chain/ethereum/src/ethereum_adapter.rs index 9c85f0ac551..8c1642f0808 100644 --- a/chain/ethereum/src/ethereum_adapter.rs +++ b/chain/ethereum/src/ethereum_adapter.rs @@ -755,6 +755,7 @@ impl EthereumAdapter { .timeout_secs(json_rpc_timeout_secs) .run(move || { let alloy = alloy.cheap_clone(); + let logger = logger.clone(); async move { alloy .get_block_by_hash(hash) @@ -763,7 +764,24 @@ impl EthereumAdapter { .map_err(Error::from) .and_then(|block| { block - .map(|b| Arc::new(LightEthereumBlock::new(b))) + .map(|b| { + let tx_count = b.transactions.len(); + if tx_count == 0 { + warn!( + &logger, + "load_blocks_rpc: block {} has 0 transactions from RPC. \ + block_hash={}, tx_variant={}", + b.header.number, + b.header.hash, + match &b.transactions { + alloy::rpc::types::BlockTransactions::Full(_) => "Full", + alloy::rpc::types::BlockTransactions::Hashes(_) => "Hashes", + alloy::rpc::types::BlockTransactions::Uncle => "Uncle", + }; + ); + } + Arc::new(LightEthereumBlock::new(b)) + }) .ok_or_else(|| { anyhow::anyhow!( "Ethereum node did not find block {:?}",