{"record":{"id":"2bbbe66a640df895","repo":"nautechsystems/nautilus_trader","slug":"invalid-receipt-log-address","errorCode":null,"errorMessage":"Invalid receipt log address","messagePattern":"Invalid receipt log address","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/verification.rs","lineNumber":166,"sourceCode":"}\n\nimpl TryFrom<RpcTransactionReceipt> for VerifiedReceipt {\n    type Error = anyhow::Error;\n\n    fn try_from(receipt: RpcTransactionReceipt) -> Result<Self, Self::Error> {\n        let logs = receipt\n            .logs\n            .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,","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/verification.rs#L148-L184","documentation":"When building a VerifiedReceiptLog, the raw receipt log's string address field is parsed into an alloy Address. If Address::from_str fails, the error is replaced with the generic 'Invalid receipt log address'. This means the address string in the RPC receipt log is not a valid 20-byte Ethereum address encoding.","triggerScenarios":"Deserializing/verifying a transaction receipt whose log.address is empty, not hex, wrong length (not 40 hex chars), missing or malformed 0x handling, or otherwise unparseable by alloy's Address parser.","commonSituations":"Mock/stub receipts in tests with placeholder addresses; a chain or node variant returning addresses in an unexpected casing/encoding; truncated or null address fields from a custom indexer or third-party API; copy-pasted fixtures with typo'd addresses.","solutions":["Log/inspect log.address; confirm it is exactly 40 hex characters (20 bytes), e.g. 0x + 40 hex digits.","Validate the address string with Address::from_str before constructing the receipt to get the underlying parse error instead of the generic message.","Fix the data source (RPC provider, indexer, fixture) that is emitting the malformed address.","If addresses may be absent in your data model, handle the optional case upstream rather than passing an empty string."],"exampleFix":"// before\nlet addr_str = \"0x1234\"; // truncated\n// after\nlet addr = alloy_primitives::Address::from_str(\"0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed\")?; // full 20-byte hex","handlingStrategy":"validation","validationCode":"fn is_valid_address(s: &str) -> bool {\n    let h = s.strip_prefix(\"0x\").unwrap_or(s);\n    h.len() == 40 && h.chars().all(|c| c.is_ascii_hexdigit())\n}","typeGuard":null,"tryCatchPattern":"let address = Address::from_str(&log.address)\n    .map_err(|e| anyhow::anyhow!(\"Invalid receipt log address '{}}}': {e}\", log.address))?;","preventionTips":["Validate receipt payloads (address/data/topics) at the ingestion boundary before verification.","Use real chain addresses in fixtures; avoid placeholder strings in tests.","Keep provider SDK/API versions pinned so address encoding stays consistent.","Preserve the underlying parse error in map_err for debuggability."],"tags":["blockchain","parsing","validation","address"],"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"}