123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377(*****************************************************************************)(* *)(* 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. *)(* *)(*****************************************************************************)openAlpha_contexttypeoperation_conflict=|Operation_conflictof{existing:Operation_hash.t;new_operation:Operation_hash.t;}letoperation_conflict_encoding=letopenData_encodingindef"operation_conflict"~title:"Conflict error"~description:"Conflict between two operations"@@conv(function|Operation_conflict{existing;new_operation}->(existing,new_operation))(fun(existing,new_operation)->Operation_conflict{existing;new_operation})(obj2(req"existing"Operation_hash.encoding)(req"new_operation"Operation_hash.encoding))moduleConsensus=structtypeerror+=Forbidden_delegateofSignature.Public_key_hash.tlet()=register_error_kind`Permanent~id:"validate.temporarily_forbidden_delegate"~title:"Temporarily forbidden delegate"~description:"The delegate has committed too many misbehaviours."~pp:(funppfdelegate->Format.fprintfppf"Delegate %a has committed too many misbehaviours; it is temporarily \
not allowed to bake/preattest/attest."Signature.Public_key_hash.ppdelegate)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(functionForbidden_delegatedelegate->Somedelegate|_->None)(fundelegate->Forbidden_delegatedelegate)(** This type is only used in consensus operation errors to make
them more informative. *)typeconsensus_operation_kind=Preattestation|Attestationletconsensus_operation_kind_encoding=Data_encoding.string_enum[("Preattestation",Preattestation);("Attestation",Attestation)]letconsensus_operation_kind_ppfmt=function|Preattestation->Format.fprintffmt"Preattestation"|Attestation->Format.fprintffmt"Attestation"(** Errors for preattestation and attestation. *)typeerror+=|Consensus_operation_for_old_levelof{kind:consensus_operation_kind;expected:Raw_level.t;provided:Raw_level.t;}|Consensus_operation_for_future_levelof{kind:consensus_operation_kind;expected:Raw_level.t;provided:Raw_level.t;}|Consensus_operation_for_old_roundof{kind:consensus_operation_kind;expected:Round.t;provided:Round.t;}|Consensus_operation_for_future_roundof{kind:consensus_operation_kind;expected:Round.t;provided:Round.t;}|Wrong_payload_hash_for_consensus_operationof{kind:consensus_operation_kind;expected:Block_payload_hash.t;provided:Block_payload_hash.t;}|Unexpected_preattestation_in_block|Unexpected_attestation_in_block|Preattestation_round_too_highof{block_round:Round.t;provided:Round.t;}|Wrong_slot_used_for_consensus_operationof{kind:consensus_operation_kind;}|Conflicting_consensus_operationof{kind:consensus_operation_kind;conflict:operation_conflict;}|Consensus_operation_not_allowedlet()=register_error_kind`Outdated~id:"validate.consensus_operation_for_old_level"~title:"Consensus operation for old level"~description:"Consensus operation for old level."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a for old level (expected: %a, provided: %a)."consensus_operation_kind_ppkindRaw_level.ppexpectedRaw_level.ppprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected"Raw_level.encoding)(req"provided"Raw_level.encoding))(function|Consensus_operation_for_old_level{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Consensus_operation_for_old_level{kind;expected;provided});register_error_kind`Temporary~id:"validate.consensus_operation_for_future_level"~title:"Consensus operation for future level"~description:"Consensus operation for future level."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a for future level (expected: %a, provided: %a)."consensus_operation_kind_ppkindRaw_level.ppexpectedRaw_level.ppprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected"Raw_level.encoding)(req"provided"Raw_level.encoding))(function|Consensus_operation_for_future_level{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Consensus_operation_for_future_level{kind;expected;provided});register_error_kind`Branch~id:"validate.consensus_operation_for_old_round"~title:"Consensus operation for old round"~description:"Consensus operation for old round."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a for old round (expected_min: %a, provided: %a)."consensus_operation_kind_ppkindRound.ppexpectedRound.ppprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected_min"Round.encoding)(req"provided"Round.encoding))(function|Consensus_operation_for_old_round{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Consensus_operation_for_old_round{kind;expected;provided});register_error_kind`Temporary~id:"validate.consensus_operation_for_future_round"~title:"Consensus operation for future round"~description:"Consensus operation for future round."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a for future round (expected: %a, provided: %a)."consensus_operation_kind_ppkindRound.ppexpectedRound.ppprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected_max"Round.encoding)(req"provided"Round.encoding))(function|Consensus_operation_for_future_round{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Consensus_operation_for_future_round{kind;expected;provided});register_error_kind(* Note: in Mempool mode this used to be
Consensus_operation_on_competing_proposal (which was
[`Branch] so we kept this classification). *)`Branch~id:"validate.wrong_payload_hash_for_consensus_operation"~title:"Wrong payload hash for consensus operation"~description:"Wrong payload hash for consensus operation."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a with wrong payload hash (expected: %a, provided: %a)."consensus_operation_kind_ppkindBlock_payload_hash.pp_shortexpectedBlock_payload_hash.pp_shortprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected"Block_payload_hash.encoding)(req"provided"Block_payload_hash.encoding))(function|Wrong_payload_hash_for_consensus_operation{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Wrong_payload_hash_for_consensus_operation{kind;expected;provided});register_error_kind`Permanent~id:"validate.unexpected_preattestation_in_block"~title:"Unexpected preattestation in block"~description:"Unexpected preattestation in block."~pp:(funppf()->Format.fprintfppf"Unexpected preattestation in block.")Data_encoding.empty(functionUnexpected_preattestation_in_block->Some()|_->None)(fun()->Unexpected_preattestation_in_block);register_error_kind`Permanent~id:"validate.unexpected_attestation_in_block"~title:"Unexpected attestation in block"~description:"Unexpected attestation in block."~pp:(funppf()->Format.fprintfppf"Unexpected attestation in block.")Data_encoding.empty(functionUnexpected_attestation_in_block->Some()|_->None)(fun()->Unexpected_attestation_in_block);register_error_kind`Permanent~id:"validate.preattestation_round_too_high"~title:"Preattestation round too high"~description:"Preattestation round too high."~pp:(funppf(block_round,provided)->Format.fprintfppf"Preattestation round too high (block_round: %a, provided: %a)."Round.ppblock_roundRound.ppprovided)Data_encoding.(obj2(req"block_round"Round.encoding)(req"provided"Round.encoding))(function|Preattestation_round_too_high{block_round;provided}->Some(block_round,provided)|_->None)(fun(block_round,provided)->Preattestation_round_too_high{block_round;provided});register_error_kind`Permanent~id:"validate.wrong_slot_for_consensus_operation"~title:"Wrong slot for consensus operation"~description:"Wrong slot used for a preattestation or attestation."~pp:(funppfkind->Format.fprintfppf"Wrong slot used for a %a."consensus_operation_kind_ppkind)Data_encoding.(obj1(req"kind"consensus_operation_kind_encoding))(function|Wrong_slot_used_for_consensus_operation{kind}->Somekind|_->None)(funkind->Wrong_slot_used_for_consensus_operation{kind});register_error_kind`Branch~id:"validate.double_inclusion_of_consensus_operation"~title:"Double inclusion of consensus operation"~description:"Double inclusion of consensus operation."~pp:(funppf(kind,Operation_conflict{existing;new_operation})->Format.fprintfppf"%a operation %a conflicts with existing %a"consensus_operation_kind_ppkindOperation_hash.ppnew_operationOperation_hash.ppexisting)Data_encoding.(obj2(req"kind"consensus_operation_kind_encoding)(req"conflict"operation_conflict_encoding))(function|Conflicting_consensus_operation{kind;conflict}->Some(kind,conflict)|_->None)(fun(kind,conflict)->Conflicting_consensus_operation{kind;conflict});register_error_kind`Branch~id:"validate.consensus_operation_not_allowed"~title:"Consensus operation not allowed"~description:"Consensus operation not allowed."~pp:(funppf()->Format.fprintfppf"Validation of consensus operation if forbidden ")Data_encoding.empty(functionConsensus_operation_not_allowed->Some()|_->None)(fun()->Consensus_operation_not_allowed)endmoduleVoting=structtypeerror+=|(* Shared voting errors *)Wrong_voting_period_indexof{expected:int32;provided:int32;}|Wrong_voting_period_kindof{current:Voting_period.kind;expected:Voting_period.kindlist;}|Source_not_in_vote_listings|(* Proposals errors *)Empty_proposals|Proposals_contain_duplicateof{proposal:Protocol_hash.t}|Already_proposedof{proposal:Protocol_hash.t}|Too_many_proposalsof{previous_count:int;operation_count:int}|Conflicting_proposalsofoperation_conflict|Testnet_dictator_multiple_proposals|Proposals_from_unregistered_delegateofSignature.Public_key_hash.t|(* Ballot errors *)Ballot_for_wrong_proposalof{current:Protocol_hash.t;submitted:Protocol_hash.t;}|Already_submitted_a_ballot|Ballot_from_unregistered_delegateofSignature.Public_key_hash.t|Conflicting_ballotofoperation_conflictlet()=(* Shared voting errors *)register_error_kind`Temporary~id:"validate.operation.wrong_voting_period_index"~title:"Wrong voting period index"~description:"The voting operation contains a voting period index different from \
the current one."~pp:(funppf(expected,provided)->Format.fprintfppf"The voting operation is meant for voting period %ld, whereas the \
current period is %ld."providedexpected)Data_encoding.(obj2(req"current_index"int32)(req"provided_index"int32))(function|Wrong_voting_period_index{expected;provided}->Some(expected,provided)|_->None)(fun(expected,provided)->Wrong_voting_period_index{expected;provided});register_error_kind`Temporary~id:"validate.operation.wrong_voting_period_kind"~title:"Wrong voting period kind"~description:"The voting operation is incompatible the current voting period kind."~pp:(funppf(current,expected)->Format.fprintfppf"The voting operation is only valid during a %a voting period, but \
we are currently in a %a period."(Format.pp_print_list~pp_sep:(funfmt()->Format.fprintffmt" or ")Voting_period.pp_kind)expectedVoting_period.pp_kindcurrent)Data_encoding.(obj2(req"current"Voting_period.kind_encoding)(req"expected"(listVoting_period.kind_encoding)))(function|Wrong_voting_period_kind{current;expected}->Some(current,expected)|_->None)(fun(current,expected)->Wrong_voting_period_kind{current;expected});letdescription="The delegate is not in the vote listings."inregister_error_kind`Temporary~id:"validate.operation.source_not_in_vote_listings"~title:"Source not in vote listings"~description~pp:(funppf()->Format.fprintfppf"%s"description)Data_encoding.empty(functionSource_not_in_vote_listings->Some()|_->None)(fun()->Source_not_in_vote_listings);(* Proposals errors *)letdescription="Proposal list cannot be empty."inregister_error_kind`Permanent~id:"validate.operation.empty_proposals"~title:"Empty proposals"~description~pp:(funppf()->Format.fprintfppf"%s"description)Data_encoding.empty(functionEmpty_proposals->Some()|_->None)(fun()->Empty_proposals);register_error_kind`Permanent~id:"validate.operation.proposals_contain_duplicate"~title:"Proposals contain duplicate"~description:"The list of proposals contains a duplicate element."~pp:(funppfproposal->Format.fprintfppf"The list of proposals contains multiple occurrences of the proposal \
%a."Protocol_hash.ppproposal)Data_encoding.(obj1(req"proposal"Protocol_hash.encoding))(function|Proposals_contain_duplicate{proposal}->Someproposal|_->None)(funproposal->Proposals_contain_duplicate{proposal});register_error_kind`Branch~id:"validate.operation.already_proposed"~title:"Already proposed"~description:"The delegate has already submitted one of the operation's proposals."~pp:(funppfproposal->Format.fprintfppf"The delegate has already submitted the proposal %a."Protocol_hash.ppproposal)Data_encoding.(obj1(req"proposal"Protocol_hash.encoding))(functionAlready_proposed{proposal}->Someproposal|_->None)(funproposal->Already_proposed{proposal});register_error_kind`Temporary~id:"validate.operation.conflict_too_many_proposals"~title:"Conflict too many proposals"~description:"The delegate exceeded the maximum number of allowed proposals due to, \
among others, previous Proposals operations in the current \
block/mempool."~pp:(funppf(previous_count,operation_count)->Format.fprintfppf"The delegate cannot submit too many protocol proposals: it \
currently voted for %d and is trying to vote for %d more."previous_countoperation_count)Data_encoding.(obj2(req"previous_count"int8)(req"operation_count"int31))(function|Too_many_proposals{previous_count;operation_count}->Some(previous_count,operation_count)|_->None)(fun(previous_count,operation_count)->Too_many_proposals{previous_count;operation_count});register_error_kind`Temporary~id:"validate.operation.conflicting_proposals"~title:"Conflicting proposals"~description:"The current block/mempool already contains a testnest dictator \
proposals operation, so it cannot have any other voting operation."~pp:(funppf(Operation_conflict{existing;_})->Format.fprintfppf"The current block/mempool already contains a conflicting operation \
%a."Operation_hash.ppexisting)Data_encoding.(obj1(req"conflict"operation_conflict_encoding))(functionConflicting_proposalsconflict->Someconflict|_->None)(funconflict->Conflicting_proposalsconflict);letdescription="A testnet dictator cannot submit more than one proposal at a time."inregister_error_kind`Permanent~id:"validate.operation.testnet_dictator_multiple_proposals"~title:"Testnet dictator multiple proposals"~description~pp:(funppf()->Format.fprintfppf"%s"description)Data_encoding.empty(functionTestnet_dictator_multiple_proposals->Some()|_->None)(fun()->Testnet_dictator_multiple_proposals);register_error_kind`Permanent~id:"operation.proposals_from_unregistered_delegate"~title:"Proposals from an unregistered delegate"~description:"Cannot submit proposals with an unregistered delegate."~pp:(funppfc->Format.fprintfppf"Cannot submit proposals with public key hash %a (unregistered \
delegate)."Signature.Public_key_hash.ppc)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(functionProposals_from_unregistered_delegatec->Somec|_->None)(func->Proposals_from_unregistered_delegatec);(* Ballot errors *)register_error_kind`Branch~id:"validate.operation.ballot_for_wrong_proposal"~title:"Ballot for wrong proposal"~description:"Ballot provided for a proposal that is not the current one."~pp:(funppf(current,submitted)->Format.fprintfppf"Ballot provided for proposal %a whereas the current proposal is %a."Protocol_hash.ppsubmittedProtocol_hash.ppcurrent)Data_encoding.(obj2(req"current_proposal"Protocol_hash.encoding)(req"ballot_proposal"Protocol_hash.encoding))(function|Ballot_for_wrong_proposal{current;submitted}->Some(current,submitted)|_->None)(fun(current,submitted)->Ballot_for_wrong_proposal{current;submitted});letdescription="The delegate has already submitted a ballot for the current voting \
period."inregister_error_kind`Branch~id:"validate.operation.already_submitted_a_ballot"~title:"Already submitted a ballot"~description~pp:(funppf()->Format.fprintfppf"%s"description)Data_encoding.empty(functionAlready_submitted_a_ballot->Some()|_->None)(fun()->Already_submitted_a_ballot);register_error_kind`Permanent~id:"operation.ballot_from_unregistered_delegate"~title:"Ballot from an unregistered delegate"~description:"Cannot cast a ballot for an unregistered delegate."~pp:(funppfc->Format.fprintfppf"Cannot cast a ballot for public key hash %a (unregistered delegate)."Signature.Public_key_hash.ppc)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(functionBallot_from_unregistered_delegatec->Somec|_->None)(func->Ballot_from_unregistered_delegatec);register_error_kind`Temporary~id:"validate.operation.conflicting_ballot"~title:"Conflicting ballot"~description:"The delegate has already submitted a ballot in a previously validated \
operation of the current block or mempool."~pp:(funppf(Operation_conflict{existing;_})->Format.fprintfppf"The delegate has already submitted a ballot in the previously \
validated operation %a of the current block or mempool."Operation_hash.ppexisting)Data_encoding.(obj1(req"conflict"operation_conflict_encoding))(functionConflicting_ballotconflict->Someconflict|_->None)(funconflict->Conflicting_ballotconflict)endmoduleAnonymous=structtypeerror+=|Invalid_activationof{pkh:Ed25519.Public_key_hash.t}|Conflicting_activationof{edpkh:Ed25519.Public_key_hash.t;conflict:operation_conflict;}let()=register_error_kind`Permanent~id:"validate.operation.invalid_activation"~title:"Invalid activation"~description:"The given key and secret do not correspond to any existing \
preallocated contract."~pp:(funppfpkh->Format.fprintfppf"Invalid activation. The public key %a and accompanying secret do \
not match any commitment."Ed25519.Public_key_hash.pppkh)Data_encoding.(obj1(req"pkh"Ed25519.Public_key_hash.encoding))(functionInvalid_activation{pkh}->Somepkh|_->None)(funpkh->Invalid_activation{pkh});register_error_kind`Branch~id:"validate.operation.conflicting_activation"~title:"Account already activated in current validation_state"~description:"The account has already been activated by a previous operation in the \
current validation state."~pp:(funppf(edpkh,Operation_conflict{existing;_})->Format.fprintfppf"Invalid activation: the account %a has already been activated in \
the current validation state by operation %a."Ed25519.Public_key_hash.ppedpkhOperation_hash.ppexisting)Data_encoding.(obj2(req"edpkh"Ed25519.Public_key_hash.encoding)(req"conflict"operation_conflict_encoding))(function|Conflicting_activation{edpkh;conflict}->Some(edpkh,conflict)|_->None)(fun(edpkh,conflict)->Conflicting_activation{edpkh;conflict})typedenunciation_kind=Misbehaviour.kindletpp_denunciation_kindfmt:denunciation_kind->unit=function|Double_preattesting->Format.fprintffmt"preattestation"|Double_attesting->Format.fprintffmt"attestation"|Double_baking->Format.fprintffmt"block"typeerror+=|Invalid_double_baking_evidenceof{hash1:Block_hash.t;level1:Raw_level.t;round1:Round.t;hash2:Block_hash.t;level2:Raw_level.t;round2:Round.t;}|Invalid_denunciationofdenunciation_kind|Inconsistent_denunciationof{kind:denunciation_kind;delegate1:Signature.Public_key_hash.t;delegate2:Signature.Public_key_hash.t;}|Already_denouncedof{kind:denunciation_kind;delegate:Signature.Public_key_hash.t;level:Level.t;}|Conflicting_denunciationof{kind:denunciation_kind;conflict:operation_conflict;}|Too_early_denunciationof{kind:denunciation_kind;level:Raw_level.t;current:Raw_level.t;}|Outdated_denunciationof{kind:denunciation_kind;level:Raw_level.t;last_cycle:Cycle.t;}let()=register_error_kind`Permanent~id:"validate.block.invalid_double_baking_evidence"~title:"Invalid double baking evidence"~description:"A double-baking evidence is inconsistent (two distinct levels)"~pp:(funppf(hash1,level1,round1,hash2,level2,round2)->Format.fprintfppf"Invalid double-baking evidence (hash: %a and %a, levels/rounds: \
(%ld,%ld) and (%ld,%ld))"Block_hash.pphash1Block_hash.pphash2(Raw_level.to_int32level1)(Round.to_int32round1)(Raw_level.to_int32level2)(Round.to_int32round2))Data_encoding.(obj6(req"hash1"Block_hash.encoding)(req"level1"Raw_level.encoding)(req"round1"Round.encoding)(req"hash2"Block_hash.encoding)(req"level2"Raw_level.encoding)(req"round2"Round.encoding))(function|Invalid_double_baking_evidence{hash1;level1;round1;hash2;level2;round2}->Some(hash1,level1,round1,hash2,level2,round2)|_->None)(fun(hash1,level1,round1,hash2,level2,round2)->Invalid_double_baking_evidence{hash1;level1;round1;hash2;level2;round2});register_error_kind`Permanent~id:"validate.operation.block.invalid_denunciation"~title:"Invalid denunciation"~description:"A denunciation is malformed"~pp:(funppfkind->Format.fprintfppf"Malformed double-%a evidence"pp_denunciation_kindkind)Data_encoding.(obj1(req"kind"Misbehaviour.kind_encoding))(functionInvalid_denunciationkind->Somekind|_->None)(funkind->Invalid_denunciationkind);register_error_kind`Permanent~id:"validate.operation.block.inconsistent_denunciation"~title:"Inconsistent denunciation"~description:"A denunciation operation is inconsistent (two distinct delegates)"~pp:(funppf(kind,delegate1,delegate2)->Format.fprintfppf"Inconsistent double-%a evidence (distinct delegate: %a and %a)"pp_denunciation_kindkindSignature.Public_key_hash.pp_shortdelegate1Signature.Public_key_hash.pp_shortdelegate2)Data_encoding.(obj3(req"kind"Misbehaviour.kind_encoding)(req"delegate1"Signature.Public_key_hash.encoding)(req"delegate2"Signature.Public_key_hash.encoding))(function|Inconsistent_denunciation{kind;delegate1;delegate2}->Some(kind,delegate1,delegate2)|_->None)(fun(kind,delegate1,delegate2)->Inconsistent_denunciation{kind;delegate1;delegate2});register_error_kind`Branch~id:"validate.operation.already_denounced"~title:"Already denounced"~description:"The same denunciation has already been validated."~pp:(funppf(kind,delegate,level)->Format.fprintfppf"Delegate %a at level %a has already been denounced for a double %a."Signature.Public_key_hash.ppdelegateLevel.pplevelpp_denunciation_kindkind)Data_encoding.(obj3(req"denunciation_kind"Misbehaviour.kind_encoding)(req"delegate"Signature.Public_key_hash.encoding)(req"level"Level.encoding))(function|Already_denounced{kind;delegate;level}->Some(kind,delegate,level)|_->None)(fun(kind,delegate,level)->Already_denounced{kind;delegate;level});register_error_kind`Branch~id:"validate.operation.conflicting_denunciation"~title:"Conflicting denunciation in current validation state"~description:"The same denunciation has already been validated in the current \
validation state."~pp:(funppf(kind,Operation_conflict{existing;_})->Format.fprintfppf"Double %a evidence already exists in the current validation state \
as operation %a."pp_denunciation_kindkindOperation_hash.ppexisting)Data_encoding.(obj2(req"denunciation_kind"Misbehaviour.kind_encoding)(req"conflict"operation_conflict_encoding))(function|Conflicting_denunciation{kind;conflict}->Some(kind,conflict)|_->None)(fun(kind,conflict)->Conflicting_denunciation{kind;conflict});register_error_kind`Temporary~id:"validate.operation.block.too_early_denunciation"~title:"Too early denunciation"~description:"A denunciation is too far in the future"~pp:(funppf(kind,level,current)->Format.fprintfppf"A double-%a denunciation is too far in the future (current level: \
%a, given level: %a)"pp_denunciation_kindkindRaw_level.ppcurrentRaw_level.pplevel)Data_encoding.(obj3(req"kind"Misbehaviour.kind_encoding)(req"level"Raw_level.encoding)(req"current"Raw_level.encoding))(function|Too_early_denunciation{kind;level;current}->Some(kind,level,current)|_->None)(fun(kind,level,current)->Too_early_denunciation{kind;level;current});register_error_kind`Permanent~id:"validate.operation.block.outdated_denunciation"~title:"Outdated denunciation"~description:"A denunciation is outdated."~pp:(funppf(kind,level,last_cycle)->Format.fprintfppf"A double-%a denunciation is outdated (last acceptable cycle: %a, \
given level: %a)."pp_denunciation_kindkindCycle.pplast_cycleRaw_level.pplevel)Data_encoding.(obj3(req"kind"Misbehaviour.kind_encoding)(req"level"Raw_level.encoding)(req"last"Cycle.encoding))(function|Outdated_denunciation{kind;level;last_cycle}->Some(kind,level,last_cycle)|_->None)(fun(kind,level,last_cycle)->Outdated_denunciation{kind;level;last_cycle})typeerror+=Conflicting_nonce_revelationofoperation_conflictlet()=register_error_kind`Branch~id:"validate.operation.conflicting_nonce_revelation"~title:"Conflicting nonce revelation in the current validation state)."~description:"A revelation for the same nonce has already been validated for the \
current validation state."~pp:(funppf(Operation_conflict{existing;_})->Format.fprintfppf"This nonce revelation is conflicting with an existing revelation %a"Operation_hash.ppexisting)Data_encoding.(obj1(req"conflict"operation_conflict_encoding))(function|Conflicting_nonce_revelationconflict->Someconflict|_->None)(funconflict->Conflicting_nonce_revelationconflict)typeerror+=Conflicting_vdf_revelationofoperation_conflictlet()=register_error_kind`Branch~id:"validate.operation.conflicting_vdf_revelation"~title:"Conflicting vdf revelation in the current validation state)."~description:"A revelation for the same vdf has already been validated for the \
current validation state."~pp:(funppf(Operation_conflict{existing;_})->Format.fprintfppf"This vdf revelation is conflicting with an existing revelation %a"Operation_hash.ppexisting)Data_encoding.(obj1(req"conflict"operation_conflict_encoding))(function|Conflicting_vdf_revelationconflict->Someconflict|_->None)(funconflict->Conflicting_vdf_revelationconflict)typeerror+=|Drain_delegate_on_unregistered_delegateofSignature.Public_key_hash.t|Invalid_drain_delegate_inactive_keyof{delegate:Signature.Public_key_hash.t;consensus_key:Signature.Public_key_hash.t;active_consensus_key:Signature.Public_key_hash.t;}|Invalid_drain_delegate_no_consensus_keyofSignature.Public_key_hash.t|Invalid_drain_delegate_noopofSignature.Public_key_hash.t|Invalid_drain_delegate_insufficient_funds_for_burn_or_feesof{delegate:Signature.Public_key_hash.t;destination:Signature.Public_key_hash.t;min_amount:Tez.t;}|Conflicting_drain_delegateof{delegate:Signature.Public_key_hash.t;conflict:operation_conflict;}let()=register_error_kind`Temporary~id:"operation.drain_delegate_key_on_unregistered_delegate"~title:"Drain delegate key on an unregistered delegate"~description:"Cannot drain an unregistered delegate."~pp:(funppfc->Format.fprintfppf"Cannot drain an unregistered delegate %a."Signature.Public_key_hash.ppc)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(function|Drain_delegate_on_unregistered_delegatec->Somec|_->None)(func->Drain_delegate_on_unregistered_delegatec);register_error_kind`Temporary~id:"operation.invalid_drain.inactive_key"~title:"Drain delegate with an inactive consensus key"~description:"Cannot drain with an inactive consensus key."~pp:(funppf(delegate,consensus_key,active_consensus_key)->Format.fprintfppf"Consensus key %a is not the active consensus key for delegate %a. \
The active consensus key is %a."Signature.Public_key_hash.ppconsensus_keySignature.Public_key_hash.ppdelegateSignature.Public_key_hash.ppactive_consensus_key)Data_encoding.(obj3(req"delegate"Signature.Public_key_hash.encoding)(req"consensus_key"Signature.Public_key_hash.encoding)(req"active_consensus_key"Signature.Public_key_hash.encoding))(function|Invalid_drain_delegate_inactive_key{delegate;consensus_key;active_consensus_key}->Some(delegate,consensus_key,active_consensus_key)|_->None)(fun(delegate,consensus_key,active_consensus_key)->Invalid_drain_delegate_inactive_key{delegate;consensus_key;active_consensus_key});register_error_kind`Temporary~id:"operation.invalid_drain.no_consensus_key"~title:"Drain a delegate without consensus key"~description:"Cannot drain a delegate without consensus key."~pp:(funppfdelegate->Format.fprintfppf"There is no active consensus key for delegate %a."Signature.Public_key_hash.ppdelegate)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(function|Invalid_drain_delegate_no_consensus_keyc->Somec|_->None)(func->Invalid_drain_delegate_no_consensus_keyc);register_error_kind`Temporary~id:"operation.invalid_drain.noop"~title:"Invalid drain delegate: noop"~description:"Cannot drain a delegate to itself."~pp:(funppfdelegate->Format.fprintfppf"The destination of a drain operation cannot be the delegate itself \
(%a)."Signature.Public_key_hash.ppdelegate)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(functionInvalid_drain_delegate_noopc->Somec|_->None)(func->Invalid_drain_delegate_noopc);register_error_kind`Temporary~id:"operation.invalid_drain.insufficient_funds_for_burn_or_fees"~title:"Drain delegate without enough balance for allocation burn or drain \
fees"~description:"Cannot drain without enough allocation burn and drain fees."~pp:(funppf(delegate,destination,min_amount)->Format.fprintfppf"Cannot drain delegate from %a to %a: not enough funds for the drain \
fees in the delegate account (minimum balance required: %a)."Signature.Public_key_hash.ppdelegateSignature.Public_key_hash.ppdestinationTez.ppmin_amount)Data_encoding.(obj3(req"delegate"Signature.Public_key_hash.encoding)(req"destination"Signature.Public_key_hash.encoding)(req"min_amount"Tez.encoding))(function|Invalid_drain_delegate_insufficient_funds_for_burn_or_fees{delegate;destination;min_amount}->Some(delegate,destination,min_amount)|_->None)(fun(delegate,destination,min_amount)->Invalid_drain_delegate_insufficient_funds_for_burn_or_fees{delegate;destination;min_amount});register_error_kind`Branch~id:"validate.operation.conflicting_drain"~title:"Conflicting drain in the current validation state)."~description:"A manager operation or another drain operation is in conflict."~pp:(funppf(delegate,Operation_conflict{existing;_})->Format.fprintfppf"This drain operation conflicts with operation %a for the delegate %a"Operation_hash.ppexistingSignature.Public_key_hash.ppdelegate)Data_encoding.(obj2(req"delegate"Signature.Public_key_hash.encoding)(req"conflict"operation_conflict_encoding))(function|Conflicting_drain_delegate{delegate;conflict}->Some(delegate,conflict)|_->None)(fun(delegate,conflict)->Conflicting_drain_delegate{delegate;conflict})endmoduleManager=structtypeerror+=|Manager_restrictionof{source:Signature.Public_key_hash.t;conflict:operation_conflict;}|Inconsistent_sources|Inconsistent_counters|Incorrect_reveal_position|Insufficient_gas_for_manager|Gas_quota_exceeded_init_deserialize|Sc_rollup_arith_pvm_disabled|Sc_rollup_riscv_pvm_disabled|Zk_rollup_feature_disabledlet()=register_error_kind`Temporary~id:"validate.operation.manager_restriction"~title:"Manager restriction"~description:"An operation with the same manager has already been validated in the \
current block."~pp:(funppf(source,Operation_conflict{existing;_})->Format.fprintfppf"Manager %a already has the operation %a in the current block."Signature.Public_key_hash.ppsourceOperation_hash.ppexisting)Data_encoding.(obj2(req"source"Signature.Public_key_hash.encoding)(req"conflict"operation_conflict_encoding))(function|Manager_restriction{source;conflict}->Some(source,conflict)|_->None)(fun(source,conflict)->Manager_restriction{source;conflict});letinconsistent_sources_description="The operation batch includes operations from different sources."inregister_error_kind`Permanent~id:"validate.operation.inconsistent_sources"~title:"Inconsistent sources in operation batch"~description:inconsistent_sources_description~pp:(funppf()->Format.fprintfppf"%s"inconsistent_sources_description)Data_encoding.empty(functionInconsistent_sources->Some()|_->None)(fun()->Inconsistent_sources);letinconsistent_counters_description="Inconsistent counters in operation. Counters of an operation must be \
successive."inregister_error_kind`Permanent~id:"validate.operation.inconsistent_counters"~title:"Inconsistent counters in operation"~description:inconsistent_counters_description~pp:(funppf()->Format.fprintfppf"%s"inconsistent_counters_description)Data_encoding.empty(functionInconsistent_counters->Some()|_->None)(fun()->Inconsistent_counters);letincorrect_reveal_description="Incorrect reveal operation position in batch: only allowed in first \
position."inregister_error_kind`Permanent~id:"validate.operation.incorrect_reveal_position"~title:"Incorrect reveal position"~description:incorrect_reveal_description~pp:(funppf()->Format.fprintfppf"%s"incorrect_reveal_description)Data_encoding.empty(functionIncorrect_reveal_position->Some()|_->None)(fun()->Incorrect_reveal_position);register_error_kind`Permanent~id:"validate.operation.insufficient_gas_for_manager"~title:"Not enough gas for initial manager cost"~description:(Format.asprintf"Gas limit is too low to cover the initial cost of manager \
operations: a minimum of %a gas units is required."Gas.pp_cost_as_gasMichelson_v1_gas.Cost_of.manager_operation)Data_encoding.empty(functionInsufficient_gas_for_manager->Some()|_->None)(fun()->Insufficient_gas_for_manager);letgas_deserialize_description="Gas limit was not high enough to deserialize the transaction parameters \
or origination script code or initial storage etc., making the \
operation impossible to parse within the provided gas bounds."inregister_error_kind`Permanent~id:"validate.operation.gas_quota_exceeded_init_deserialize"~title:"Not enough gas for initial deserialization of script expressions"~description:gas_deserialize_description~pp:(funppf()->Format.fprintfppf"%s"gas_deserialize_description)Data_encoding.empty(functionGas_quota_exceeded_init_deserialize->Some()|_->None)(fun()->Gas_quota_exceeded_init_deserialize);letscoru_arith_pvm_disabled_description="Arith PVM is disabled in this network."inregister_error_kind`Permanent~id:"operation.arith_pvm_disabled"~title:"The Arith PVM is disabled"~description:scoru_arith_pvm_disabled_description~pp:(funppf()->Format.fprintfppf"%s"scoru_arith_pvm_disabled_description)Data_encoding.unit(functionSc_rollup_arith_pvm_disabled->Some()|_->None)(fun()->Sc_rollup_arith_pvm_disabled);letscoru_riscv_pvm_disabled_description="RISCV PVM is disabled in this network."inregister_error_kind`Permanent~id:"operation.riscv_pvm_disabled"~title:"The RISCV PVM is disabled"~description:scoru_riscv_pvm_disabled_description~pp:(funppf()->Format.fprintfppf"%s"scoru_riscv_pvm_disabled_description)Data_encoding.unit(functionSc_rollup_riscv_pvm_disabled->Some()|_->None)(fun()->Sc_rollup_riscv_pvm_disabled);letzkru_disabled_description="ZK rollups will be enabled in a future proposal."inregister_error_kind`Permanent~id:"validate.operation.zk_rollup_disabled"~title:"ZK rollups are disabled"~description:zkru_disabled_description~pp:(funppf()->Format.fprintfppf"%s"zkru_disabled_description)Data_encoding.unit(functionZk_rollup_feature_disabled->Some()|_->None)(fun()->Zk_rollup_feature_disabled)endtypeerror+=Failing_noop_errorlet()=letdescription="A failing_noop operation can never be validated."inregister_error_kind`Permanent~id:"validate.operation.failing_noop_error"~title:"Failing_noop error"~description~pp:(funppf()->Format.fprintfppf"%s"description)Data_encoding.empty(functionFailing_noop_error->Some()|_->None)(fun()->Failing_noop_error)moduleBlock=struct(* All block errors are permanent. *)typeerror+=|Not_enough_attestationsof{required:int;provided:int}|Inconsistent_validation_passes_in_blockof{expected:int;provided:int;}|Invalid_payload_hashof{expected:Block_payload_hash.t;provided:Block_payload_hash.t;}|Locked_round_after_block_roundof{locked_round:Round.t;round:Round.t;}|Insufficient_locked_round_evidenceof{voting_power:int;consensus_threshold:int;}let()=register_error_kind`Permanent~id:"validate.block.not_enough_attestations"~title:"Not enough attestations"~description:"The block being validated does not include the required minimum \
number of attestations."~pp:(funppf(required,provided)->Format.fprintfppf"Wrong number of attestations (%i), at least %i are expected"providedrequired)Data_encoding.(obj2(req"required"int31)(req"provided"int31))(function|Not_enough_attestations{required;provided}->Some(required,provided)|_->None)(fun(required,provided)->Not_enough_attestations{required;provided});register_error_kind`Permanent~id:"validate.block.inconsistent_validation_passes_in_block"~title:"Inconsistent validation passes in block"~description:"Validation of operation should be ordered by their validation passes \
in a block."~pp:(funppf(expected,provided)->Format.fprintfppf"Validation of operation should be ordered by their validation \
passes in a block. Got an operation with validation pass: %d while \
the last validated operation had the validation pass %d."providedexpected)Data_encoding.(obj2(req"expected"int31)(req"provided"int31))(function|Inconsistent_validation_passes_in_block{expected;provided}->Some(expected,provided)|_->None)(fun(expected,provided)->Inconsistent_validation_passes_in_block{expected;provided});register_error_kind`Permanent~id:"validate.block.invalid_payload_hash"~title:"Invalid payload hash"~description:"Invalid payload hash."~pp:(funppf(expected,provided)->Format.fprintfppf"Invalid payload hash (expected: %a, provided: %a)."Block_payload_hash.pp_shortexpectedBlock_payload_hash.pp_shortprovided)Data_encoding.(obj2(req"expected"Block_payload_hash.encoding)(req"provided"Block_payload_hash.encoding))(function|Invalid_payload_hash{expected;provided}->Some(expected,provided)|_->None)(fun(expected,provided)->Invalid_payload_hash{expected;provided});();register_error_kind`Permanent~id:"validate.block.locked_round_after_block_round"~title:"Locked round after block round"~description:"Locked round after block round."~pp:(funppf(locked_round,round)->Format.fprintfppf"Locked round (%a) is after the block round (%a)."Round.pplocked_roundRound.ppround)Data_encoding.(obj2(req"locked_round"Round.encoding)(req"round"Round.encoding))(function|Locked_round_after_block_round{locked_round;round}->Some(locked_round,round)|_->None)(fun(locked_round,round)->Locked_round_after_block_round{locked_round;round});();register_error_kind`Permanent~id:"validate.block.insufficient_locked_round_evidence"~title:"Insufficient locked round evidence"~description:"Insufficient locked round evidence."~pp:(funppf(voting_power,consensus_threshold)->Format.fprintfppf"The provided locked round evidence is not sufficient: provided %d \
voting power but was expecting at least %d."voting_powerconsensus_threshold)Data_encoding.(obj2(req"voting_power"int31)(req"consensus_threshold"int31))(function|Insufficient_locked_round_evidence{voting_power;consensus_threshold}->Some(voting_power,consensus_threshold)|_->None)(fun(voting_power,consensus_threshold)->Insufficient_locked_round_evidence{voting_power;consensus_threshold})end