diff --git a/cli/parse_and_prove.py b/cli/parse_and_prove.py index c1fb877..4d0c2b2 100644 --- a/cli/parse_and_prove.py +++ b/cli/parse_and_prove.py @@ -15,7 +15,7 @@ def find_latest_data(): latest_data = max(latest_data, int(d)) return latest_data -def prepare_json (net, _test_data, _binance_onchain, _binance_zk_bonsai, _binance_zk_local): +def prepare_json(net, _test_data, _binance_onchain, _binance_zk_bonsai, _binance_zk_local, pairs_file_path): assert _test_data + _binance_onchain + _binance_zk_bonsai + _binance_zk_local == 1, "exactly one of flags is required" @@ -38,7 +38,11 @@ def prepare_json (net, _test_data, _binance_onchain, _binance_zk_bonsai, _binanc parse_env_var(net, DCAP_ATTESTATION, root="lib/sgx_verifier_deployer/") os.environ["RPC_URL"] = net.rpc_url - run_subprocess(["./lib/zktls-enclave/target/debug/zktls-pairs"], "request from binance using sgx") + app_cmd = ["./lib/zktls-enclave/target/debug/zktls-pairs"] + if pairs_file_path: + app_cmd += ["--pairs-file-path", pairs_file_path] + run_subprocess(app_cmd, "request from binance using sgx") + for f in files_1: run_subprocess(["mv", f, new_data_dir + f], "move requested " + f + " to " + new_data_dir) if _binance_onchain == True: @@ -66,9 +70,11 @@ def main(): data_source_group.add_argument('--binance-zk-bonsai', action='store_true', help='Request data from binance and prove using bonsai (quite fast and checks proving process)') data_source_group.add_argument('--binance-zk-local', action='store_true', help='Request data from binance and prove locally (15 minutes but checks that local proving works)') + parser.add_argument('--pairs-file-path', type=str, required=False, help='Path to the pairs file') + args = parser.parse_args() - prepare_json(args.network, args.test_data, args.binance_onchain, args.binance_zk_bonsai, args.binance_zk_local) + prepare_json(args.network, args.test_data, args.binance_onchain, args.binance_zk_bonsai, args.binance_zk_local, args.pairs_file_path) if __name__ == "__main__": main() diff --git a/cli/test.py b/cli/test.py index ceafd72..5527fb7 100644 --- a/cli/test.py +++ b/cli/test.py @@ -13,7 +13,7 @@ from lib.sgx_verifier_deployer.script.utils.network import * -def test(test_data, binance_zk_bonsai, binance_zk_local): +def test(test_data, binance_zk_bonsai, binance_zk_local, pairs_file_path): assert test_data + binance_zk_bonsai + binance_zk_local == 1, "test requires exactly one flag" @@ -64,7 +64,7 @@ def test(test_data, binance_zk_bonsai, binance_zk_local): step+=1 print(f"step {step}: request and prove data from binance...") - prepare_json(LOCAL_NETWORK, False, False, binance_zk_bonsai, binance_zk_local) + prepare_json(LOCAL_NETWORK, False, False, binance_zk_bonsai, binance_zk_local, pairs_file_path) step+=1 print(f"step {step}: Print traces of feeding execution(zk)...") @@ -147,6 +147,8 @@ def test(test_data, binance_zk_bonsai, binance_zk_local): test_config.add_argument('--binance-zk-bonsai', action='store_true', help='Request data from binance and prove using bonsai (quite fast and checks proving process)') test_config.add_argument('--binance-zk-local', action='store_true', help='Request data from binance and prove locally (15 minutes but checks that local proving works)') +parser.add_argument('--pairs-file-path', type=str, required=False, help='Path to the pairs file') + args = parser.parse_args() -test(args.test_data, args.binance_zk_bonsai, args.binance_zk_local) +test(args.test_data, args.binance_zk_bonsai, args.binance_zk_local, args.pairs_file_path)