123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.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. *)(* *)(*****************************************************************************)letversion_number="\000"letproof_of_work_nonce_size=8letnonce_length=32letmax_revelations_per_block=32letmax_operation_data_length=16*1024;(* 16kB *)typefixed={proof_of_work_nonce_size:int;nonce_length:int;max_revelations_per_block:int;max_operation_data_length:int;}letfixed_encoding=letopenData_encodinginconv(func->(c.proof_of_work_nonce_size,c.nonce_length,c.max_revelations_per_block,c.max_operation_data_length))(fun(proof_of_work_nonce_size,nonce_length,max_revelations_per_block,max_operation_data_length)->{proof_of_work_nonce_size;nonce_length;max_revelations_per_block;max_operation_data_length;})(obj4(req"proof_of_work_nonce_size"uint8)(req"nonce_length"uint8)(req"max_revelations_per_block"uint8)(req"max_operation_data_length"int31))letfixed={proof_of_work_nonce_size;nonce_length;max_revelations_per_block;max_operation_data_length;}typeparametric={preserved_cycles:int;blocks_per_cycle:int32;blocks_per_commitment:int32;blocks_per_roll_snapshot:int32;blocks_per_voting_period:int32;time_between_blocks:Period_repr.tlist;endorsers_per_block:int;hard_gas_limit_per_operation:Z.t;hard_gas_limit_per_block:Z.t;proof_of_work_threshold:int64;tokens_per_roll:Tez_repr.t;michelson_maximum_type_size:int;seed_nonce_revelation_tip:Tez_repr.t;origination_burn:Tez_repr.t;block_security_deposit:Tez_repr.t;endorsement_security_deposit:Tez_repr.t;block_reward:Tez_repr.t;endorsement_reward:Tez_repr.t;cost_per_byte:Tez_repr.t;hard_storage_limit_per_operation:Z.t;}letdefault={preserved_cycles=5;blocks_per_cycle=4096l;blocks_per_commitment=32l;blocks_per_roll_snapshot=256l;blocks_per_voting_period=32768l;time_between_blocks=List.mapPeriod_repr.of_seconds_exn[60L;75L];endorsers_per_block=32;hard_gas_limit_per_operation=Z.of_int400_000;hard_gas_limit_per_block=Z.of_int4_000_000;proof_of_work_threshold=Int64.(sub(shift_left1L46)1L);tokens_per_roll=Tez_repr.(mul_exnone10_000);michelson_maximum_type_size=1000;seed_nonce_revelation_tip=beginmatchTez_repr.(one/?8L)with|Okc->c|Error_->assertfalseend;origination_burn=Tez_repr.of_mutez_exn257_000L;block_security_deposit=Tez_repr.(mul_exnone512);endorsement_security_deposit=Tez_repr.(mul_exnone64);block_reward=Tez_repr.(mul_exnone16);endorsement_reward=Tez_repr.(mul_exnone2);hard_storage_limit_per_operation=Z.of_int60_000;cost_per_byte=Tez_repr.of_mutez_exn1_000L;}moduleCompareListInt=Compare.List(Compare.Int)letparametric_encoding=letopenData_encodinginconv(func->((c.preserved_cycles,c.blocks_per_cycle,c.blocks_per_commitment,c.blocks_per_roll_snapshot,c.blocks_per_voting_period,c.time_between_blocks,c.endorsers_per_block,c.hard_gas_limit_per_operation,c.hard_gas_limit_per_block),((c.proof_of_work_threshold,c.tokens_per_roll,c.michelson_maximum_type_size,c.seed_nonce_revelation_tip,c.origination_burn,c.block_security_deposit,c.endorsement_security_deposit,c.block_reward),(c.endorsement_reward,c.cost_per_byte,c.hard_storage_limit_per_operation))))(fun((preserved_cycles,blocks_per_cycle,blocks_per_commitment,blocks_per_roll_snapshot,blocks_per_voting_period,time_between_blocks,endorsers_per_block,hard_gas_limit_per_operation,hard_gas_limit_per_block),((proof_of_work_threshold,tokens_per_roll,michelson_maximum_type_size,seed_nonce_revelation_tip,origination_burn,block_security_deposit,endorsement_security_deposit,block_reward),(endorsement_reward,cost_per_byte,hard_storage_limit_per_operation)))->{preserved_cycles;blocks_per_cycle;blocks_per_commitment;blocks_per_roll_snapshot;blocks_per_voting_period;time_between_blocks;endorsers_per_block;hard_gas_limit_per_operation;hard_gas_limit_per_block;proof_of_work_threshold;tokens_per_roll;michelson_maximum_type_size;seed_nonce_revelation_tip;origination_burn;block_security_deposit;endorsement_security_deposit;block_reward;endorsement_reward;cost_per_byte;hard_storage_limit_per_operation;})(merge_objs(obj9(req"preserved_cycles"uint8)(req"blocks_per_cycle"int32)(req"blocks_per_commitment"int32)(req"blocks_per_roll_snapshot"int32)(req"blocks_per_voting_period"int32)(req"time_between_blocks"(listPeriod_repr.encoding))(req"endorsers_per_block"uint16)(req"hard_gas_limit_per_operation"z)(req"hard_gas_limit_per_block"z))(merge_objs(obj8(req"proof_of_work_threshold"int64)(req"tokens_per_roll"Tez_repr.encoding)(req"michelson_maximum_type_size"uint16)(req"seed_nonce_revelation_tip"Tez_repr.encoding)(req"origination_burn"Tez_repr.encoding)(req"block_security_deposit"Tez_repr.encoding)(req"endorsement_security_deposit"Tez_repr.encoding)(req"block_reward"Tez_repr.encoding))(obj3(req"endorsement_reward"Tez_repr.encoding)(req"cost_per_byte"Tez_repr.encoding)(req"hard_storage_limit_per_operation"z))))typet={fixed:fixed;parametric:parametric;}letencoding=letopenData_encodinginconv(fun{fixed;parametric}->(fixed,parametric))(fun(fixed,parametric)->{fixed;parametric})(merge_objsfixed_encodingparametric_encoding)