Skip to content

Commit 825a10a

Browse files
committed
graph: Use expect() for required trace fields instead of silent skip
Localized traces from finalized blocks must have block_number and block_hash. Using ? would silently skip traces missing these fields, potentially hiding data integrity issues. Use expect() to fail fast. Also fixes silent truncation on block_number by using try_from().unwrap().
1 parent 75ae18a commit 825a10a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

graph/src/components/ethereum/types.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,15 @@ impl EthereumCall {
246246
gas_used: gas_used,
247247
input: call.input.clone(),
248248
output: output,
249-
block_number: trace.block_number? as BlockNumber,
250-
block_hash: trace.block_hash?,
249+
block_number: BlockNumber::try_from(
250+
trace
251+
.block_number
252+
.expect("localized trace must have block_number"),
253+
)
254+
.unwrap(),
255+
block_hash: trace
256+
.block_hash
257+
.expect("localized trace must have block_hash"),
251258
transaction_hash: trace.transaction_hash,
252259
transaction_index,
253260
})

0 commit comments

Comments
 (0)