How long MusdClient.getConstants may reuse a cached read of the GOVERNABLE
values, in milliseconds. 60 seconds (MK-012).
The values behind it, minNetDebt() and the global interest rate, are governable: they
can change under a running process at any time. They were previously cached for the
lifetime of the client object, so a keeper or a server that builds one client at boot
could act on a debt floor that changed hours earlier, and nothing in the SDK would ever
notice.
60 seconds is chosen against the cost of being wrong in each direction. Being stale is
unbounded harm: a preview reports a floor the contract no longer enforces, so an open
that the SDK says is fine reverts, or one it rejects would have succeeded. Being fresh
costs two eth_calls a minute per client, which is nothing next to the reads a single
previewOpen already makes. It is not lower because these are governance parameters,
changed by a timelocked process, not a price: sub second freshness would buy nothing real
and would turn every preview into an extra round trip.
Override it with constantsTtlMs, or drop the cache at a moment you choose with
MusdClient.invalidateConstants. 0 re-reads on every call.
How long MusdClient.getConstants may reuse a cached read of the GOVERNABLE values, in milliseconds. 60 seconds (MK-012).
The values behind it,
minNetDebt()and the global interest rate, are governable: they can change under a running process at any time. They were previously cached for the lifetime of the client object, so a keeper or a server that builds one client at boot could act on a debt floor that changed hours earlier, and nothing in the SDK would ever notice.60 seconds is chosen against the cost of being wrong in each direction. Being stale is unbounded harm: a preview reports a floor the contract no longer enforces, so an open that the SDK says is fine reverts, or one it rejects would have succeeded. Being fresh costs two
eth_calls a minute per client, which is nothing next to the reads a singlepreviewOpenalready makes. It is not lower because these are governance parameters, changed by a timelocked process, not a price: sub second freshness would buy nothing real and would turn every preview into an extra round trip.Override it with
constantsTtlMs, or drop the cache at a moment you choose with MusdClient.invalidateConstants.0re-reads on every call.