Skip to content

Commit cfb3a86

Browse files
Patch "VersionsByEpoch" in config.toml.
1 parent a57fa49 commit cfb3a86

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

multiversx_sdk_cli/localnet/node_config_toml.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ def patch_config(data: ConfigDict, config: ConfigRoot, enable_epochs_config: Con
6868
item["MetachainConsensusGroupSize"] = config.metashard.consensus_size
6969
item["MetachainMinNumNodes"] = config.metashard.num_validators
7070

71+
# Adjust "Versions" (of blocks)
72+
versions_by_epoch = data["Versions"].get("VersionsByEpochs", [])
73+
74+
for item in versions_by_epoch:
75+
enable_epoch = item["StartEpoch"]
76+
77+
if enable_epoch == supernova_activation_epoch:
78+
item["StartRound"] = _compute_supernova_activation_round(config, supernova_activation_epoch)
79+
7180

7281
def patch_api(data: ConfigDict, config: ConfigRoot):
7382
routes = data["APIPackages"]["transaction"]["Routes"]
@@ -109,9 +118,12 @@ def patch_enable_rounds(data: ConfigDict, config: ConfigRoot, enable_epochs_conf
109118

110119
if supernova_entry:
111120
# Epochs are zero-indexed.
112-
supernova_computed_activation_round = (
113-
config.general.rounds_per_epoch * supernova_activation_epoch
114-
+ NUM_ROUNDS_BETWEEN_SUPERNOVA_ACTIVATION_EPOCH_AND_ACTIVATION_ROUND
115-
)
116-
121+
supernova_computed_activation_round = _compute_supernova_activation_round(config, supernova_activation_epoch)
117122
supernova_entry["Round"] = str(supernova_computed_activation_round)
123+
124+
125+
def _compute_supernova_activation_round(config: ConfigRoot, supernova_activation_epoch: int) -> int:
126+
return (
127+
config.general.rounds_per_epoch * supernova_activation_epoch
128+
+ NUM_ROUNDS_BETWEEN_SUPERNOVA_ACTIVATION_EPOCH_AND_ACTIVATION_ROUND
129+
)

0 commit comments

Comments
 (0)