{"record":{"id":"1b4f4f0747d3bbec","repo":"nautechsystems/nautilus_trader","slug":"invalid-uniswap-v3-fee-protocol-update","errorCode":null,"errorMessage":"invalid Uniswap V3 fee protocol update","messagePattern":"invalid Uniswap V3 fee protocol update","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/defi/pool_analysis/profiler.rs","lineNumber":1240,"sourceCode":"    ///\n    /// This function does not currently return an error; the `Result` keeps the signature uniform\n    /// with the other `process_*` event handlers.\n    pub fn process_fee_protocol_update(\n        &mut self,\n        update: &PoolFeeProtocolUpdate,\n    ) -> anyhow::Result<()> {\n        if self.check_if_already_processed(update.block, update.transaction_index, update.log_index)\n        {\n            return Ok(());\n        }\n\n        if update.dex.name == DexType::PancakeSwapV3 {\n            self.state\n                .set_protocol_fee_basis_points(update.fee_protocol0_new, update.fee_protocol1_new);\n        } else {\n            let fee_protocol = update\n                .uniswap_v3_packed()\n                .ok_or_else(|| anyhow::anyhow!(\"invalid Uniswap V3 fee protocol update\"))?;\n            self.state.set_uniswap_v3_fee_protocol(fee_protocol);\n        }\n\n        self.last_processed_event = Some(\n            BlockPosition::new(\n                update.block,\n                update.transaction_hash.clone(),\n                update.transaction_index,\n                update.log_index,\n            )\n            .with_block_hash(update.block_hash.clone()),\n        );\n        self.last_processed_ts = Some(update.ts_event);\n        self.update_reporter_if_enabled(update.block);\n\n        Ok(())\n    }\n","sourceCodeStart":1222,"sourceCodeEnd":1258,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/defi/pool_analysis/profiler.rs#L1222-L1258","documentation":"On a fee-protocol update event, `process_fee_protocol_update` accepts packed Uniswap V3 protocol-fee values via `uniswap_v3_packed()` (which unpacks protocolFee0/1 from a single u24 word). For non-PancakeSwapV3 DEXes, if the update cannot be unpacked (wrong event kind, missing/invalid packed field), the update is rejected with this error. It signals the event doesn't actually carry valid Uniswap V3 fee protocol data.","triggerScenarios":"Calling `process_fee_protocol_update` (or `process`/`process_defi_data` dispatching a FeeProtocolUpdate event) on a non-PancakeSwapV3 pool where the update's packed Uniswap V3 field is absent or malformed.","commonSituations":"Mapping a different DEX's fee-change event into a UniswapV3FeeProtocolUpdate by mistake; version drift where the event signature/word layout changed; misconfigured DexType so the PancakeSwapV3 branch is skipped.","solutions":["Verify the update event's DexType is actually Uniswap V3 (not PancakeSwapV3, which takes the other branch) and matches the event actually decoded.","Check that the event decoder populates `uniswap_v3_packed` (protocolFee0/1) for this event; fix the decoder if the field is empty.","Update decoding for the pool's deployed contract version if fee event layout changed.","Handle the error per-event in replay and skip pools with unsupported fee-update formats."],"exampleFix":"// before\nprofiler.process(update)?; // aborts on non-V3 fee update\n// after\nif let Err(e) = profiler.process(update) {\n    if e.to_string().contains(\"invalid Uniswap V3 fee protocol update\") {\n        warn!(\"skipping unsupported fee protocol update: {e}\");\n    } else { return Err(e); }\n}","handlingStrategy":"validation","validationCode":"if update.dex.name != DexType::PancakeSwapV3 && update.uniswap_v3_packed().is_none() {\n    anyhow::bail!(\"fee update lacks valid uniswap v3 packed field; skipping\");\n}\nprofiler.process_fee_protocol_update(update)?;","typeGuard":null,"tryCatchPattern":"match profiler.process_fee_protocol_update(&update) {\n    Ok(_) => {}\n    Err(e) if e.to_string().contains(\"invalid Uniswap V3 fee protocol update\") => warn!(\"skip fee update\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Confirm DexType classification before dispatching fee events","Keep event decoders in sync with deployed contract versions","Unit-test fee-protocol decoding for each supported DEX"],"tags":["defi","uniswap-v3","event-decoding"],"backgroundTag":"invalid-enum-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"}