The input echo: why a handler’s proof binds to its input
The problem
A zero-knowledge receipt proves that some program ran and produced some output, not what it was given: a handler proven on a made-up balance, sender or grant set produces a valid receipt.
In the public case this does not matter: the sequencer runs the handler itself and supplies the real input. In the private case the handler runs on the user’s machine, and the user chooses the input.
The fix
A handler run outputs not the Response alone but a Transition, which carries the input next to the response (lee/state_machine/core/src/program/mod.rs):
pub struct Transition {
pub input: ReceiveInput,
pub response: Response,
}
The guest commits the whole Transition to its journal (the public output a RISC Zero receipt proves). The program author does nothing: actor_entrypoint! reads the input, passes it to the handler, and commits it unchanged next to the handler’s response. Only a guest that writes its own main must commit its input itself.
What must match, byte for byte, is the whole ReceiveInput: the receiver, the sender, the grant set, the starting state and the message. It is checked in two places.
On the sequencer, for a public actor. It runs the guest, decodes the Transition it committed, and the engine compares (process_actor_message, lee/state_machine/core/src/execution_state.rs):
let transition = environment.handle_message(&input, &view)?;
if transition.input != input {
return Err(ExecutionError::TransitionInputMismatch { .. });
}
In the privacy circuit, for a private actor. The prover hands the circuit only the handler’s response. The circuit attaches the input the engine itself computed, and requires a receipt for exactly those bytes (lee/privacy_preserving_circuit/src/private_backend.rs):
let transition = response.into_transition(input.clone());
env::verify(image_id, &lee_core::to_borsh_frame(&transition));
A receipt made by running the handler on any other input committed different bytes, so it does not verify.
So the proof of a private transaction says: this program, given this receiver, sender, grant set, starting state and message, produced this response.
What this buys
- The starting state is real. The circuit separately proves that the private account’s state is the one committed on chain, and the echo ties the handler run to it.
- The sender is real: the engine supplies
fromfrom the message being delivered, so a program cannot be shown a sender that did not send. - Authorization is real: the engine computes the grant set, and the handler ran with it.
- Private output can be trusted in public: a message leaving a private actor was produced by the proven handler from proven input. This is the property behind the proof-carrying message pattern, which most of the catalog uses.
What the echo assumes
The guest writes the echo, and nothing outside it can force it to be honest: a zkVM receipt binds a program to its journal, not to what the host fed it. A program with a hand-written main could read one input, compute a response from it, and commit a different input next to that response.
So the guarantee is conditional: for a program whose code echoes faithfully, a prover cannot feed it a false input. Programs built with actor_entrypoint! echo faithfully by construction, and a prover cannot substitute other code, because the proof binds each program account to the image deployed there, or, for a shadow program, to the image its id is derived from (Program identity in a private transaction).
A program that lies in its echo gains nothing beyond what any dishonest program already has.
- In a public transaction it fails: the committed input differs from the real one the sequencer supplied, and the engine rejects the transition.
- In a private transaction it lets its own prover produce any response. That is the same as a program with a “do whatever the caller says” instruction. The response can still only write the state of that program’s own actor and send messages whose
from.program_account_idis that program, which is what a receiver’s sender check,from_own_program()included, reads.
The echo protects those relying on an honest program from dishonest provers, not anyone from a dishonest program. Relying on a message from an actor means trusting that actor’s program, and “it uses the standard entry point” is one line of that review.
What it does not hide
The echo is inside the proof, not published. An observer of a private transaction sees neither the input nor the response of a private handler, only what crosses to the public side, listed in What a private transaction reveals.
A short rule
A handler never needs to re-check that its input is genuine, only that it is acceptable: the right sender, the right authorization, a valid state transition.