{"record":{"id":"a667c9ed17cc6b31","repo":"FuelLabs/fuel-core","slug":"the-provided-time-parameters-lead-to-an-overflow","errorCode":null,"errorMessage":"The provided time parameters lead to an overflow","messagePattern":"The provided time parameters lead to an overflow","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/services/consensus_module/poa/src/service.rs","lineNumber":861,"sourceCode":"        config,\n        txpool,\n        block_producer,\n        block_importer,\n        p2p_port,\n        block_signer,\n        predefined_blocks,\n        clock,\n        block_production_ready_signal,\n        reconciliation_port,\n    ))\n}\n\nfn increase_time(time: Tai64, duration: Duration) -> anyhow::Result<Tai64> {\n    let timestamp = time.0;\n    let timestamp = timestamp\n        .checked_add(duration.as_secs())\n        .ok_or(anyhow::anyhow!(\n            \"The provided time parameters lead to an overflow\"\n        ))?;\n    Ok(Tai64(timestamp))\n}\n","sourceCodeStart":843,"sourceCodeEnd":865,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/services/consensus_module/poa/src/service.rs#L843-L865","documentation":"increase_time(Tai64, Duration) adds duration.as_secs() to the Tai64 seconds counter (a u64) with checked_add and errors on overflow. It is the single helper behind next_time for both manual and trigger requests, so any block_time/period/elapsed-time combination that would push the next block timestamp past u64::MAX seconds fails here.","triggerScenarios":"next_time(RequestType::Manual) computing last_timestamp + block_time/period/elapsed where the sum overflows u64; manual start_times near Tai64::MAX followed by further next_time advances; huge Interval block_time or Open period in config added to the head timestamp.","commonSituations":"Config unit mistakes (a value intended as milliseconds parsed as seconds via Duration::from_secs); test chains whose timestamps were advanced close to Tai64::MAX by manual production; unbounded integers from config files fed straight into Duration.","solutions":["Use small, realistic intervals (seconds-scale) for Trigger::Interval block_time and Trigger::Open period.","Do not pass manual start_times near Tai64::MAX; prefer None and let next_time derive the value.","If the chain head timestamp is already extreme (from earlier manual jumps), reset the test chain or continue with explicit lower-but-monotonic start_times."],"exampleFix":"// before\nlet config = Config {\n    trigger: Trigger::Interval { block_time: Duration::from_secs(u64::MAX) },\n    ..Default::default()\n};\n\n// after\nlet config = Config {\n    trigger: Trigger::Interval { block_time: Duration::from_secs(10) },\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"// Mirror increase_time's checked arithmetic before triggering production\nfn next_timestamp_fits(last_timestamp: Tai64, step: std::time::Duration) -> bool {\n    last_timestamp.0.checked_add(step.as_secs()).is_some()\n}\n\nif !next_timestamp_fits(head.time(), trigger_step) {\n    anyhow::bail!(\"head timestamp + trigger step would overflow Tai64\");\n}","typeGuard":"fn increase_time_checked(time: Tai64, duration: std::time::Duration) -> Option<Tai64> {\n    time.0.checked_add(duration.as_secs()).map(Tai64)\n}","tryCatchPattern":"match result {\n    Err(err) if err.to_string().contains(\"lead to an overflow\") => {\n        // permanent config/state issue: fix trigger interval or reset the chain's timestamps\n    }\n    other => other,\n}","preventionTips":["Keep trigger intervals at realistic second-scale values.","Avoid manual start_times near Tai64::MAX; prefer None and let the service derive timestamps.","Unit-test config parsing so millisecond values cannot silently become Duration::from_secs."],"tags":["consensus","poa","overflow","time","configuration","rust"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}