{"record":{"id":"1649b27b6cf949b4","repo":"nautechsystems/nautilus_trader","slug":"invalid-receipt-log-topic","errorCode":null,"errorMessage":"Invalid receipt log topic","messagePattern":"Invalid receipt log topic","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/verification.rs","lineNumber":174,"sourceCode":"            .into_iter()\n            .map(|log| {\n                Ok(VerifiedReceiptLog {\n                    removed: log.removed,\n                    log_index: parse_optional_quantity(log.log_index.as_deref())?,\n                    transaction_index: parse_optional_quantity(log.transaction_index.as_deref())?,\n                    transaction_hash: parse_optional_hash(log.transaction_hash.as_deref())?,\n                    block_hash: parse_optional_hash(log.block_hash.as_deref())?,\n                    block_number: parse_optional_quantity(log.block_number.as_deref())?,\n                    address: Address::from_str(&log.address)\n                        .map_err(|_| anyhow::anyhow!(\"Invalid receipt log address\"))?,\n                    data: Bytes::from_str(&log.data)\n                        .map_err(|_| anyhow::anyhow!(\"Invalid receipt log data\"))?,\n                    topics: log\n                        .topics\n                        .iter()\n                        .map(|topic| {\n                            B256::from_str(topic)\n                                .map_err(|_| anyhow::anyhow!(\"Invalid receipt log topic\"))\n                        })\n                        .collect::<anyhow::Result<_>>()?,\n                })\n            })\n            .collect::<anyhow::Result<_>>()?;\n        Ok(Self {\n            transaction_hash: receipt.transaction_hash,\n            block_hash: receipt.block_hash,\n            block_number: receipt.block_number,\n            gas_used: receipt.gas_used,\n            effective_gas_price: receipt.effective_gas_price,\n            transaction_index: receipt.transaction_index,\n            status: receipt.status,\n            logs,\n        })\n    }\n}\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/verification.rs#L156-L192","documentation":"Each topic string in a receipt log's topics array is parsed into a 32-byte B256 (fixed bytes) via B256::from_str. A failure while mapping the topics iterator is surfaced as 'Invalid receipt log topic'. A topic must be exactly 64 hex digits (32 bytes), typically 0x-prefixed.","triggerScenarios":"Verifying a receipt log containing a topic that is not valid 32-byte hex: short/long strings, non-hex characters, empty string, or a value like an event name fragment instead of the keccak hash.","commonSituations":"A provider returning topics of nonstandard length (e.g. some chains or L2s emit shorter topics); fixtures with placeholder topic strings; confusing event parameters (data field) with topics and putting non-32-byte values in topics; API version change altering topic encoding.","solutions":["Check each topic string is exactly 0x + 64 hex characters; pad or left-align values shorter than 32 bytes only if the source semantically allows it.","Pre-validate with B256::from_str per topic before receipt verification to capture the underlying error.","Verify you are not placing parameter data into the topics array; only indexed event parameters and the signature hash belong there.","Fix or regenerate the upstream data (node, indexer, fixture) producing the malformed topic."],"exampleFix":"// before\n\"topics\": [\"0xddf252ad\"] // truncated topic\n// after\n\"topics\": [\"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"] // full 32-byte hash","handlingStrategy":"validation","validationCode":"fn is_valid_topic(s: &str) -> bool {\n    let h = s.strip_prefix(\"0x\").unwrap_or(s);\n    h.len() == 64 && h.chars().all(|c| c.is_ascii_hexdigit())\n}\n// check: log.topics.iter().all(|t| is_valid_topic(t))","typeGuard":null,"tryCatchPattern":"let topics: Vec<B256> = log.topics.iter()\n    .map(|t| B256::from_str(t).map_err(|e| anyhow::anyhow!(\"Invalid receipt log topic '{}}}': {e}\", t)))\n    .collect::<anyhow::Result<_>>()?;","preventionTips":["Enforce 32-byte (64 hex char) topic length at ingestion; left-pad shorter values only when the source semantics allow it.","Keep only indexed parameters and the event signature hash in topics; put other parameters in data.","Verify topic count matches the event's indexed parameter count when the event is known.","Sanity-check chain/L2-specific topic encodings against the node's documentation."],"tags":["blockchain","parsing","hex","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}