The request
{
"name": "wever_firewall-order-check",
"arguments": {
"checks": [
{
"name": "Exposure cap",
"kind": "exposure_cap",
"runs_at": "before_settlement",
"on_fail": "reduce"
},
{
"name": "Counterparty screen",
"kind": "counterparty",
"runs_at": "after_settlement",
"on_fail": "reject"
}
],
"cap": {
"check": "Exposure cap",
"amount": "5,000 USDC",
"scope": "open_exposure",
"includes_pending": true
},
"paths": [
{
"name": "First attempt",
"kind": "order",
"runs": [
"Exposure cap",
"Counterparty screen"
]
},
{
"name": "Retry after timeout",
"kind": "retry",
"runs": [
"Counterparty screen"
]
}
],
"records": {
"passes": true,
"rejects": true,
"reductions": true,
"fields": [
"order reference",
"amount asked",
"amount passed",
"check",
"result",
"reason",
"time"
]
}
}
}What the report returns
Verdict: settles_unchecked.
| Counterparty screen | Counterparty screen runs after settlement, so an order that fails it has already settled. |
|---|
| Cap bypass, retry | The Retry after timeout path runs Counterparty screen and not Exposure cap, so an order on it settles without the cap. |
|---|
| Fix, Counterparty screen | Run Counterparty screen before settlement, and hold the order until it passes. |
|---|
| Fix, retry | Run Exposure cap on the Retry after timeout path before settlement. |
|---|
An order can settle unchecked: 1 check after settlement and 1 cap bypass (retry).
The first attempt runs the exposure cap before settlement, and a large order comes back reduced to the cap, with both sizes on record. The retry after a timeout runs only the counterparty screen, so a retried order settles at full size. The counterparty screen itself runs after settlement, so an order that fails it has already settled. Running both checks on every path, before settlement, closes the gap.