fix: wire attestation-committee-count CLI flag through to ChainOptions#678
Merged
ch4r10t33r merged 3 commits intomainfrom Mar 18, 2026
Merged
fix: wire attestation-committee-count CLI flag through to ChainOptions#678ch4r10t33r merged 3 commits intomainfrom
ch4r10t33r merged 3 commits intomainfrom
Conversation
NodeCommand was missing the @"attestation-committee-count" field, so simargs silently ignored the flag and the value always fell through to the hardcoded default of 1 in ChainConfig.init. With every node using committee_count=1, all validators compute validator_id % 1 = 0 and end up subscribed to the same single subnet. Changes: - Add @"attestation-committee-count": ?u64 = null to NodeCommand so simargs parses and exposes the flag. - Add attestation_committee_count: ?u64 = null to NodeOptions. - Add attestationCommitteeCountFromYAML() helper that reads ATTESTATION_COMMITTEE_COUNT from config.yaml as a fallback. - In buildStartOptions: CLI flag takes precedence; falls back to config.yaml value; leaves null if neither is present (ChainConfig still defaults to 1 in that case for backward compat). - In Node.init: apply options.attestation_committee_count to chain_options before constructing ChainConfig so the correct value reaches EthLibp2p.attestation_committee_count and the subnet assignment logic. - Add ATTESTATION_COMMITTEE_COUNT: 4 to test fixture config.yaml. - Add two unit tests for attestationCommitteeCountFromYAML.
ch4r10t33r
approved these changes
Mar 18, 2026
GrapeBaBa
pushed a commit
that referenced
this pull request
Apr 2, 2026
#678) * fix: wire attestation-committee-count CLI flag through to ChainOptions NodeCommand was missing the @"attestation-committee-count" field, so simargs silently ignored the flag and the value always fell through to the hardcoded default of 1 in ChainConfig.init. With every node using committee_count=1, all validators compute validator_id % 1 = 0 and end up subscribed to the same single subnet. Changes: - Add @"attestation-committee-count": ?u64 = null to NodeCommand so simargs parses and exposes the flag. - Add attestation_committee_count: ?u64 = null to NodeOptions. - Add attestationCommitteeCountFromYAML() helper that reads ATTESTATION_COMMITTEE_COUNT from config.yaml as a fallback. - In buildStartOptions: CLI flag takes precedence; falls back to config.yaml value; leaves null if neither is present (ChainConfig still defaults to 1 in that case for backward compat). - In Node.init: apply options.attestation_committee_count to chain_options before constructing ChainConfig so the correct value reaches EthLibp2p.attestation_committee_count and the subnet assignment logic. - Add ATTESTATION_COMMITTEE_COUNT: 4 to test fixture config.yaml. - Add two unit tests for attestationCommitteeCountFromYAML. * fix: validate attestation-committee-count >= 1, default to 1 with warning * build: add minimum_zig_version = "0.15.0" to build.zig.zon --------- Co-authored-by: zclawz <zclawz@blockblaz.io> Co-authored-by: zclawz <zclawz@openclaw.ai>
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.
Problem
NodeCommandwas missing the@"attestation-committee-count"field, so simargs silently discarded the flag. The value always fell through to the hardcoded default of1insideChainConfig.init. Withcommittee_count = 1every node computesvalidator_id % 1 = 0and all validators end up on the same single subnet, breaking the subnet-sharding design entirely.Fix
pkgs/cli/src/main.zig@"attestation-committee-count": ?u64 = nulltoNodeCommandso simargs now parses and exposes the flag.__messages__entry for the new field.pkgs/cli/src/node.zigattestation_committee_count: ?u64 = nulltoNodeOptions.attestationCommitteeCountFromYAML()helper that readsATTESTATION_COMMITTEE_COUNTfromconfig.yamlas a fallback when the CLI flag is absent.buildStartOptions: CLI flag takes precedence; falls back to config.yaml; leavesnullif neither is present (ChainConfigstill defaults to1for backward compat).Node.init: applyoptions.attestation_committee_counttochain_optionsbefore constructingChainConfig, so the correct count propagates toEthLibp2pand the subnet-assignment logic (validator_id % attestation_committee_count).pkgs/cli/test/fixtures/config.yamlATTESTATION_COMMITTEE_COUNT: 4to the test fixture.New tests
attestationCommitteeCountFromYAML reads ATTESTATION_COMMITTEE_COUNT from config.yaml— asserts value4is read correctly.attestationCommitteeCountFromYAML returns null when field is absent— assertsnullfor a YAML file without the field.Usage
Via CLI flag (overrides config.yaml):
Via config.yaml (new fallback, no flag needed):