feat: Add --network flag to CLI tools for multi-network support#2283
Open
rockysingh wants to merge 1 commit intohiero-ledger:mainfrom
Open
feat: Add --network flag to CLI tools for multi-network support#2283rockysingh wants to merge 1 commit intohiero-ledger:mainfrom
--network flag to CLI tools for multi-network support#2283rockysingh wants to merge 1 commit intohiero-ledger:mainfrom
Conversation
--network flag to CLI tools for multi-network support
…ro-ledger#2268) Introduce a NetworkConfig framework that replaces hardcoded mainnet values throughout the tools project, enabling the same CLI commands to work with testnet (and future networks) via a --network flag. Signed-off-by: Rocky Thind <[email protected]>
cfec3b6 to
81179c3
Compare
--network flag to CLI tools for multi-network support--network flag to CLI tools for multi-network support
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2283 +/- ##
============================================
+ Coverage 80.74% 80.90% +0.16%
- Complexity 1461 1463 +2
============================================
Files 139 139
Lines 6766 6766
Branches 728 728
============================================
+ Hits 5463 5474 +11
+ Misses 984 969 -15
- Partials 319 323 +4 see 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
jsync-swirlds
approved these changes
Feb 28, 2026
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.
Summary
NetworkConfigrecord with staticcurrent()singleton that holds all network-specific parameters (GCS bucket, mirror node URL, genesis date, node range, genesis address book, etc.)--networkoption (mainnet/testnet) toBlockStreamToolroot command withscope = ScopeType.INHERIT, making it available on all subcommandsNetworkConfig.current()referencesAddressBookRegistryfalls back to fetching the genesis address book from the mirror node API at runtime when a bundled resource isn't available (e.g. for testnet)Files Changed
NetworkConfig.javamainnet()/testnet()factoriesBlockStreamTool.java--networkoption with inherited scopeDownloadConstants.java,MainNetBucket.java,DownloadDayImplV2.java,LiveDownloader.javaNetworkConfigFetchBlockQuery.java,FixBlockTime.java,BlockTimeCommand.java,UpdateBlockData.java,MirrorNodeAddressBook.java,ExtractDayBlocksFromApi.javaNetworkConfigDownloadDaysV3.java,UpdateDayListingsCommand.java,Validate.java,ValidateWithStats.javaNetworkConfigAddressBookRegistry.javaNetworkConfigwith mirror node fallbackTest plan
./gradlew :tools:compileJava— compiles without errors./gradlew :tools:test— all 1075 existing tests pass./gradlew spotlessApply— formatting clean--networkstill use mainnet--network testnetcommands hit testnet mirror node and GCS bucketCloses #2268