Problem
Contract state reads via RPC are slow and rate-limited. A dashboard polling
quotas for a hundred payers will exhaust a public RPC endpoint's budget
immediately, and the failure mode is the whole service degrading rather than
one feature.
What to do
- Cache contract reads with TTLs chosen per data type: contract metadata is
effectively immutable, quota balances are not.
- Invalidate on the corresponding indexer event rather than waiting for TTL
expiry, so writes are reflected promptly.
- Serve stale on RPC failure, but label the response as stale with an
as-of timestamp — silently serving old numbers in a billing product is worse
than an error.
- Add request coalescing so a hundred concurrent misses produce one upstream
call.
Acceptance criteria
Notes
The stale labelling matters commercially. A number without an as-of timestamp
in a billing dispute is not evidence.
Problem
Contract state reads via RPC are slow and rate-limited. A dashboard polling
quotas for a hundred payers will exhaust a public RPC endpoint's budget
immediately, and the failure mode is the whole service degrading rather than
one feature.
What to do
effectively immutable, quota balances are not.
expiry, so writes are reflected promptly.
as-of timestamp — silently serving old numbers in a billing product is worse
than an error.
call.
Acceptance criteria
Notes
The stale labelling matters commercially. A number without an as-of timestamp
in a billing dispute is not evidence.