taikoxyz / raiko

Multi-proofs for Taiko. SNARKS, STARKS and Trusted Execution Enclave. Our previous ZK-EVM circuits are deprecated.
Apache License 2.0
124 stars 91 forks source link

Prover config doesn't work #153

Closed Brechtpd closed 6 months ago

Brechtpd commented 6 months ago

Describe the bug

After https://github.com/taikoxyz/raiko/pull/31 prover configs don't seem to work anymore.

For example: https://github.com/taikoxyz/raiko/blob/8b23bae83730db8c37da513157407543595f90e1/provers/risc0/src/lib.rs#L58

this doesn't work because the config it gets looks like this:

config: Object {"beacon_rpc": String("https://l1beacon.hekla.taiko.xyz"), "block_number": Number(39367), "graffiti": String("0x8008500000000000000000000000000000000000000000000000000000000000"), "l1_network": String("holesky"), "l1_rpc": String("https://l1rpc.hekla.taiko.xyz/"), "network": String("TaikoA7"), "proof_type": String("Risc0"), "prover": String("0x70997970C51812dc3A010C7d01b50e0d17dc79C8"), "rpc": String("https://rpc.hekla.taiko.xyz/")}

But the values are defined both in the config:

https://github.com/taikoxyz/raiko/blob/8b23bae83730db8c37da513157407543595f90e1/host/config/config.json#L14-L19

and also in the prove_block script:

https://github.com/taikoxyz/raiko/blob/8b23bae83730db8c37da513157407543595f90e1/prove_block.sh#L66-L71

Steps to reproduce

Steps to reproduce here.

Spam policy

petarvujovic98 commented 6 months ago

@Brechtpd I am now seeing that the config file is putting sgx and risc0 one level deeper than it should be. The current way we capture the prover configs is on the same level as network (top level fields). So the config should look like:

{
    "network": "taiko_a7",
    "l1_network": "holesky",
    "prover": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
    "graffiti": "8008500000000000000000000000000000000000000000000000000000000000",
    "proof_type": "risc0",
    "sgx": {
        "instance_id": 456,
        "setup": true,
        "bootstrap": true,
        "prove": true,
        "input_path": null
    },
    "risc0": {
        "bonsai": true,
        "snark": true,
        "profile": false,
        "execution_po2": 20
    }
}

and in the prove block script it should be:

elif [ "$proof" == "sgx" ]; then
    proofParam='
    "proof_type": "sgx",
    "sgx" : {
        "instance_id": 123,
        "setup": false,
        "bootstrap": false,
        "prove": true,
        "input_path": null
    }
    '
elif [ "$proof" == "risc0" ]; then
    proofParam='
    "proof_type": "risc0",
    "risc0": {
        "bonsai": false,
        "snark": false,
        "profile": true,
        "execution_po2": 18
    }
  '
elif [ "$proof" == "risc0-bonsai" ]; then
    proofParam='
    "proof_type": "risc0",
    "risc0": {
        "bonsai": true,
        "snark": true,
        "profile": false,
        "execution_po2": 20
    }
  '
Brechtpd commented 6 months ago

Ah okay great because that's how I think it indeed makes the most sense. The configs were changed to make the current code work, but the configs like in your post would be preferred.