{"record":{"id":"9782eeb5d1156597","repo":"nautechsystems/nautilus_trader","slug":"profiler-watermark-log-did-not-come-from-expected","errorCode":null,"errorMessage":"Profiler watermark log did not come from expected pool {pool_address}","messagePattern":"Profiler watermark log did not come from expected pool (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":4234,"sourceCode":"        matching_logs.len(),\n        position.log_index\n    );\n    let log = matching_logs[0];\n    let log_transaction_hash = B256::from_str(&rpc_log::extract_transaction_hash(log)?)\n        .with_context(|| \"Invalid profiler log transaction hash\")?;\n    let log_block_hash = log\n        .block_hash\n        .as_deref()\n        .ok_or_else(|| anyhow::anyhow!(\"Profiler log has no block hash\"))?;\n    anyhow::ensure!(\n        !log.removed\n            && log_transaction_hash == transaction_hash\n            && rpc_log::extract_block_number(log)? == position.number\n            && rpc_log::extract_transaction_index(log)? == position.transaction_index\n            && B256::from_str(log_block_hash)? == expected_block_hash,\n        \"Profiler log position does not match its ingestion watermark\"\n    );\n    anyhow::ensure!(\n        rpc_log::extract_address(log)? == pool_address,\n        \"Profiler watermark log did not come from expected pool {pool_address}\"\n    );\n    let signature = log\n        .topics\n        .first()\n        .ok_or_else(|| anyhow::anyhow!(\"Profiler watermark log has no event signature\"))?;\n    let supported =\n        profiler_event_signatures(pool).any(|expected| expected.eq_ignore_ascii_case(signature));\n    anyhow::ensure!(\n        supported,\n        \"Profiler watermark log has an unsupported event signature\"\n    );\n    Ok(())\n}\n\nfn profiler_event_signatures(pool: &Pool) -> impl Iterator<Item = &str> {\n    [","sourceCodeStart":4216,"sourceCodeEnd":4252,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L4216-L4252","documentation":"The profiler watermark log must be emitted by the expected pool contract address. The library compares the log's address field against pool_address and throws if they differ, ensuring the watermark event actually originated from the pool being profiled rather than some other contract.","triggerScenarios":"Profiler validation where rpc_log::extract_address(log) != pool_address — i.e., the log at the watermark index was emitted by a different contract than the configured pool.","commonSituations":"Pool address misconfiguration (wrong token pair, proxy vs implementation address); a pool migration/upgrade changed the emitting contract; the transaction touched multiple pools and the watermark index points at another pool's event.","solutions":["Verify pool_address in the profiler configuration matches the contract that actually emits the event (check the log's address field in a block explorer).","If a pool was upgraded/migrated, update the configured address and re-ingest the watermark.","Ensure the watermark log_index points at the correct log within the transaction, not a sibling pool's event.","For proxy contracts, configure the proxy address that emits events, not the implementation address."],"exampleFix":"// before\nprofiler.configure(pool_address: impl_addr);\n\n// after: use the emitting (proxy) address\nprofiler.configure(pool_address: proxy_addr);","handlingStrategy":"validation","validationCode":"let addr = extract_address(&log)?;\nif !addr.eq_ignore_ascii_case(pool_address) {\n    return Err(format!(\"log from {addr}, expected {pool_address}\").into());\n}","typeGuard":null,"tryCatchPattern":"match client.validate_watermark_pool(&log, pool_address) {\n    Ok(()) => Ok(()),\n    Err(e) if e.to_string().contains(\"did not come from expected pool\") => reload_pool_config_and_retry(e),\n    Err(e) => Err(e),\n}","preventionTips":["Verify pool_address against a block explorer before configuring","For proxy contracts configure the event-emitting proxy address","Re-check pool addresses after contract migrations"],"tags":["blockchain","configuration","logs","contract-address"],"backgroundTag":"invalid-config-value","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"}