{"record":{"id":"91ba972e2a0c1bd9","repo":"nautechsystems/nautilus_trader","slug":"slippage-bps-slippage-bps-exceeds-max-slippag","errorCode":null,"errorMessage":"`slippage_bps` {slippage_bps} exceeds `max_slippage_bps` {max_slippage_bps}","messagePattern":"`slippage_bps` (.+?) exceeds `max_slippage_bps` (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":321,"sourceCode":"            config.max_quote_age_blocks,\n            config.receipt_timeout_secs,\n        )\n        else {\n            anyhow::bail!(\n                \"Blockchain execution transaction limits are required: allowed_token_pairs, slippage_bps, max_slippage_bps, max_order_amount, deadline_seconds, max_quote_age_blocks, receipt_timeout_secs\"\n            );\n        };\n\n        let mut parsed_pairs = HashSet::with_capacity(allowed_token_pairs.len());\n        for (token_in, token_out) in allowed_token_pairs {\n            parsed_pairs.insert((\n                validate_address(token_in.as_str())?,\n                validate_address(token_out.as_str())?,\n            ));\n        }\n\n        if slippage_bps > max_slippage_bps {\n            anyhow::bail!(\n                \"`slippage_bps` {slippage_bps} exceeds `max_slippage_bps` {max_slippage_bps}\"\n            );\n        }\n\n        if max_slippage_bps >= BPS_DENOMINATOR {\n            anyhow::bail!(\"`max_slippage_bps` {max_slippage_bps} must be below {BPS_DENOMINATOR}\");\n        }\n\n        Ok(TransactionLimits {\n            allowed_token_pairs: parsed_pairs,\n            slippage_bps,\n            max_slippage_bps,\n            max_order_amount,\n            deadline_seconds,\n            max_quote_age_blocks,\n            receipt_timeout_secs,\n        })\n    }","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/execution/client.rs#L303-L339","documentation":"Config validation enforces slippage ordering: the default `slippage_bps` applied to derive a swap's minimum output must not exceed `max_slippage_bps`, the ceiling accepted for per-order overrides. Values are in basis points, and the very next check requires max_slippage_bps to stay below 10_000 (BPS_DENOMINATOR, i.e. 100%).","triggerScenarios":"Constructing the client with slippage_bps greater than max_slippage_bps — e.g. slippage_bps=200 with max_slippage_bps=100 — typically from swapped values or independent edits that drift apart.","commonSituations":"Copying slippage numbers between the two fields in the wrong order; raising the default slippage without updating the ceiling; config templates where the ceiling was filled with a placeholder smaller than the default.","solutions":["Reorder the values so slippage_bps <= max_slippage_bps.","Keep both below 10_000 basis points (100%).","Treat max_slippage_bps as a risk ceiling set by policy, with slippage_bps a tunable default under it.","Add a config round-trip test that constructs the client in CI to catch bad values before deploy."],"exampleFix":"// before\nslippage_bps: Some(200),\nmax_slippage_bps: Some(100), // bails: 200 exceeds 100\n\n// after\nslippage_bps: Some(50),      // default applied to swaps\nmax_slippage_bps: Some(300), // ceiling for per-order overrides (< 10_000)","handlingStrategy":"validation","validationCode":"fn slippage_ok(slippage_bps: u32, max_slippage_bps: u32) -> bool {\n    slippage_bps <= max_slippage_bps && max_slippage_bps < 10_000\n}\n// assert at config load","typeGuard":null,"tryCatchPattern":"Fail deployment with the two values from the message compared side by side; retrying is pointless until the config file changes.","preventionTips":["Set max_slippage_bps as a policy ceiling first, then the default under it.","Keep both values below 10_000 bps.","Add a config validation test in CI."],"tags":["rust","nautilustrader","config","slippage","validation","blockchain"],"backgroundTag":"config-validation-failed","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}