nautechsystems/nautilus_trader · error

Missing tickLower in topic2 when parsing mint event

Error message

Missing tickLower in topic2 when parsing mint event

What it means

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.

Source

Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/mint.rs:67

/// # Errors
///
/// Returns an error if the log parsing fails or if the event data is invalid.
///
/// # Panics
///
/// Panics if the contract address is not set in the log.
pub fn parse_mint_event_hypersync(dex: SharedDex, log: &HypersyncLog) -> anyhow::Result<MintEvent> {
    validate_event_signature_hash("Mint", MINT_EVENT_SIGNATURE_HASH, log)?;

    let owner = extract_address_from_topic(log, 1, "owner")?;

    // Extract int24 tickLower from topic2 (stored as a 32-byte padded value)
    let tick_lower = match log.topics.get(2).and_then(|t| t.as_ref()) {
        Some(topic) => {
            let tick_lower_bytes: [u8; 32] = topic.as_ref().try_into()?;
            i32::from_be_bytes(tick_lower_bytes[28..32].try_into()?)
        }
        None => anyhow::bail!("Missing tickLower in topic2 when parsing mint event"),
    };

    // Extract int24 tickUpper from topic3 (stored as a 32-byte padded value)
    let tick_upper = match log.topics.get(3).and_then(|t| t.as_ref()) {
        Some(topic) => {
            let tick_upper_bytes: [u8; 32] = topic.as_ref().try_into()?;
            i32::from_be_bytes(tick_upper_bytes[28..32].try_into()?)
        }
        None => anyhow::bail!("Missing tickUpper in topic3 when parsing mint event"),
    };

    if let Some(data) = &log.data {
        let data_bytes = data.as_ref();

        // Validate if data contains 4 parameters of 32 bytes each
        if data_bytes.len() < 4 * 32 {
            anyhow::bail!("Mint event data is too short");
        }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the Hypersync log field_selection requests all topic slots (at least indices 0..=3).
  2. Verify topic0 is the standard Uniswap V3 Mint signature before parsing.
  3. Check log.topics.len() >= 4 (signature + 3 indexed params) as a precondition.
  4. Fix test fixtures to include a 32-byte tickLower topic.

Example fix

// before: fixture missing topic2
topics: vec![Some(mint_sig), Some(owner)]
// after
topics: vec![Some(mint_sig), Some(owner), Some(tick_lower_padded), Some(tick_upper_padded)]
Defensive patterns

Strategy: validation

Validate before calling

// Before calling parse_mint_event_hypersync
fn mint_topics_present(log: &HypersyncLog) -> bool {
    log.topics.len() >= 4
        && log.topics[..4].iter().all(|t| t.is_some())
}
if !mint_topics_present(&log) { skip(&log); }

Type guard

fn has_mint_topics(log: &HypersyncLog) -> bool {
    matches!(&log.topics.get(2), Some(Some(_))) && matches!(&log.topics.get(3), Some(Some(_)))
}

Try / catch

match parse_mint_event_hypersync(log, dex) {
    Ok(event) => process(event),
    Err(e) if e.to_string().contains("Missing tickLower") => {
        log::debug!("log missing topic2 (check hypersync topics selection): {e}");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: Hypersync field_selection excluding topics[2], malformed test fixtures, or routing a non-Mint event (with fewer indexed args) into the Mint parser.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/f711f9e7dc0fab51. Report an issue: GitHub.