From 10ed2b99eb300d18a026f0b3a14cb1b03dfbe2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20Vujovi=C4=87?= Date: Fri, 10 May 2024 23:32:26 +0200 Subject: [PATCH] Prover config loading fix (#177) * fix: Fix prover specific args * fix: Add serde flatten to properly read prover specific configs --------- Co-authored-by: Brecht Devos --- host/config/config.json | 28 +++++++++++++--------------- host/src/request.rs | 1 + script/prove-block.sh | 38 ++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/host/config/config.json b/host/config/config.json index ebcfa71a..b691035b 100644 --- a/host/config/config.json +++ b/host/config/config.json @@ -4,19 +4,17 @@ "prover": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", "graffiti": "8008500000000000000000000000000000000000000000000000000000000000", "proof_type": "risc0", - "prover_args": { - "sgx": { - "instance_id": 456, - "setup": true, - "bootstrap": true, - "prove": true, - "input_path": null - }, - "risc0": { - "bonsai": true, - "snark": true, - "profile": false, - "execution_po2": 20 - } + "sgx": { + "instance_id": 456, + "setup": true, + "bootstrap": true, + "prove": true, + "input_path": null + }, + "risc0": { + "bonsai": true, + "snark": true, + "profile": false, + "execution_po2": 20 } -} \ No newline at end of file +} diff --git a/host/src/request.rs b/host/src/request.rs index 570bbc73..7ce29472 100644 --- a/host/src/request.rs +++ b/host/src/request.rs @@ -196,6 +196,7 @@ pub struct ProofRequestOpt { /// The proof type. pub proof_type: Option, #[command(flatten)] + #[serde(flatten)] /// Any additional prover params in JSON format. pub prover_args: ProverSpecificOpts, } diff --git a/script/prove-block.sh b/script/prove-block.sh index 929e54c8..fa84f207 100755 --- a/script/prove-block.sh +++ b/script/prove-block.sh @@ -52,38 +52,32 @@ elif [ "$proof" == "sp1" ]; then elif [ "$proof" == "sgx" ]; then proofParam=' "proof_type": "sgx", - "prover_args": { - "sgx" : { - "instance_id": 123, - "setup": false, - "bootstrap": false, - "prove": true, - "input_path": null - } + "sgx" : { + "instance_id": 123, + "setup": false, + "bootstrap": false, + "prove": true, + "input_path": null } ' elif [ "$proof" == "risc0" ]; then proofParam=' "proof_type": "risc0", - "prover_args": { - "risc0": { - "bonsai": false, - "snark": false, - "profile": true, - "execution_po2": 18 - } + "risc0": { + "bonsai": false, + "snark": false, + "profile": true, + "execution_po2": 18 } ' elif [ "$proof" == "risc0-bonsai" ]; then proofParam=' "proof_type": "risc0", - "prover_args": { - "risc0": { - "bonsai": true, - "snark": true, - "profile": false, - "execution_po2": 20 - } + "risc0": { + "bonsai": true, + "snark": true, + "profile": false, + "execution_po2": 20 } ' else