devmode: Allow DevMode + FollowMode configurations.#5157
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5157 +/- ##
==========================================
+ Coverage 53.44% 53.50% +0.05%
==========================================
Files 431 431
Lines 54364 54378 +14
==========================================
+ Hits 29056 29093 +37
+ Misses 23053 23034 -19
+ Partials 2255 2251 -4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
|
||
| if t.Genesis.DevMode && len(t.Nodes) != 1 { | ||
| return fmt.Errorf("invalid template: DevMode should only have a single node") | ||
| if countRelayNodes(t.Nodes) != 1 { |
There was a problem hiding this comment.
why do we need to run a relay node for dev mode?
There was a problem hiding this comment.
If there's a follower node, it needs to connect to the relay.
|
Builtin has https://pkg.go.dev/encoding/json#Decoder.DisallowUnknownFields for json to reject unknown fields |
| node.devMode = genesis.DevMode | ||
|
|
||
| if node.devMode { | ||
| cfg.DisableNetworking = true |
There was a problem hiding this comment.
When you enable networking here, it will cause the network to look for peers to connect to, right? What are the network bootstrap URLs used by dev mode users ...? I am not clear on how dev mode networks are named or whether they would find peers when networking is enabled.
There was a problem hiding this comment.
It might make more sense to move this toggle to config.go and still have it be the default behavior for devmode, unless you were explicitly setting DisableNetwork=false? IDK. Otherwise if someone named their dev mode network name "testnet", "devnet", "betanet", or "mainnet" it would start connecting to relays
Summary
Allow multi-node devmode private networks with one DevMode relay and one or more FollowMode followers.
This is required to support Indexer running against a DevMode network.
Note: added
DisallowUnknownFieldsto the JSON decoder so that we would fail to create a private network if one of the configurations is unknown.Test Plan
New unit tests.
In the future Sandbox would continuously integration test this configuration.
Manual test with the following configuration: