Skip to content

Commit 67017b8

Browse files
Merge pull request #489 from multiversx/MX-16463-localnet-andromeda
Localnet: add support for Andromeda
2 parents a12071b + cb950dd commit 67017b8

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

multiversx_sdk_cli/localnet/node_config_toml.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ def patch_config(data: ConfigDict, config: ConfigRoot):
3030
data['VirtualMachine']['Execution']['WasmVMVersions'] = [{'StartEpoch': 0, 'Version': '*'}]
3131
data['VirtualMachine']['Querying']['WasmVMVersions'] = [{'StartEpoch': 0, 'Version': '*'}]
3232

33+
# Adjust "ChainParametersByEpoch" (for Andromeda)
34+
chain_parameters_by_epoch = data['GeneralSettings'].get('ChainParametersByEpoch', [])
35+
36+
if chain_parameters_by_epoch:
37+
# For convenience, keep a single entry ...
38+
chain_parameters_by_epoch.clear()
39+
chain_parameters_by_epoch.append({})
40+
41+
# ... and set the activation epoch to 0
42+
chain_parameters_by_epoch[0]["EnableEpoch"] = 0
43+
chain_parameters_by_epoch[0]["RoundDuration"] = config.general.round_duration_milliseconds
44+
chain_parameters_by_epoch[0]["ShardConsensusGroupSize"] = config.shards.consensus_size
45+
chain_parameters_by_epoch[0]["ShardMinNumNodes"] = config.shards.num_validators_per_shard
46+
chain_parameters_by_epoch[0]["MetachainConsensusGroupSize"] = config.metashard.consensus_size
47+
chain_parameters_by_epoch[0]["MetachainMinNumNodes"] = config.metashard.num_validators
48+
3349

3450
def patch_api(data: ConfigDict, config: ConfigRoot):
3551
routes = data['APIPackages']['transaction']['Routes']

multiversx_sdk_cli/localnet/step_start.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from multiversx_sdk_cli.localnet.config_root import ConfigRoot
1414
from multiversx_sdk_cli.localnet.constants import \
1515
NETWORK_MONITORING_INTERVAL_IN_SECONDS
16+
from multiversx_sdk_cli.localnet.step_config import \
17+
copy_binaries_into_localnet_workspace
1618

1719
logger = logging.getLogger("localnet")
1820

@@ -38,6 +40,17 @@ def start(configfile: Path, stop_after_seconds: int):
3840
async def do_start(configfile: Path, stop_after_seconds: int):
3941
config = ConfigRoot.from_file(configfile)
4042

43+
logger.info("Copy (overwrite) binaries, in case they've changed between restarts.")
44+
45+
try:
46+
# Do this on a best-effort basis.
47+
# Though useful (e.g. when the developer is using "resolution" = "local" and works with the Protocol itself),
48+
# this step is not strictly necessary, and might even fail in some cases
49+
# (e.g. when localnet is embedded in a Docker container and some cleanup procedures are performed upon setting up the localnet).
50+
copy_binaries_into_localnet_workspace(config)
51+
except Exception as e:
52+
logger.warning(f"Error while copying binaries: {e}")
53+
4154
display_api_table(config)
4255

4356
logger.info('Localnet folder is %s', config.root())
@@ -62,6 +75,7 @@ async def do_start(configfile: Path, stop_after_seconds: int):
6275
"--log-save",
6376
f"--log-level={loglevel}",
6477
"--log-logger-name",
78+
"--log-correlation",
6579
f"--destination-shard-as-observer={observer.shard}",
6680
f"--rest-api-interface={observer.api_interface()}",
6781
"--operation-mode=historical-balances"
@@ -75,6 +89,7 @@ async def do_start(configfile: Path, stop_after_seconds: int):
7589
"--log-save",
7690
f"--log-level={loglevel}",
7791
"--log-logger-name",
92+
"--log-correlation",
7893
f"--rest-api-interface={validator.api_interface()}"
7994
], cwd=validator.folder, delay=NODES_START_DELAY))
8095

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "multiversx-sdk-cli"
7-
version = "9.11.0"
7+
version = "9.12.0"
88
authors = [
99
{ name="MultiversX" },
1010
]

0 commit comments

Comments
 (0)