celo-monorepo
celo-monorepo copied to clipboard
Combiner PNP quota endpoint
For ASv2 and the new version of the rate limit defined in https://www.notion.so/clabsco/ODIS-Rate-Limit-v2-2d3e7bcf01cf4fd19f00b1542ae862b9, clients will need to be able to easily check their remaining ODIS quota and top up if necessary.
Because Signers can have different views of an account's performed quota count and (consequently) remaining ODIS quota, the combiner should be able to aggregate quota responses from all the signers into a single summary response.
Ex. For an ODIS instance with a 2/3 threshold, where signer[i] believes the user has i remaining quota, the user has 1 remaining quota. This is because signer[0] will not accept any requests (believing the user has zero quota), while signer[1] and signer[2] will both accept one request, but not two. This means the user can make at most one request where a threshold of signers will accept.
In general, the combiner should return the "nth least restrictive" (or technically n-1th least restrictive) view of the user's quota for a system with threshold n/m. See the code in https://github.com/celo-org/celo-monorepo/blob/794ab6b0aa7afbe6479f9d9357f93dea05854f25/packages/phone-number-privacy/combiner/src/domain/services/thresholdState.ts#L10 to get a sense of how this is done for the domains use case.