Legend:
Library
Module
Module type
Parameter
Class
Class type
A refutation game proof is required as part of the final move in a game.
This proof is basically a combination of a PVM proof (provided by each implementation of the PVM signature) and an input proof. To check the proof we must check each part separately and then also check that they match on the two points where they touch:
the input_requested of the PVM proof should match the starting point of the input proof ;
the input_given of the PVM proof should match the output message of the input proof.
It is also often the case that the PVM proof has No_input_required for its input_requested and None for its input_given. If this is the case, we don't need the input proof at all and the input_proof parameter in our proof should be None.
type reveal_proof =
| Raw_data_proofof string
(*
The existence of reveal for a given hash when the input_requested is the Needs_reveal Reveal_raw_data.
The existence or not of a confirmed slot for a given page ID when the input_requested is the Needs_reveal Request_dal_page.
*)
The proof that a reveal is valid.
A PVM proof pvm_step is combined with an input_proof to provide the proof necessary to validate a single step in the refutation game.
If the step doesn't involve any input, proof_input_requested
pvm_step and proof_input_given pvm_step will be No_input_required and None respectively, and in this case inbox should also be None.
In the case that input is involved, input_proof is either:
a proof of the next inbox message available from the inbox after a given location; this must match up with pvm_step to give a valid refutation proof ; or
a proof of a reveal satisfiability.
a claim that the input involved is the first input of the inbox, which does not need to be proved as we know by construction what is the input (i.e. the Start_of_level of the level after the rollup's origination level).
produce ~metadata pvm_and_state inbox_context inbox_history
commit_inbox_level will construct a full refutation game proof out of the state given in pvm_and_state. It uses the inbox if necessary to provide input in the proof. If the input is above or at commit_level it will block it, and produce a proof that the PVM is blocked. If the input requested is a reveal the proof production will also fail.
This will fail if any of the context, inbox_context, inbox_history or dal_slots_history_cache given doesn't have enough data to make the proof. For example, the 'protocol implementation' version of each PVM won't be able to run this function. Similarly, the version of the inbox stored in the L1 won't be enough because it forgets old levels.
This uses the name in the pvm_and_state module to produce an encodable wrapped_proof if possible. See the wrap_proof function in Sc_rollups.
It also need the metadata if it produces a proof for the Needs_metadata state.