Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block ingestor: Improve error reporting for missing recepits #2743

Merged
merged 1 commit into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions chain/ethereum/src/ethereum_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,27 +1103,21 @@ impl EthereumAdapterTrait for EthereumAdapter {
// trying to ingest this block.
//
// This could also be because the receipt is simply not
// available yet. For that case, we should retry until
// available yet. For that case, we should retry until
// it becomes available.
IngestorError::BlockUnavailable(block_hash)
IngestorError::ReceiptUnavailable(block_hash, tx_hash)
})
})
.and_then(move |receipt| {
// Parity nodes seem to return receipts with no block hash
// when a transaction is no longer in the main chain, so
// treat that case the same as a receipt being absent
// entirely.
let receipt_block_hash =
receipt.block_hash.ok_or_else(|| {
IngestorError::BlockUnavailable(block_hash)
})?;

// Check if receipt is for the right block
if receipt_block_hash != block_hash {
// Check if the receipt has a block hash and is for the right
// block. Parity nodes seem to return receipts with no block
// hash when a transaction is no longer in the main chain, so
// treat that case the same as a receipt being absent entirely.
if receipt.block_hash != Some(block_hash) {
info!(
logger, "receipt block mismatch";
"receipt_block_hash" =>
receipt_block_hash.to_string(),
receipt.block_hash.unwrap_or_default().to_string(),
"block_hash" =>
block_hash.to_string(),
"tx_hash" => tx_hash.to_string(),
Expand Down
6 changes: 6 additions & 0 deletions graph/src/blockchain/block_ingestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ where
"Trying again after block polling failed: {}", err
);
}
Err(err @ IngestorError::ReceiptUnavailable(_, _)) => {
info!(
self.logger,
"Trying again after block polling failed: {}", err
);
}
Err(IngestorError::Unknown(inner_err)) => {
warn!(
self.logger,
Expand Down
5 changes: 5 additions & 0 deletions graph/src/blockchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ pub enum IngestorError {
#[error("Block data unavailable, block was likely uncled (block hash = {0:?})")]
BlockUnavailable(H256),

/// The Ethereum node does not know about this block for some reason, probably because it
/// disappeared in a chain reorg.
#[error("Receipt for tx {1:?} unavailable, block was likely uncled (block hash = {0:?})")]
ReceiptUnavailable(H256, H256),

/// An unexpected error occurred.
#[error("Ingestor error: {0}")]
Unknown(Error),
Expand Down