Skip to content

Add is-aggregator configuration flag#368

Merged
tcoratger merged 2 commits intoleanEthereum:mainfrom
ch4r10t33r:feat/add-is-aggregator-flag
Feb 6, 2026
Merged

Add is-aggregator configuration flag#368
tcoratger merged 2 commits intoleanEthereum:mainfrom
ch4r10t33r:feat/add-is-aggregator-flag

Conversation

@ch4r10t33r
Copy link
Contributor

Summary

Introduces a new --is-aggregator command-line parameter that enables aggregator mode for consensus nodes. When enabled, the node performs attestation aggregation operations and advertises this capability in its ENR for peer discovery.

Changes

  • NodeConfig: Add is_aggregator field with default value False
  • ENR Keys: Add IS_AGGREGATOR constant for ENR key-value pairs
  • ENR Class: Add is_aggregator property to read aggregator flag from ENR records
  • NetworkService: Add is_aggregator field for ENR advertisement
  • CLI: Add --is-aggregator argument with help text
  • Initialization: Thread flag through genesis and checkpoint sync paths
  • Logging: Add informational log when aggregator mode is enabled

Usage

# Run node in standard mode (default)
python -m lean_spec --genesis config.yaml --validator-keys ./keys

# Run node in aggregator mode
python -m lean_spec --genesis config.yaml --validator-keys ./keys --is-aggregator

Implementation Details

Configuration Flow

The flag flows through the entire initialization chain:

CLI → run_node() → _init_from_genesis() → NodeConfig → NetworkService

ENR Advertisement

  • When is_aggregator=True, the node's ENR includes the is_aggregator key
  • The key uses 1 byte encoding: 0x00 = false, 0x01 = true
  • Other nodes can query this via the ENR.is_aggregator property

Backward Compatibility

  • Default value is False, maintaining existing behavior
  • No breaking changes to existing APIs
  • Optional feature that can be enabled per-node

Test plan

  • Verify CLI argument parsing works correctly
  • Test node initialization with --is-aggregator flag
  • Confirm flag propagates through NodeConfig to NetworkService
  • Verify ENR property reads aggregator flag correctly
  • Test both genesis and checkpoint sync initialization paths
  • Confirm logging output when aggregator mode is enabled
  • Verify backward compatibility (default behavior unchanged)

Next Steps

Future work to complete aggregator functionality:

  1. Update ENR creation/signing to include is_aggregator key in the record
  2. Implement attestation aggregation logic in validator service
  3. Add runtime checks to enable/disable aggregation based on flag
  4. Add metrics for aggregation operations

Introduces a new --is-aggregator command-line parameter that enables
aggregator mode for consensus nodes. When enabled, the node performs
attestation aggregation operations and advertises this capability in
its ENR.

Changes:
- Add is_aggregator field to NodeConfig with default value False
- Add IS_AGGREGATOR ENR key constant for peer discovery
- Add is_aggregator property to ENR class for reading aggregator flag
- Add is_aggregator field to NetworkService for ENR advertisement
- Add --is-aggregator CLI argument with help text
- Thread flag through initialization paths (genesis and checkpoint sync)
- Add logging when aggregator mode is enabled

Usage:
  python -m lean_spec --genesis config.yaml --is-aggregator

The flag defaults to False, maintaining backward compatibility with
existing deployments. When True, the node's ENR will include the
is_aggregator key, allowing peers to discover aggregator nodes.
Updates the is_aggregator helper function to use the actual node
configuration instead of always returning False. The flag now flows
from NodeConfig -> SyncService -> aggregation logic.

Changes:
- Add is_aggregator field to SyncService (defaults to False)
- Pass is_aggregator from NodeConfig to SyncService initialization
- Update is_aggregator() helper to accept node_is_aggregator parameter
- Update call site in SyncService to pass the configuration flag
- Improve documentation explaining aggregator role requirements

The helper now returns True only when:
1. The validator is active (validator_id is not None)
2. The node operator has enabled aggregator mode (--is-aggregator flag)

This completes the integration of the is-aggregator configuration,
allowing nodes to actually perform aggregation when the flag is set.
@ch4r10t33r ch4r10t33r marked this pull request as ready for review February 6, 2026 15:13
Copy link
Collaborator

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

Thanks!

@tcoratger tcoratger merged commit 4cd25f4 into leanEthereum:main Feb 6, 2026
11 checks passed
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.

2 participants