{"record":{"id":"2b2c67d19c3ab6e8","repo":"FuelLabs/fuel-core","slug":"invalid-timestamp-ordering","errorCode":null,"errorMessage":"Invalid timestamp ordering","messagePattern":"Invalid timestamp ordering","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/compression/src/config.rs","lineNumber":30,"sourceCode":"    /// If the value is needed again, it must be re-registered.\n    pub temporal_registry_retention: Duration,\n}\n\nimpl Config {\n    /// Given timestamp of the current block and a key in an older block,\n    /// is the key is still accessible?\n    /// Returns error if the arguments are not valid block timestamps,\n    /// or if the block is older than the key.\n    pub fn is_timestamp_accessible(\n        &self,\n        block_timestamp: Tai64,\n        key_timestamp: Tai64,\n    ) -> anyhow::Result<bool> {\n        let block = Tai64N(block_timestamp, 0);\n        let key = Tai64N(key_timestamp, 0);\n        let duration = block\n            .duration_since(&key)\n            .map_err(|_| anyhow::anyhow!(\"Invalid timestamp ordering\"))?;\n        Ok(duration <= self.temporal_registry_retention)\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":34,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/compression/src/config.rs#L12-L34","documentation":"Config::is_timestamp_accessible computes how long ago a temporal-registry key was registered by taking block.duration_since(key); Tai64N returns Err when the block timestamp is earlier than the key timestamp, which maps to 'Invalid timestamp ordering' (crates/compression/src/config.rs:30). The caller asked whether a key is accessible from a block that predates the key's registration. Invalid timestamp pairs therefore surface as this error rather than as a plain false.","triggerScenarios":"Calling is_timestamp_accessible(block_timestamp, key_timestamp) with block_timestamp < key_timestamp — swapped arguments, replaying an older block, or a key whose registration timestamp is in the future relative to the block being produced.","commonSituations":"Swapping the two Tai64 arguments; replaying/verifying historical blocks against newer registry entries; desynced clocks when importing blocks; tests with hand-picked timestamps.","solutions":["Fix the inputs so block_timestamp >= key_timestamp (check argument order first).","If 'block older than key' is semantically valid for your flow, treat it as not-accessible (false) instead of an error — check before calling.","Add tests asserting timestamps are non-decreasing along your block pipeline."],"exampleFix":"// before\nlet accessible = config.is_timestamp_accessible(block_ts, key_ts)?;\n\n// after — treat older blocks as not accessible instead of erroring\nlet accessible = if block_ts < key_ts {\n    false\n} else {\n    config.is_timestamp_accessible(block_ts, key_ts)?\n};","handlingStrategy":"validation","validationCode":"if block_timestamp < key_timestamp {\n    // block predates key registration: not accessible, not an error\n    return Ok(false);\n}\nlet accessible = config.is_timestamp_accessible(block_timestamp, key_timestamp)?;","typeGuard":"fn is_ordering_valid(block_ts: Tai64, key_ts: Tai64) -> bool {\n    block_ts >= key_ts\n}","tryCatchPattern":null,"preventionTips":["Name the arguments at call sites or use a struct so block/key timestamps cannot be swapped.","Assert non-decreasing timestamps along the block pipeline in tests.","Treat 'block older than key' as Ok(false) in callers where it is semantically valid."],"tags":["rust","fuel-core","compression","temporal-registry","timestamps"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}