{"record":{"id":"b191a5c991da078c","repo":"nautechsystems/nautilus_trader","slug":"l2-queue-update-should-be-processed","errorCode":null,"errorMessage":"L2 queue update should be processed","messagePattern":"L2 queue update should be processed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/execution/benches/matching_engine.rs","lineNumber":246,"sourceCode":"                        assert_events(state, EventCounts::default());\n                        assert_order_status(state, OrderStatus::Accepted, order_count);\n                    },\n                )\n            });\n        });\n\n        // Level-wide updates affect every order queued at the updated price\n        group.bench_function(BenchmarkId::new(\"delta_l2_update\", order_count), |b| {\n            b.iter_custom(|iters| {\n                run_iterations(\n                    iters,\n                    || build_queue_engine(BookType::L2_MBP, &orders, Some(&bid), None),\n                    |state| {\n                        for delta in &updates {\n                            state\n                                .engine\n                                .process_order_book_delta(black_box(delta))\n                                .expect(\"L2 queue update should be processed\");\n                        }\n                    },\n                    |state| {\n                        assert_eq!(\n                            state.engine.get_book().update_count,\n                            (MARKET_DATA_COUNT + 1) as u64,\n                        );\n                        assert_events(state, EventCounts::default());\n                        assert_order_status(state, OrderStatus::Accepted, order_count);\n                    },\n                )\n            });\n        });\n\n        // Per-order L3 updates expose the tracked-order lookup cost\n        group.bench_function(BenchmarkId::new(\"delta_l3_update\", order_count), |b| {\n            b.iter_custom(|iters| {\n                run_iterations(","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/execution/benches/matching_engine.rs#L228-L264","documentation":"Benchmark panic from `.expect(\"L2 queue update should be processed\")` on `OrderMatchingEngine::process_order_book_delta` in the queue-position benchmark. The engine validates Add/Update delta price/size precision against the instrument and applies the delta to the L2 book, seeding and adjusting order queue positions; any precision mismatch or `book.apply_delta` failure returns `Err` and panics the bench.","triggerScenarios":"The synthetic queue-update deltas having price/size precision inconsistent with the instrument in `build_queue_engine`; an update referencing a price level/order state the L2 book doesn't contain; flags on the delta triggering snapshot/clear handling unexpectedly.","commonSituations":"Queue-update generator emitting sizes rounded differently from the order sizes seeded via `orders`; changing `queue_position` config or book type without regenerating deltas; price levels drifted between the seeded book and update stream.","solutions":["Build the queue-update deltas from the same instrument precision and price levels used to seed `orders` and the book.","Ensure each Update delta targets an existing level/order created by the seed deltas (Apply order matters).","Read the anyhow error message to identify the failing check (price precision, size precision, or apply_delta) and fix the generator accordingly."],"exampleFix":"// before\nstate.engine.process_order_book_delta(black_box(delta)).expect(\"L2 queue update should be processed\");\n// after\nstate.engine.process_order_book_delta(black_box(delta))\n    .unwrap_or_else(|e| panic!(\"queue update at {:?} rejected: {e}\", delta.order.price));","handlingStrategy":"validation","validationCode":"// build queue updates from the same seeded book state\nassert!(updates.iter().all(|d| seeded_levels.contains(&d.order.price)),\n        \"every update must target a seeded level\");","typeGuard":"fn targets_seeded_level(d: &OrderBookDelta, seeded: &[Price]) -> bool {\n    seeded.iter().any(|p| **p == d.order.price)\n}","tryCatchPattern":"if let Err(e) = engine.process_order_book_delta(update) {\n    log::error!(\"queue update rejected: {e} — verify precision and seeded level consistency\");\n}","preventionTips":["Generate updates from the same instrument precision as the seeded orders.","Keep update price levels aligned with the book built by seed deltas.","Regenerate bench fixtures whenever build_queue_engine config changes."],"tags":["rust","benchmark","queue-position","order-book"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}