Diagnostics · semantic
semantic[trigger-incomplete]
TRIGGER does not list exactly the actions the caller pinned.
Reported only when validation is given an actions set. It catches a service that performs an action the contract does not govern.
Example
compileSource(source, { actions: new Set(["grant","revoke"]) })CONTRACT 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 > cap [SOURCE:over_cap]
}
}rejected semantic[trigger-incomplete] at 15:3 TRIGGER must list all actions for its contract
Fix
Govern the missing action.
compileSource(source, { actions: new Set(["grant","revoke"]) })CONTRACT 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()
revoke()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.count > cap [SOURCE:over_cap]
FORBID revoke WHEN Request.ready == false [SOURCE:revoke_ready]
}
}accepted
See also: the docs.