{"record":{"id":"0ae95819c8618a0c","repo":"linera-io/linera-protocol","slug":"header-rlp-hash-mismatch-computed-computed-hash","errorCode":null,"errorMessage":"header RLP hash mismatch: computed {computed_hash}, expected {block_hash}. This may indicate the RPC returned non-standard header fields.","messagePattern":"header RLP hash mismatch: computed (.+?), expected (.+?)\\. This may indicate the RPC returned non-standard header fields\\.","errorType":"exception","errorClass":"ProofError","httpStatus":null,"severity":"critical","filePath":"linera-bridge/src/proof/gen.rs","lineNumber":129,"sourceCode":"        })?;\n\n        // 2. Get full block → header RLP\n        let block = self\n            .provider\n            .get_block_by_hash(block_hash)\n            .await\n            .map_err(|e| ProofError::Transient(e.into()))?\n            .ok_or_else(|| {\n                ProofError::Transient(anyhow::anyhow!(\"block not found for hash {block_hash}\"))\n            })?;\n\n        let mut block_header_rlp = Vec::new();\n        block.header.inner.encode(&mut block_header_rlp);\n\n        // Sanity check: header RLP hashes to the expected block hash\n        let computed_hash = alloy_primitives::keccak256(&block_header_rlp);\n        if computed_hash != block_hash {\n            return Err(ProofError::Permanent(anyhow::anyhow!(\n                \"header RLP hash mismatch: computed {computed_hash}, expected {block_hash}. \\\n                 This may indicate the RPC returned non-standard header fields.\"\n            )));\n        }\n\n        // 3. Get all block receipts\n        let all_receipts = self\n            .provider\n            .get_block_receipts(block.header.number.into())\n            .await\n            .map_err(|e| ProofError::Transient(e.into()))?\n            .ok_or_else(|| {\n                ProofError::Transient(anyhow::anyhow!(\n                    \"block receipts not found for block {block_hash}\"\n                ))\n            })?;\n\n        // 4. Encode each receipt to canonical EIP-2718 form (as stored in the trie).","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-bridge/src/proof/gen.rs#L111-L147","documentation":"A permanent sanity check: the locally RLP-encoded block header must keccak256-hash to the block hash reported by the receipt. A mismatch means the header the RPC returned does not round-trip to the canonical consensus encoding — extra/non-standard fields, a different header layout, or wrong alloy encoding for this chain type. Retrying will not help; the trust anchor for the proof is broken.","triggerScenarios":"Calling generate_deposit_proof against an RPC that returns non-canonical header fields (some OP-Stack/L2 providers expose custom fields); using the wrong network type for the chain (Ethereum header encoding on an Optimism chain); alloy/op-alloy version drift changing header Encodable behavior.","commonSituations":"L2 chains with extended headers served by third-party gateways; after upgrading alloy crates where header RLP encoding changed; pointing the client at a chain it was not configured for (the client is built with the Optimism network type).","solutions":["Try a different, reputable RPC provider for the same chain — often the gateway mangles headers","Verify the RPC URL targets the expected network (Base L2 with OP-style headers)","Pin/align alloy and op-alloy versions to the ones this crate was built and tested with","If reproducible across providers, file a bug — the header Encodable path no longer matches consensus"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Err(ProofError::Permanent(e)) if e.to_string().contains(\"header RLP hash mismatch\") => {\n    // trust failure: fall back to a different RPC provider and re-run;\n    // if it persists across providers, stop and report — do not bypass the check\n}","preventionTips":["Keep a list of fallback RPC providers for the chain","Pin alloy/op-alloy versions known to encode the target chain's headers canonically","Never skip or downgrade this sanity check — it anchors the whole proof"],"tags":["evm","rpc","block-header","rlp","keccak","bridge","permanent"],"backgroundTag":"block-header-hash-mismatch","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}