{"record":{"id":"e5cdae61bf0d450c","repo":"nautechsystems/nautilus_trader","slug":"fixed-tick-scheme-is-valid","errorCode":null,"errorMessage":"fixed tick scheme is valid","messagePattern":"fixed tick scheme is valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/model/src/instruments/tick_scheme.rs","lineNumber":200,"sourceCode":"            (1_000.0, 3_000.0, 0.5),\n            (3_000.0, 10_000.0, 1.0),\n            (10_000.0, 30_000.0, 5.0),\n            (30_000.0, 100_000.0, 10.0),\n            (100_000.0, 300_000.0, 50.0),\n            (300_000.0, 1_000_000.0, 100.0),\n            (1_000_000.0, 3_000_000.0, 500.0),\n            (3_000_000.0, 10_000_000.0, 1_000.0),\n            (10_000_000.0, 30_000_000.0, 5_000.0),\n            (30_000_000.0, f64::INFINITY, 10_000.0),\n        ],\n        4,\n        10_000,\n    )\n    .expect(\"TOPIX100 tick scheme tiers are valid by construction\")\n});\n\nstatic FIXED_TICK_SCHEME: LazyLock<FixedTickScheme> =\n    LazyLock::new(|| FixedTickScheme::new(1.0).expect(\"fixed tick scheme is valid\"));\n\nstatic CRYPTO_0_01_TICK_SCHEME: LazyLock<FixedTickScheme> =\n    LazyLock::new(|| FixedTickScheme::new(0.01).expect(\"crypto tick scheme is valid\"));\n\nstatic FIXED_PRECISION_TICK_SCHEMES: LazyLock<Vec<FixedTickScheme>> = LazyLock::new(|| {\n    (0..=FIXED_PRECISION)\n        .map(|precision| {\n            let tick = 10_f64.powi(-i32::from(precision));\n            FixedTickScheme::new(tick).expect(\"fixed precision tick scheme is valid\")\n        })\n        .collect()\n});\n\n#[derive(Debug, Clone, Copy, PartialEq)]\npub struct FixedTickScheme {\n    tick: f64,\n}\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/instruments/tick_scheme.rs#L182-L218","documentation":"This panic lives in a static initializer for FIXED_TICK_SCHEME, a LazyLock that builds a FixedTickScheme with tick size 1.0. `FixedTickScheme::new` only fails for non-finite or non-positive tick sizes, which cannot happen here, so this expect documents an invariant that should never fire at runtime. If it does trigger, the constructor's validation logic itself has regressed.","triggerScenarios":"Effectively untriggerable: would require the constant tick 1.0 to be rejected by FixedTickScheme::new, i.e. first access to the static after a code change broke the constructor or the constant.","commonSituations":"Developers would only encounter this after modifying FixedTickScheme::new validation or the tick constant in a patch, causing the first use of price rounding to panic on static init.","solutions":["Inspect recent changes to FixedTickScheme::new — the validation is rejecting a valid tick by mistake.","Confirm the tick constant (1.0) is positive and finite.","Run the tick_scheme unit tests to pin down the regressed validation branch.","Keep the static as-is if reverting; it is correct by construction."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Library-internal static; nothing for users to validate.\n// If you maintain this code:\nassert!(1.0_f64.is_finite() && 1.0 > 0.0);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not modify FixedTickScheme::new validation without updating its tests.","Keep tick constants positive and finite.","Run tick_scheme unit tests when touching this module."],"tags":["rust","panic","static-init","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}