Skip to content
Merged
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
7 changes: 5 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ zkaleido = { git = "https://github.com/alpenlabs/zkaleido", tag = "v0.1.0-alpha-
zkaleido-native-adapter = { git = "https://github.com/alpenlabs/zkaleido", tag = "v0.1.0-alpha-rc22", features = [
"remote-prover",
] }
zkaleido-sp1-host = { git = "https://github.com/alpenlabs/zkaleido", tag = "v0.1.0-alpha-rc22" }

# external dependencies
anyhow = "1.0.86"
Expand Down
7 changes: 7 additions & 0 deletions bin/asm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ jsonrpsee = { workspace = true, features = ["server", "macros"] }
serde.workspace = true
serde_json.workspace = true
ssz.workspace = true
strata-asm-sp1-guest-builder = { path = "../../guest-builder/sp1", optional = true }
threadpool = "1.8"
tokio.workspace = true
toml.workspace = true
tracing.workspace = true
zkaleido.workspace = true
zkaleido-sp1-host = { workspace = true, optional = true, features = [
"remote-prover",
] }

[features]
sp1 = ["dep:zkaleido-sp1-host", "dep:strata-asm-sp1-guest-builder"]
20 changes: 17 additions & 3 deletions bin/asm-runner/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use anyhow::Result;
use bitcoind_async_client::{Auth, Client};
use strata_asm_params::AsmParams;
use strata_asm_proof_db::SledProofDb;
use strata_asm_proof_impl::program::AsmStfProofProgram;
use strata_asm_worker::AsmWorkerBuilder;
use strata_tasks::TaskExecutor;
use tokio::{
Expand Down Expand Up @@ -64,11 +63,26 @@ pub(crate) async fn bootstrap(
let proof_db = SledProofDb::open(&orch_config.proof_db_path)?;
let proof_db_clone = proof_db.clone();

let native_host = AsmStfProofProgram::native_host();
#[cfg(feature = "sp1")]
let host = {
use std::fs;

use strata_asm_sp1_guest_builder::ASM_ELF_PATH;
use zkaleido_sp1_host::SP1Host;
let elf = fs::read(ASM_ELF_PATH)
.unwrap_or_else(|err| panic!("failed to read guest elf at {ASM_ELF_PATH}: {err}"));
SP1Host::init(&elf)
};

#[cfg(not(feature = "sp1"))]
let host = {
use strata_asm_proof_impl::program::AsmStfProofProgram;
AsmStfProofProgram::native_host()
};

let input_builder = InputBuilder::new(asm_manager.clone(), bitcoin_client.clone());
let mut orchestrator =
ProofOrchestrator::new(proof_db, native_host, orch_config, input_builder, rx);
ProofOrchestrator::new(proof_db, host, orch_config, input_builder, rx);

// ZkVmRemoteProver is !Send (#[async_trait(?Send)]), so the orchestrator
// future cannot be spawned on a multi-threaded runtime directly. We run it
Expand Down
14 changes: 14 additions & 0 deletions functional-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,18 @@ cd functional-tests
./run_test.sh fn_asm_block_test
```

### SP1 proof generation

To run with SP1 proof generation enabled:

```bash
SP1_PROOF_STRATEGY="" NETWORK_PRIVATE_KEY="" CARGO_DEBUG=0 CARGO_FEATURES=sp1 ./run_test.sh fn_asm_proof_test
```
Comment thread
MdTeach marked this conversation as resolved.

- `SP1_PROOF_STRATEGY` — the SP1 proof fulfillment strategy. See
[FulfillmentStrategy](https://docs.rs/sp1-sdk/5.2.1/sp1_sdk/network/enum.FulfillmentStrategy.html)
for available options.
- `NETWORK_PRIVATE_KEY` — private key for the SP1 network prover (required
when using a network strategy).

Results are written under `functional-tests/_dd/`.
4 changes: 4 additions & 0 deletions functional-tests/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ else
TARGET_DIR="debug"
fi

if [ -n "${CARGO_FEATURES:-}" ]; then
CARGO_ARGS+=(--features "$CARGO_FEATURES")
fi

cargo build --bin strata-asm-runner ${CARGO_ARGS[@]+"${CARGO_ARGS[@]}"}
TARGET_ROOT="${CARGO_TARGET_DIR:-target}"
if [[ "$TARGET_ROOT" != /* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion functional-tests/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def check():
return height_holder["height"]


def wait_until_asm_proof_exists(asm_rpc, block_hash: str, timeout: int = 60, step: int = 2):
def wait_until_asm_proof_exists(asm_rpc, block_hash: str, timeout: int = 600, step: int = 2):
"""Wait until an ASM proof exists for the given block hash."""

def check():
Expand Down
Loading