Skip to content

Commit 54511a7

Browse files
Fix after review.
1 parent 22f5b6f commit 54511a7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

multiversx_sdk_cli/localnet/node_config_toml.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Optional
1+
from typing import Any, Dict
22

33
from multiversx_sdk_cli.localnet.config_root import ConfigRoot
44
from multiversx_sdk_cli.localnet.constants import (
@@ -24,7 +24,7 @@ def patch_config(data: ConfigDict, config: ConfigRoot, enable_epochs_config: Con
2424
data["StoragePruning"]["ObserverCleanOldEpochsData"] = False
2525
data["StoragePruning"]["AccountsTrieCleanOldEpochsData"] = False
2626

27-
# Some time after the release of Supernova, we should drop this custom (and somehow cumbersome) logic.
27+
# Some time after the release of Supernova, we should drop this custom (and somewhat cumbersome) logic.
2828
if supernova_activation_epoch is None:
2929
# Before Supernova (as software version, not as "era after activation"),
3030
# we alter epoch duration by adjusting "RoundsPerEpoch" and "MinRoundsBetweenEpochs" in section "EpochStartConfig".
@@ -49,7 +49,7 @@ def patch_config(data: ConfigDict, config: ConfigRoot, enable_epochs_config: Con
4949
for item in chain_parameters_by_epoch:
5050
enable_epoch = item["EnableEpoch"]
5151

52-
is_supernova_enabled = supernova_activation_epoch and enable_epoch >= supernova_activation_epoch
52+
is_supernova_enabled = supernova_activation_epoch is not None and enable_epoch >= supernova_activation_epoch
5353
if is_supernova_enabled:
5454
item["RoundDuration"] = config.general.round_duration_milliseconds_in_supernova
5555
item["RoundsPerEpoch"] = config.general.rounds_per_epoch_in_supernova
@@ -116,7 +116,7 @@ def patch_enable_rounds(data: ConfigDict, config: ConfigRoot, enable_epochs_conf
116116
activations = data["RoundActivations"]
117117
supernova_entry = activations.get("SupernovaEnableRound")
118118

119-
if supernova_entry:
119+
if supernova_entry and supernova_activation_epoch is not None:
120120
supernova_computed_activation_round = _compute_supernova_activation_round(config, supernova_activation_epoch)
121121
supernova_entry["Round"] = str(supernova_computed_activation_round)
122122

multiversx_sdk_cli/tests/test_testnet.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def test_override_config() -> None:
1414
# Check a few default values
1515
assert config.general.rounds_per_epoch == 100
1616
assert config.general.round_duration_milliseconds == 6000
17+
assert config.general.rounds_per_epoch_in_supernova == 300
18+
assert config.general.round_duration_milliseconds_in_supernova == 2000
1719
assert config.metashard.consensus_size == 1
1820
assert config.networking.port_proxy == 7950
1921
assert config.software.mx_chain_go.resolution == SoftwareResolution.Remote
@@ -27,6 +29,8 @@ def test_override_config() -> None:
2729
config_patch["general"] = {
2830
"rounds_per_epoch": 200,
2931
"round_duration_milliseconds": 4000,
32+
"rounds_per_epoch_in_supernova": 400,
33+
"round_duration_milliseconds_in_supernova": 1000,
3034
}
3135
config_patch["metashard"] = {
3236
"consensus_size": 2,
@@ -43,6 +47,8 @@ def test_override_config() -> None:
4347
# Check the overridden values
4448
assert config.general.rounds_per_epoch == 200
4549
assert config.general.round_duration_milliseconds == 4000
50+
assert config.general.rounds_per_epoch_in_supernova == 400
51+
assert config.general.round_duration_milliseconds_in_supernova == 1000
4652
assert config.metashard.consensus_size == 2
4753
assert config.networking.port_proxy == 7951
4854
assert config.software.mx_chain_go.resolution == SoftwareResolution.Remote

0 commit comments

Comments
 (0)