{"record":{"id":"09d4db41cd543f8c","repo":"linera-io/linera-protocol","slug":"invalid-log-data-rlp-e","errorCode":null,"errorMessage":"invalid log data RLP: {e}","messagePattern":"invalid log data RLP: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-bridge/src/proof/mod.rs","lineNumber":586,"sourceCode":"    ensure!(topics_header.list, \"topics must be an RLP list\");\n    ensure!(\n        log_data_buf.len() >= topics_header.payload_length,\n        \"topics payload extends past log boundary\"\n    );\n\n    let mut topics_data = &log_data_buf[..topics_header.payload_length];\n    log_data_buf = &log_data_buf[topics_header.payload_length..];\n\n    let mut topics = Vec::new();\n    while !topics_data.is_empty() {\n        let topic = <B256 as alloy_rlp::Decodable>::decode(&mut topics_data)\n            .map_err(|e| anyhow!(\"invalid topic: {e}\"))?;\n        topics.push(topic);\n    }\n\n    // Decode log data (byte string)\n    let data_header = alloy_rlp::Header::decode(&mut log_data_buf)\n        .map_err(|e| anyhow!(\"invalid log data RLP: {e}\"))?;\n    ensure!(\n        !data_header.list,\n        \"log data must be a byte string, not a list\"\n    );\n    ensure!(\n        log_data_buf.len() >= data_header.payload_length,\n        \"log data extends past log boundary\"\n    );\n    let log_bytes = log_data_buf[..data_header.payload_length].to_vec();\n    log_data_buf = &log_data_buf[data_header.payload_length..];\n\n    ensure!(\n        log_data_buf.is_empty(),\n        \"trailing data after log fields ({} unexpected bytes)\",\n        log_data_buf.len()\n    );\n\n    Ok(ReceiptLog {","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-bridge/src/proof/mod.rs#L568-L604","documentation":"After address and topics were consumed, the final field — the log data — does not start with a parsable RLP header. The data field must be an RLP byte string (list flag clear); a header decode failure here means the remaining bytes inside the log payload are truncated or misaligned.","triggerScenarios":"decode_log with log_data_buf exhausted or starting mid-item after the topics slice: payload_length that stops before the data field, extra bytes appended inside the topics region, or a data field encoded as something other than a byte string header.","commonSituations":"Logs built without the data field at all (empty payloads must still be encoded as 0x80); encoders that put the data before the topics; truncation when copying proof blobs between systems.","solutions":["Pre-validate the entire log entry with alloy_primitives::Log::decode — it checks the three-field layout end to end.","Confirm the encoder always emits the data byte string, even when empty (0x80).","Check that topics_header.payload_length covers exactly all topics and nothing more.","Regenerate the receipt and proof from the source chain."],"exampleFix":"// before: data header read from whatever bytes remain\nlet data_header = alloy_rlp::Header::decode(&mut log_data_buf)\n    .map_err(|e| anyhow!(\"invalid log data RLP: {e}\"))?;\n\n// after: whole-entry validation first, custom parse second\nuse alloy_rlp::Decodable;\nanyhow::ensure!(\n    alloy_primitives::Log::decode(&mut &log_entry_bytes[..]).is_ok(),\n    \"log data field missing or misaligned — rejecting entry\"\n);","handlingStrategy":"validation","validationCode":"use alloy_rlp::Decodable;\nfn log_has_valid_data_field(rlp: &[u8]) -> bool {\n    alloy_primitives::Log::decode(&mut &rlp[..]).is_ok() // data must be an RLP byte string\n}","typeGuard":null,"tryCatchPattern":"Err(e) if e.to_string().contains(\"invalid log data RLP\") => reject_proof(e),","preventionTips":["Always emit the data byte string in encoders, even for empty payloads (0x80).","Keep the [address, topics, data] field order fixed across all producers."],"tags":["rlp","ethereum","log-data","decoding","bridge"],"backgroundTag":"rlp-decoding-failed","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}