feat: implement dynamic config for manager #409
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.
Summary
Introduce a dynamic configuration system that allows operators to tune the aggregation manager's behavior at runtime without restarting piri. This enables gas usage optimization by adjusting how frequently the manager polls for work and how many roots it batches together when adding to the chain.
Motivation
The aggregation manager is responsible for batching aggregated roots and submitting them on-chain. The cost of these operations depends on:
Previously, changing these values required editing the config file and restarting piri. This PR enables operators to:
Changes
Core Dynamic Config Infrastructure (
pkg/config/dynamic/)Key design decisions:
Manager Integration (
pkg/pdp/aggregation/manager/)Dynamic behavior:
PollInterval: When changed, the manager's ticker immediately resets to the new intervalBatchSize: Read on each poll cycle, no subscription neededHTTP API (
pkg/admin/httpapi/)/admin/config/admin/config/admin/config/reloadCLI Commands (
cmd/cli/client/admin/config/)Config Keys
pdp.aggregation.manager.poll_intervalpdp.aggregation.manager.batch_sizeExample Usage
Scenario: Operator wants to reduce gas costs by batching more roots together and polling less frequently.