Add support for dynamic network definitions #18
Merged
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.
For the bulk of the Smart Node (and NMC's) life, the list of networks has been baked directly into the source. This prevents people from adding support for custom network definitions, which is a problem for things like testing. This PR changes that so network definitions can be loaded dynamically (i.e., from disk or something) instead of being baked into the source. The original network definitions are left as global variables for reference but are otherwise no longer used.
Note this also enables dynamic parameter defaults for each config setting based on the network definition. Parameters now have a general-purpose "all networks" default, but that can be overwritten by including a default for that parameter in the new network settings struct.
Side effects / other changes rolled into the PR for convenience:
ServiceProvider
has been changed to an interface to support mocking (Fornax has already approved that indev
, but since this is targetingmain
it'll show up in the diff list again)dev
Uinteger
andByteArray
types have been moved from the beacon.client package intoutils
, which is a more appropriate place for general-purpose types like that. The move lets other package use them without needing to import theclient
package, which is not compatible with stuff that has CGO disabled.