1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351(*****************************************************************************)(* *)(* 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+=Zero_frozen_depositsofSignature.Public_key_hash.tlet()=register_error_kind`Permanent~id:"validate.zero_frozen_deposits"~title:"Zero frozen deposits"~description:"The delegate has zero frozen deposits."~pp:(funppfdelegate->Format.fprintfppf"Delegate %a has zero frozen deposits; it is not allowed to \
bake/preendorse/endorse."Signature.Public_key_hash.ppdelegate)Data_encoding.(obj1(req"delegate"Signature.Public_key_hash.encoding))(functionZero_frozen_depositsdelegate->Somedelegate|_->None)(fundelegate->Zero_frozen_depositsdelegate)(** This type is only used in consensus operation errors to make
them more informative. *)typeconsensus_operation_kind=|Preendorsement|Endorsement|Grandparent_endorsement|Dal_slot_availabilityletconsensus_operation_kind_encoding=Data_encoding.string_enum[("Preendorsement",Preendorsement);("Endorsement",Endorsement);("Grandparent_endorsement",Grandparent_endorsement);("Dal_slot_availability",Dal_slot_availability);]letconsensus_operation_kind_ppfmt=function|Preendorsement->Format.fprintffmt"Preendorsement"|Endorsement->Format.fprintffmt"Endorsement"|Grandparent_endorsement->Format.fprintffmt"Grandparent endorsement"|Dal_slot_availability->Format.fprintffmt"Dal_slot_availability"(** Errors for preendorsements and endorsements. *)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_consensus_operation_branchof{kind:consensus_operation_kind;expected:Block_hash.t;provided:Block_hash.t;}|Wrong_payload_hash_for_consensus_operationof{kind:consensus_operation_kind;expected:Block_payload_hash.t;provided:Block_payload_hash.t;}|Unexpected_preendorsement_in_block|Unexpected_endorsement_in_block|Preendorsement_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`Temporary~id:"validate.wrong_consensus_operation_branch"~title:"Wrong consensus operation branch"~description:"Trying to include an endorsement or preendorsement which points to \
the wrong block. It should be the predecessor for preendorsements and \
the grandfather for endorsements."~pp:(funppf(kind,expected,provided)->Format.fprintfppf"%a with wrong branch (expected: %a, provided: %a)."consensus_operation_kind_ppkindBlock_hash.ppexpectedBlock_hash.ppprovided)Data_encoding.(obj3(req"kind"consensus_operation_kind_encoding)(req"expected"Block_hash.encoding)(req"provided"Block_hash.encoding))(function|Wrong_consensus_operation_branch{kind;expected;provided}->Some(kind,expected,provided)|_->None)(fun(kind,expected,provided)->Wrong_consensus_operation_branch{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_preendorsement_in_block"~title:"Unexpected preendorsement in block"~description:"Unexpected preendorsement in block."~pp:(funppf()->Format.fprintfppf"Unexpected preendorsement in block.")Data_encoding.empty(functionUnexpected_preendorsement_in_block->Some()|_->None)(fun()->Unexpected_preendorsement_in_block);register_error_kind`Permanent~id:"validate.unexpected_endorsement_in_block"~title:"Unexpected endorsement in block"~description:"Unexpected endorsement in block."~pp:(funppf()->Format.fprintfppf"Unexpected endorsement in block.")Data_encoding.empty(functionUnexpected_endorsement_in_block->Some()|_->None)(fun()->Unexpected_endorsement_in_block);register_error_kind`Permanent~id:"validate.preendorsement_round_too_high"~title:"Preendorsement round too high"~description:"Preendorsement round too high."~pp:(funppf(block_round,provided)->Format.fprintfppf"Preendorsement 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|Preendorsement_round_too_high{block_round;provided}->Some(block_round,provided)|_->None)(fun(block_round,provided)->Preendorsement_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 preendorsement or endorsement."~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=Preendorsement|Endorsement|Blockletdenunciation_kind_encoding=letopenData_encodinginstring_enum[("preendorsement",Preendorsement);("endorsement",Endorsement);("block",Block);]letpp_denunciation_kindfmt:denunciation_kind->unit=function|Preendorsement->Format.fprintffmt"preendorsement"|Endorsement->Format.fprintffmt"endorsement"|Block->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"denunciation_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"denunciation_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."pp_denunciation_kindkindSignature.Public_key_hash.ppdelegateLevel.pplevel)Data_encoding.(obj3(req"denunciation_kind"denunciation_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"denunciation_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"denunciation_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"denunciation_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|Tx_rollup_feature_disabled|Sc_rollup_feature_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);register_error_kind`Permanent~id:"validate.operation.tx_rollup_is_disabled"~title:"Tx rollup is disabled"~description:"Cannot originate a tx rollup as it is disabled."~pp:(funppf()->Format.fprintfppf"Cannot apply a tx rollup operation as it is disabled. This feature \
will be enabled in a future proposal")Data_encoding.unit(functionTx_rollup_feature_disabled->Some()|_->None)(fun()->Tx_rollup_feature_disabled);letscoru_disabled_description="Smart contract rollups will be enabled in a future proposal."inregister_error_kind`Permanent~id:"validate.operation.sc_rollup_disabled"~title:"Smart contract rollups are disabled"~description:scoru_disabled_description~pp:(funppf()->Format.fprintfppf"%s"scoru_disabled_description)Data_encoding.unit(functionSc_rollup_feature_disabled->Some()|_->None)(fun()->Sc_rollup_feature_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=structtypeerror+=|Not_enough_endorsementsof{required:int;provided:int}|Inconsistent_validation_passes_in_blockof{expected:int;provided:int;}let()=register_error_kind`Permanent~id:"validate.block.not_enough_endorsements"~title:"Not enough endorsements"~description:"The block being validated does not include the required minimum \
number of endorsements."~pp:(funppf(required,provided)->Format.fprintfppf"Wrong number of endorsements (%i), at least %i are expected"providedrequired)Data_encoding.(obj2(req"required"int31)(req"provided"int31))(function|Not_enough_endorsements{required;provided}->Some(required,provided)|_->None)(fun(required,provided)->Not_enough_endorsements{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})end