{"record":{"id":"fbd88fd8a3640651","repo":"FuelLabs/fuel-core","slug":"the-message-block-height-is-higher-than-commit","errorCode":null,"errorMessage":"The `message_block_height` is higher than `commit_block_height`","messagePattern":"The `message_block_height` is higher than `commit_block_height`","errorType":"validation","errorClass":"StorageError","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/database/block.rs","lineNumber":96,"sourceCode":"                        .and_then(|tx| tx.ok_or(not_found!(Transactions)))\n                        .map(Cow::into_owned)\n                })\n                .try_collect()?;\n            Ok(Some(block.into_owned().uncompress(txs)))\n        } else {\n            Ok(None)\n        }\n    }\n}\n\nimpl OnChainIterableKeyValueView {\n    pub fn block_history_proof(\n        &self,\n        message_block_height: &BlockHeight,\n        commit_block_height: &BlockHeight,\n    ) -> StorageResult<MerkleProof> {\n        if message_block_height > commit_block_height {\n            Err(anyhow::anyhow!(\n                \"The `message_block_height` is higher than `commit_block_height`\"\n            ))?;\n        }\n\n        let message_merkle_metadata = self\n            .storage::<FuelBlockMerkleMetadata>()\n            .get(&DenseMetadataKey::Primary(*message_block_height))?\n            .ok_or(not_found!(FuelBlockMerkleMetadata))?;\n\n        let commit_merkle_metadata = self\n            .storage::<FuelBlockMerkleMetadata>()\n            .get(&DenseMetadataKey::Primary(*commit_block_height))?\n            .ok_or(not_found!(FuelBlockMerkleMetadata))?;\n\n        let storage = self;\n        let tree: MerkleTree<FuelBlockMerkleData, _> =\n            MerkleTree::load(storage, commit_merkle_metadata.version())\n                .map_err(|err| StorageError::Other(anyhow::anyhow!(err)))?;","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/database/block.rs#L78-L114","documentation":"OnChainIterableKeyValueView::block_history_proof(message_block_height, commit_block_height) builds a Merkle inclusion proof of a message leaf within the block-commitment Merkle tree. By construction a message's block cannot be after the commit block, so message_block_height > commit_block_height is rejected up front as an invalid request rather than producing a nonsense proof.","triggerScenarios":"Calling block_history_proof with the two heights swapped, or with a commit height derived incorrectly (off-by-one, wrong DA-to-Fuel height conversion), so that message_block_height exceeds commit_block_height.","commonSituations":"GraphQL/API message proof queries where callers pass heights in the wrong order; bridging code mapping DA heights to Fuel heights incorrectly; tests constructing proof requests by hand.","solutions":["Validate and, if swapped, exchange the arguments so message_block_height <= commit_block_height.","Audit the code that derives both heights — look for off-by-one errors and DA-height vs Fuel-height confusion.","Return a 4xx-style invalid-argument error to API clients instead of propagating the internal error."],"exampleFix":"// before\nlet proof = view.block_history_proof(&msg_height, &commit_height)?;\n\n// after\nlet (msg_height, commit_height) = if msg_height <= commit_height {\n    (msg_height, commit_height)\n} else {\n    return Err(anyhow::anyhow!(\"message height must be <= commit height\"));\n};\nlet proof = view.block_history_proof(&msg_height, &commit_height)?;","handlingStrategy":"validation","validationCode":"if message_block_height > commit_block_height {\n    return Err(anyhow::anyhow!(\n        \"invalid request: message_block_height {} > commit_block_height {}\",\n        message_block_height, commit_block_height\n    ));\n}\nlet proof = view.block_history_proof(&message_block_height, &commit_block_height)?;","typeGuard":null,"tryCatchPattern":"match view.block_history_proof(&msg_h, &commit_h) {\n    Ok(p) => Ok(p),\n    Err(e) if e.to_string().contains(\"higher than\") => {\n        // argument-order bug in the caller; fix the call site, do not retry\n        Err(anyhow::anyhow!(\"bad proof request: {}\", e))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Assert message_block_height <= commit_block_height at the API boundary and reject early.","Double-check DA-height to Fuel-height conversions in bridging code.","Write unit tests covering both orderings of the two height arguments."],"tags":["merkle-proof","messages","validation","graphql","rust"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}