Skip to content

devmode: Allow DevMode + FollowMode configurations.#5157

Merged
winder merged 4 commits into
algorand:masterfrom
winder:will/dev-follow-config
Feb 25, 2023
Merged

devmode: Allow DevMode + FollowMode configurations.#5157
winder merged 4 commits into
algorand:masterfrom
winder:will/dev-follow-config

Conversation

@winder
Copy link
Copy Markdown
Contributor

@winder winder commented Feb 24, 2023

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 DisallowUnknownFields to 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:

{
  "Genesis": {
    "LastPartKeyRound": 3000,
    "NetworkName": "tbd",
    "Wallets": [
      {
        "Name": "Wallet1",
        "Stake": 100,
        "Online": true
      }
    ],
    "DevMode": true
  },
  "Nodes": [
    {
      "Name": "Primary",
      "IsRelay": true,
      "Wallets": [
        {
          "Name": "Wallet1",
          "ParticipationOnly": false
        }
      ]
    },
    {
      "Name": "Follower",
      "Wallets": [],
      "ConfigJSONOverride": "{\"EnableFollowMode\":true,\"CatchupBlockValidateMode\":3}"
    }
  ]
}

@winder winder changed the title Allow DevMode + FollowMode configurations. devmode: Allow DevMode + FollowMode configurations. Feb 24, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 24, 2023

Codecov Report

Merging #5157 (95fce85) into master (a688c23) will increase coverage by 0.05%.
The diff coverage is 84.00%.

@@            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     
Impacted Files Coverage Δ
node/node.go 4.11% <0.00%> (+0.01%) ⬆️
netdeploy/networkTemplate.go 39.56% <86.95%> (+11.69%) ⬆️
node/follower_node.go 26.08% <100.00%> (+1.22%) ⬆️
data/transactions/verify/streamverifier.go 92.30% <0.00%> (-1.78%) ⬇️
ledger/testing/randomAccounts.go 56.26% <0.00%> (-0.62%) ⬇️
network/wsNetwork.go 65.43% <0.00%> (+0.27%) ⬆️
network/wsPeer.go 67.81% <0.00%> (+1.83%) ⬆️
catchup/service.go 70.82% <0.00%> (+1.88%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@winder winder marked this pull request as ready for review February 24, 2023 15:11
Comment thread netdeploy/networkTemplate.go Outdated

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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to run a relay node for dev mode?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a follower node, it needs to connect to the relay.

Comment thread netdeploy/networkTemplates_test.go
@cce
Copy link
Copy Markdown
Contributor

cce commented Feb 24, 2023

Builtin has https://pkg.go.dev/encoding/json#Decoder.DisallowUnknownFields for json to reject unknown fields

Comment thread netdeploy/networkTemplate.go Outdated
@winder winder requested review from cce and shiqizng February 24, 2023 19:02
@winder winder merged commit 51d5925 into algorand:master Feb 25, 2023
@winder winder deleted the will/dev-follow-config branch February 25, 2023 17:23
Comment thread node/node.go
node.devMode = genesis.DevMode

if node.devMode {
cfg.DisableNetworking = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants