{"record":{"id":"17e7a8aa4ce00bf7","repo":"nautechsystems/nautilus_trader","slug":"lighter-transaction-lookup-did-not-match-acknowled","errorCode":null,"errorMessage":"Lighter transaction lookup did not match acknowledged create identity","messagePattern":"Lighter transaction lookup did not match acknowledged create identity","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":3371,"sourceCode":"    #[serde(rename = \"ClientOrderIndex\")]\n    client_order_index: i64,\n}\n\n#[derive(Default, Deserialize)]\nstruct AckedCreateEvent {\n    #[serde(default, rename = \"ae\")]\n    app_error: String,\n}\n\nfn validate_acked_create_tx(\n    tx: &crate::http::models::LighterTx,\n    account_index: i64,\n    api_key_index: u8,\n    client_order_index: i64,\n    nonce: i64,\n    tx_hash: &str,\n) -> anyhow::Result<()> {\n    anyhow::ensure!(\n        tx_hash_matches(&tx.hash, tx_hash)\n            && tx.tx_type == LighterTxType::CreateOrder as u8\n            && tx.account_index == account_index\n            && tx.api_key_index == api_key_index\n            && tx.nonce == nonce,\n        \"Lighter transaction lookup did not match acknowledged create identity\",\n    );\n    let info: AckedCreateTxInfo = serde_json::from_str(&tx.info)\n        .context(\"failed to parse Lighter create transaction info\")?;\n    anyhow::ensure!(\n        info.client_order_index == client_order_index,\n        \"Lighter transaction lookup returned client_order_index {} for acknowledged create {client_order_index}\",\n        info.client_order_index,\n    );\n    Ok(())\n}\n\nfn tx_hash_matches(left: &str, right: &str) -> bool {","sourceCodeStart":3353,"sourceCodeEnd":3389,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L3353-L3389","documentation":"validate_acked_create_tx fetches a Lighter on-chain transaction by hash and asserts it matches the acknowledged create-order identity: tx hash, tx type CreateOrder, account_index, api_key_index, and nonce. Any mismatch in that combined ensure! means the exchange returned a transaction that is not the create submission this client acknowledged, so the lookup cannot be trusted to verify the order's on-chain state.","triggerScenarios":"After submitting a create order, the async verification looked up the tx by hash but the node returned a transaction with a different hash (case/prefix mismatch), a different tx_type, or one belonging to a different account_index / api_key_index / nonce than the locally tracked acknowledgement.","commonSituations":"Using a wrong api_key_index or stale nonce when resubmitting after reconnect; querying against a non-sticky RPC node that has not yet indexed the tx and returns a hash-normalized or different tx; replaying an old tx_hash after a restart while account/nonce state moved on.","solutions":["Verify the tx_hash stored at acknowledgement time exactly matches the one sent (same casing/0x form) before calling validate_acked_create_tx","Re-check that account_index, api_key_index, and nonce used in the lookup are the same values used to sign and submit the create transaction","Re-fetch the transaction after a short delay in case the node served stale/pre-ack data, then retry validation","If nonce drift is the cause, re-sync the nonce from the exchange before the next submission"],"exampleFix":"// before\nvalidate_acked_create_tx(..., stale_nonce, old_tx_hash)?;\n// after\nlet nonce = self.current_nonce(account_index, api_key_index).await?;\nvalidate_acked_create_tx(..., nonce, &ack.tx_hash)?;","handlingStrategy":"validation","validationCode":"assert_eq!(ack.tx_hash, submitted.tx_hash);\nassert_eq!(ack.account_index, config.account_index);\nassert_eq!(ack.api_key_index, config.api_key_index);\nassert_eq!(ack.nonce, submitted.nonce);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store the exact tx_hash, nonce, and key index at submission time and use only those for validation","Use a sticky/single RPC node for submit-and-verify flows","Re-sync nonces after any reconnect before resubmitting"],"tags":["rust","lighter","blockchain","verification"],"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"}