{"record":{"id":"f711f9e7dc0fab51","repo":"nautechsystems/nautilus_trader","slug":"missing-ticklower-in-topic2-when-parsing-mint-even","errorCode":null,"errorMessage":"Missing tickLower in topic2 when parsing mint event","messagePattern":"Missing tickLower in topic2 when parsing mint event","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/mint.rs","lineNumber":67,"sourceCode":"/// # Errors\n///\n/// Returns an error if the log parsing fails or if the event data is invalid.\n///\n/// # Panics\n///\n/// Panics if the contract address is not set in the log.\npub fn parse_mint_event_hypersync(dex: SharedDex, log: &HypersyncLog) -> anyhow::Result<MintEvent> {\n    validate_event_signature_hash(\"Mint\", MINT_EVENT_SIGNATURE_HASH, log)?;\n\n    let owner = extract_address_from_topic(log, 1, \"owner\")?;\n\n    // Extract int24 tickLower from topic2 (stored as a 32-byte padded value)\n    let tick_lower = match log.topics.get(2).and_then(|t| t.as_ref()) {\n        Some(topic) => {\n            let tick_lower_bytes: [u8; 32] = topic.as_ref().try_into()?;\n            i32::from_be_bytes(tick_lower_bytes[28..32].try_into()?)\n        }\n        None => anyhow::bail!(\"Missing tickLower in topic2 when parsing mint event\"),\n    };\n\n    // Extract int24 tickUpper from topic3 (stored as a 32-byte padded value)\n    let tick_upper = match log.topics.get(3).and_then(|t| t.as_ref()) {\n        Some(topic) => {\n            let tick_upper_bytes: [u8; 32] = topic.as_ref().try_into()?;\n            i32::from_be_bytes(tick_upper_bytes[28..32].try_into()?)\n        }\n        None => anyhow::bail!(\"Missing tickUpper in topic3 when parsing mint event\"),\n    };\n\n    if let Some(data) = &log.data {\n        let data_bytes = data.as_ref();\n\n        // Validate if data contains 4 parameters of 32 bytes each\n        if data_bytes.len() < 4 * 32 {\n            anyhow::bail!(\"Mint event data is too short\");\n        }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/mint.rs#L49-L85","documentation":"Thrown by parse_mint_event_hypersync when topic2 (the tickLower parameter of the Uniswap V3 Mint event) is absent from the log. The Mint event has three indexed parameters (owner in topic1, tickLower in topic2, tickUpper in topic3), so a missing topic2 means the log cannot represent a valid Mint event.","triggerScenarios":"A Hypersync log with fewer than 3 topics passed to parse_mint_event_hypersync — e.g. the hypersync query did not request all topic fields, or a synthetic log fixture omits topic2.","commonSituations":"Hypersync field_selection excluding topics[2], malformed test fixtures, or routing a non-Mint event (with fewer indexed args) into the Mint parser.","solutions":["Ensure the Hypersync log field_selection requests all topic slots (at least indices 0..=3).","Verify topic0 is the standard Uniswap V3 Mint signature before parsing.","Check log.topics.len() >= 4 (signature + 3 indexed params) as a precondition.","Fix test fixtures to include a 32-byte tickLower topic."],"exampleFix":"// before: fixture missing topic2\ntopics: vec![Some(mint_sig), Some(owner)]\n// after\ntopics: vec![Some(mint_sig), Some(owner), Some(tick_lower_padded), Some(tick_upper_padded)]","handlingStrategy":"validation","validationCode":"// Before calling parse_mint_event_hypersync\nfn mint_topics_present(log: &HypersyncLog) -> bool {\n    log.topics.len() >= 4\n        && log.topics[..4].iter().all(|t| t.is_some())\n}\nif !mint_topics_present(&log) { skip(&log); }","typeGuard":"fn has_mint_topics(log: &HypersyncLog) -> bool {\n    matches!(&log.topics.get(2), Some(Some(_))) && matches!(&log.topics.get(3), Some(Some(_)))\n}","tryCatchPattern":"match parse_mint_event_hypersync(log, dex) {\n    Ok(event) => process(event),\n    Err(e) if e.to_string().contains(\"Missing tickLower\") => {\n        log::debug!(\"log missing topic2 (check hypersync topics selection): {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Request topic slots 0..=3 in the Hypersync field_selection","Check log.topics length before parsing Mint events","Verify topic0 equals the canonical Mint signature hash","Include all four topics in test log fixtures"],"tags":["abi-decode","uniswap-v3","hypersync","events"],"backgroundTag":"missing-required-argument","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"}