New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rate limit by payer account #67
Conversation
|
the main function was already too big before adding rate limiting, this at least mvoes some logic outside
// remove from mempool, conflicts with finalized block will never be valid | ||
b.transactions.Rem(txID) | ||
continue | ||
} | ||
|
||
// enforce rate limiting rules | ||
if limiter.shouldRateLimit(tx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing rate limiting a tx would be an exception vs a norm and if that is the case then should we log.debug the tx and payer we rate limited to figure out who is abusing the system from logs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could add a metric later "rate_limited_tx".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I won't have time before the spork we're trying to get this in for, but I'll add a note to the other issue.
Reference: https://github.com/dapperlabs/flow-go/issues/4909
This PR implements rate limiting on transaction payer accounts. It adds two new configuration options to the collection builder module, a max rate which limits the rate at which transactions for any given payer account are included, and a set of unlimited payers which are not hindered by the rate limiting.
We do not add this rate limiting to the
Mutator
module because this is not part of the protocol, and inconsistent configuration between collection nodes could lead to finalization problems if we did. Conceptually this is an optional feature that is enabled and enforced independently on each collection node. When all collection nodes select the same rate limit the effect is an equivalent network-wide rate limit.Usage
NBA/Dapper use one payer account, on mainnet we should set the flag
builder-unlimited-payers=<DAPPER_ADDR>
. When setting the rate limit, note that the limiting is enforced on a per-cluster basis, so the number of clusters should be factored into choosing that value.