12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667(*****************************************************************************)(* *)(* SPDX-License-Identifier: MIT *)(* Copyright (c) 2024 Functori <contact@functori.com> *)(* *)(*****************************************************************************)typeunsafe_patch=Increase_max_nb_ticksofint64typekind=Hardcoded|User_providedtypet=(unsafe_patch*kind)listletpatch_kinds=functionIncrease_max_nb_ticks_->[Kind.Wasm_2_0_0](* Patches for Etherlink PVM. *)letetherlink_patches=[(Increase_max_nb_ticks50_000_000_000_000L,Hardcoded)](* Add hardcoded etherlink addresses on various networks. *)letetherlink_addresses=["sr1Ghq66tYK9y3r8CC1Tf8i8m5nxh8nTvZEf"(* Etherlink on Mainnet *)]lethardcoded_patches_list=List.map(funaddr->(Address.of_b58check_exnaddr,etherlink_patches))etherlink_addressesletunsafe_patch_encoding=letopenData_encodinginunion[case(Tag0)~title:"increase_max_nb_tick"(obj1(req"increase_max_nb_tick"int64))(functionIncrease_max_nb_ticksticks->Someticks)(funticks->Increase_max_nb_ticksticks);]letpp_unsafe_patchfmt=function|Increase_max_nb_ticksnb->Format.fprintffmt"Increase maximum number of ticks to %#Ld"nbletmakekindrollup_addressuser_provided_patches=letopenResult_syntaxinlethardcoded_patches=List.assoc~equal:Address.equalrollup_addresshardcoded_patches_list|>Option.value~default:[]inletpatches=hardcoded_patches@List.map(funp->(p,User_provided))user_provided_patchesinlet+()=List.iter_e(fun(patch,_kind)->ifnot@@List.mem~equal:Kind.equalkind(patch_kindspatch)thenerror_with"Patch \"%a\" is not supported for rollup kind %a"pp_unsafe_patchpatchKind.ppkindelseOk())patchesinpatches