Skip to content

Simplify istio rate limits - #6933

Open
nicu-da wants to merge 6 commits into
mainfrom
nicu/rate_limits/simplify_istio
Open

Simplify istio rate limits#6933
nicu-da wants to merge 6 commits into
mainfrom
nicu/rate_limits/simplify_istio

Conversation

@nicu-da

@nicu-da nicu-da commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

By default only have a global rate limit

[static]

fixes https://github.com/DACH-NY/canton-network-internal/issues/2115

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If an upgrade test is required, comment /upgrade_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

@canton-network-da

Copy link
Copy Markdown
Contributor

[backport] Reminder

Please consider backporting to the following branches:

  • release-line-0.7.4
  • release-line-0.7.3
  • release-line-0.7.1
  • release-line-0.7.0

▶️ Please check the boxes for branches that you wish to backport to and backport PRs will
automatically be created when you merge this PR.

And your PR is currently against base branch: main.

Note: Any PR comment containing [backport] will be considered for auto-backporting upon merge,
you can always add those manually for PRs that did not get these reminders. You can also edit
this comment manually and add more branches that this should be backported to.

By default only have a global rate limit

[static]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da
nicu-da force-pushed the nicu/rate_limits/simplify_istio branch from 2edaaeb to 8b03586 Compare August 24, 2026 13:36
@nicu-da
nicu-da marked this pull request as ready for review August 26, 2026 08:29

@martinflorian-da martinflorian-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread cluster/configs/shared/base.yaml Outdated
scan:
externalRateLimits:
!include(./rate-limits/v0-acs.yaml;./rate-limits/unlimited.yaml;./rate-limits/public-banned.yaml;./rate-limits/token-registry.yaml)
enablePerEndpointRateLimits: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea is to keep the functionality around in case we want to use it after all, at least for our deployments?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pretty much, as a safety precaution

});
});

test('buildGlobalPerIpRateLimitAction keys only on the non-spoofable client address', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does "keys" even mean in this context 😕

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key of the attribute used for the ip basically. making sure we don't change something unintentionally to not use the masked address


globalPerIpLimits?: Limits;

enablePerEndpointRateLimits?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm can we just skip this flag and simply leave the per-endpoint-rate limits unset if we don't want these?

Having something explicitly set in a config that is actually unused because of a boolean flag somewhere seems a bit meh.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, issue was that it would've made the PR more complex. Let me do it though

[static]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da

nicu-da commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/cluster_test

@github-actions

Copy link
Copy Markdown

Deploy cluster test triggered for Commit f6558566cd2a4ccab237245cc9198a1f88c5a87c in , please contact a Contributor to approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/79853

@martinflorian-da martinflorian-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes more LOC than it adds, must be good. Thank you!

tokensPerFill: 500
fillInterval: 60s
perIpLimits: # per-IP limit
maxTokens: 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talking to myself: this should be fine:

getAcsSnapshot.rate-per-second = 20

Comment thread cluster/configs/shared/base.yaml Outdated
scan:
externalRateLimits:
!include(./rate-limits/v0-acs.yaml;./rate-limits/unlimited.yaml;./rate-limits/public-banned.yaml;./rate-limits/token-registry.yaml)
!include(./rate-limits/public-banned.yaml;./rate-limits/token-registry.yaml)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For token registry - is the medium-term to remove those as well in favor of relying only on the splice rate limits? (Shall we add a TODO if so?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me create an issue to revisit right before opening it up.
The idea is to remove it unless we explicitly want some higher limits for that part of the API

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

higher limits for that part of the API

Can we do actually do that? Successful requests will not deplete the global and default per-IP buckets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the first match consumes the limit, the global one is basically the "default" and used if nothing else matches
so we can sort of partition out certain parts of the API

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

const effectiveRateLimits = Object.fromEntries(
Object.entries(args.rateLimits || {}).filter(
(ent): ent is [string, LocalLimit<MatchedLimits>] => {
// TODO (#4201): in banned case, implement actual banning with special short-circuit for whitelisted IPs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to explicitly track this as nice-to-have for MainNet opening?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh not sure if it's even worth doing.
we can just set the limit to 0 in the splice rate limiter, as we need to ship it to everyone anyway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO that would be a valid way to resolve this, but AFAIU banned currently is a NOP, which can mislead us in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let me just delete the banned stuff

.
[ci]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da

nicu-da commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

/cluster_test

@github-actions

Copy link
Copy Markdown

Deploy cluster test triggered for Commit 5f2d2f663b5607798ab45572ec5ee8ddb0c16996 in , please contact a Contributor to approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/79996

[static ]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
[static]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da

nicu-da commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

/cluster_test

@github-actions

Copy link
Copy Markdown

Deploy cluster test triggered for Commit aedd3997ef7faf42b5017581c1348da90ea943aa in , please contact a Contributor to approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/80012

.
[ci]

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da

nicu-da commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

/cluster_test

@github-actions

Copy link
Copy Markdown

Deploy cluster test triggered for Commit 52d86a9580765bbaddf1bc40dad627915a64fe07 in , please contact a Contributor to approve it in CircleCI: https://app.circleci.com/pipelines/github/DACH-NY/canton-network-internal/80030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants