{"record":{"id":"adbb2591c109b1dd","repo":"nautechsystems/nautilus_trader","slug":"context-verification-is-locally-invalid","errorCode":null,"errorMessage":"{context} verification is locally invalid","messagePattern":"(.+?) verification is locally invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1983,"sourceCode":"}\n\nfn required_verification<T>(\n    outcome: VerificationOutcome<T>,\n    context: &str,\n) -> anyhow::Result<Verified<T>> {\n    match outcome {\n        VerificationOutcome::Verified(verified) => Ok(verified),\n        VerificationOutcome::Disagreement(_) => {\n            anyhow::bail!(\"{context} verification disagreed\")\n        }\n        VerificationOutcome::Unavailable(_) => {\n            anyhow::bail!(\"{context} verification is unavailable\")\n        }\n        VerificationOutcome::Retryable(_) => {\n            anyhow::bail!(\"{context} verification is retryable\")\n        }\n        VerificationOutcome::LocallyInvalid(_) => {\n            anyhow::bail!(\"{context} verification is locally invalid\")\n        }\n    }\n}\n\nfn validate_transaction_authorization(\n    authorization: Option<&TransactionAuthorization>,\n    to: Address,\n    value: U256,\n    input: &[u8],\n) -> anyhow::Result<()> {\n    match authorization {\n        None => Ok(()),\n        Some(TransactionAuthorization::Wrap { weth }) => {\n            anyhow::ensure!(\n                to == *weth && !value.is_zero() && input == WETH9::depositCall::SELECTOR,\n                \"Wrap authorization does not match the transaction call\"\n            );\n            Ok(())","sourceCodeStart":1965,"sourceCodeEnd":2001,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1965-L2001","documentation":"Raised when the verification outcome is LocallyInvalid: the verification result violates a local precondition or validation rule (the data came back but fails local checks). The library bails because proceeding would violate its own invariants about what a valid verification looks like.","triggerScenarios":"A verification check returns VerificationOutcome::LocallyInvalid — e.g. the returned value fails local decoding/validation, a receipt field is malformed, or the verified value contradicts locally computed expectations.","commonSituations":"Node returning malformed or unexpected response payloads; ABI/decoder version mismatch producing invalid decoded data; local state (nonce, chain id) out of sync with the network.","solutions":["Inspect the LocallyInvalid payload to find which local validation failed","Re-sync local state (nonce, chain id, balances) with the chain","Update decoder/ABI definitions if the node response format changed","Switch to a different RPC provider and compare responses"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate expected response shape before trusting verification\nlet decoded = decode_receipt(&raw);\nanyhow::ensure!(decoded.status <= 1, \"unexpected receipt status field\");","typeGuard":"fn is_valid_receipt(r: &RawReceipt) -> bool {\n    r.status.is_some() && r.block_number.is_some()\n}","tryCatchPattern":"match res {\n    Err(e) if e.to_string().contains(\"verification is locally invalid\") => {\n        // inspect payload, re-sync local state, do not blind-retry\n    }\n    r => r?,\n}","preventionTips":["Keep ABI/decoder definitions in sync with the node version","Periodically re-sync nonce and chain-local state","Alert on malformed node responses and switch providers"],"tags":["verification","validation","blockchain"],"backgroundTag":"unexpected-api-response-shape","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"}