From 8fd58cbf537d7451770b9601e802795d5aa89cc4 Mon Sep 17 00:00:00 2001 From: Marcelo Diop-Gonzalez Date: Wed, 22 May 2024 12:10:33 -0400 Subject: [PATCH] feat(forknet): allow running traffic generator with a key map secret (#11375) we've been using the mirror tool without a secret used to map keys, which is fine when we're running internal tests. but if we want to start a forknet instance that will later be opened up to the public, we'll want to use a mix the mapped keys with a secret. so here we will assume that it will be placed in ~/.near/setup/mirror-secret.json (or ~/.near/target/setup/mirror-secret.json for V2 setups) and we'll use it if so --- pytest/tests/mocknet/helpers/neard_runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytest/tests/mocknet/helpers/neard_runner.py b/pytest/tests/mocknet/helpers/neard_runner.py index 7042c1dd8bb..f3c06fb0ab2 100644 --- a/pytest/tests/mocknet/helpers/neard_runner.py +++ b/pytest/tests/mocknet/helpers/neard_runner.py @@ -850,8 +850,12 @@ def start_neard(self, batch_interval_millis=None): self.source_near_home_path(), '--target-home', self.target_near_home_path(), - '--no-secret', ] + if os.path.exists(self.setup_path('mirror-secret.json')): + cmd.append('--secret-file') + cmd.append(self.setup_path('mirror-secret.json')) + else: + cmd.append('--no-secret') if batch_interval_millis is not None: with open(self.target_near_home_path('mirror-config.json'), 'w') as f: