Diagnostics · limit
limit[condition-depth]
A condition tree deeper than maxConditionDepth (16).
Each comparison in a flat AND or OR chain adds a level, so a chain of 17 comparisons is too deep. A long OR chain under FORBID can be split into several FORBID clauses with the same meaning: the action is denied if any of them holds.
Example
compileSourceCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.count == 0 OR Request.count == 1 OR Request.count == 2 OR Request.count == 3 OR Request.count == 4 OR Request.count == 5 OR Request.count == 6 OR Request.count == 7 OR Request.count == 8 OR Request.count == 9 OR Request.count == 10 OR Request.count == 11 OR Request.count == 12 OR Request.count == 13 OR Request.count == 14 OR Request.count == 15 OR Request.count == 16 [SOURCE:blocked_counts]
}
}rejected limit[condition-depth] at 22:23 condition depth exceeded
Fix
Split the chain into two clauses.
compileSourceCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.count == 0 OR Request.count == 1 OR Request.count == 2 OR Request.count == 3 OR Request.count == 4 OR Request.count == 5 OR Request.count == 6 OR Request.count == 7 OR Request.count == 8 [SOURCE:blocked_counts_a]
FORBID grant WHEN Request.count == 9 OR Request.count == 10 OR Request.count == 11 OR Request.count == 12 OR Request.count == 13 OR Request.count == 14 OR Request.count == 15 OR Request.count == 16 [SOURCE:blocked_counts_b]
}
}accepted
See also: the specification.