diff options
author | Gary <982483+gmalouf@users.noreply.github.com> | 2024-01-19 16:02:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 16:02:29 -0500 |
commit | 877090be830c2003ff9e44b56ed5a8f355258ae5 (patch) | |
tree | f1a18bc80f94829cc1a482465d461b7d58143dd4 | |
parent | d8dfaadadf73cfd1a10198dd9660afb7276bce09 (diff) |
Config: Archival mode is no longer automatically enabled when netAddress is s… (#5904)
-rw-r--r-- | cmd/algocfg/profileCommand.go | 4 | ||||
-rw-r--r-- | config/config.go | 3 | ||||
-rw-r--r-- | config/config_test.go | 47 | ||||
-rw-r--r-- | test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp | 4 |
4 files changed, 7 insertions, 51 deletions
diff --git a/cmd/algocfg/profileCommand.go b/cmd/algocfg/profileCommand.go index 06ae4ff61..34f918300 100644 --- a/cmd/algocfg/profileCommand.go +++ b/cmd/algocfg/profileCommand.go @@ -69,7 +69,9 @@ var ( relay = configUpdater{ description: "Relay consensus messages across the network and support catchup.", updateFunc: func(cfg config.Local) config.Local { - cfg.Archival = true + cfg.MaxBlockHistoryLookback = 20000 + cfg.CatchpointFileHistoryLength = 3 + cfg.CatchpointTracking = 2 cfg.EnableLedgerService = true cfg.EnableBlockService = true cfg.NetAddress = ":4160" diff --git a/config/config.go b/config/config.go index c5dc5d954..a8beb0580 100644 --- a/config/config.go +++ b/config/config.go @@ -145,10 +145,7 @@ func mergeConfigFromFile(configpath string, source Local) (Local, error) { err = loadConfig(f, &source) - // For now, all relays (listening for incoming connections) are also Archival - // We can change this logic in the future, but it's currently the sanest default. if source.NetAddress != "" { - source.Archival = true source.EnableLedgerService = true source.EnableBlockService = true diff --git a/config/config_test.go b/config/config_test.go index 914e1e8e9..432c0f928 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -112,7 +112,8 @@ func TestLocal_MergeConfig(t *testing.T) { c2, err := mergeConfigFromDir(tempDir, defaultConfig) require.NoError(t, err) - require.Equal(t, defaultConfig.Archival || c1.NetAddress != "", c2.Archival) + require.Equal(t, defaultConfig.EnableLedgerService || c1.NetAddress != "", c2.EnableLedgerService) + require.Equal(t, defaultConfig.EnableBlockService || c1.NetAddress != "", c2.EnableBlockService) require.Equal(t, defaultConfig.IncomingConnectionsLimit, c2.IncomingConnectionsLimit) require.Equal(t, defaultConfig.BaseLoggerDebugLevel, c2.BaseLoggerDebugLevel) @@ -165,50 +166,6 @@ func TestLoadPhonebookMissing(t *testing.T) { require.True(t, os.IsNotExist(err)) } -func TestArchivalIfRelay(t *testing.T) { - partitiontest.PartitionTest(t) - t.Parallel() - - testArchivalIfRelay(t, true) -} - -func TestArchivalIfNotRelay(t *testing.T) { - partitiontest.PartitionTest(t) - t.Parallel() - - testArchivalIfRelay(t, false) -} - -func testArchivalIfRelay(t *testing.T, relay bool) { - tempDir := t.TempDir() - - c1 := struct { - NetAddress string - }{} - if relay { - c1.NetAddress = ":1234" - } - - // write our reduced version of the Local struct - fileToMerge := filepath.Join(tempDir, ConfigFilename) - f, err := os.OpenFile(fileToMerge, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err == nil { - enc := json.NewEncoder(f) - err = enc.Encode(c1) - f.Close() - } - require.NoError(t, err) - require.False(t, defaultConfig.Archival, "Default should be non-archival") - - c2, err := mergeConfigFromDir(tempDir, defaultConfig) - require.NoError(t, err) - if relay { - require.True(t, c2.Archival, "Relay should be archival") - } else { - require.False(t, c2.Archival, "Non-relay should still be non-archival") - } -} - func TestLocal_ConfigExampleIsCorrect(t *testing.T) { partitiontest.PartitionTest(t) diff --git a/test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp b/test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp index 0a3b8ea48..7ba924f99 100644 --- a/test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp +++ b/test/e2e-go/cli/goal/expect/catchpointCatchupTest.exp @@ -6,7 +6,7 @@ log_user 1 # # The goal of the test is to demonstrate the catchpoint catchup functionality using the goal command line interface. # It does that by deploying a single relay, which advances until it generates a catchpoint. -# Once it does, another node is started, and instructred to catchup using the catchpoint from the first relay. +# Once it does, another node is started, and instructed to catchup using the catchpoint from the first relay. # To make sure that the second node won't be using the "regular" catchup, we tunnel all the communication between the two using a proxy. # The proxy is responsible to filter out block number 2. This would prevent the "regular" catchup from working, # and would be a good test ground for the catchpoint catchup. @@ -64,7 +64,7 @@ if { [catch { ::AlgorandGoal::CreateNetwork $NETWORK_NAME $NETWORK_TEMPLATE $TEST_ALGO_DIR $TEST_ROOT_DIR # Update the Primary Node configuration - exec -- cat "$TEST_ROOT_DIR/Primary/config.json" | jq {. |= . + {"MaxAcctLookback": 2, "CatchpointInterval": 4,"EnableRequestLogger":true}} > $TEST_ROOT_DIR/Primary/config.json.new + exec -- cat "$TEST_ROOT_DIR/Primary/config.json" | jq {. |= . + {"MaxAcctLookback": 2, "CatchpointInterval": 4,"EnableRequestLogger":true,"Archival":true}} > $TEST_ROOT_DIR/Primary/config.json.new exec rm $TEST_ROOT_DIR/Primary/config.json exec mv $TEST_ROOT_DIR/Primary/config.json.new $TEST_ROOT_DIR/Primary/config.json |