{"record":{"id":"2ebd3bc2e551a909","repo":"linera-io/linera-protocol","slug":"failed-to-skip-receipt-field-i-e","errorCode":null,"errorMessage":"failed to skip receipt field {i}: {e}","messagePattern":"failed to skip receipt field (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-bridge/src/proof/mod.rs","lineNumber":397,"sourceCode":"    // EIP-2718: if first byte < 0x80, it's a transaction type prefix\n    if data[0] < 0x80 {\n        data = &data[1..];\n    }\n\n    let list_header =\n        alloy_rlp::Header::decode(&mut data).map_err(|e| anyhow!(\"invalid receipt RLP: {e}\"))?;\n    ensure!(list_header.list, \"receipt must be an RLP list\");\n\n    // Limit reads to the receipt's declared payload.\n    ensure!(\n        data.len() >= list_header.payload_length,\n        \"receipt payload extends past available data\"\n    );\n    let mut data = &data[..list_header.payload_length];\n\n    // Skip: status (0), cumulative_gas_used (1), logs_bloom (2)\n    for i in 0..3 {\n        skip_rlp_item(&mut data).map_err(|e| anyhow!(\"failed to skip receipt field {i}: {e}\"))?;\n    }\n\n    // Decode the logs list\n    let logs_header =\n        alloy_rlp::Header::decode(&mut data).map_err(|e| anyhow!(\"invalid logs list RLP: {e}\"))?;\n    ensure!(logs_header.list, \"logs must be an RLP list\");\n    ensure!(\n        data.len() >= logs_header.payload_length,\n        \"logs payload extends past receipt boundary\"\n    );\n\n    let mut logs_data = &data[..logs_header.payload_length];\n    let mut logs = Vec::new();\n    while !logs_data.is_empty() {\n        logs.push(decode_log(&mut logs_data)?);\n    }\n\n    Ok(logs)","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-bridge/src/proof/mod.rs#L379-L415","documentation":"While walking the receipt prefix, skip_rlp_item failed on one of the first three fields (status, cumulative_gas_used, logs_bloom) — the field index i in the message says which. The bytes at that cursor are not a valid RLP item header, so the receipt prefix is malformed or truncated.","triggerScenarios":"decode_receipt_logs on a receipt whose prefix is truncated (buffer ends mid-field), where a field starts with an invalid length prefix, or where a field that must be a single byte is a long string/list.","commonSituations":"Truncated receipt bytes from bad hex decoding or storage; hand-crafted receipt fixtures with wrong field ordering; feeding envelope bytes that skip the type byte incorrectly.","solutions":["Re-derive the receipt bytes from a trusted source (RPC receipt re-encoded via Encodable2718)","Check the field order: status, cumulativeGasUsed, bloom, then logs","Verify the buffer length covers the declared payload (the prior 'extends past available data' check passed, so the corruption is inside the payload)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match decode_receipt_logs(&receipt_rlp) {\n    Err(e) if e.to_string().contains(\"failed to skip receipt field\") => {\n        // receipt prefix malformed: re-fetch and re-encode the receipt instead of patching bytes\n    }\n    other => other?,\n}","preventionTips":["Use complete receipt bytes from a trusted re-encoding path","In tests, build receipts with the crate's build_test_receipt helpers","Field order is status, cumulativeGasUsed, bloom, logs — never reorder fixtures"],"tags":["rlp","decoding","receipt","bridge","proof"],"backgroundTag":"rlp-decode-failed","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}