pub fn work_only_circuit(guest: &impl ZkvmGuest)
Expand description
Executes the “work-only” zkVM circuit, verifying the total work value and committing it as a structured output.
§Parameters
guest
: A reference to an object implementingZkvmGuest
.
§Functionality
- Reads
WorkOnlyCircuitInput
from the guest. - Ensures the
method_id
matchesHEADER_CHAIN_METHOD_ID
. - Serializes and verifies the header chain circuit output using
env::verify()
. - Converts
total_work
(from bytes) into a 128-bit integer (U128
). - Breaks down the 128-bit integer into four 32-bit words.
- Commits the resulting
WorkOnlyCircuitOutput
to the guest.
§Panics
- If
method_id
does not matchHEADER_CHAIN_METHOD_ID
. - If serialization (
borsh::to_vec()
) or verification (env::verify()
) fails. - If
total_work
conversion or chunk processing fails.