pub fn prepare_core_worker(
request: &CheckRequest,
key_file: &Path,
timeout: Duration,
) -> Result<CoreWorker, ApiError>Expand description
Independently prepares the same pure Core model as a distributed coordinator.
The source/config, executable, seed/fingerprint, value policy, Core switches and compiled startup are pinned before receiving any work. The local key file must hold exactly 32 secret bytes; work messages cannot choose paths or code. Both worker and coordinator require explicit seed and fingerprint options.
use dive_api::{CheckRequest, prepare_core_worker};
use std::{net::TcpListener, path::Path, time::Duration};
let request = CheckRequest {
file: "Counter.tla".into(), seed: Some(0), fp: Some(0),
..CheckRequest::default()
};
let worker = prepare_core_worker(&request, Path::new("worker.key"), Duration::from_secs(5))?;
let listener = TcpListener::bind("127.0.0.1:7801")?;
let facts = worker.serve(&listener, Some(5), &|| false)?;
assert!(facts.completed_units <= 5); // Work facts never prove the model.ยงErrors
Source/configuration errors, effects, unimplemented combinations, compilation, private protocol admission, key-file or identity failures.