Skip to content

Trading pairs file configuration #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cli/parse_and_prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update prepare_json calls in cli/test.py


assert _test_data + _binance_onchain + _binance_zk_bonsai + _binance_zk_local == 1, "exactly one of flags is required"

Expand All @@ -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:
Expand Down Expand Up @@ -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()
8 changes: 5 additions & 3 deletions cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)...")
Expand Down Expand Up @@ -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)