{"record":{"id":"b4d10c09efdc264c","repo":"linera-io/linera-protocol","slug":"blockheightoverflow","errorCode":"BlockHeightOverflow","errorMessage":"Sequence numbers above the maximal value are not usable for blocks","messagePattern":"Sequence numbers above the maximal value are not usable for blocks","errorType":"validation","errorClass":"ChainError","httpStatus":null,"severity":"error","filePath":"linera-chain/src/manager.rs","lineNumber":296,"sourceCode":"    ///\n    /// Having a leader timeout certificate in any given round causes the next one to become\n    /// current. Seeing a validated block certificate or a valid proposal in any round causes that\n    /// round to become current, unless a higher one already is.\n    pub fn current_round(&self) -> Round {\n        *self.current_round.get()\n    }\n\n    /// Verifies that a proposed block is relevant and should be handled.\n    pub fn check_proposed_block(&self, proposal: &BlockProposal) -> Result<Outcome, ChainError> {\n        let new_block = &proposal.content.block;\n        let new_round = proposal.content.round;\n        if let Some(old_proposal) = self.proposed.get() {\n            if old_proposal.content == proposal.content {\n                return Ok(Outcome::Skip); // We have already seen this proposal; nothing to do.\n            }\n        }\n        // When a block is certified, incrementing its height must succeed.\n        ensure!(\n            new_block.height < BlockHeight::MAX,\n            ChainError::BlockHeightOverflow\n        );\n        let current_round = self.current_round();\n        match new_round {\n            // The proposal from the fast round may still be relevant as a locking block, so\n            // we don't compare against the current round here.\n            Round::Fast => {}\n            Round::MultiLeader(_) | Round::SingleLeader(0) => {\n                // If the fast round has not timed out yet, only a super owner is allowed to open\n                // a later round by making a proposal.\n                ensure!(\n                    self.is_super(&proposal.owner()) || !current_round.is_fast(),\n                    ChainError::WrongRound(current_round)\n                );\n                // After the fast round, proposals older than the current round are obsolete.\n                ensure!(\n                    new_round >= current_round,","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-chain/src/manager.rs#L278-L314","documentation":"Guard in ChainManager::check_proposed_block: a proposed block's height must be strictly below BlockHeight::MAX (u64::MAX) so that incrementing the height after certification can never fail. A block at the maximal height could be certified but never extended, deadlocking the chain, so the proposal is refused up front.","triggerScenarios":"Submitting (via try_handle_block_proposal) a block proposal whose block.height equals BlockHeight::MAX.","commonSituations":"Practically unreachable in production because it requires 2^64 blocks on one chain; occasionally produced by fuzzers or unit tests that construct blocks at extreme heights.","solutions":["If hit in tests or fuzzing, use a fresh chain or reset the fixture instead of extending one at u64::MAX","If ever hit in production, the chain is exhausted and cannot be extended further; migrate state to a new chain"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Refuse to build or submit a proposal at the maximal height.\nif block.height >= BlockHeight::MAX {\n    return Err(my::Error::ChainExhausted);\n}","typeGuard":"fn is_block_height_overflow(e: &ChainError) -> bool {\n    matches!(e, ChainError::BlockHeightOverflow)\n}","tryCatchPattern":null,"preventionTips":["Never construct blocks with u64::MAX heights outside fuzz tests","In long-running test suites, use fresh chains when a chain's height approaches artificial limits"],"tags":["blockchain","block-height","overflow","consensus","linera"],"backgroundTag":"integer-overflow","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}