networkconfig: make hardcoded values configurable#2164
Conversation
…-from-beacon-node
…-from-beacon-node # Conflicts: # beacon/goclient/attest_test.go # beacon/goclient/events_test.go # beacon/goclient/goclient.go # beacon/goclient/goclient_test.go # cli/operator/node.go # networkconfig/beacon.go
This reverts commit c2e2f8f.
…dcoded-configurable # Conflicts: # networkconfig/ssv.go
iurii-ssv
left a comment
There was a problem hiding this comment.
LGTM, left minor suggestions
| if epochsPerSyncCommitteePeriodDecoded, ok := epochsPerSyncCommitteePeriodRaw.(uint64); ok { | ||
| epochsPerSyncCommitteePeriod = phase0.Epoch(epochsPerSyncCommitteePeriodDecoded) | ||
| } else { | ||
| gc.log.Warn("epochs per sync committee not known by chain, using default value", |
There was a problem hiding this comment.
I'm not sure if "not known by chain" phrasing is best, maybe something like "isn't provided by Beacon node" (or similar) would better describe what it actually entails ?
| Bootnodes: []string{ | ||
| "enr:-Li4QFIQzamdvTxGJhvcXG_DFmCeyggSffDnllY5DiU47pd_K_1MRnSaJimWtfKJ-MD46jUX9TwgW5Jqe0t4pH41RYWGAYuFnlyth2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhCLdu_SJc2VjcDI1NmsxoQN4v-N9zFYwEqzGPBBX37q24QPFvAVUtokIo1fblIsmTIN0Y3CCE4uDdWRwgg-j", | ||
| }, | ||
| TotalEthereumValidators: 10, // just some random number |
There was a problem hiding this comment.
Maybe this value (for testnet) should be high enough so we never accidentally reach the message-limits derived from it while testing something with local testnet (unless ofc we are testing those message-limits specifically)
otherwise we might encounter some hard-to-debug failures just because of that ?
…-from-beacon-node # Conflicts: # beacon/goclient/goclient.go # beacon/goclient/spec.go # cli/operator/node.go
…dcoded-configurable # Conflicts: # beacon/goclient/aggregator.go # beacon/goclient/spec.go # beacon/goclient/sync_committee_contribution.go
…dcoded-configurable
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the network configuration to replace various hardcoded values with configurable parameters, preparing the project for local testnet deployment. Key changes include using externally defined beacon configurations, updating peer scoring and topic parameters to use dynamic network values, and revising mock and client code to incorporate the new configurable values.
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| networkconfig/holesky-e2e.go | Updated beacon and SSV configuration to use dynamic parameters. |
| networkconfig/beacon_mock.go | Renamed and updated mock methods for beacon configuration. |
| networkconfig/beacon.go | Added new getters (e.g. EpochDuration, IntervalDuration) to BeaconConfig. |
| network/topics/* | Updated topic options and scoring parameters to use network configuration. |
| beacon/goclient/* | Refactored sync committee, spec, signing, and aggregator code to reference new config values. |
| message/validation/* | Revised validation logic to use configurable epoch duration. |
Comments suppressed due to low confidence (1)
networkconfig/beacon_mock.go:67
- [nitpick] The renaming of the mock method from 'EpochsPerSyncCommitteePeriod' to 'EpochStartTime' may cause confusion; please ensure these changes are fully consistent with the corresponding interface methods in beacon.go.
func (mr *MockBeaconMockRecorder) EpochStartTime(epoch any) *gomock.Call {
…-from-beacon-node # Conflicts: # beacon/goclient/attest_test.go # beacon/goclient/events_test.go # beacon/goclient/goclient.go # beacon/goclient/goclient_test.go # beacon/goclient/validator.go # cli/bootnode/boot_node.go # cli/operator/node.go # exporter/api/query_handlers_test.go # protocol/v2/blockchain/beacon/client.go # utils/boot_node/node.go
…rate-ssv # Conflicts: # networkconfig/holesky-e2e.go # networkconfig/holesky-stage.go # networkconfig/holesky.go # networkconfig/hoodi-stage.go # networkconfig/hoodi.go # networkconfig/local-testnet.go # networkconfig/mainnet.go # networkconfig/sepolia.go # networkconfig/test-network.go
…dcoded-configurable # Conflicts: # beacon/goclient/aggregator.go # beacon/goclient/spec.go # beacon/goclient/sync_committee_contribution.go # message/validation/validation.go # networkconfig/beacon.go # networkconfig/beacon_mock.go # networkconfig/holesky-e2e.go # networkconfig/holesky-stage.go # networkconfig/holesky.go # networkconfig/hoodi-stage.go # networkconfig/hoodi.go # networkconfig/local-testnet.go # networkconfig/mainnet.go # networkconfig/network_mock.go # networkconfig/sepolia.go # networkconfig/test-network.go # operator/duties/committee_test.go # operator/duties/scheduler.go # operator/duties/scheduler_test.go # operator/duties/sync_committee.go # operator/duties/sync_committee_test.go
…-from-beacon-node
…dcoded-configurable
…-make-hardcoded-configurable # Conflicts: # beacon/goclient/aggregator.go # beacon/goclient/spec.go # beacon/goclient/sync_committee_contribution.go # networkconfig/holesky-e2e.go # networkconfig/holesky-stage.go # networkconfig/holesky.go # networkconfig/hoodi-stage.go # networkconfig/hoodi.go # networkconfig/local-testnet.go # networkconfig/mainnet.go # networkconfig/ssv.go # networkconfig/test-network.go
21e346c
into
networkconfig-extract-beacon-params
… interface (#2145) * networkconfig: split beacon and ssv configs * move most parameters outside of BeaconNetwork interface * get rid of BeaconNetwork interface * some leftovers * fix linter * fix message validation tests * fix linter again * leftovers after merging * fix issues after merging * fix network name bug * code review comments * fix issues after merging * update go.mod * fix ekm tests * remove unused import * update go.mod * fix issues after merging * format/imports * revert preparationSlots type change * use uint64 for amount of slots and epochs * use github.com/ssvlabs/eth2-key-manager@v1.5.5 * spec-alignment * feat(networkconfig,beacon/goclient): get beacon config from beacon node (#2153) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * fix issues after merging * code review comments * unexport supportedSSVConfigs * fix a context bug * pass network config name * feat(networkconfig): CLI for custom SSV config generation (#2156) * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * fix linter * add missing fields to LocalTestnet * update go.mod * networkconfig: make hardcoded values configurable (#2164) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * fix linter * fix a typo * remove redundant comments * fix a context bug * fix issues after merging * pass network config name * networkconfig: narrow config usage (#2172) * use SSV/Beacon configs instead of NetworkConfig where possible * fix linter * fix a comment * fix issues after merging * fix issues after merging * beacon,networkconfig: move fork handling from beacon to networkconfig (#2178) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * pass network config name * update go.mod * fix issues after merging * networkconfig: delete hardcoded beacon configs (#2183) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * networkconfig: delete mainnet beacon config * networkconfig: delete rest of configs * replace TestRealNetwork with TestNetwork * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * delete TestRealNetwork * pass network config name * update go.mod * fix issues after merging * fix issues after merging * rename BeaconName to NetworkName * refactor getting spec parameters * update go.mod * fix type assertion * fix spec align --------- Co-authored-by: y0sher <lyosher@gmail.com> Co-authored-by: Matus Kysel <matus@ssvlabs.io>
… interface (#2145) * networkconfig: split beacon and ssv configs * move most parameters outside of BeaconNetwork interface * get rid of BeaconNetwork interface * some leftovers * fix linter * fix message validation tests * fix linter again * leftovers after merging * fix issues after merging * fix network name bug * code review comments * fix issues after merging * update go.mod * fix ekm tests * remove unused import * update go.mod * fix issues after merging * format/imports * revert preparationSlots type change * use uint64 for amount of slots and epochs * use github.com/ssvlabs/eth2-key-manager@v1.5.5 * spec-alignment * feat(networkconfig,beacon/goclient): get beacon config from beacon node (#2153) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * fix issues after merging * code review comments * unexport supportedSSVConfigs * fix a context bug * pass network config name * feat(networkconfig): CLI for custom SSV config generation (#2156) * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * fix linter * add missing fields to LocalTestnet * update go.mod * networkconfig: make hardcoded values configurable (#2164) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * fix linter * fix a typo * remove redundant comments * fix a context bug * fix issues after merging * pass network config name * networkconfig: narrow config usage (#2172) * use SSV/Beacon configs instead of NetworkConfig where possible * fix linter * fix a comment * fix issues after merging * fix issues after merging * beacon,networkconfig: move fork handling from beacon to networkconfig (#2178) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * pass network config name * update go.mod * fix issues after merging * networkconfig: delete hardcoded beacon configs (#2183) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * networkconfig: delete mainnet beacon config * networkconfig: delete rest of configs * replace TestRealNetwork with TestNetwork * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * delete TestRealNetwork * pass network config name * update go.mod * fix issues after merging * fix issues after merging * rename BeaconName to NetworkName * refactor getting spec parameters * update go.mod * fix type assertion * fix spec align --------- Co-authored-by: y0sher <lyosher@gmail.com> Co-authored-by: Matus Kysel <matus@ssvlabs.io>
… interface (#2145) * networkconfig: split beacon and ssv configs * move most parameters outside of BeaconNetwork interface * get rid of BeaconNetwork interface * some leftovers * fix linter * fix message validation tests * fix linter again * leftovers after merging * fix issues after merging * fix network name bug * code review comments * fix issues after merging * update go.mod * fix ekm tests * remove unused import * update go.mod * fix issues after merging * format/imports * revert preparationSlots type change * use uint64 for amount of slots and epochs * use github.com/ssvlabs/eth2-key-manager@v1.5.5 * spec-alignment * feat(networkconfig,beacon/goclient): get beacon config from beacon node (#2153) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * fix issues after merging * code review comments * unexport supportedSSVConfigs * fix a context bug * pass network config name * feat(networkconfig): CLI for custom SSV config generation (#2156) * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * fix linter * add missing fields to LocalTestnet * update go.mod * networkconfig: make hardcoded values configurable (#2164) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * fix linter * fix a typo * remove redundant comments * fix a context bug * fix issues after merging * pass network config name * networkconfig: narrow config usage (#2172) * use SSV/Beacon configs instead of NetworkConfig where possible * fix linter * fix a comment * fix issues after merging * fix issues after merging * beacon,networkconfig: move fork handling from beacon to networkconfig (#2178) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * pass network config name * update go.mod * fix issues after merging * networkconfig: delete hardcoded beacon configs (#2183) * beacon/goclient: get beacon config from beacon node * use beacon config obtained from beacon node * log config as JSON * networkconfig: CLI for custom SSV config generation * implement JSON marshaling and YAML marshaling/unmarshaling * remove TotalEthereumValidators * simplify marshaling/unmarshaling logic * fix markdown formatting * use yaml@v3 * add tests * simplify unmarshaling * delete a comment * use Stringer to log node * guard beacon config reads with mutex * add a timeout log * delete hardcoded beacon configs * Revert "delete hardcoded beacon configs" This reverts commit c2e2f8f. * networkconfig: make hardcoded values configurable * fix issues after merging * code review comments * fix issues after merging * delete outer metrics for genesisForClient * rewrite modulo calculation * code review comments * unexport supportedSSVConfigs * revert the modulo calculation * add EpochDuration mock * G115 * fill missing fields in configs * add a comment about eth spec * fix error text * use genesis validators root from config in computeVoluntaryExitDomain * beacon,networkconfig: move forks from beacon to networkconfig * get rid of using Genesis method * use ForkAtEpoch instead of DataVersion * generate mocks * fix linter * fix beacon tests * beacon: delete ForkAtEpoch * fix ekm tests * update go.mod * fix some TODOs * networkconfig: delete mainnet beacon config * networkconfig: delete rest of configs * replace TestRealNetwork with TestNetwork * fix linter * fix a typo * remove redundant comments * remove Spec method * delete a comment * uncomment config print * fix a context bug * fix issues after merging * delete TestRealNetwork * pass network config name * update go.mod * fix issues after merging * fix issues after merging * rename BeaconName to NetworkName * refactor getting spec parameters * update go.mod * fix type assertion * fix spec align --------- Co-authored-by: y0sher <lyosher@gmail.com> Co-authored-by: Matus Kysel <matus@ssvlabs.io>
Part of PRs that will replace #1308
Depends on #2156
Required as a preparation for the local testnet