ratelimits: API improvements necessary for batches and limit fixes#7117
Merged
Conversation
Member
|
The test failure is The test that's triggering this states:
I think what you may want is for |
Member
Author
Thanks, it appears I got a little overzealous when chopping up the larger changeset to produce this PR. This missing clause' have been added back and now an error is returned, as intended. |
pgporada
reviewed
Oct 25, 2023
52d7bcb to
3ce9716
Compare
pgporada
reviewed
Oct 26, 2023
pgporada
previously approved these changes
Oct 27, 2023
pgporada
previously approved these changes
Oct 27, 2023
aarongable
reviewed
Oct 27, 2023
Co-authored-by: Aaron Gable <aaron@letsencrypt.org>
aarongable
approved these changes
Nov 7, 2023
pgporada
reviewed
Nov 8, 2023
pgporada
approved these changes
Nov 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
LimiterAPI has been adjusted significantly to both improve both safety and ergonomics and twoLimittypes have been corrected to match the legacy implementations.Safety
Previously, the key used for looking up limit overrides and for fetching individual buckets from the key-value store was constructed within the WFE. This posed a risk: if the key was malformed, the default limit would still be enforced, but individual overrides would fail to function properly. This has been addressed by the introduction of a new
BucketIdtype along with aBucketIdconstructor for eachLimittype. Each constructor is responsible for producing a well-formed bucket key which undergoes the very same validation as any potentially matching override key.Ergonomics
Previously, each of the
Limitermethods took aLimitname, a bucket identifier, and a cost to be spent/ refunded. To simplify this, each method now accepts a newTransactiontype which provides a cost, and wraps aBucketIdidentifying the specific bucket.The two changes above, when taken together, make the implementation of batched rate limit transactions considerably easier, as a batch method can accept a slice of
Transaction.Limit Corrections
PR #6947 added all of the existing rate limits which could be made compatible with the key-value approach. Two of these were improperly implemented;
CertificatesPerDomainandCertificatesPerFQDNSet, were implemented asCertificatesPerDomainPerAccountandCertificatesPerFQDNSetPerAccount.Since we do not actually associate these limits with a particular ACME account, the
regIDportion of each of their bucket keys has been removed.