{"record":{"id":"4594970731bb3116","repo":"linera-io/linera-protocol","slug":"trailing-data-after-log-fields-unexpected-byte","errorCode":null,"errorMessage":"trailing data after log fields ({} unexpected bytes)","messagePattern":"trailing data after log fields \\((.+?) unexpected bytes\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-bridge/src/proof/mod.rs","lineNumber":598,"sourceCode":"            .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 {\n        address,\n        topics,\n        data: log_bytes,\n    })\n}\n\n#[cfg(test)]\nmod tests {\n    #![allow(clippy::cast_possible_truncation)]\n\n    use std::str::FromStr;\n","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-bridge/src/proof/mod.rs#L580-L616","documentation":"decode_log enforces the log's declared payload boundary is consumed exactly: after address, topics list, and data string, log_data_buf must be empty (linera-bridge/src/proof/mod.rs:598). Trailing bytes mean the log list contains more than the three schema fields — a malformed log or a schema the parser does not know (e.g., a future EIP adding a fourth log field).","triggerScenarios":"Decoding logs from a chain whose log entries carry extra fields beyond (address, topics, data); a corrupt node whose payload length overstates the content; fixtures that append extra bytes inside the log list.","commonSituations":"A hard fork extends the log schema and old parser binaries scan post-fork blocks; hand-built test logs with stray padding; trie nodes from an incompatible chain preset.","solutions":["Hex-dump the trailing bytes: recognizable structure (e.g., another RLP item) indicates a schema extension — check the chain's EIP/fork status and update the parser to decode or deliberately skip the new field.","Confirm the receipt proof verifies against the header root; if it does, the extra bytes are protocol content, not corruption.","If the bytes are garbage, re-fetch the node — likely provider corruption.","Keep parser and chain-preset versions locked together when deploying the bridge scanner."],"exampleFix":"// before\nensure!(log_data_buf.is_empty(), \"trailing data after log fields ({} unexpected bytes)\", log_data_buf.len());\n\n// after (post-fork schema with an optional 4th field: skip instead of failing)\nif !log_data_buf.is_empty() {\n    skip_rlp_item(&mut log_data_buf)?;\n    ensure!(log_data_buf.is_empty(), \"more than one extra log field\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match decode_receipt_logs(receipt_rlp) {\n    Ok(logs) => logs,\n    Err(e) if e.to_string().contains(\"trailing data after log fields\") => {\n        tracing::warn!(error = %e, \"unknown extra log fields (fork?); rejecting node pending parser update\");\n        Vec::new()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Track hard-fork schedules of scanned chains; log-schema extensions require parser updates.","Verify the proof before parsing so trailing bytes can be attributed to protocol vs corruption.","Pin scanner and chain-preset versions together in deployment."],"tags":["rlp","ethereum","decoding","schema-evolution","rust","linera-bridge"],"backgroundTag":"rlp-decoding-error","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}