123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(* TODO: https://gitlab.com/tezos/tezos/-/issues/2880
Add corresponding .mli file. *)letsection=["sc_rollup_node";"refutation_game"]moduleSimple=structincludeInternal_event.Simplelettimeout=declare_1~section~name:"sc_rollup_node_timeout"~msg:"The rollup node has been slashed because of a timeout issued by \
{address}"~level:Notice("address",Signature.Public_key_hash.encoding)letinvalid_move=declare_0~section~name:"sc_rollup_node_invalid_move"~msg:"The rollup node is about to make an invalid move in the refutation \
game! It is stopped to avoid being slashed. The problem should be \
reported immediately or the rollup node should be upgraded to have a \
chance to be back before the timeout is reached."~level:Notice()letconflict_detected=declare_5~section~name:"sc_rollup_node_conflict_detected"~msg:"A conflict has been found with our commitment {our_commitment_hash} \
at level {level} with staker {other} that hash issued commitment \
{their_commitment_hash} both based on {parent_commitment_hash}."~level:Notice("our_commitment_hash",Octez_smart_rollup.Commitment.Hash.encoding)("level",Data_encoding.int32)("other",Signature.Public_key_hash.encoding)("their_commitment_hash",Octez_smart_rollup.Commitment.Hash.encoding)("parent_commitment_hash",Octez_smart_rollup.Commitment.Hash.encoding)letpotential_conflict_detected=declare_4~section~name:"sc_rollup_node_potential_conflict_detected"~msg:"A potential conflict has been found with our commitment \
{our_commitment_hash} at level {level} with staker {other} that hash \
issued commitment {their_commitment_hash}."~level:Notice("our_commitment_hash",Commitment.Hash.encoding)("level",Data_encoding.int32)("other",Signature.Public_key_hash.encoding)("their_commitment_hash",Commitment.Hash.encoding)lettimeout_detected=declare_1~section~name:"sc_rollup_node_timeout_detected"~msg:"The rollup node has detected that opponent {other} can be timed out."~level:Notice("other",Signature.Public_key_hash.encoding)letcomputed_dissection=declare_4~section~name:"sc_rollup_node_computed_dissection"~msg:"Computed dissection against {opponent} between ticks {start_tick} and \
{end_tick}: {dissection}."~level:Debug("opponent",Signature.Public_key_hash.encoding)("start_tick",Data_encoding.z)("end_tick",Data_encoding.z)("dissection",Data_encoding.listOctez_smart_rollup.Game.dissection_chunk_encoding)moduleWorker(ARG:sigvalsection:stringlistend)(Request:Worker_intf.REQUEST)=structincludeARGletrequest_failed=declare_3~section~name:"request_failed"~msg:"request {view} failed ({worker_status}): {errors}"~level:Notice("view",Request.encoding)~pp1:Request.pp("worker_status",Worker_types.request_status_encoding)~pp2:Worker_types.pp_status("errors",Error_monad.trace_encoding)~pp3:Error_monad.pp_print_traceletrequest_completed=declare_2~section~name:"request_completed"~msg:"{view} {worker_status}"~level:Debug("view",Request.encoding)("worker_status",Worker_types.request_status_encoding)~pp1:Request.pp~pp2:Worker_types.pp_statusendmodulePlayer=structincludeWorker(structletsection=section@["player"]end)(Refutation_player_types.Request)letstarted=declare_2~section~name:"player_started"~msg:"refutation player started to play against {opponent}, defenfing \
commitment {commitment}"~level:Notice("opponent",Signature.Public_key_hash.encoding)~pp1:Signature.Public_key_hash.pp("commitment",Octez_smart_rollup.Commitment.encoding)~pp2:Octez_smart_rollup.Commitment.ppletstopped=declare_1~section~name:"player_stopped"~msg:"refutation player for opponent {opponent} has been stopped"~level:Notice("opponent",Signature.Public_key_hash.encoding)~pp1:Signature.Public_key_hash.ppendmoduleCoordinator=structincludeWorker(structletsection=section@["coordinator"]end)(Refutation_coordinator_types.Request)letstarting=declare_0~section~name:"coordinator_starting"~msg:"Starting refutation coordinator for the smart rollup node"~level:Notice()endendlettimeoutaddress=Simple.(emittimeoutaddress)letinvalid_move()=Simple.(emitinvalid_move())letconflict_detected(conflict:Octez_smart_rollup.Game.conflict)=letour_commitment_hash=Octez_smart_rollup.Commitment.hashconflict.our_commitmentinlettheir_commitment_hash=Octez_smart_rollup.Commitment.hashconflict.their_commitmentinletparent_commitment_hash=conflict.parent_commitmentinletother=conflict.otherinletlevel=conflict.our_commitment.inbox_levelinSimple.(emitconflict_detected(our_commitment_hash,level,other,their_commitment_hash,parent_commitment_hash))letpotential_conflict_detected~our_commitment_hash~their_commitment_hash~other~level=Simple.(emitpotential_conflict_detected(our_commitment_hash,level,other,their_commitment_hash))lettimeout_detectedother=Simple.(emittimeout_detectedother)letcomputed_dissection~opponent~start_tick~end_tickdissection=Simple.(emitcomputed_dissection(opponent,start_tick,end_tick,dissection))modulePlayer=structletsection=Simple.Player.sectionletrequest_failedviewworker_statuserrors=Simple.(emitPlayer.request_failed(view,worker_status,errors))letrequest_completedviewworker_status=Simple.(emitPlayer.request_completed(view,worker_status))letstartedopponentcommitment=Simple.(emitPlayer.started(opponent,commitment))letstoppedopponent=Simple.(emitPlayer.stoppedopponent)endmoduleCoordinator=structletsection=Simple.Coordinator.sectionletrequest_failedviewworker_statuserrors=Simple.(emitCoordinator.request_failed(view,worker_status,errors))letrequest_completedviewworker_status=Simple.(emitCoordinator.request_completed(view,worker_status))letstarting=Simple.(emitCoordinator.starting)end