diff --git a/.lock b/.lock new file mode 100644 index 0000000..e69de29 diff --git a/crates.js b/crates.js new file mode 100644 index 0000000..7a066fc --- /dev/null +++ b/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["zksync_vm2","zksync_vm2_interface"]; \ No newline at end of file diff --git a/help.html b/help.html new file mode 100644 index 0000000..d0f8081 --- /dev/null +++ b/help.html @@ -0,0 +1 @@ +Help

Rustdoc help

Back
\ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..667ed65 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +Index of crates

List of all crates

\ No newline at end of file diff --git a/search-index.js b/search-index.js new file mode 100644 index 0000000..69b4b2e --- /dev/null +++ b/search-index.js @@ -0,0 +1,6 @@ +var searchIndex = new Map(JSON.parse('[\ +["zksync_vm2",{"t":"PGFPPPPPPPFFPGFPPFFFKPFKFCOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNMMNNNONNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOENNNNNNNNNNNNMONNONONNNNNONNNNNNMNNNNNNNNNONCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFPPFPPGGFFPFPPFFFFPPPFFGFPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFNNNNNNNNNNNNNNN","n":["Always","ExecutionEnd","FatPointer","IfEQ","IfGE","IfGT","IfGTOrLT","IfLE","IfLT","IfNotEQ","Instruction","ModeRequirements","Panicked","Predicate","Program","ProgramFinished","Reverted","Settings","Snapshot","StorageChange","StorageInterface","SuspendedOnHook","VirtualMachine","World","WorldDiff","addressing_modes","after","before","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","callframe","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","code_page","context_u128_register","cost_of_writing_storage","current_frame","decommit","decommit_code","decommitted_hashes","default","default","default_aa_code_hash","eq","eq","eq","eq","events","events_after","evm_interpreter_code_hash","flags","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from_add","from_and","from_aux_heap_read","from_aux_heap_store","from_aux_mutating","from_caller","from_code_address","from_context_meta","from_context_sp","from_context_u128","from_decommit","from_div","from_ergs_left","from_event","from_far_call","from_heap_read","from_heap_write","from_increment_tx_number","from_invalid","from_jump","from_l2_to_l1_message","from_mul","from_near_call","from_nop","from_or","from_panic","from_pointer_add","from_pointer_pack","from_pointer_read","from_pointer_shrink","from_pointer_sub","from_precompile_call","from_ret","from_revert","from_rotate_left","from_rotate_right","from_set_context_u128","from_shift_left","from_shift_right","from_storage_read","from_storage_write","from_sub","from_this","from_transient_storage_read","from_transient_storage_write","from_words","from_xor","get_storage_changes","get_storage_changes_after","get_storage_state","get_transient_storage","get_transient_storage_state","hash","hook_address","interface","into","into","into","into","into","into","into","into","into","into","into","into_u256","is_free_storage_slot","is_initial","l2_to_l1_logs","l2_to_l1_logs_after","length","make_snapshot","memory_page","new","new","new","none","number_of_callframes","offset","pop_snapshot","pubdata","pubdata_costs","read_heap_byte","read_heap_u256","read_register","read_storage","resume_with_additional_gas_limit","rollback","run","set_context_u128_register","set_flags","set_pubdata","set_register","set_transaction_number","snapshot","start","storage_refunds","testonly","to_owned","to_owned","to_owned","to_owned","to_owned","transaction_number","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","world_diff","write_heap_u256","write_transient_storage","AbsoluteStack","AbsoluteStack","AbsoluteStack","AdvanceStackPointer","AdvanceStackPointer","AdvanceStackPointer","AnyDestination","AnySource","Arguments","CodePage","CodePage","Immediate1","Immediate1","Immediate1","Immediate2","NotRegisterOrImmediate","Register","Register1","Register1","Register1","Register1","Register2","RegisterAndImmediate","RegisterOrImmediate","RelativeStack","RelativeStack","RelativeStack","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","immediate","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","new","new","register","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","TestWorld","borrow","borrow_mut","cost_of_writing_storage","decommit","decommit_code","fmt","from","into","is_free_storage_slot","new","read_storage","try_from","try_into","type_id","vzip"],"q":[[0,"zksync_vm2"],[262,"zksync_vm2::addressing_modes"],[518,"zksync_vm2::testonly"],[534,"zksync_vm2::vm"],[535,"zksync_vm2_interface::state_interface"],[536,"zksync_vm2_interface::tracer_interface"],[537,"zksync_vm2::program"],[538,"zksync_vm2::mode_requirements"],[539,"zksync_vm2::predication"],[540,"zksync_vm2::world_diff"],[541,"primitive_types"],[542,"core::option"],[543,"alloc::vec"],[544,"core::iter::traits::iterator"],[545,"zksync_vm2::instruction"],[546,"core::fmt"],[547,"zksync_vm2::fat_pointer"],[548,"core::hash"],[549,"core::result"],[550,"core::any"],[551,"ethereum_types"]],"i":[9,0,0,9,9,9,9,9,9,9,0,0,26,0,0,26,26,0,0,0,0,26,0,0,0,0,27,27,30,7,33,26,8,9,10,3,22,11,27,30,7,33,26,8,9,10,3,22,11,27,3,7,8,9,10,11,7,8,9,10,11,7,8,8,9,9,10,11,7,3,16,3,19,19,22,9,22,10,7,26,11,27,3,22,10,3,30,7,33,26,8,9,10,3,22,11,27,30,7,33,33,33,26,8,9,10,3,22,11,27,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,7,30,22,22,3,3,3,9,10,0,30,7,33,26,8,9,10,3,22,11,27,33,16,27,3,22,33,3,33,7,8,3,8,3,33,3,3,22,3,3,3,16,3,3,3,3,3,3,3,3,22,33,22,0,7,8,9,10,11,3,30,7,33,26,8,9,10,3,22,11,27,30,7,33,26,8,9,10,3,22,11,27,30,7,33,26,8,9,10,3,22,11,27,30,7,33,26,8,9,10,3,22,11,27,3,3,3,0,35,37,0,35,37,0,0,0,0,35,0,35,39,0,0,0,0,35,39,37,0,0,0,0,35,37,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,40,36,41,42,53,54,55,43,56,57,35,39,37,40,36,41,42,53,54,55,43,56,57,35,39,37,40,40,36,36,41,41,42,42,53,53,54,54,55,55,43,43,56,56,57,57,35,35,39,39,37,37,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,38,40,36,41,42,53,54,55,43,56,57,35,35,35,35,35,35,35,39,39,39,58,37,37,37,37,37,53,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,38,57,53,40,36,41,42,53,54,55,43,56,57,35,39,37,38,40,36,41,42,53,54,55,43,56,57,35,39,39,58,37,38,40,36,41,42,53,54,55,43,56,57,35,35,35,35,35,35,35,39,39,39,58,37,37,37,37,37,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,38,40,36,41,42,53,54,55,43,56,57,35,39,58,37,0,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59],"f":"````````````````````````````{{{b{c}}}{{b{e}}}{}{}}0000000000{{{b{dc}}}{{b{de}}}{}{}}0000000000{{{b{d{f{ce}}}}h}{{`{j}}}l{}}{{{b{{n{ce}}}}}{{n{ce}}}{}{}}{{{b{A`}}}A`}{{{b{Ab}}}Ab}{{{b{Ad}}}Ad}{{{b{Af}}}Af}{{{b{c}}{b{de}}}Ah{}{}}0000{{{b{c}}}Ah{}}000000{{{b{{n{ce}}}}}{{b{{Al{Aj}}}}}{}{}}{{{b{{f{ce}}}}}Anl{}}{{{b{dB`}}{Bb{Aj}}Aj}Bd}{{{b{d{f{ce}}}}}{{`{j}}}l{}}{{{b{dBf}}Aj}{{n{cBf}}}l}{{{b{dBf}}Aj}{{Bj{Bh}}}}{{{b{Bl}}}{{`{{C`{}{{Bn{Aj}}}}}}}}{{}Ab}{{}Bl}`{{{b{{n{ce}}}}{b{{n{ce}}}}}Cb{}{}}{{{b{Cd}}{b{Cd}}}Cb}{{{b{Af}}{b{Af}}}Cb}{{{b{Cf}}{b{Cf}}}Cb}{{{b{{f{ce}}}}}{{`{{C`{}{{Bn{Ch}}}}}}}l{}}{{{b{Bl}}{b{Af}}}{{b{{Al{Ch}}}}}}`{{{b{{f{ce}}}}}Cjl{}}{{{b{{Cl{ce}}}}{b{dCn}}}D`{}{}}{{{b{{n{ce}}}}{b{dCn}}}D`{}{}}{{{b{Db}}{b{dCn}}}D`}{{{b{Cd}}{b{dCn}}}D`}{{{b{A`}}{b{dCn}}}D`}{{{b{Ab}}{b{dCn}}}D`}{{{b{Ad}}{b{dCn}}}D`}{{{b{{f{ce}}}}{b{dCn}}}D`DdDd}{{{b{Bl}}{b{dCn}}}D`}{{{b{Af}}{b{dCn}}}D`}{{{b{Cf}}{b{dCn}}}D`}{cc{}}0{AjDb}1{{{b{dAj}}}{{b{dDb}}}}22222222{{DfDhDjDlCbCb}{{Cl{ce}}}l{{Bf{c}}}}0{{DnE`{Bb{Dh}}Dl}{{Cl{ce}}}l{}}{{DnDh{Bb{E`}}Dl}{{Cl{ce}}}l{}}{Dl{{Cl{ce}}}l{}}{{E`Dl}{{Cl{ce}}}l{}}0000{{E`DhE`Dl}{{Cl{ce}}}l{{Bf{c}}}}{{DfDhDjDhDlCbCb}{{Cl{ce}}}l{{Bf{c}}}}2{{E`DhCbDl}{{Cl{ce}}}l{}}{{E`DhEbCbCbDl}{{Cl{ce}}}l{{Bf{c}}}}7{{DnDh{Bb{E`}}DlCb}{{Cl{ce}}}l{}}6{{}{{Cl{ce}}}l{}}{{DfE`Dl}{{Cl{ce}}}l{}}45{{E`EbEdDl}{{Cl{ce}}}l{}}{{EfEfDl}{{Cl{ce}}}l{}}={{{Bb{Eb}}Dl}{{Cl{ce}}}l{}}{{DfDhDjDlCb}{{Cl{ce}}}l{}}0{{E`E`{Bb{Dh}}Dl}{{Cl{ce}}}l{}}11{{E`DhE`Dl}{{Cl{ce}}}l{}}{{E`{Bb{Eb}}Dl}{{Cl{ce}}}l{}}0{{DfDhDjDlCbCb}{{Cl{ce}}}l{{Bf{c}}}}0?00{{E`E`Dl}{{Cl{ce}}}l{{Bf{c}}}}{{E`DhDl}{{Cl{ce}}}l{{Bf{c}}}}2{{E`Dl}{{Cl{ce}}}l{}}21{{{Bj{Aj}}Cb}{{n{ce}}}l{{Bf{c}}}}4{{{b{Bl}}}{{`{{C`{}{{Bn{{Ej{{Ej{EhAj}}{Ej{{Bb{Aj}}Aj}}}}}}}}}}}}{{{b{Bl}}{b{Af}}}{{`{{C`{}{{Bn{{Ej{{Ej{EhAj}}Cf}}}}}}}}}}{{{b{{f{ce}}}}}{{`{{C`{}{{Bn{{Ej{{Ej{EhAj}}Aj}}}}}}}}}l{}}{{{b{{f{ce}}}}EhAj}Ajl{}}1{{{b{Ab}}{b{dc}}}AhEl}``{ce{}{}}0000000000{DbAj}{{{b{B`}}{b{Eh}}{b{Aj}}}Cb}`{{{b{{f{ce}}}}}{{`{{C`{}{{Bn{En}}}}}}}l{}}{{{b{Bl}}{b{Af}}}{{b{{Al{En}}}}}}`{{{b{d{f{ce}}}}}Ahl{{Bf{c}}}}`{{{b{{Al{Bh}}}}Cb}{{n{ce}}}l{{Bf{c}}}}{{CbCb}A`}{{Eh{n{ce}}Eh{b{{Al{Bh}}}}BdAd}{{f{ce}}}l{{Bf{c}}}}{{}A`}{{{b{{f{ce}}}}}hl{}}`5{{{b{{f{ce}}}}}F`l{}}{{{b{Bl}}}{{b{{Al{F`}}}}}}{{{b{{f{ce}}}}FbBd}Bhl{}}{{{b{{f{ce}}}}FbBd}Ajl{}}{{{b{{f{ce}}}}Bh}{{Ej{AjCb}}}l{}}{{{b{dB`}}EhAj}{{Bb{Aj}}}}{{{b{d{f{ce}}}}{b{de}}{b{dc}}Bd}{{Bb{{Ej{BdCd}}}}}l{{Bf{c}}}}<{{{b{d{f{ce}}}}{b{de}}{b{dc}}}Cdl{{Bf{c}}}}{{{b{d{f{ce}}}}An}Ahl{}}{{{b{d{f{ce}}}}Cj}Ahl{}}{{{b{d{f{ce}}}}F`}Ahl{}}{{{b{d{f{ce}}}}BhAjCb}Ahl{}}{{{b{d{f{ce}}}}Fd}Ahl{}}{{{b{Bl}}}Af}`{{{b{Bl}}}{{b{{Al{Bd}}}}}}`{{{b{c}}}e{}{}}0000{{{b{{f{ce}}}}}Fdl{}}{c{{Ff{e}}}{}{}}000000000000000000000{{{b{c}}}Fh{}}0000000000{ce{}{}}0000000000{{{b{{f{ce}}}}}{{b{Bl}}}l{{Bf{c}}}}{{{b{d{f{ce}}}}FbBdAj}Ahl{}}{{{b{d{f{ce}}}}EhAjAj}Ahl{}}```````````````````````````{{{b{c}}}{{b{e}}}{}{}}00000000000000{{{b{dc}}}{{b{de}}}{}{}}00000000000000{{{b{E`}}}E`}{{{b{Dh}}}Dh}{{{b{Eb}}}Eb}{{{b{Ed}}}Ed}{{{b{Fj}}}Fj}{{{b{Fl}}}Fl}{{{b{Fn}}}Fn}{{{b{Ef}}}Ef}{{{b{G`}}}G`}{{{b{Gb}}}Gb}{{{b{Df}}}Df}{{{b{Dn}}}Dn}{{{b{Dj}}}Dj}{{{b{c}}{b{de}}}Ah{}{}}000000000000{{{b{c}}}Ah{}}0000000000000000000000000{{{b{Dl}}{b{dCn}}}D`}{{{b{E`}}{b{dCn}}}D`}{{{b{Dh}}{b{dCn}}}D`}{{{b{Eb}}{b{dCn}}}D`}{{{b{Ed}}{b{dCn}}}D`}{{{b{Fj}}{b{dCn}}}D`}{{{b{Fl}}{b{dCn}}}D`}{{{b{Fn}}{b{dCn}}}D`}{{{b{Ef}}{b{dCn}}}D`}{{{b{G`}}{b{dCn}}}D`}{{{b{Gb}}{b{dCn}}}D`}{{{b{Df}}{b{dCn}}}D`}{{{b{Dn}}{b{dCn}}}D`}{{{b{Gd}}{b{dCn}}}D`}{{{b{Dj}}{b{dCn}}}D`}{cc{}}0000000000{FnDf}1{EfDf}{FlDf}{G`Df}{EbDf}{E`Df}{EbDn}{E`Dn}88{E`Dj}{EfDj}:{FnDj}{FlDj}`{ce{}{}}00000000000000{{AbBdA`}Dl}{BhGb}`{{{b{c}}}e{}{}}000000000000{c{{Ff{e}}}{}{}}000000000000{Df{{Ff{Dnc}}}{}}11111111111111{Df{{Ff{G`c}}}{}}{Df{{Ff{Efc}}}{}}{Df{{Ff{Fnc}}}{}}{Df{{Ff{Flc}}}{}}{Df{{Ff{E`c}}}{}}{Df{{Ff{Ebc}}}{}}7{Dn{{Ff{Ebc}}}{}}{Dn{{Ff{E`c}}}{}}99{Dj{{Ff{E`c}}}{}}{Dj{{Ff{Flc}}}{}}{Dj{{Ff{Fnc}}}{}}{Dj{{Ff{Efc}}}{}}{{{b{c}}}Fh{}}00000000000000{ce{}{}}00000000000000`{{{b{c}}}{{b{e}}}{}{}}{{{b{dc}}}{{b{de}}}{}{}}{{{b{d{Gf{c}}}}{Bb{Aj}}Aj}Bd{}}{{{b{d{Gf{c}}}}Aj}{{n{c{Gf{c}}}}}l}{{{b{d{Gf{c}}}}Aj}{{Bj{Bh}}}l}{{{b{{Gf{c}}}}{b{dCn}}}D`Dd}{cc{}}7{{{b{{Gf{c}}}}{b{Eh}}{b{Aj}}}Cb{}}{{{b{{Al{{Ej{Gh{n{c{Gf{c}}}}}}}}}}}{{Gf{c}}}l}{{{b{d{Gf{c}}}}EhAj}{{Bb{Aj}}}{}}{c{{Ff{e}}}{}{}}0<;","D":"AHj","p":[[1,"reference"],[0,"mut"],[5,"VirtualMachine",0,534],[1,"usize"],[10,"CallframeInterface",535],[10,"Tracer",536],[5,"Program",0,537],[5,"ModeRequirements",0,538],[6,"Predicate",0,539],[5,"Settings",0,534],[5,"Snapshot",0,540],[1,"unit"],[5,"U256",541],[1,"slice"],[1,"u128"],[10,"StorageInterface",0],[6,"Option",542],[1,"u32"],[10,"World",0],[1,"u8"],[5,"Vec",543],[5,"WorldDiff",0,540],[17,"Item"],[10,"Iterator",544],[1,"bool"],[6,"ExecutionEnd",0,545],[5,"StorageChange",0,540],[5,"Event",535],[5,"Flags",535],[5,"Instruction",0,545],[5,"Formatter",546],[8,"Result",546],[5,"FatPointer",0,547],[10,"Debug",546],[6,"AnySource",262],[5,"Register2",262],[6,"AnyDestination",262],[5,"Arguments",262],[6,"RegisterOrImmediate",262],[5,"Register1",262],[5,"Immediate1",262],[5,"Immediate2",262],[5,"AdvanceStackPointer",262],[5,"H160",541],[1,"tuple"],[10,"Hasher",548],[5,"L2ToL1Log",535],[1,"i32"],[5,"HeapId",535],[1,"u16"],[6,"Result",549],[5,"TypeId",550],[5,"RegisterAndImmediate",262],[5,"AbsoluteStack",262],[5,"RelativeStack",262],[5,"CodePage",262],[5,"Register",262],[5,"NotRegisterOrImmediate",262],[5,"TestWorld",518],[8,"Address",551]],"r":[[1,545],[2,547],[10,545],[11,538],[13,539],[14,537],[17,534],[18,540],[19,540],[22,534],[24,540]],"b":[[99,"impl-From%3CU256%3E-for-FatPointer"],[101,"impl-From%3C%26mut+U256%3E-for-%26mut+FatPointer"],[397,"impl-From%3CRelativeStack%3E-for-AnySource"],[399,"impl-From%3CAdvanceStackPointer%3E-for-AnySource"],[400,"impl-From%3CAbsoluteStack%3E-for-AnySource"],[401,"impl-From%3CCodePage%3E-for-AnySource"],[402,"impl-From%3CImmediate1%3E-for-AnySource"],[403,"impl-From%3CRegister1%3E-for-AnySource"],[404,"impl-From%3CImmediate1%3E-for-RegisterOrImmediate"],[405,"impl-From%3CRegister1%3E-for-RegisterOrImmediate"],[408,"impl-From%3CRegister1%3E-for-AnyDestination"],[409,"impl-From%3CAdvanceStackPointer%3E-for-AnyDestination"],[411,"impl-From%3CRelativeStack%3E-for-AnyDestination"],[412,"impl-From%3CAbsoluteStack%3E-for-AnyDestination"],[473,"impl-TryInto%3CCodePage%3E-for-AnySource"],[474,"impl-TryInto%3CAdvanceStackPointer%3E-for-AnySource"],[475,"impl-TryInto%3CRelativeStack%3E-for-AnySource"],[476,"impl-TryInto%3CAbsoluteStack%3E-for-AnySource"],[477,"impl-TryInto%3CRegister1%3E-for-AnySource"],[478,"impl-TryInto%3CImmediate1%3E-for-AnySource"],[480,"impl-TryInto%3CImmediate1%3E-for-RegisterOrImmediate"],[481,"impl-TryInto%3CRegister1%3E-for-RegisterOrImmediate"],[484,"impl-TryInto%3CRegister1%3E-for-AnyDestination"],[485,"impl-TryInto%3CAbsoluteStack%3E-for-AnyDestination"],[486,"impl-TryInto%3CRelativeStack%3E-for-AnyDestination"],[487,"impl-TryInto%3CAdvanceStackPointer%3E-for-AnyDestination"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAFEBGgAdACcARgAAAEgAAABMAAEATwAEAFYACwBkAAAAZgAAAKAAAwClAAAAtAAAAL0AAADAAAAAwgACAMkABADSADEABQEBACIBYACOAQAAkAEGAJkBAQCcAQEAsQFVAAgCBQAQAgAAEgIEAA=="}],\ +["zksync_vm2_interface",{"t":"PPPPPPKGPPPGPPPPPPFPTTTPFFPPPPPFPPPPPPPGKPPPPPPPPPGPPPPPPPPPKPPPPPPKPPTPMONNNMMNNNNNNNNNNNNNNNNNNMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMMMNNNNNNNOMMMNNNNNNNNNNNNNNNNMMMMONNNNMMNNNNNNNNNOMMOMOOMOMNNCMMMMMMMMMMMMMMMMMMMMMMOOMMNNNNNNNNMNNNNNNNNNNNNNNNNOONNNNNNNNOONNNNNNNNMMMFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFKKTTFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN","n":["Add","And","AuxHeapRead","AuxHeapWrite","AuxMutating0","Caller","CallframeInterface","CallingMode","CodeAddress","ContextMeta","ContextU128","CycleStats","Decommit","Decommit","Delegate","Div","EcRecover","ErgsLeft","Event","Event","FIRST","FIRST_AUX","FIRST_CALLDATA","FarCall","Flags","HeapId","HeapRead","HeapWrite","IncrementTxNumber","Jump","Keccak256","L2ToL1Log","L2ToL1Message","Mimic","Mul","NearCall","Nop","Normal","Normal","Opcode","OpcodeType","Or","Panic","PointerAdd","PointerPack","PointerRead","PointerShrink","PointerSub","PrecompileCall","Ret","ReturnType","Revert","RotateLeft","RotateRight","SP","Secp256r1Verify","SetContextU128","Sha256","ShiftLeft","ShiftRight","StateInterface","StorageRead","StorageRead","StorageWrite","StorageWrite","Sub","This","Tracer","TransientStorageRead","TransientStorageWrite","VALUE","Xor","address","address","after_instruction","after_instruction","as_u32","aux_heap","aux_heap_bound","before_instruction","before_instruction","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","caller","callframe","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","clone_to_uninit","code_address","context_u128","context_u128_register","current_frame","eq","eq","eq","eq","eq","eq","eq","equal","events","exception_handler","flags","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","gas","get_storage_state","get_transient_storage","get_transient_storage_state","greater","hash","hash","hash","hash","heap","heap_bound","into","into","into","into","into","into","into","into","is_failure","is_first","is_kernel","is_near_call","is_service","is_static","key","key","l2_to_l1_logs","less_than","number_of_callframes","on_extra_prover_cycles","on_extra_prover_cycles","opcodes","program_counter","pubdata","read_contract_code","read_heap_byte","read_heap_u256","read_register","read_stack","set_address","set_aux_heap_bound","set_caller","set_code_address","set_context_u128","set_context_u128_register","set_exception_handler","set_flags","set_gas","set_heap_bound","set_program_counter","set_pubdata","set_register","set_stack_pointer","set_transaction_number","shard_id","shard_id","stack_pointer","stipend","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","transaction_number","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","tx_number","tx_number","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","value","value","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","write_heap_u256","write_stack","write_transient_storage","Add","And","AuxHeapRead","AuxHeapWrite","AuxMutating0","Caller","CodeAddress","ContextMeta","ContextU128","Decommit","Delegate","Div","ErgsLeft","Event","FarCall","HeapRead","HeapWrite","IncrementTxNumber","Jump","L2ToL1Message","Mimic","Mul","NearCall","Nop","Normal","Or","Panic","PointerAdd","PointerPack","PointerRead","PointerShrink","PointerSub","PrecompileCall","Ret","Revert","RotateLeft","RotateRight","SP","SetContextU128","ShiftLeft","ShiftRight","StorageRead","StorageWrite","Sub","This","TransientStorageRead","TransientStorageWrite","TypeLevelCallingMode","TypeLevelReturnType","VALUE","VALUE","Xor","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip"],"q":[[0,"zksync_vm2_interface"],[269,"zksync_vm2_interface::opcodes"],[753,"zksync_vm2_interface::state_interface"],[754,"primitive_types"],[755,"zksync_vm2_interface::tracer_interface"],[756,"core::iter::traits::iterator"],[757,"core::fmt"],[758,"core::hash"],[759,"core::option"],[760,"core::result"],[761,"core::any"],[762,"zksync_vm2_interface::tracer_interface::opcodes"]],"i":[14,14,14,14,14,14,0,0,14,14,14,0,14,17,15,14,17,14,0,14,8,8,8,14,0,0,14,14,14,14,17,0,14,15,14,14,14,15,16,0,0,14,16,14,14,14,14,14,14,14,0,16,14,14,14,17,14,17,14,14,0,14,17,14,17,14,14,0,14,14,84,14,1,13,5,5,8,1,1,5,5,11,8,12,13,14,15,16,17,11,8,12,13,14,15,16,17,1,7,11,8,12,13,14,15,16,17,11,8,12,13,14,15,16,17,11,11,8,8,12,12,13,13,14,14,15,15,16,16,17,17,1,1,7,7,11,8,12,13,14,15,16,11,7,1,7,11,8,12,13,14,15,16,17,11,8,12,13,14,15,16,17,1,7,7,7,11,11,14,15,16,1,1,11,8,12,13,14,15,16,17,16,12,1,1,13,1,12,13,7,11,7,5,5,0,1,7,1,7,7,7,1,1,1,1,1,1,7,1,7,1,1,1,7,7,1,7,12,13,1,1,11,8,12,13,14,15,16,17,7,11,8,12,13,14,15,16,17,11,8,12,13,14,15,16,17,12,13,11,8,12,13,14,15,16,17,12,13,11,8,12,13,14,15,16,17,7,1,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,78,0,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,79,80,81,82,83],"f":"````````````````````````````````````````````````````````````````````````{{{d{b}}}f}`{{{d{hj}}{d{hc}}}ln}0{A`Ab}{{{d{b}}}A`}{{{d{b}}}Ab}33{{{d{c}}}{{d{e}}}{}{}}0000000{{{d{hc}}}{{d{he}}}{}{}}00000006{{{d{hn}}Ad}{{`{b}}}}{{{d{Af}}}Af}{{{d{A`}}}A`}{{{d{Ah}}}Ah}{{{d{Aj}}}Aj}{{{d{Al}}}Al}{{{d{An}}}An}{{{d{B`}}}B`}{{{d{Bb}}}Bb}{{{d{c}}{d{he}}}l{}{}}0000000{{{d{c}}}l{}}000000000000000{{{d{b}}}f}{{{d{b}}}Bd}{{{d{n}}}Bd}{{{d{hn}}}{{`{b}}}}{{{d{Af}}{d{Af}}}Bf}{{{d{A`}}{d{A`}}}Bf}{{{d{Ah}}{d{Ah}}}Bf}{{{d{Aj}}{d{Aj}}}Bf}{{{d{Al}}{d{Al}}}Bf}{{{d{An}}{d{An}}}Bf}{{{d{B`}}{d{B`}}}Bf}`{{{d{n}}}{{`{{Bj{}{{Bh{Ah}}}}}}}}{{{d{b}}}Bl}{{{d{n}}}Af}{{{d{Af}}{d{hBn}}}C`}{{{d{A`}}{d{hBn}}}C`}{{{d{Ah}}{d{hBn}}}C`}{{{d{Aj}}{d{hBn}}}C`}{{{d{Al}}{d{hBn}}}C`}{{{d{An}}{d{hBn}}}C`}{{{d{B`}}{d{hBn}}}C`}{{{d{Bb}}{d{hBn}}}C`}{cc{}}0000000{{{d{b}}}Ab}{{{d{n}}}{{`{{Bj{}{{Bh{{Cd{{Cd{fCb}}Cb}}}}}}}}}}{{{d{n}}fCb}Cb}1`{{{d{Af}}{d{hc}}}lCf}{{{d{Al}}{d{hc}}}lCf}{{{d{An}}{d{hc}}}lCf}{{{d{B`}}{d{hc}}}lCf}{{{d{b}}}A`}7{ce{}{}}0000000{{{d{B`}}}Bf}`{{{d{b}}}Bf}0`0``{{{d{n}}}{{`{{Bj{}{{Bh{Aj}}}}}}}}`{{{d{n}}}Ad}{{{d{hj}}Bb}l}0`{{{d{b}}}{{Ch{Bl}}}}{{{d{n}}}Cj}{{{d{b}}Bl}Cb}{{{d{n}}A`Ab}Cl}{{{d{n}}A`Ab}Cb}{{{d{n}}Cl}{{Cd{CbBf}}}}{{{d{b}}Bl}{{Cd{CbBf}}}}{{{d{hb}}f}l}{{{d{hb}}Ab}l}11{{{d{hb}}Bd}l}{{{d{hn}}Bd}l}{{{d{hb}}Bl}l}{{{d{hn}}Af}l}441{{{d{hn}}Cj}l}{{{d{hn}}ClCbBf}l}3{{{d{hn}}Bl}l}``{{{d{b}}}Bl}{{{d{b}}}Ab}{{{d{c}}}e{}{}}0000000{{{d{n}}}Bl}{c{{Cn{e}}}{}{}}000000000000000``{{{d{c}}}D`{}}0000000``{ce{}{}}0000000{{{d{hn}}A`AbCb}l}{{{d{hb}}BlCbBf}l}{{{d{hn}}fCbCb}l}````````````````````````````````````````````````````{{{d{c}}}{{d{e}}}{}{}}00000000000000000000000000000000000000000000000{{{d{hc}}}{{d{he}}}{}{}}00000000000000000000000000000000000000000000000{{{d{Db}}{d{hBn}}}C`}{{{d{Dd}}{d{hBn}}}C`}{{{d{Df}}{d{hBn}}}C`}{{{d{Dh}}{d{hBn}}}C`}{{{d{Dj}}{d{hBn}}}C`}{{{d{Dl}}{d{hBn}}}C`}{{{d{Dn}}{d{hBn}}}C`}{{{d{E`}}{d{hBn}}}C`}{{{d{Eb}}{d{hBn}}}C`}{{{d{Ed}}{d{hBn}}}C`}{{{d{Ef}}{d{hBn}}}C`}{{{d{Eh}}{d{hBn}}}C`}{{{d{Ej}}{d{hBn}}}C`}{{{d{El}}{d{hBn}}}C`}{{{d{En}}{d{hBn}}}C`}{{{d{F`}}{d{hBn}}}C`}{{{d{Fb}}{d{hBn}}}C`}{{{d{Fd}}{d{hBn}}}C`}{{{d{Ff}}{d{hBn}}}C`}{{{d{Fh}}{d{hBn}}}C`}{{{d{Fj}}{d{hBn}}}C`}{{{d{Fl}}{d{hBn}}}C`}{{{d{Fn}}{d{hBn}}}C`}{{{d{G`}}{d{hBn}}}C`}{{{d{Gb}}{d{hBn}}}C`}{{{d{Gd}}{d{hBn}}}C`}{{{d{Gf}}{d{hBn}}}C`}{{{d{Gh}}{d{hBn}}}C`}{{{d{Gj}}{d{hBn}}}C`}{{{d{Gl}}{d{hBn}}}C`}{{{d{Gn}}{d{hBn}}}C`}{{{d{H`}}{d{hBn}}}C`}{{{d{Hb}}{d{hBn}}}C`}{{{d{Hd}}{d{hBn}}}C`}{{{d{Hf}}{d{hBn}}}C`}{{{d{Hh}}{d{hBn}}}C`}{{{d{Hj}}{d{hBn}}}C`}{{{d{Hl}}{d{hBn}}}C`}{{{d{Hn}}{d{hBn}}}C`}{{{d{I`}}{d{hBn}}}C`}{{{d{Ib}}{d{hBn}}}C`}{{{d{{Id{c}}}}{d{hBn}}}C`{IfIh}}{{{d{{Ij{c}}}}{d{hBn}}}C`{IfIl}}{{{d{In}}{d{hBn}}}C`}{{{d{J`}}{d{hBn}}}C`}{{{d{Jb}}{d{hBn}}}C`}{{{d{Jd}}{d{hBn}}}C`}{{{d{Jf}}{d{hBn}}}C`}{cc{}}00000000000000000000000000000000000000000000000{ce{}{}}00000000000000000000000000000000000000000000000{c{{Cn{e}}}{}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{c}}}D`{}}00000000000000000000000000000000000000000000000222222222222222222222222222222222222222222222222","D":"BAh","p":[[10,"CallframeInterface",0,753],[1,"reference"],[5,"H160",754],[0,"mut"],[10,"Tracer",0,755],[1,"unit"],[10,"StateInterface",0,753],[5,"HeapId",0,753],[1,"u32"],[1,"usize"],[5,"Flags",0,753],[5,"Event",0,753],[5,"L2ToL1Log",0,753],[6,"Opcode",0,755],[6,"CallingMode",0,755],[6,"ReturnType",0,755],[6,"CycleStats",0,755],[1,"u128"],[1,"bool"],[17,"Item"],[10,"Iterator",756],[1,"u16"],[5,"Formatter",757],[8,"Result",757],[5,"U256",754],[1,"tuple"],[10,"Hasher",758],[6,"Option",759],[1,"i32"],[1,"u8"],[6,"Result",760],[5,"TypeId",761],[5,"Nop",269,762],[5,"Add",269,762],[5,"Sub",269,762],[5,"And",269,762],[5,"Or",269,762],[5,"Xor",269,762],[5,"ShiftLeft",269,762],[5,"ShiftRight",269,762],[5,"RotateLeft",269,762],[5,"RotateRight",269,762],[5,"Mul",269,762],[5,"Div",269,762],[5,"NearCall",269,762],[5,"Jump",269,762],[5,"Event",269,762],[5,"L2ToL1Message",269,762],[5,"Decommit",269,762],[5,"This",269,762],[5,"Caller",269,762],[5,"CodeAddress",269,762],[5,"ErgsLeft",269,762],[5,"SP",269,762],[5,"ContextMeta",269,762],[5,"ContextU128",269,762],[5,"SetContextU128",269,762],[5,"IncrementTxNumber",269,762],[5,"AuxMutating0",269,762],[5,"PrecompileCall",269,762],[5,"HeapRead",269,762],[5,"HeapWrite",269,762],[5,"AuxHeapRead",269,762],[5,"AuxHeapWrite",269,762],[5,"PointerRead",269,762],[5,"PointerAdd",269,762],[5,"PointerSub",269,762],[5,"PointerPack",269,762],[5,"PointerShrink",269,762],[5,"StorageRead",269,762],[5,"StorageWrite",269,762],[5,"TransientStorageRead",269,762],[5,"TransientStorageWrite",269,762],[5,"FarCall",269,762],[10,"Debug",757],[10,"TypeLevelCallingMode",269,762],[5,"Ret",269,762],[10,"TypeLevelReturnType",269,762],[5,"Normal",269,762],[5,"Delegate",269,762],[5,"Mimic",269,762],[5,"Revert",269,762],[5,"Panic",269,762],[10,"OpcodeType",0]],"r":[[6,753],[7,755],[11,755],[18,753],[24,753],[25,753],[31,753],[39,755],[40,755],[50,755],[60,753],[67,755],[194,755],[269,762],[270,762],[271,762],[272,762],[273,762],[274,762],[275,762],[276,762],[277,762],[278,762],[279,762],[280,762],[281,762],[282,762],[283,762],[284,762],[285,762],[286,762],[287,762],[288,762],[289,762],[290,762],[291,762],[292,762],[293,762],[294,762],[295,762],[296,762],[297,762],[298,762],[299,762],[300,762],[301,762],[302,762],[303,762],[304,762],[305,762],[306,762],[307,762],[308,762],[309,762],[310,762],[311,762],[312,762],[313,762],[314,762],[315,762],[316,762],[317,762],[320,762]],"b":[],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAOUBHwABAAUACQACAA0AAAAQAAAAEgAAABQAAAAYAAAAGwADACEAAAAjAAIAKgAAACwABgA1AAIAOQAAADsAAQA+AAAAQAAAAEIAAQBFAAEASAAAAFIADwBkAB8AiAAGAJMABwCoAAMA3gAHAOcADwD5AAcAAwEHAEIBjwAyAr8A"}]\ +]')); +if (typeof exports !== 'undefined') exports.searchIndex = searchIndex; +else if (window.initSearch) window.initSearch(searchIndex); diff --git a/search.desc/zksync_vm2/zksync_vm2-desc-0-.js b/search.desc/zksync_vm2/zksync_vm2-desc-0-.js new file mode 100644 index 0000000..630742c --- /dev/null +++ b/search.desc/zksync_vm2/zksync_vm2-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("zksync_vm2", 0, "High-Performance ZKsync Era VM\nAlways execute the associated instruction.\nVM stop reason returned from VirtualMachine::run().\nFat pointer to a heap location.\nExecute the associated instruction if the “equal” …\nExecute the associated instruction if either of “greater …\nExecute the associated instruction if the “greater than…\nExecute the associated instruction if either of “less …\nExecute the associated instruction if either of “less …\nExecute the associated instruction if the “less than” …\nExecute the associated instruction if the “equal” …\nSingle EraVM instruction (an opcode + Arguments).\nVM execution mode requirements (kernel only, not in static …\nThe executed program has panicked.\nPredicate for an instruction. Encoded so that comparing it …\nCompiled EraVM bytecode.\nThe executed program has finished and returned the …\nThe executed program has reverted returning the specified …\nVirtualMachine settings.\nOpaque snapshot of a WorldDiff output by its eponymous …\nChange in a single storage slot.\nVM storage access operations.\nReturned when the bootloader writes to the heap location …\nHigh-performance out-of-circuit EraVM implementation.\nEncapsulates VM interaction with the external world. This …\nPending modifications to the global state that are …\nAddressing modes supported by EraVM.\nValue written to the slot.\nValue before the slot was written to. None if the slot was …\nReturns a reference to the code page of this program.\nComputes the cost of writing a storage slot.\nLoads a bytecode with the specified hash.\nLoads bytecode bytes for the decommit opcode.\nReturns hashes of decommitted contract bytecodes in no …\nBytecode hash of the default account abstraction contract.\nReturns events emitted after the specified snapshot was …\nBytecode hash of the EVM interpreter.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates Add instruction with the provided params.\nCreates And instruction with the provided params.\nCreates an AuxHeapRead instruction with the provided …\nCreates an AuxHeapWrite instruction with the provided …\nCreates an AuxMutating0 instruction with the provided …\nCreates a Caller instruction with the provided params.\nCreates a CodeAddress instruction with the provided params.\nCreates a ContextMeta instruction with the provided params.\nCreates an SP instruction with the provided params.\nCreates a ContextU128 instruction with the provided params.\nCreates a Decommit instruction with the provided params.\nCreates Div instruction with the provided params.\nCreates an ErgsLeft instruction with the provided params.\nCreates an Event instruction with the provided params.\nCreates a FarCall instruction with the provided mode and …\nCreates a HeapRead instruction with the provided params.\nCreates a HeapWrite instruction with the provided params.\nCreates an IncrementTxNumber instruction with the provided …\nCreates a invalid instruction that will panic by draining …\nCreates a Jump instruction with the provided params.\nCreates an L2ToL1Message instruction with the provided …\nCreates Mul instruction with the provided params.\nCreates a NearCall instruction with the provided params.\nCreates a Nop instruction with the provided params.\nCreates Or instruction with the provided params.\nCreates a panic Ret instruction with the provided params.\nCreates a PointerAdd instruction with the provided params.\nCreates a PointerPack instruction with the provided params.\nCreates an PointerRead instruction with the provided …\nCreates a PointerShrink instruction with the provided …\nCreates a PointerSub instruction with the provided params.\nCreates a PrecompileCall instruction with the provided …\nCreates a normal Ret instruction with the provided params.\nCreates a revert Ret instruction with the provided params.\nCreates RotateLeft instruction with the provided params.\nCreates RotateRight instruction with the provided params.\nCreates a SetContextU128 instruction with the provided …\nCreates ShiftLeft instruction with the provided params.\nCreates ShiftRight instruction with the provided params.\nCreates a StorageRead instruction with the provided params.\nCreates a StorageWrite instruction with the provided …\nCreates Sub instruction with the provided params.\nCreates a This instruction with the provided params.\nCreates a TransientStorageRead instruction with the …\nCreates a TransientStorageWrite instruction with the …\nCreates a new program from U256 words.\nCreates Xor instruction with the provided params.\nGets changes for all touched storage slots.\nGets changes for storage slots touched after the specified …\nWriting to this address in the bootloader’s heap …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts this pointer into a U256 word.\nReturns if the storage slot is free both in terms of gas …\ntrue if the slot is not set in the World. A write may be …\nReturns L2-to-L1 logs emitted after the specified snapshot …\nLength of the pointed slice in bytes.\nCreates a VM snapshot. The snapshot can then be rolled …\nID of the heap this points to.\nCreates a new program.\nCreates new requirements.\nCreates a new VM instance.\nCreates default requirements that always hold.\nAdditional pointer offset inside the …\nPops a previously made snapshot without rolling back to …\nReturns recorded pubdata costs for all storage operations.\nReads the specified slot from the storage.\nReturns how much of the extra gas limit is left and the …\nReturns the VM to the state it was in when …\nRuns this VM with the specified World and Tracer until an …\nGet a snapshot for selecting which logs & co. to output …\n0-based index of the pointer start byte at the memory page.\nReturns recorded refunds for all storage operations.\nTest-only tools for EraVM.\nProvides a reference to the World diff accumulated by VM …\nAbsolute addressing into stack.\nAbsolute stack addressing.\nAbsolute stack addressing.\nSame as RelativeStack, but moves the stack pointer on …\nRelative stack addressing that updates the stack pointer …\nRelative stack addressing that updates the stack pointer …\nAll supported addressing modes for the first destination …\nAll supported addressing modes for the first source …\nArguments provided to an instruction in an EraVM bytecode.\nAbsolute addressing into the code page of the currently …\nAddressing into the code page of the executing contract.\nImmediate value passed as a first instruction arg.\nImmediate mode.\nImmediate mode.\nImmediate value passed as a second instruction arg.\nError converting AnySource to RegisterOrImmediate.\nRepresentation of one of 16 VM registers.\nRegister passed as a first instruction argument.\nRegister mode.\nRegister mode.\nRegister mode.\nRegister passed as a second instruction argument.\nCombination of a register and an immediate value wrapped …\nRegister or immediate addressing modes required by some VM …\nRelative addressing into stack (relative to the VM stack …\nRelative stack addressing.\nRelative stack addressing.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nImmediate value.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreates arguments from the provided info.\nCreates a register with the specified 0-based index.\nRegister spec.\nTest World implementation.\nReturns the argument unchanged.\nCalls U::from(self).\nCreates a test world with the provided programs.") \ No newline at end of file diff --git a/search.desc/zksync_vm2_interface/zksync_vm2_interface-desc-0-.js b/search.desc/zksync_vm2_interface/zksync_vm2_interface-desc-0-.js new file mode 100644 index 0000000..daa2491 --- /dev/null +++ b/search.desc/zksync_vm2_interface/zksync_vm2_interface-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("zksync_vm2_interface", 0, "EraVM Stable Interface\nPublic interface of an EraVM call frame.\nAll supported calling modes for FarCall opcode.\nCycle statistics emitted by the VM and supplied to …\nDecommitting an opcode.\nDelegate calling mode (similar to delegatecall in EVM).\nCall to the ecrecover precompile with the specified number …\nEvent emitted by EraVM.\nIdentifier of the heap used by the first executed program …\nIdentifier of the auxiliary heap used by the first …\nIdentifier of the calldata heap used by the first executed …\nVM execution flags. See the EraVM reference for more …\nIdentifier of a VM heap.\nCall to the keccak256 precompile with the specified number …\nL2-to-L1 log emitted by EraVM.\nMimic calling mode (can only be used by system contracts; …\nNormal calling mode.\nNormal return.\nAll supported EraVM opcodes in a single enumeration.\nTrait mapping opcodes as types to the corresponding …\nPanic, i.e. a non-revert abnormal control flow termination …\nAll supported return types for the Ret opcode.\nRevert (e.g., a result of a Solidity revert).\nCall to the secp256r1_verify precompile with the specified …\nCall to the sha256 precompile with the specified number of …\nPublic interface of the VM state. Encompasses both read …\nReading a slot from the VM storage.\nWriting a slot to the VM storage.\nEraVM instruction tracer.\nOpcode variant corresponding to this opcode type.\nAddress of the storage context associated with this frame. …\nAddress of the contract that has emitted this log.\nExecutes logic after an instruction handler.\nExecutes logic after an instruction handler.\nConverts this ID to an integer value.\nReturns ID of the auxiliary heap used in this call.\nReturns the auxiliary heap boundary (number of paid bytes).\nExecutes logic before an instruction handler.\nExecutes logic before an instruction handler.\nAddress of the calling contract. Respects delegate and …\nReturns a mutable handle to a call frame with the …\nAddress of the contract being executed.\nReturns the context value for this call. This context is …\nReturns the value of the context register.\nReturns a mutable handle to the current call frame.\n“Equal” flag.\nIterates over events emitted during VM execution.\nReturns the program counter that the parent frame should …\nReturns current execution flags.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the remaining amount of gas.\nIterates over storage slots read or written during VM …\nGets value of the specified transient storage slot.\nIterates over all transient storage slots set during VM …\n“Greater than” flag.\nReturns ID of the main heap used in this call.\nReturns the main heap boundary (number of paid bytes).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nChecks if this return type is normal.\nIs this event first in a chain of events?\nChecks whether the call is executed in kernel mode.\nChecks whether this frame corresponds to a near call.\nIs this a service log?\nChecks whether the call is static.\nEvent key.\nLog key.\nIterates over L2-to-L1 logs emitted during VM execution.\n“Less than” flag.\nReturns the total number of call frames.\nProvides cycle statistics for “complex” instructions …\nProvides cycle statistics for “complex” instructions …\nEraVM opcodes.\nReturns the current program counter (i.e., 0-based index …\nGets the current amount of published pubdata.\nReads a word from the bytecode of the executing contract.\nReads a single byte from the specified heap at the …\nReads an entire U256 word in the big-endian order from the …\nReads a register with the specified zero-based index. …\nReads the specified stack slot. Returns a value together …\nSets the address of the executing contract.\nSets the auxiliary heap boundary.\nSets the address of the calling contract.\nSets the address of the contract being executed. Does not …\nSets the context value for this call.\nSets the value of the context register.\nSets the exception handler as specified above.\nSets current execution flags.\nSets the remaining amount of gas.\nSets the main heap boundary.\nSets the program counter. The VM will execute an invalid …\nSets the current amount of published pubdata.\nSets a register with the specified zero-based index\nSets the stack pointer.\nSets the current transaction number.\nShard identifier (currently, always set to 0).\nShard identifier (currently, always set to 0).\nReturns the stack pointer.\nAdditional gas provided for the duration of this callframe.\nReturns the currently set 0-based transaction number.\n0-based index of a transaction that has emitted this event.\n0-based index of a transaction that has emitted this event.\nEvent value.\nLog value.\nWrites an entire U256 word in the big-endian order to the …\nSets the value and pointer flag for the specified stack …\nSets value of the specified transient storage slot.\nAdd opcode.\nAnd opcode.\nAuxHeapRead opcode.\nAuxHeapWrite opcode.\nAuxMutating0 opcode.\nCaller opcode.\nCodeAddress opcode.\nContextMeta opcode.\nContextU128 opcode.\nDecommit opcode.\nDelegate FarCall mode.\nDiv opcode.\nErgsLeft opcode.\nEvent opcode.\nFarCall group of opcodes distinguished by the calling mode …\nHeapRead opcode.\nHeapWrite opcode.\nIncrementTxNumber opcode.\nJump opcode.\nL2ToL1Message opcode.\nMimic FarCall mode.\nMul opcode.\nNearCall opcode.\nNop opcode.\nNormal Return mode / FarCall mode.\nOr opcode.\nPanic Return mode.\nPointerAdd opcode.\nPointerPack opcode.\nPointerRead opcode.\nPointerShrink opcode.\nPointerSub opcode.\nPrecompileCall opcode.\nRet group of opcodes distinguished by the return type …\nRevert Return mode.\nRotateLeft opcode.\nRotateRight opcode.\nSP opcode.\nSetContextU128 opcode.\nShiftLeft opcode.\nShiftRight opcode.\nStorageRead opcode.\nStorageWrite opcode.\nSub opcode.\nThis opcode.\nTransientStorageRead opcode.\nTransientStorageWrite opcode.\nCalling mode for the FarCall opcodes.\nReturn type for the Ret opcodes.\nConstant corresponding to this mode allowing to easily …\nConstant corresponding to this return type allowing to …\nXor opcode.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).") \ No newline at end of file diff --git a/settings.html b/settings.html new file mode 100644 index 0000000..7d9f7b3 --- /dev/null +++ b/settings.html @@ -0,0 +1 @@ +Settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/src-files.js b/src-files.js new file mode 100644 index 0000000..369ed7d --- /dev/null +++ b/src-files.js @@ -0,0 +1,5 @@ +var srcIndex = new Map(JSON.parse('[\ +["zksync_vm2",["",[["instruction_handlers",[],["binop.rs","common.rs","context.rs","decommit.rs","event.rs","far_call.rs","heap_access.rs","jump.rs","mod.rs","monomorphization.rs","near_call.rs","nop.rs","pointer.rs","precompiles.rs","ret.rs","storage.rs"]]],["addressing_modes.rs","bitset.rs","callframe.rs","decode.rs","decommit.rs","fat_pointer.rs","heap.rs","instruction.rs","lib.rs","mode_requirements.rs","predication.rs","program.rs","rollback.rs","stack.rs","state.rs","testonly.rs","tracing.rs","vm.rs","world_diff.rs"]]],\ +["zksync_vm2_interface",["",[],["lib.rs","state_interface.rs","tracer_interface.rs"]]]\ +]')); +createSrcSidebar(); diff --git a/src/zksync_vm2/addressing_modes.rs.html b/src/zksync_vm2/addressing_modes.rs.html new file mode 100644 index 0000000..29f6bbb --- /dev/null +++ b/src/zksync_vm2/addressing_modes.rs.html @@ -0,0 +1,1191 @@ +addressing_modes.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+
//! Addressing modes supported by EraVM.
+
+#[cfg(feature = "arbitrary")]
+use arbitrary::{Arbitrary, Unstructured};
+use enum_dispatch::enum_dispatch;
+use primitive_types::U256;
+use zkevm_opcode_defs::erase_fat_pointer_metadata;
+
+use crate::{mode_requirements::ModeRequirements, predication::Predicate};
+
+pub(crate) trait Source {
+    /// Get a word's value for non-pointer operations. (Pointers are erased.)
+    fn get(args: &Arguments, state: &mut impl Addressable) -> U256 {
+        Self::get_with_pointer_flag_and_erasing(args, state).0
+    }
+
+    /// Get a word's value and pointer flag.
+    fn get_with_pointer_flag(args: &Arguments, state: &mut impl Addressable) -> (U256, bool) {
+        (Self::get(args, state), false)
+    }
+
+    /// Get a word's value, erasing pointers but also returning the pointer flag.
+    /// The flag will always be false unless in kernel mode.
+    /// Necessary for pointer operations, which for some reason erase their second argument
+    /// but also panic when it was a pointer.
+    fn get_with_pointer_flag_and_erasing(
+        args: &Arguments,
+        state: &mut impl Addressable,
+    ) -> (U256, bool) {
+        let (mut value, is_pointer) = Self::get_with_pointer_flag(args, state);
+        if is_pointer && !state.in_kernel_mode() {
+            erase_fat_pointer_metadata(&mut value);
+        }
+        (value, is_pointer && state.in_kernel_mode())
+    }
+}
+
+pub(crate) trait Destination {
+    /// Set this register/stack location to value and clear its pointer flag
+    fn set(args: &Arguments, state: &mut impl Addressable, value: U256);
+
+    /// Same as `set` but sets the pointer flag
+    fn set_fat_ptr(args: &Arguments, state: &mut impl Addressable, value: U256);
+}
+
+/// The part of VM state that addressing modes need to operate on
+pub(crate) trait Addressable {
+    fn registers(&mut self) -> &mut [U256; 16];
+    fn register_pointer_flags(&mut self) -> &mut u16;
+
+    fn read_stack(&mut self, slot: u16) -> U256;
+    fn write_stack(&mut self, slot: u16, value: U256);
+    fn stack_pointer(&mut self) -> &mut u16;
+
+    fn read_stack_pointer_flag(&mut self, slot: u16) -> bool;
+    fn set_stack_pointer_flag(&mut self, slot: u16);
+    fn clear_stack_pointer_flag(&mut self, slot: u16);
+
+    fn code_page(&self) -> &[U256];
+
+    fn in_kernel_mode(&self) -> bool;
+}
+
+#[enum_dispatch]
+pub(crate) trait SourceWriter {
+    fn write_source(&self, args: &mut Arguments);
+}
+
+impl<T: SourceWriter> SourceWriter for Option<T> {
+    fn write_source(&self, args: &mut Arguments) {
+        if let Some(x) = self {
+            x.write_source(args);
+        }
+    }
+}
+
+#[enum_dispatch]
+pub(crate) trait DestinationWriter {
+    fn write_destination(&self, args: &mut Arguments);
+}
+
+impl<T: DestinationWriter> DestinationWriter for Option<T> {
+    fn write_destination(&self, args: &mut Arguments) {
+        if let Some(x) = self {
+            x.write_destination(args);
+        }
+    }
+}
+
+/// Arguments provided to an instruction in an EraVM bytecode.
+// It is important for performance that this fits into 8 bytes.
+#[derive(Debug)]
+pub struct Arguments {
+    source_registers: PackedRegisters,
+    destination_registers: PackedRegisters,
+    immediate1: u16,
+    immediate2: u16,
+    predicate_and_mode_requirements: u8,
+    static_gas_cost: u8,
+}
+
+pub(crate) const L1_MESSAGE_COST: u32 = 156_250;
+pub(crate) const SSTORE_COST: u32 = 5_511;
+pub(crate) const SLOAD_COST: u32 = 2_008;
+pub(crate) const INVALID_INSTRUCTION_COST: u32 = 4_294_967_295;
+
+impl Arguments {
+    /// Creates arguments from the provided info.
+    #[allow(clippy::missing_panics_doc)] // never panics on properly created inputs
+    pub const fn new(
+        predicate: Predicate,
+        gas_cost: u32,
+        mode_requirements: ModeRequirements,
+    ) -> Self {
+        // Make sure that these two can be packed into 8 bits without overlapping
+        assert!(predicate as u8 & (0b11 << 6) == 0);
+        assert!(mode_requirements.0 & !0b11 == 0);
+
+        Self {
+            source_registers: PackedRegisters(0),
+            destination_registers: PackedRegisters(0),
+            immediate1: 0,
+            immediate2: 0,
+            predicate_and_mode_requirements: (predicate as u8) << 2 | mode_requirements.0,
+            static_gas_cost: Self::encode_static_gas_cost(gas_cost),
+        }
+    }
+
+    #[allow(clippy::cast_possible_truncation)] // checked
+    const fn encode_static_gas_cost(x: u32) -> u8 {
+        match x {
+            L1_MESSAGE_COST => 1,
+            SSTORE_COST => 2,
+            SLOAD_COST => 3,
+            INVALID_INSTRUCTION_COST => 4,
+            1..=4 => panic!("Reserved gas cost values overlap with actual gas costs"),
+            x => {
+                if x > u8::MAX as u32 {
+                    panic!("Gas cost doesn't fit into 8 bits");
+                } else {
+                    x as u8
+                }
+            }
+        }
+    }
+
+    pub(crate) fn get_static_gas_cost(&self) -> u32 {
+        match self.static_gas_cost {
+            1 => L1_MESSAGE_COST,
+            2 => SSTORE_COST,
+            3 => SLOAD_COST,
+            4 => INVALID_INSTRUCTION_COST,
+            x => x.into(),
+        }
+    }
+
+    pub(crate) fn predicate(&self) -> Predicate {
+        unsafe { std::mem::transmute(self.predicate_and_mode_requirements >> 2) }
+    }
+
+    pub(crate) fn mode_requirements(&self) -> ModeRequirements {
+        ModeRequirements(self.predicate_and_mode_requirements & 0b11)
+    }
+
+    pub(crate) fn write_source(mut self, sw: &impl SourceWriter) -> Self {
+        sw.write_source(&mut self);
+        self
+    }
+
+    pub(crate) fn write_destination(mut self, sw: &impl DestinationWriter) -> Self {
+        sw.write_destination(&mut self);
+        self
+    }
+}
+
+/// Register passed as a first instruction argument.
+///
+/// It must not be used simultaneously with [`AbsoluteStack`], [`RelativeStack`], [`AdvanceStackPointer`],
+/// or [`CodePage`].
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct Register1(pub Register);
+
+/// Register passed as a second instruction argument.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct Register2(pub Register);
+
+impl Source for Register1 {
+    fn get_with_pointer_flag(args: &Arguments, state: &mut impl Addressable) -> (U256, bool) {
+        let register = args.source_registers.register1();
+        (register.value(state), register.pointer_flag(state))
+    }
+}
+
+impl SourceWriter for Register1 {
+    fn write_source(&self, args: &mut Arguments) {
+        args.source_registers.set_register1(self.0);
+    }
+}
+
+impl Source for Register2 {
+    fn get_with_pointer_flag(args: &Arguments, state: &mut impl Addressable) -> (U256, bool) {
+        let register = args.source_registers.register2();
+        (register.value(state), register.pointer_flag(state))
+    }
+}
+
+impl SourceWriter for Register2 {
+    fn write_source(&self, args: &mut Arguments) {
+        args.source_registers.set_register2(self.0);
+    }
+}
+
+impl Destination for Register1 {
+    fn set(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        args.destination_registers.register1().set(state, value);
+    }
+
+    fn set_fat_ptr(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        args.destination_registers.register1().set_ptr(state, value);
+    }
+}
+
+impl DestinationWriter for Register1 {
+    fn write_destination(&self, args: &mut Arguments) {
+        args.destination_registers.set_register1(self.0);
+    }
+}
+
+impl Destination for Register2 {
+    fn set(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        args.destination_registers.register2().set(state, value);
+    }
+
+    fn set_fat_ptr(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        args.destination_registers.register2().set_ptr(state, value);
+    }
+}
+
+impl DestinationWriter for Register2 {
+    fn write_destination(&self, args: &mut Arguments) {
+        args.destination_registers.set_register2(self.0);
+    }
+}
+
+/// Immediate value passed as a first instruction arg.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct Immediate1(pub u16);
+
+/// Immediate value passed as a second instruction arg.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct Immediate2(pub u16);
+
+impl Immediate1 {
+    pub(crate) fn get_u16(args: &Arguments) -> u16 {
+        args.immediate1
+    }
+}
+
+impl Immediate2 {
+    pub(crate) fn get_u16(args: &Arguments) -> u16 {
+        args.immediate2
+    }
+}
+
+impl Source for Immediate1 {
+    fn get(args: &Arguments, _state: &mut impl Addressable) -> U256 {
+        U256([args.immediate1.into(), 0, 0, 0])
+    }
+}
+
+impl SourceWriter for Immediate1 {
+    fn write_source(&self, args: &mut Arguments) {
+        args.immediate1 = self.0;
+    }
+}
+
+impl Source for Immediate2 {
+    fn get(args: &Arguments, _state: &mut impl Addressable) -> U256 {
+        U256([args.immediate2.into(), 0, 0, 0])
+    }
+}
+
+impl SourceWriter for Immediate2 {
+    fn write_source(&self, args: &mut Arguments) {
+        args.immediate2 = self.0;
+    }
+}
+
+/// Combination of a register and an immediate value wrapped by [`AbsoluteStack`], [`RelativeStack`],
+/// [`AdvanceStackPointer`] and [`CodePage`] addressing modes.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct RegisterAndImmediate {
+    /// Immediate value.
+    pub immediate: u16,
+    /// Register spec.
+    pub register: Register,
+}
+
+/// Any addressing mode that uses reg + imm in some way.
+/// They all encode their parameters in the same way.
+trait RegisterPlusImmediate {
+    fn inner(&self) -> &RegisterAndImmediate;
+}
+
+impl<T: RegisterPlusImmediate> SourceWriter for T {
+    fn write_source(&self, args: &mut Arguments) {
+        args.immediate1 = self.inner().immediate;
+        args.source_registers.set_register1(self.inner().register);
+    }
+}
+
+impl<T: RegisterPlusImmediate> DestinationWriter for T {
+    fn write_destination(&self, args: &mut Arguments) {
+        args.immediate2 = self.inner().immediate;
+        args.destination_registers
+            .set_register1(self.inner().register);
+    }
+}
+
+trait StackAddressing {
+    fn address_for_get(args: &Arguments, state: &mut impl Addressable) -> u16;
+    fn address_for_set(args: &Arguments, state: &mut impl Addressable) -> u16;
+}
+
+impl<T: StackAddressing> Source for T {
+    fn get_with_pointer_flag(args: &Arguments, state: &mut impl Addressable) -> (U256, bool) {
+        let address = Self::address_for_get(args, state);
+        (
+            state.read_stack(address),
+            state.read_stack_pointer_flag(address),
+        )
+    }
+}
+
+impl<T: StackAddressing> Destination for T {
+    fn set(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        let address = Self::address_for_set(args, state);
+        state.write_stack(address, value);
+        state.clear_stack_pointer_flag(address);
+    }
+
+    fn set_fat_ptr(args: &Arguments, state: &mut impl Addressable, value: U256) {
+        let address = Self::address_for_set(args, state);
+        state.write_stack(address, value);
+        state.set_stack_pointer_flag(address);
+    }
+}
+
+fn source_stack_address(args: &Arguments, state: &mut impl Addressable) -> u16 {
+    compute_stack_address(state, args.source_registers.register1(), args.immediate1)
+}
+
+pub(crate) fn destination_stack_address(args: &Arguments, state: &mut impl Addressable) -> u16 {
+    compute_stack_address(
+        state,
+        args.destination_registers.register1(),
+        args.immediate2,
+    )
+}
+
+/// Computes register + immediate (mod 2^16).
+/// Stack addresses are always in that remainder class anyway.
+#[allow(clippy::cast_possible_truncation)]
+fn compute_stack_address(state: &mut impl Addressable, register: Register, immediate: u16) -> u16 {
+    (register.value(state).low_u32() as u16).wrapping_add(immediate)
+}
+
+/// Absolute addressing into stack.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct AbsoluteStack(pub RegisterAndImmediate);
+
+impl RegisterPlusImmediate for AbsoluteStack {
+    fn inner(&self) -> &RegisterAndImmediate {
+        &self.0
+    }
+}
+
+impl StackAddressing for AbsoluteStack {
+    fn address_for_get(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        source_stack_address(args, state)
+    }
+
+    fn address_for_set(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        destination_stack_address(args, state)
+    }
+}
+
+/// Relative addressing into stack (relative to the VM stack pointer).
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct RelativeStack(pub RegisterAndImmediate);
+
+impl RegisterPlusImmediate for RelativeStack {
+    fn inner(&self) -> &RegisterAndImmediate {
+        &self.0
+    }
+}
+
+impl StackAddressing for RelativeStack {
+    fn address_for_get(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        state
+            .stack_pointer()
+            .wrapping_sub(source_stack_address(args, state))
+    }
+
+    fn address_for_set(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        state
+            .stack_pointer()
+            .wrapping_sub(destination_stack_address(args, state))
+    }
+}
+
+/// Same as [`RelativeStack`], but moves the stack pointer on access (decreases it when reading data;
+/// increases when writing data).
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct AdvanceStackPointer(pub RegisterAndImmediate);
+
+impl RegisterPlusImmediate for AdvanceStackPointer {
+    fn inner(&self) -> &RegisterAndImmediate {
+        &self.0
+    }
+}
+
+impl StackAddressing for AdvanceStackPointer {
+    fn address_for_get(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        let offset = source_stack_address(args, state);
+        let sp = state.stack_pointer();
+        *sp = sp.wrapping_sub(offset);
+        *sp
+    }
+
+    fn address_for_set(args: &Arguments, state: &mut impl Addressable) -> u16 {
+        let offset = destination_stack_address(args, state);
+        let sp = state.stack_pointer();
+        let address_to_set = *sp;
+        *sp = sp.wrapping_add(offset);
+        address_to_set
+    }
+}
+
+/// Absolute addressing into the code page of the currently executing program.
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub struct CodePage(pub RegisterAndImmediate);
+
+impl RegisterPlusImmediate for CodePage {
+    fn inner(&self) -> &RegisterAndImmediate {
+        &self.0
+    }
+}
+
+impl Source for CodePage {
+    fn get(args: &Arguments, state: &mut impl Addressable) -> U256 {
+        let address = source_stack_address(args, state);
+        state
+            .code_page()
+            .get(address as usize)
+            .copied()
+            .unwrap_or(U256::zero())
+    }
+}
+
+/// Representation of one of 16 VM registers.
+#[derive(Debug, Clone, Copy)]
+pub struct Register(u8);
+
+impl Register {
+    /// Creates a register with the specified 0-based index.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `n >= 16`; EraVM has 16 registers.
+    pub const fn new(n: u8) -> Self {
+        assert!(n < 16, "EraVM has 16 registers");
+        Self(n)
+    }
+
+    fn value(self, state: &mut impl Addressable) -> U256 {
+        unsafe { *state.registers().get_unchecked(self.0 as usize) }
+    }
+
+    fn pointer_flag(self, state: &mut impl Addressable) -> bool {
+        *state.register_pointer_flags() & (1 << self.0) != 0
+    }
+
+    fn set(self, state: &mut impl Addressable, value: U256) {
+        if self.0 != 0 {
+            unsafe { *state.registers().get_unchecked_mut(self.0 as usize) = value };
+            *state.register_pointer_flags() &= !(1 << self.0);
+        }
+    }
+
+    fn set_ptr(self, state: &mut impl Addressable, value: U256) {
+        if self.0 != 0 {
+            unsafe { *state.registers().get_unchecked_mut(self.0 as usize) = value };
+            *state.register_pointer_flags() |= 1 << self.0;
+        }
+    }
+}
+
+#[cfg(feature = "arbitrary")]
+impl<'a> Arbitrary<'a> for Register {
+    #[allow(clippy::cast_possible_truncation)] // false positive: the value is <16
+    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self, arbitrary::Error> {
+        Ok(Register(u.choose_index(16)? as u8))
+    }
+}
+
+#[derive(Hash, Debug)]
+struct PackedRegisters(u8);
+
+impl PackedRegisters {
+    fn register1(&self) -> Register {
+        Register(self.0 >> 4)
+    }
+    fn set_register1(&mut self, value: Register) {
+        self.0 &= 0xf;
+        self.0 |= value.0 << 4;
+    }
+    fn register2(&self) -> Register {
+        Register(self.0 & 0xf)
+    }
+    fn set_register2(&mut self, value: Register) {
+        self.0 &= 0xf0;
+        self.0 |= value.0;
+    }
+}
+
+/// All supported addressing modes for the first source argument.
+#[enum_dispatch(SourceWriter)]
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub enum AnySource {
+    /// Register mode.
+    Register1,
+    /// Immediate mode.
+    Immediate1,
+    /// Absolute stack addressing.
+    AbsoluteStack,
+    /// Relative stack addressing.
+    RelativeStack,
+    /// Relative stack addressing that updates the stack pointer on access.
+    AdvanceStackPointer,
+    /// Addressing into the code page of the executing contract.
+    CodePage,
+}
+
+/// Register or immediate addressing modes required by some VM instructions.
+#[enum_dispatch(SourceWriter)]
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub enum RegisterOrImmediate {
+    /// Register mode.
+    Register1,
+    /// Immediate mode.
+    Immediate1,
+}
+
+/// Error converting [`AnySource`] to [`RegisterOrImmediate`].
+#[derive(Debug)]
+pub struct NotRegisterOrImmediate;
+
+impl TryFrom<AnySource> for RegisterOrImmediate {
+    type Error = NotRegisterOrImmediate;
+
+    fn try_from(value: AnySource) -> Result<Self, Self::Error> {
+        match value {
+            AnySource::Register1(r) => Ok(RegisterOrImmediate::Register1(r)),
+            AnySource::Immediate1(r) => Ok(RegisterOrImmediate::Immediate1(r)),
+            _ => Err(NotRegisterOrImmediate),
+        }
+    }
+}
+
+/// All supported addressing modes for the first destination argument.
+#[enum_dispatch(DestinationWriter)]
+#[derive(Debug, Clone, Copy)]
+#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
+pub enum AnyDestination {
+    /// Register mode.
+    Register1,
+    /// Absolute stack addressing.
+    AbsoluteStack,
+    /// Relative stack addressing.
+    RelativeStack,
+    /// Relative stack addressing that updates the stack pointer on access.
+    AdvanceStackPointer,
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/bitset.rs.html b/src/zksync_vm2/bitset.rs.html new file mode 100644 index 0000000..d91557a --- /dev/null +++ b/src/zksync_vm2/bitset.rs.html @@ -0,0 +1,69 @@ +bitset.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
/// Bitset with `1 << 16` elements. Used to store pointer flags for VM [`Stack`](crate::stack::Stack).
+#[derive(Clone, PartialEq, Debug, Hash)]
+pub(crate) struct Bitset([u64; 1 << 10]);
+
+impl Bitset {
+    #[inline(always)]
+    pub(crate) fn get(&self, i: u16) -> bool {
+        let (slot, bit) = slot_and_bit(i);
+        self.0[slot] & bit != 0
+    }
+
+    #[inline(always)]
+    pub(crate) fn set(&mut self, i: u16) {
+        let (slot, bit) = slot_and_bit(i);
+        self.0[slot] |= bit;
+    }
+
+    #[inline(always)]
+    pub(crate) fn clear(&mut self, i: u16) {
+        let (slot, bit) = slot_and_bit(i);
+        self.0[slot] &= !bit;
+    }
+}
+
+#[inline(always)]
+fn slot_and_bit(i: u16) -> (usize, u64) {
+    ((i >> 6) as usize, 1u64 << (i & 0b_0011_1111))
+}
+
+impl Default for Bitset {
+    fn default() -> Self {
+        Self([0; 1 << 10])
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/callframe.rs.html b/src/zksync_vm2/callframe.rs.html new file mode 100644 index 0000000..0731071 --- /dev/null +++ b/src/zksync_vm2/callframe.rs.html @@ -0,0 +1,589 @@ +callframe.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+
use std::{mem, ptr};
+
+use primitive_types::H160;
+use zkevm_opcode_defs::system_params::{NEW_FRAME_MEMORY_STIPEND, NEW_KERNEL_FRAME_MEMORY_STIPEND};
+use zksync_vm2_interface::{HeapId, Tracer};
+
+use crate::{
+    decommit::is_kernel,
+    instruction_handlers::invalid_instruction,
+    program::Program,
+    stack::{Stack, StackSnapshot},
+    world_diff::Snapshot,
+    Instruction,
+};
+
+#[derive(Debug)]
+pub(crate) struct Callframe<T, W> {
+    pub(crate) address: H160,
+    pub(crate) code_address: H160,
+    pub(crate) caller: H160,
+    pub(crate) exception_handler: u16,
+    pub(crate) context_u128: u128,
+    pub(crate) is_static: bool,
+    pub(crate) is_kernel: bool,
+    pub(crate) stack: Box<Stack>,
+    pub(crate) sp: u16,
+    pub(crate) gas: u32,
+    pub(crate) stipend: u32,
+    pub(crate) near_calls: Vec<NearCallFrame>,
+    pub(crate) pc: *const Instruction<T, W>,
+    pub(crate) program: Program<T, W>,
+    pub(crate) heap: HeapId,
+    pub(crate) aux_heap: HeapId,
+    /// The amount of heap that has been paid for. This should always be greater
+    /// or equal to the actual size of the heap in memory.
+    pub(crate) heap_size: u32,
+    pub(crate) aux_heap_size: u32,
+    /// Returning a pointer to the calldata is illegal because it could result in
+    /// the caller's heap being accessible both directly and via the fat pointer.
+    /// The problem only occurs if the calldata originates from the caller's heap
+    /// but this rule is easy to implement.
+    pub(crate) calldata_heap: HeapId,
+    /// Because of the above rule we know that heaps returned to this frame only
+    /// exist to allow this frame to read from them. Therefore we can deallocate
+    /// all of them upon return, except possibly one that we pass on.
+    pub(crate) heaps_i_am_keeping_alive: Vec<HeapId>,
+    pub(crate) world_before_this_frame: Snapshot,
+}
+
+#[derive(Clone, PartialEq, Debug)]
+pub(crate) struct NearCallFrame {
+    pub(crate) exception_handler: u16,
+    pub(crate) previous_frame_sp: u16,
+    pub(crate) previous_frame_gas: u32,
+    pub(crate) previous_frame_pc: u16,
+    world_before_this_frame: Snapshot,
+}
+
+impl<T, W> Callframe<T, W> {
+    #[allow(clippy::too_many_arguments)]
+    pub(crate) fn new(
+        address: H160,
+        code_address: H160,
+        caller: H160,
+        program: Program<T, W>,
+        stack: Box<Stack>,
+        heap: HeapId,
+        aux_heap: HeapId,
+        calldata_heap: HeapId,
+        gas: u32,
+        stipend: u32,
+        exception_handler: u16,
+        context_u128: u128,
+        is_static: bool,
+        world_before_this_frame: Snapshot,
+    ) -> Self {
+        let is_kernel = is_kernel(address);
+        let heap_size = if is_kernel {
+            NEW_KERNEL_FRAME_MEMORY_STIPEND
+        } else {
+            NEW_FRAME_MEMORY_STIPEND
+        };
+
+        Self {
+            address,
+            code_address,
+            caller,
+            pc: program.instruction(0).unwrap(),
+            program,
+            context_u128,
+            is_static,
+            is_kernel,
+            stack,
+            heap,
+            aux_heap,
+            heap_size,
+            aux_heap_size: heap_size,
+            calldata_heap,
+            heaps_i_am_keeping_alive: vec![],
+            sp: 0,
+            gas,
+            stipend,
+            exception_handler,
+            near_calls: vec![],
+            world_before_this_frame,
+        }
+    }
+}
+
+impl<T: Tracer, W> Callframe<T, W> {
+    pub(crate) fn push_near_call(
+        &mut self,
+        gas_to_call: u32,
+        exception_handler: u16,
+        world_before_this_frame: Snapshot,
+    ) {
+        self.near_calls.push(NearCallFrame {
+            exception_handler,
+            previous_frame_sp: self.sp,
+            previous_frame_gas: self.gas - gas_to_call,
+            previous_frame_pc: self.get_pc_as_u16(),
+            world_before_this_frame,
+        });
+        self.gas = gas_to_call;
+    }
+
+    pub(crate) fn pop_near_call(&mut self) -> Option<FrameRemnant> {
+        self.near_calls.pop().map(|f| {
+            self.sp = f.previous_frame_sp;
+            self.gas = f.previous_frame_gas;
+            self.set_pc_from_u16(f.previous_frame_pc);
+
+            FrameRemnant {
+                exception_handler: f.exception_handler,
+                snapshot: f.world_before_this_frame,
+            }
+        })
+    }
+
+    /// Gets a raw inferred program counter. This value can be garbage if the frame is on an invalid instruction or free panic.
+    #[allow(clippy::cast_possible_wrap)] // false positive: `Instruction` isn't that large
+    pub(crate) fn get_raw_pc(&self) -> isize {
+        // We cannot use `<*const _>::offset_from` because `self.pc` isn't guaranteed to be allocated within `self.program`
+        // (invalid instructions and free panics aren't).
+        let offset_in_bytes =
+            self.pc as isize - ptr::from_ref(self.program.instruction(0).unwrap()) as isize;
+        offset_in_bytes / mem::size_of::<Instruction<T, W>>() as isize
+    }
+
+    // TODO: can overflow / underflow after an invalid instruction or free panic. Ordinarily, this will lead to VM termination (for an invalid instruction)
+    //   or the callframe getting popped (for a panic), but it's still technically possible to invoke this method afterwards in certain cases (e.g., in the bootloader callframe).
+    #[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
+    pub(crate) fn get_pc_as_u16(&self) -> u16 {
+        self.get_raw_pc() as u16
+    }
+
+    /// Sets the next instruction to execute to the instruction at the given index.
+    /// If the index is out of bounds, the invalid instruction is used.
+    pub(crate) fn set_pc_from_u16(&mut self, index: u16) {
+        self.pc = self
+            .program
+            .instruction(index)
+            .unwrap_or_else(invalid_instruction);
+    }
+
+    /// The total amount of gas in this frame, including gas currently inaccessible because of a near call.
+    pub(crate) fn contained_gas(&self) -> u32 {
+        self.gas
+            + self
+                .near_calls
+                .iter()
+                .map(|f| f.previous_frame_gas)
+                .sum::<u32>()
+    }
+
+    pub(crate) fn snapshot(&self) -> CallframeSnapshot {
+        CallframeSnapshot {
+            stack: self.stack.snapshot(),
+
+            context_u128: self.context_u128,
+            sp: self.sp,
+            pc: self.get_pc_as_u16(),
+            gas: self.gas,
+            near_calls: self.near_calls.clone(),
+            heap_size: self.heap_size,
+            aux_heap_size: self.aux_heap_size,
+            heaps_i_was_keeping_alive: self.heaps_i_am_keeping_alive.len(),
+        }
+    }
+
+    /// Returns heaps that were created during the period that is rolled back
+    /// and thus can't be referenced anymore and should be deallocated.
+    pub(crate) fn rollback(
+        &mut self,
+        snapshot: CallframeSnapshot,
+    ) -> impl Iterator<Item = HeapId> + '_ {
+        let CallframeSnapshot {
+            stack,
+            context_u128,
+            sp,
+            pc,
+            gas,
+            near_calls,
+            heap_size,
+            aux_heap_size,
+            heaps_i_was_keeping_alive,
+        } = snapshot;
+
+        self.stack.rollback(stack);
+
+        self.context_u128 = context_u128;
+        self.sp = sp;
+        self.set_pc_from_u16(pc);
+        self.gas = gas;
+        self.near_calls = near_calls;
+        self.heap_size = heap_size;
+        self.aux_heap_size = aux_heap_size;
+
+        self.heaps_i_am_keeping_alive
+            .drain(heaps_i_was_keeping_alive..)
+    }
+}
+
+pub(crate) struct FrameRemnant {
+    pub(crate) exception_handler: u16,
+    pub(crate) snapshot: Snapshot,
+}
+
+/// Only contains the fields that can change (other than via tracer).
+#[derive(Debug)]
+pub(crate) struct CallframeSnapshot {
+    stack: StackSnapshot,
+    context_u128: u128,
+    sp: u16,
+    pc: u16,
+    gas: u32,
+    near_calls: Vec<NearCallFrame>,
+    heap_size: u32,
+    aux_heap_size: u32,
+    heaps_i_was_keeping_alive: usize,
+}
+
+impl<T, W> Clone for Callframe<T, W> {
+    fn clone(&self) -> Self {
+        Self {
+            address: self.address,
+            code_address: self.code_address,
+            caller: self.caller,
+            exception_handler: self.exception_handler,
+            context_u128: self.context_u128,
+            is_static: self.is_static,
+            is_kernel: self.is_kernel,
+            stack: self.stack.clone(),
+            sp: self.sp,
+            gas: self.gas,
+            stipend: self.stipend,
+            near_calls: self.near_calls.clone(),
+            pc: self.pc,
+            program: self.program.clone(),
+            heap: self.heap,
+            aux_heap: self.aux_heap,
+            heap_size: self.heap_size,
+            aux_heap_size: self.aux_heap_size,
+            calldata_heap: self.calldata_heap,
+            heaps_i_am_keeping_alive: self.heaps_i_am_keeping_alive.clone(),
+            world_before_this_frame: self.world_before_this_frame.clone(),
+        }
+    }
+}
+
+impl<T, W> PartialEq for Callframe<T, W> {
+    fn eq(&self, other: &Self) -> bool {
+        self.address == other.address
+            && self.code_address == other.code_address
+            && self.caller == other.caller
+            && self.exception_handler == other.exception_handler
+            && self.context_u128 == other.context_u128
+            && self.is_static == other.is_static
+            && self.stack == other.stack
+            && self.sp == other.sp
+            && self.gas == other.gas
+            && self.stipend == other.stipend
+            && self.near_calls == other.near_calls
+            && self.pc == other.pc
+            && self.program == other.program
+            && self.heap == other.heap
+            && self.aux_heap == other.aux_heap
+            && self.heap_size == other.heap_size
+            && self.aux_heap_size == other.aux_heap_size
+            && self.calldata_heap == other.calldata_heap
+            && self.heaps_i_am_keeping_alive == other.heaps_i_am_keeping_alive
+            && self.world_before_this_frame == other.world_before_this_frame
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/decode.rs.html b/src/zksync_vm2/decode.rs.html new file mode 100644 index 0000000..6f3bd4a --- /dev/null +++ b/src/zksync_vm2/decode.rs.html @@ -0,0 +1,691 @@ +decode.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+
use zkevm_opcode_defs::{
+    decoding::{EncodingModeProduction, VmEncodingMode},
+    ImmMemHandlerFlags, Opcode,
+    Operand::{Full, RegOnly, RegOrImm},
+    RegOrImmFlags, FAR_CALL_SHARD_FLAG_IDX, FAR_CALL_STATIC_FLAG_IDX, FIRST_MESSAGE_FLAG_IDX,
+    RET_TO_LABEL_BIT_IDX, SET_FLAGS_FLAG_IDX, SWAP_OPERANDS_FLAG_IDX_FOR_ARITH_OPCODES,
+    SWAP_OPERANDS_FLAG_IDX_FOR_PTR_OPCODE, UMA_INCREMENT_FLAG_IDX,
+};
+use zksync_vm2_interface::{
+    opcodes::{
+        self, Add, And, Div, Mul, Or, PointerAdd, PointerPack, PointerShrink, PointerSub,
+        RotateLeft, RotateRight, ShiftLeft, ShiftRight, Sub, Xor,
+    },
+    Tracer,
+};
+
+use crate::{
+    addressing_modes::{
+        AbsoluteStack, AdvanceStackPointer, AnyDestination, AnySource, Arguments, CodePage,
+        Immediate1, Immediate2, Register, Register1, Register2, RegisterAndImmediate,
+        RelativeStack, SourceWriter,
+    },
+    instruction::{ExecutionEnd, ExecutionStatus},
+    mode_requirements::ModeRequirements,
+    Instruction, Predicate, VirtualMachine, World,
+};
+
+fn unimplemented_instruction<T, W>(variant: Opcode) -> Instruction<T, W> {
+    let mut arguments = Arguments::new(Predicate::Always, 0, ModeRequirements::none());
+    let variant_as_number: u16 = unsafe { std::mem::transmute(variant) };
+    Immediate1(variant_as_number).write_source(&mut arguments);
+    Instruction {
+        handler: unimplemented_handler,
+        arguments,
+    }
+}
+
+fn unimplemented_handler<T, W>(
+    vm: &mut VirtualMachine<T, W>,
+    _: &mut W,
+    _: &mut T,
+) -> ExecutionStatus {
+    let variant: Opcode = unsafe {
+        std::mem::transmute(Immediate1::get_u16(&(*vm.state.current_frame.pc).arguments))
+    };
+    eprintln!("Unimplemented instruction: {variant:?}");
+    ExecutionStatus::Stopped(ExecutionEnd::Panicked)
+}
+
+#[allow(clippy::too_many_lines)]
+pub(crate) fn decode<T: Tracer, W: World<T>>(raw: u64, is_bootloader: bool) -> Instruction<T, W> {
+    let (parsed, _) = EncodingModeProduction::parse_preliminary_variant_and_absolute_number(raw);
+
+    let predicate = match parsed.condition {
+        zkevm_opcode_defs::Condition::Always => Predicate::Always,
+        zkevm_opcode_defs::Condition::Gt => Predicate::IfGT,
+        zkevm_opcode_defs::Condition::Lt => Predicate::IfLT,
+        zkevm_opcode_defs::Condition::Eq => Predicate::IfEQ,
+        zkevm_opcode_defs::Condition::Ge => Predicate::IfGE,
+        zkevm_opcode_defs::Condition::Le => Predicate::IfLE,
+        zkevm_opcode_defs::Condition::Ne => Predicate::IfNotEQ,
+        zkevm_opcode_defs::Condition::GtOrLt => Predicate::IfGTOrLT,
+    };
+    let arguments = Arguments::new(
+        predicate,
+        parsed.variant.ergs_price(),
+        ModeRequirements::new(
+            parsed.variant.requires_kernel_mode(),
+            !parsed.variant.can_be_used_in_static_context(),
+        ),
+    );
+
+    let stack_in = RegisterAndImmediate {
+        immediate: parsed.imm_0,
+        register: Register::new(parsed.src0_reg_idx),
+    };
+    let src1: AnySource = match parsed.variant.src0_operand_type {
+        RegOnly | RegOrImm(RegOrImmFlags::UseRegOnly) | Full(ImmMemHandlerFlags::UseRegOnly) => {
+            Register1(Register::new(parsed.src0_reg_idx)).into()
+        }
+        RegOrImm(RegOrImmFlags::UseImm16Only) | Full(ImmMemHandlerFlags::UseImm16Only) => {
+            Immediate1(parsed.imm_0).into()
+        }
+        Full(ImmMemHandlerFlags::UseAbsoluteOnStack) => AbsoluteStack(stack_in).into(),
+        Full(ImmMemHandlerFlags::UseStackWithPushPop) => AdvanceStackPointer(stack_in).into(),
+        Full(ImmMemHandlerFlags::UseStackWithOffset) => RelativeStack(stack_in).into(),
+        Full(ImmMemHandlerFlags::UseCodePage) => CodePage(stack_in).into(),
+    };
+
+    let stack_out = RegisterAndImmediate {
+        immediate: parsed.imm_1,
+        register: Register::new(parsed.dst0_reg_idx),
+    };
+    let out: AnyDestination = match parsed.variant.dst0_operand_type {
+        RegOnly | RegOrImm(RegOrImmFlags::UseRegOnly) | Full(ImmMemHandlerFlags::UseRegOnly) => {
+            Register1(Register::new(parsed.dst0_reg_idx)).into()
+        }
+        RegOrImm(RegOrImmFlags::UseImm16Only) | Full(ImmMemHandlerFlags::UseImm16Only) => {
+            panic!("Parser wants to output to immediate")
+        }
+        Full(ImmMemHandlerFlags::UseAbsoluteOnStack) => AbsoluteStack(stack_out).into(),
+        Full(ImmMemHandlerFlags::UseStackWithPushPop) => AdvanceStackPointer(stack_out).into(),
+        Full(ImmMemHandlerFlags::UseStackWithOffset) => RelativeStack(stack_out).into(),
+        Full(ImmMemHandlerFlags::UseCodePage) => panic!("Parser wants to write to code page"),
+    };
+
+    let src2 = Register2(Register::new(parsed.src1_reg_idx));
+    let out2 = Register2(Register::new(parsed.dst1_reg_idx));
+
+    macro_rules! binop {
+        ($op: ident, $snd: tt) => {
+            Instruction::from_binop::<$op>(
+                src1,
+                src2,
+                out,
+                &$snd,
+                arguments,
+                parsed.variant.flags[SWAP_OPERANDS_FLAG_IDX_FOR_ARITH_OPCODES],
+                parsed.variant.flags[SET_FLAGS_FLAG_IDX],
+            )
+        };
+    }
+
+    macro_rules! ptr {
+        ($op: ident) => {
+            Instruction::from_ptr::<$op>(
+                src1,
+                src2,
+                out,
+                arguments,
+                parsed.variant.flags[SWAP_OPERANDS_FLAG_IDX_FOR_PTR_OPCODE],
+            )
+        };
+    }
+
+    match parsed.variant.opcode {
+        Opcode::Add(_) => binop!(Add, ()),
+        Opcode::Sub(_) => binop!(Sub, ()),
+        Opcode::Mul(_) => binop!(Mul, out2),
+        Opcode::Div(_) => binop!(Div, out2),
+        Opcode::Binop(x) => match x {
+            zkevm_opcode_defs::BinopOpcode::Xor => binop!(Xor, ()),
+            zkevm_opcode_defs::BinopOpcode::And => binop!(And, ()),
+            zkevm_opcode_defs::BinopOpcode::Or => binop!(Or, ()),
+        },
+        Opcode::Shift(x) => match x {
+            zkevm_opcode_defs::ShiftOpcode::Shl => binop!(ShiftLeft, ()),
+            zkevm_opcode_defs::ShiftOpcode::Shr => binop!(ShiftRight, ()),
+            zkevm_opcode_defs::ShiftOpcode::Rol => binop!(RotateLeft, ()),
+            zkevm_opcode_defs::ShiftOpcode::Ror => binop!(RotateRight, ()),
+        },
+        Opcode::Jump(_) => Instruction::from_jump(src1, out.try_into().unwrap(), arguments),
+        Opcode::Context(x) => match x {
+            zkevm_opcode_defs::ContextOpcode::This => {
+                Instruction::from_this(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::Caller => {
+                Instruction::from_caller(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::CodeAddress => {
+                Instruction::from_code_address(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::ErgsLeft => {
+                Instruction::from_ergs_left(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::GetContextU128 => {
+                Instruction::from_context_u128(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::SetContextU128 => {
+                Instruction::from_set_context_u128(src1.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::Sp => {
+                Instruction::from_context_sp(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::Meta => {
+                Instruction::from_context_meta(out.try_into().unwrap(), arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::IncrementTxNumber => {
+                Instruction::from_increment_tx_number(arguments)
+            }
+            zkevm_opcode_defs::ContextOpcode::AuxMutating0 => {
+                Instruction::from_aux_mutating(arguments)
+            }
+        },
+        Opcode::Ptr(x) => match x {
+            zkevm_opcode_defs::PtrOpcode::Add => ptr!(PointerAdd),
+            zkevm_opcode_defs::PtrOpcode::Sub => ptr!(PointerSub),
+            zkevm_opcode_defs::PtrOpcode::Pack => ptr!(PointerPack),
+            zkevm_opcode_defs::PtrOpcode::Shrink => ptr!(PointerShrink),
+        },
+        Opcode::NearCall(_) => Instruction::from_near_call(
+            Register1(Register::new(parsed.src0_reg_idx)),
+            Immediate1(parsed.imm_0),
+            Immediate2(parsed.imm_1),
+            arguments,
+        ),
+        Opcode::FarCall(kind) => {
+            let constructor = match kind {
+                zkevm_opcode_defs::FarCallOpcode::Normal => {
+                    Instruction::from_far_call::<opcodes::Normal>
+                }
+                zkevm_opcode_defs::FarCallOpcode::Delegate => {
+                    Instruction::from_far_call::<opcodes::Delegate>
+                }
+                zkevm_opcode_defs::FarCallOpcode::Mimic => {
+                    Instruction::from_far_call::<opcodes::Mimic>
+                }
+            };
+            constructor(
+                src1.try_into().unwrap(),
+                src2,
+                Immediate1(parsed.imm_0),
+                parsed.variant.flags[FAR_CALL_STATIC_FLAG_IDX],
+                parsed.variant.flags[FAR_CALL_SHARD_FLAG_IDX],
+                arguments,
+            )
+        }
+        Opcode::Ret(kind) => {
+            let to_label = parsed.variant.flags[RET_TO_LABEL_BIT_IDX];
+            let label = if to_label {
+                Some(Immediate1(parsed.imm_0))
+            } else {
+                None
+            };
+            match kind {
+                zkevm_opcode_defs::RetOpcode::Ok => {
+                    Instruction::from_ret(src1.try_into().unwrap(), label, arguments)
+                }
+                zkevm_opcode_defs::RetOpcode::Revert => {
+                    Instruction::from_revert(src1.try_into().unwrap(), label, arguments)
+                }
+                zkevm_opcode_defs::RetOpcode::Panic => Instruction::from_panic(label, arguments),
+            }
+        }
+        Opcode::Log(x) => match x {
+            zkevm_opcode_defs::LogOpcode::StorageRead => Instruction::from_storage_read(
+                src1.try_into().unwrap(),
+                out.try_into().unwrap(),
+                arguments,
+            ),
+            zkevm_opcode_defs::LogOpcode::TransientStorageRead => {
+                Instruction::from_transient_storage_read(
+                    src1.try_into().unwrap(),
+                    out.try_into().unwrap(),
+                    arguments,
+                )
+            }
+
+            zkevm_opcode_defs::LogOpcode::StorageWrite => {
+                Instruction::from_storage_write(src1.try_into().unwrap(), src2, arguments)
+            }
+
+            zkevm_opcode_defs::LogOpcode::TransientStorageWrite => {
+                Instruction::from_transient_storage_write(src1.try_into().unwrap(), src2, arguments)
+            }
+
+            zkevm_opcode_defs::LogOpcode::ToL1Message => Instruction::from_l2_to_l1_message(
+                src1.try_into().unwrap(),
+                src2,
+                parsed.variant.flags[FIRST_MESSAGE_FLAG_IDX],
+                arguments,
+            ),
+            zkevm_opcode_defs::LogOpcode::Event => Instruction::from_event(
+                src1.try_into().unwrap(),
+                src2,
+                parsed.variant.flags[FIRST_MESSAGE_FLAG_IDX],
+                arguments,
+            ),
+            zkevm_opcode_defs::LogOpcode::PrecompileCall => Instruction::from_precompile_call(
+                src1.try_into().unwrap(),
+                src2,
+                out.try_into().unwrap(),
+                arguments,
+            ),
+            zkevm_opcode_defs::LogOpcode::Decommit => Instruction::from_decommit(
+                src1.try_into().unwrap(),
+                src2,
+                out.try_into().unwrap(),
+                arguments,
+            ),
+        },
+        Opcode::UMA(x) => {
+            let increment = parsed.variant.flags[UMA_INCREMENT_FLAG_IDX];
+            match x {
+                zkevm_opcode_defs::UMAOpcode::HeapRead => Instruction::from_heap_read(
+                    src1.try_into().unwrap(),
+                    out.try_into().unwrap(),
+                    increment.then_some(out2),
+                    arguments,
+                ),
+                zkevm_opcode_defs::UMAOpcode::HeapWrite => Instruction::from_heap_write(
+                    src1.try_into().unwrap(),
+                    src2,
+                    increment.then_some(out.try_into().unwrap()),
+                    arguments,
+                    is_bootloader,
+                ),
+                zkevm_opcode_defs::UMAOpcode::AuxHeapRead => Instruction::from_aux_heap_read(
+                    src1.try_into().unwrap(),
+                    out.try_into().unwrap(),
+                    increment.then_some(out2),
+                    arguments,
+                ),
+                zkevm_opcode_defs::UMAOpcode::AuxHeapWrite => Instruction::from_aux_heap_store(
+                    src1.try_into().unwrap(),
+                    src2,
+                    increment.then_some(out.try_into().unwrap()),
+                    arguments,
+                ),
+                zkevm_opcode_defs::UMAOpcode::FatPointerRead => Instruction::from_pointer_read(
+                    src1.try_into().unwrap(),
+                    out.try_into().unwrap(),
+                    increment.then_some(out2),
+                    arguments,
+                ),
+                zkevm_opcode_defs::UMAOpcode::StaticMemoryRead => unimplemented_instruction(
+                    Opcode::UMA(zkevm_opcode_defs::UMAOpcode::StaticMemoryRead),
+                ),
+                zkevm_opcode_defs::UMAOpcode::StaticMemoryWrite => unimplemented_instruction(
+                    Opcode::UMA(zkevm_opcode_defs::UMAOpcode::StaticMemoryWrite),
+                ),
+            }
+        }
+        Opcode::Invalid(_) => Instruction::from_invalid(),
+        Opcode::Nop(_) => {
+            let no_sp_movement = AdvanceStackPointer(RegisterAndImmediate {
+                immediate: 0,
+                register: Register::new(0),
+            });
+            Instruction::from_nop(
+                if let AnySource::AdvanceStackPointer(pop) = src1 {
+                    pop
+                } else {
+                    no_sp_movement
+                },
+                if let AnyDestination::AdvanceStackPointer(push) = out {
+                    push
+                } else {
+                    no_sp_movement
+                },
+                arguments,
+            )
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/decommit.rs.html b/src/zksync_vm2/decommit.rs.html new file mode 100644 index 0000000..4ece0f7 --- /dev/null +++ b/src/zksync_vm2/decommit.rs.html @@ -0,0 +1,307 @@ +decommit.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+
use primitive_types::{H160, U256};
+use zkevm_opcode_defs::{
+    ethereum_types::Address, system_params::DEPLOYER_SYSTEM_CONTRACT_ADDRESS_LOW,
+};
+use zksync_vm2_interface::{CycleStats, Tracer};
+
+use crate::{program::Program, world_diff::WorldDiff, World};
+
+impl WorldDiff {
+    pub(crate) fn decommit<T: Tracer>(
+        &mut self,
+        world: &mut impl World<T>,
+        tracer: &mut T,
+        address: U256,
+        default_aa_code_hash: [u8; 32],
+        evm_interpreter_code_hash: [u8; 32],
+        is_constructor_call: bool,
+    ) -> Option<(UnpaidDecommit, bool)> {
+        let deployer_system_contract_address =
+            Address::from_low_u64_be(DEPLOYER_SYSTEM_CONTRACT_ADDRESS_LOW.into());
+
+        let mut is_evm = false;
+
+        let mut code_info = {
+            let code_info = self.read_storage_without_refund(
+                world,
+                tracer,
+                deployer_system_contract_address,
+                address,
+            );
+            let mut code_info_bytes = [0; 32];
+            code_info.to_big_endian(&mut code_info_bytes);
+
+            // Note that EOAs are considered constructed because their code info is all zeroes.
+            let is_constructed = match code_info_bytes[1] {
+                0 => true,
+                1 => false,
+                _ => {
+                    return None;
+                }
+            };
+
+            let try_default_aa = if is_kernel(u256_into_address(address)) {
+                None
+            } else {
+                Some(default_aa_code_hash)
+            };
+
+            // The address aliasing contract implements Ethereum-like behavior of calls to EOAs
+            // returning successfully (and address aliasing when called from the bootloader).
+            // It makes sense that unconstructed code is treated as an EOA but for some reason
+            // a constructor call to constructed code is also treated as EOA.
+            match code_info_bytes[0] {
+                1 => {
+                    if is_constructed == is_constructor_call {
+                        try_default_aa?
+                    } else {
+                        code_info_bytes
+                    }
+                }
+                2 => {
+                    if is_constructed == is_constructor_call {
+                        try_default_aa?
+                    } else {
+                        is_evm = true;
+                        evm_interpreter_code_hash
+                    }
+                }
+                _ if code_info == U256::zero() => try_default_aa?,
+                _ => return None,
+            }
+        };
+
+        code_info[1] = 0;
+        let code_key: U256 = U256::from_big_endian(&code_info);
+
+        let was_decommitted = self.decommitted_hashes.as_ref().get(&code_key) == Some(&true);
+        let cost = if was_decommitted {
+            0
+        } else {
+            let code_length_in_words = u16::from_be_bytes([code_info[2], code_info[3]]);
+            u32::from(code_length_in_words) * zkevm_opcode_defs::ERGS_PER_CODE_WORD_DECOMMITTMENT
+        };
+
+        Some((UnpaidDecommit { cost, code_key }, is_evm))
+    }
+
+    /// Returns the decommitted contract code and a flag set to `true` if this is a fresh decommit (i.e.,
+    /// the code wasn't decommitted previously in the same VM run).
+    #[doc(hidden)] // should be used for testing purposes only; can break VM operation otherwise
+    pub fn decommit_opcode<T: Tracer>(
+        &mut self,
+        world: &mut impl World<T>,
+        tracer: &mut T,
+        code_hash: U256,
+    ) -> (Vec<u8>, bool) {
+        let is_new = self.decommitted_hashes.insert(code_hash, true) != Some(true);
+        let code = world.decommit_code(code_hash);
+        if is_new {
+            let code_len = u32::try_from(code.len()).expect("bytecode length overflow");
+            // Decommitter can process two words per cycle, hence division by 2 * 32 = 64.
+            tracer.on_extra_prover_cycles(CycleStats::Decommit(code_len.div_ceil(64)));
+        }
+        (code, is_new)
+    }
+
+    pub(crate) fn pay_for_decommit<T: Tracer, W: World<T>>(
+        &mut self,
+        world: &mut W,
+        tracer: &mut T,
+        decommit: UnpaidDecommit,
+        gas: &mut u32,
+    ) -> Option<Program<T, W>> {
+        if decommit.cost > *gas {
+            // We intentionally record a decommitment event even if actual decommitment never happens because of an out-of-gas error.
+            // This is how the old VM behaves.
+            self.decommitted_hashes.insert(decommit.code_key, false);
+            // Unlike all other gas costs, this one is not paid if low on gas.
+            return None;
+        }
+
+        let is_new = self.decommitted_hashes.insert(decommit.code_key, true) != Some(true);
+        *gas -= decommit.cost;
+
+        let decommit = world.decommit(decommit.code_key);
+        if is_new {
+            let code_len_in_words =
+                u32::try_from(decommit.code_page().len()).expect("bytecode length overflow");
+            // Decommitter can process two words per cycle.
+            tracer.on_extra_prover_cycles(CycleStats::Decommit(code_len_in_words.div_ceil(2)));
+        }
+
+        Some(decommit)
+    }
+}
+
+#[derive(Debug, Clone, Copy)]
+pub(crate) struct UnpaidDecommit {
+    cost: u32,
+    code_key: U256,
+}
+
+pub(crate) fn u256_into_address(source: U256) -> H160 {
+    let mut result = H160::zero();
+    let mut bytes = [0; 32];
+    source.to_big_endian(&mut bytes);
+    result.assign_from_slice(&bytes[12..]);
+    result
+}
+
+pub(crate) fn is_kernel(address: H160) -> bool {
+    address.0[..18].iter().all(|&byte| byte == 0)
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/fat_pointer.rs.html b/src/zksync_vm2/fat_pointer.rs.html new file mode 100644 index 0000000..bdff384 --- /dev/null +++ b/src/zksync_vm2/fat_pointer.rs.html @@ -0,0 +1,81 @@ +fat_pointer.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+
use std::ptr;
+
+use primitive_types::U256;
+use zksync_vm2_interface::HeapId;
+
+/// Fat pointer to a heap location.
+#[derive(Debug)]
+#[repr(C)]
+pub struct FatPointer {
+    /// Additional pointer offset inside the `start..(start + length)` range.
+    pub offset: u32,
+    /// ID of the heap this points to.
+    pub memory_page: HeapId,
+    /// 0-based index of the pointer start byte at the `memory` page.
+    pub start: u32,
+    /// Length of the pointed slice in bytes.
+    pub length: u32,
+}
+
+#[cfg(target_endian = "little")]
+impl From<&mut U256> for &mut FatPointer {
+    fn from(value: &mut U256) -> Self {
+        unsafe { &mut *ptr::from_mut(value).cast() }
+    }
+}
+
+#[cfg(target_endian = "little")]
+impl From<U256> for FatPointer {
+    fn from(value: U256) -> Self {
+        unsafe { std::mem::transmute(value.low_u128()) }
+    }
+}
+
+impl FatPointer {
+    /// Converts this pointer into a `U256` word.
+    #[cfg(target_endian = "little")]
+    pub fn into_u256(self) -> U256 {
+        U256::zero() + unsafe { std::mem::transmute::<FatPointer, u128>(self) }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/heap.rs.html b/src/zksync_vm2/heap.rs.html new file mode 100644 index 0000000..32f8419 --- /dev/null +++ b/src/zksync_vm2/heap.rs.html @@ -0,0 +1,1099 @@ +heap.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+
use std::{
+    fmt, mem,
+    ops::{Index, Range},
+};
+
+use primitive_types::U256;
+use zksync_vm2_interface::HeapId;
+
+/// Heap page size in bytes.
+const HEAP_PAGE_SIZE: usize = 1 << 12;
+
+/// Heap page.
+#[derive(Debug, Clone, PartialEq)]
+struct HeapPage(Box<[u8; HEAP_PAGE_SIZE]>);
+
+impl Default for HeapPage {
+    fn default() -> Self {
+        let boxed_slice: Box<[u8]> = vec![0_u8; HEAP_PAGE_SIZE].into();
+        Self(boxed_slice.try_into().unwrap())
+    }
+}
+
+#[derive(Debug, Clone, Default)]
+pub(crate) struct Heap {
+    pages: Vec<Option<HeapPage>>,
+}
+
+// We never remove `HeapPage`s (even after rollbacks – although we do zero all added pages in this case),
+// we allow additional pages to be present if they are zeroed.
+impl PartialEq for Heap {
+    fn eq(&self, other: &Self) -> bool {
+        for i in 0..self.pages.len().max(other.pages.len()) {
+            let this_page = self.pages.get(i).and_then(Option::as_ref);
+            let other_page = other.pages.get(i).and_then(Option::as_ref);
+            match (this_page, other_page) {
+                (Some(this_page), Some(other_page)) => {
+                    if this_page != other_page {
+                        return false;
+                    }
+                }
+                (Some(page), None) | (None, Some(page)) => {
+                    if page.0.iter().any(|&byte| byte != 0) {
+                        return false;
+                    }
+                }
+                (None, None) => { /* do nothing */ }
+            }
+        }
+        true
+    }
+}
+
+impl Heap {
+    fn from_bytes(bytes: &[u8], pagepool: &mut PagePool) -> Self {
+        let pages = bytes
+            .chunks(HEAP_PAGE_SIZE)
+            .map(|bytes| {
+                Some(if let Some(mut page) = pagepool.get_dirty_page() {
+                    page.0[..bytes.len()].copy_from_slice(bytes);
+                    page.0[bytes.len()..].fill(0);
+                    page
+                } else {
+                    let mut page = HeapPage::default();
+                    page.0[..bytes.len()].copy_from_slice(bytes);
+                    page
+                })
+            })
+            .collect();
+        Self { pages }
+    }
+
+    pub(crate) fn read_u256(&self, start_address: u32) -> U256 {
+        let (page_idx, offset_in_page) = address_to_page_offset(start_address);
+        let bytes_in_page = HEAP_PAGE_SIZE - offset_in_page;
+
+        if bytes_in_page >= 32 {
+            if let Some(page) = self.page(page_idx) {
+                U256::from_big_endian(&page.0[offset_in_page..offset_in_page + 32])
+            } else {
+                U256::zero()
+            }
+        } else {
+            let mut result = [0u8; 32];
+            if let Some(page) = self.page(page_idx) {
+                for (res, src) in result.iter_mut().zip(&page.0[offset_in_page..]) {
+                    *res = *src;
+                }
+            }
+            if let Some(page) = self.page(page_idx + 1) {
+                for (res, src) in result[bytes_in_page..].iter_mut().zip(&*page.0) {
+                    *res = *src;
+                }
+            }
+            U256::from_big_endian(&result)
+        }
+    }
+
+    pub(crate) fn read_u256_partially(&self, range: Range<u32>) -> U256 {
+        let (page_idx, offset_in_page) = address_to_page_offset(range.start);
+        let length = range.len();
+        let bytes_in_page = length.min(HEAP_PAGE_SIZE - offset_in_page);
+
+        let mut result = [0u8; 32];
+        if let Some(page) = self.page(page_idx) {
+            for (res, src) in result[..bytes_in_page]
+                .iter_mut()
+                .zip(&page.0[offset_in_page..])
+            {
+                *res = *src;
+            }
+        }
+        if let Some(page) = self.page(page_idx + 1) {
+            for (res, src) in result[bytes_in_page..length].iter_mut().zip(&*page.0) {
+                *res = *src;
+            }
+        }
+        U256::from_big_endian(&result)
+    }
+
+    pub(crate) fn read_range_big_endian(&self, range: Range<u32>) -> Vec<u8> {
+        let length = range.len();
+
+        let (mut page_idx, mut offset_in_page) = address_to_page_offset(range.start);
+        let mut result = Vec::with_capacity(length);
+        while result.len() < length {
+            let len_in_page = (length - result.len()).min(HEAP_PAGE_SIZE - offset_in_page);
+            if let Some(page) = self.page(page_idx) {
+                result.extend_from_slice(&page.0[offset_in_page..(offset_in_page + len_in_page)]);
+            } else {
+                result.resize(result.len() + len_in_page, 0);
+            }
+            page_idx += 1;
+            offset_in_page = 0;
+        }
+        result
+    }
+
+    /// Needed only by tracers
+    pub(crate) fn read_byte(&self, address: u32) -> u8 {
+        let (page, offset) = address_to_page_offset(address);
+        self.page(page).map_or(0, |page| page.0[offset])
+    }
+
+    fn page(&self, idx: usize) -> Option<&HeapPage> {
+        self.pages.get(idx)?.as_ref()
+    }
+
+    fn get_or_insert_page(&mut self, idx: usize, pagepool: &mut PagePool) -> &mut HeapPage {
+        if self.pages.len() <= idx {
+            self.pages.resize(idx + 1, None);
+        }
+        self.pages[idx].get_or_insert_with(|| pagepool.allocate_page())
+    }
+
+    fn write_u256(&mut self, start_address: u32, value: U256, pagepool: &mut PagePool) {
+        let (page_idx, offset_in_page) = address_to_page_offset(start_address);
+        let bytes_in_page = HEAP_PAGE_SIZE - offset_in_page;
+        let page = self.get_or_insert_page(page_idx, pagepool);
+
+        if bytes_in_page >= 32 {
+            value.to_big_endian(&mut page.0[offset_in_page..offset_in_page + 32]);
+        } else {
+            let mut bytes = [0; 32];
+            value.to_big_endian(&mut bytes);
+            let mut bytes_iter = bytes.into_iter();
+
+            for (dst, src) in page.0[offset_in_page..].iter_mut().zip(bytes_iter.by_ref()) {
+                *dst = src;
+            }
+
+            let page = self.get_or_insert_page(page_idx + 1, pagepool);
+            for (dst, src) in page.0.iter_mut().zip(bytes_iter) {
+                *dst = src;
+            }
+        }
+    }
+}
+
+#[inline(always)]
+fn address_to_page_offset(address: u32) -> (usize, usize) {
+    let offset = address as usize;
+    (offset >> 12, offset & (HEAP_PAGE_SIZE - 1))
+}
+
+#[derive(Debug, Clone)]
+pub(crate) struct Heaps {
+    heaps: Vec<Heap>,
+    pagepool: PagePool,
+    bootloader_heap_rollback_info: Vec<(u32, U256)>,
+    bootloader_aux_rollback_info: Vec<(u32, U256)>,
+}
+
+impl Heaps {
+    pub(crate) fn new(calldata: &[u8]) -> Self {
+        // The first heap can never be used because heap zero
+        // means the current heap in precompile calls
+        let mut pagepool = PagePool::default();
+        Self {
+            heaps: vec![
+                Heap::default(),
+                Heap::from_bytes(calldata, &mut pagepool),
+                Heap::default(),
+                Heap::default(),
+            ],
+            pagepool,
+            bootloader_heap_rollback_info: vec![],
+            bootloader_aux_rollback_info: vec![],
+        }
+    }
+
+    pub(crate) fn allocate(&mut self) -> HeapId {
+        self.allocate_inner(&[])
+    }
+
+    pub(crate) fn allocate_with_content(&mut self, content: &[u8]) -> HeapId {
+        self.allocate_inner(content)
+    }
+
+    fn allocate_inner(&mut self, memory: &[u8]) -> HeapId {
+        let id = u32::try_from(self.heaps.len()).expect("heap ID overflow");
+        let id = HeapId::from_u32_unchecked(id);
+        self.heaps
+            .push(Heap::from_bytes(memory, &mut self.pagepool));
+        id
+    }
+
+    pub(crate) fn deallocate(&mut self, heap: HeapId) {
+        let heap = mem::take(&mut self.heaps[heap.as_u32() as usize]);
+        for page in heap.pages.into_iter().flatten() {
+            self.pagepool.recycle_page(page);
+        }
+    }
+
+    pub(crate) fn write_u256(&mut self, heap: HeapId, start_address: u32, value: U256) {
+        if heap == HeapId::FIRST {
+            let prev_value = self[heap].read_u256(start_address);
+            self.bootloader_heap_rollback_info
+                .push((start_address, prev_value));
+        } else if heap == HeapId::FIRST_AUX {
+            let prev_value = self[heap].read_u256(start_address);
+            self.bootloader_aux_rollback_info
+                .push((start_address, prev_value));
+        }
+        self.heaps[heap.as_u32() as usize].write_u256(start_address, value, &mut self.pagepool);
+    }
+
+    pub(crate) fn snapshot(&self) -> (usize, usize) {
+        (
+            self.bootloader_heap_rollback_info.len(),
+            self.bootloader_aux_rollback_info.len(),
+        )
+    }
+
+    pub(crate) fn rollback(&mut self, (heap_snap, aux_snap): (usize, usize)) {
+        for (address, value) in self.bootloader_heap_rollback_info.drain(heap_snap..).rev() {
+            self.heaps[HeapId::FIRST.as_u32() as usize].write_u256(
+                address,
+                value,
+                &mut self.pagepool,
+            );
+        }
+
+        for (address, value) in self.bootloader_aux_rollback_info.drain(aux_snap..).rev() {
+            self.heaps[HeapId::FIRST_AUX.as_u32() as usize].write_u256(
+                address,
+                value,
+                &mut self.pagepool,
+            );
+        }
+    }
+
+    pub(crate) fn delete_history(&mut self) {
+        self.bootloader_heap_rollback_info.clear();
+        self.bootloader_aux_rollback_info.clear();
+    }
+}
+
+impl Index<HeapId> for Heaps {
+    type Output = Heap;
+
+    fn index(&self, index: HeapId) -> &Self::Output {
+        &self.heaps[index.as_u32() as usize]
+    }
+}
+
+// Since we never remove `Heap` entries (even after rollbacks – although we do deallocate heaps in this case),
+// we allow additional empty heaps at the end of `Heaps`.
+impl PartialEq for Heaps {
+    fn eq(&self, other: &Self) -> bool {
+        for i in 0..self.heaps.len().max(other.heaps.len()) {
+            if self.heaps.get(i).unwrap_or(&Heap::default())
+                != other.heaps.get(i).unwrap_or(&Heap::default())
+            {
+                return false;
+            }
+        }
+        true
+    }
+}
+
+#[derive(Default, Clone)]
+struct PagePool(Vec<HeapPage>);
+
+impl fmt::Debug for PagePool {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        formatter
+            .debug_struct("PagePool")
+            .field("len", &self.0.len())
+            .finish_non_exhaustive()
+    }
+}
+
+impl PagePool {
+    fn allocate_page(&mut self) -> HeapPage {
+        self.get_dirty_page()
+            .map(|mut page| {
+                page.0.fill(0);
+                page
+            })
+            .unwrap_or_default()
+    }
+
+    fn get_dirty_page(&mut self) -> Option<HeapPage> {
+        self.0.pop()
+    }
+
+    fn recycle_page(&mut self, page: HeapPage) {
+        self.0.push(page);
+    }
+}
+
+#[cfg(test)]
+#[allow(clippy::cast_possible_truncation)]
+mod tests {
+    use super::*;
+
+    fn repeat_byte(byte: u8) -> U256 {
+        U256::from_little_endian(&[byte; 32])
+    }
+
+    fn test_heap_write_resizes(recycled_pages: &mut PagePool) {
+        let mut heap = Heap::default();
+        heap.write_u256(5, 1.into(), recycled_pages);
+        assert_eq!(heap.pages.len(), 1);
+        assert_eq!(heap.read_u256(5), 1.into());
+
+        // Check writing at a page boundary
+        heap.write_u256(
+            HEAP_PAGE_SIZE as u32 - 32,
+            repeat_byte(0xaa),
+            recycled_pages,
+        );
+        assert_eq!(heap.pages.len(), 1);
+        assert_eq!(
+            heap.read_u256(HEAP_PAGE_SIZE as u32 - 32),
+            repeat_byte(0xaa)
+        );
+
+        for offset in (1..=31).rev() {
+            heap.write_u256(
+                HEAP_PAGE_SIZE as u32 - offset,
+                repeat_byte(offset as u8),
+                recycled_pages,
+            );
+            assert_eq!(heap.pages.len(), 2);
+            assert_eq!(
+                heap.read_u256(HEAP_PAGE_SIZE as u32 - offset),
+                repeat_byte(offset as u8)
+            );
+        }
+
+        // check reading at a page boundary from a missing page
+        for offset in 0..32 {
+            assert_eq!(heap.read_u256((1 << 20) - offset), 0.into());
+        }
+
+        heap.write_u256(1 << 20, repeat_byte(0xff), recycled_pages);
+        assert_eq!(heap.pages.len(), 257);
+        assert_eq!(heap.pages.iter().flatten().count(), 3);
+        assert_eq!(heap.read_u256(1 << 20), repeat_byte(0xff));
+    }
+
+    #[test]
+    fn heap_write_resizes() {
+        test_heap_write_resizes(&mut PagePool::default());
+    }
+
+    #[test]
+    fn heap_write_resizes_with_recycled_pages() {
+        test_heap_write_resizes(&mut populated_pagepool());
+    }
+
+    fn populated_pagepool() -> PagePool {
+        let mut pagepool = PagePool::default();
+        for _ in 0..10 {
+            let mut page = HeapPage::default();
+            // Fill pages with 0xff bytes to detect not clearing pages
+            page.0.fill(0xff);
+            pagepool.recycle_page(page);
+        }
+        pagepool
+    }
+
+    #[test]
+    fn reading_heap_range() {
+        let mut heap = Heap::default();
+        let offsets = [
+            0_u32,
+            10,
+            HEAP_PAGE_SIZE as u32 - 10,
+            HEAP_PAGE_SIZE as u32 + 10,
+            (1 << 20) - 10,
+            1 << 20,
+            (1 << 20) + 10,
+        ];
+        for offset in offsets {
+            for length in [0, 1, 10, 31, 32, 1_024, 32_768] {
+                let data = heap.read_range_big_endian(offset..offset + length);
+                assert_eq!(data.len(), length as usize);
+                assert!(data.iter().all(|&byte| byte == 0));
+            }
+        }
+
+        for (i, offset) in offsets.into_iter().enumerate() {
+            let bytes: Vec<_> = (i..i + 32).map(|byte| byte as u8).collect();
+            heap.write_u256(
+                offset,
+                U256::from_big_endian(&bytes),
+                &mut PagePool::default(),
+            );
+            for length in 1..=32 {
+                let data = heap.read_range_big_endian(offset..offset + length);
+                assert_eq!(data, bytes[..length as usize]);
+            }
+        }
+    }
+
+    #[test]
+    fn heap_partial_u256_reads() {
+        let mut heap = Heap::default();
+        let bytes: Vec<_> = (1..=32).collect();
+        heap.write_u256(0, U256::from_big_endian(&bytes), &mut PagePool::default());
+        for length in 1..=32 {
+            let read = heap.read_u256_partially(0..length);
+            // Mask is 0xff...ff00..00, where the number of `0xff` bytes is the number of read bytes
+            let mask = U256::MAX << (8 * (32 - length));
+            assert_eq!(read, U256::from_big_endian(&bytes) & mask);
+        }
+
+        // The same test at the page boundary.
+        let offset = HEAP_PAGE_SIZE as u32 - 10;
+        heap.write_u256(
+            offset,
+            U256::from_big_endian(&bytes),
+            &mut PagePool::default(),
+        );
+        for length in 1..=32 {
+            let read = heap.read_u256_partially(offset..offset + length);
+            let mask = U256::MAX << (8 * (32 - length));
+            assert_eq!(read, U256::from_big_endian(&bytes) & mask);
+        }
+    }
+
+    #[test]
+    fn heap_read_out_of_bounds() {
+        let heap = Heap::default();
+        assert_eq!(heap.read_u256(5), 0.into());
+    }
+
+    fn test_creating_heap_from_bytes(recycled_pages: &mut PagePool) {
+        let bytes: Vec<_> = (0..=u8::MAX).collect();
+        let heap = Heap::from_bytes(&bytes, recycled_pages);
+        assert_eq!(heap.pages.len(), 1);
+
+        assert_eq!(heap.read_range_big_endian(0..256), bytes);
+        for offset in 0..256 - 32 {
+            let value = heap.read_u256(offset as u32);
+            assert_eq!(value, U256::from_big_endian(&bytes[offset..offset + 32]));
+        }
+
+        // Test larger heap with multiple pages.
+        let bytes: Vec<_> = (0..HEAP_PAGE_SIZE * 5 / 2).map(|byte| byte as u8).collect();
+        let heap = Heap::from_bytes(&bytes, recycled_pages);
+        assert_eq!(heap.pages.len(), 3);
+
+        assert_eq!(
+            heap.read_range_big_endian(0..HEAP_PAGE_SIZE as u32 * 5 / 2),
+            bytes
+        );
+        for len in [
+            1,
+            10,
+            100,
+            HEAP_PAGE_SIZE / 3,
+            HEAP_PAGE_SIZE / 2,
+            HEAP_PAGE_SIZE,
+            2 * HEAP_PAGE_SIZE,
+        ] {
+            for offset in 0..(HEAP_PAGE_SIZE * 5 / 2 - len) {
+                assert_eq!(
+                    heap.read_range_big_endian(offset as u32..(offset + len) as u32),
+                    bytes[offset..offset + len]
+                );
+            }
+        }
+
+        for offset in 0..HEAP_PAGE_SIZE * 5 / 2 - 32 {
+            let value = heap.read_u256(offset as u32);
+            assert_eq!(value, U256::from_big_endian(&bytes[offset..offset + 32]));
+        }
+    }
+
+    #[test]
+    fn creating_heap_from_bytes() {
+        test_creating_heap_from_bytes(&mut PagePool::default());
+    }
+
+    #[test]
+    fn creating_heap_from_bytes_with_recycling() {
+        test_creating_heap_from_bytes(&mut populated_pagepool());
+    }
+
+    #[test]
+    fn rolling_back_heaps() {
+        let mut heaps = Heaps::new(b"test");
+        let written_value = U256::from(123_456_789) << 224; // writes bytes 0..4
+        heaps.write_u256(HeapId::FIRST, 0, written_value);
+        assert_eq!(heaps[HeapId::FIRST].read_u256(0), written_value);
+        heaps.write_u256(HeapId::FIRST_AUX, 0, 42.into());
+        assert_eq!(heaps[HeapId::FIRST_AUX].read_u256(0), 42.into());
+
+        let snapshot = heaps.snapshot();
+        assert_eq!(snapshot, (1, 1));
+
+        heaps.write_u256(HeapId::FIRST, 7, U256::MAX);
+        assert_eq!(
+            heaps[HeapId::FIRST].read_u256(0),
+            written_value + (U256::MAX >> 56)
+        );
+        heaps.write_u256(HeapId::FIRST_AUX, 16, U256::MAX);
+        assert_eq!(heaps[HeapId::FIRST_AUX].read_u256(16), U256::MAX);
+
+        heaps.rollback(snapshot);
+        assert_eq!(heaps[HeapId::FIRST].read_u256(0), written_value);
+        assert_eq!(heaps[HeapId::FIRST_AUX].read_u256(0), 42.into());
+        assert_eq!(heaps.bootloader_heap_rollback_info.len(), 1);
+        assert_eq!(heaps.bootloader_aux_rollback_info.len(), 1);
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction.rs.html b/src/zksync_vm2/instruction.rs.html new file mode 100644 index 0000000..2f30369 --- /dev/null +++ b/src/zksync_vm2/instruction.rs.html @@ -0,0 +1,85 @@ +instruction.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
use std::fmt;
+
+use crate::{addressing_modes::Arguments, vm::VirtualMachine};
+
+/// Single EraVM instruction (an opcode + [`Arguments`]).
+///
+/// Managing instructions is warranted for low-level tests; prefer using [`Program`](crate::Program)s to decode instructions
+/// from EraVM bytecodes.
+pub struct Instruction<T, W> {
+    pub(crate) handler: Handler<T, W>,
+    pub(crate) arguments: Arguments,
+}
+
+impl<T, W> fmt::Debug for Instruction<T, W> {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        formatter
+            .debug_struct("Instruction")
+            .field("arguments", &self.arguments)
+            .finish_non_exhaustive()
+    }
+}
+
+pub(crate) type Handler<T, W> = fn(&mut VirtualMachine<T, W>, &mut W, &mut T) -> ExecutionStatus;
+
+#[derive(Debug)]
+pub(crate) enum ExecutionStatus {
+    Running,
+    Stopped(ExecutionEnd),
+}
+
+/// VM stop reason returned from [`VirtualMachine::run()`].
+#[derive(Debug, PartialEq)]
+pub enum ExecutionEnd {
+    /// The executed program has finished and returned the specified data.
+    ProgramFinished(Vec<u8>),
+    /// The executed program has reverted returning the specified data.
+    Reverted(Vec<u8>),
+    /// The executed program has panicked.
+    Panicked,
+    /// Returned when the bootloader writes to the heap location specified by [`hook_address`](crate::Settings.hook_address).
+    SuspendedOnHook(u32),
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/binop.rs.html b/src/zksync_vm2/instruction_handlers/binop.rs.html new file mode 100644 index 0000000..c5f70a3 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/binop.rs.html @@ -0,0 +1,547 @@ +binop.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+
use primitive_types::U256;
+use zksync_vm2_interface::{
+    opcodes::{Add, And, Div, Mul, Or, RotateLeft, RotateRight, ShiftLeft, ShiftRight, Sub, Xor},
+    OpcodeType, Tracer,
+};
+
+use super::{
+    common::boilerplate,
+    monomorphization::{
+        match_boolean, match_destination, match_source, monomorphize, parameterize,
+    },
+};
+use crate::{
+    addressing_modes::{
+        AbsoluteStack, Addressable, AdvanceStackPointer, AnyDestination, AnySource, Arguments,
+        CodePage, Destination, DestinationWriter, Immediate1, Register1, Register2, RelativeStack,
+        Source,
+    },
+    instruction::{ExecutionStatus, Instruction},
+    predication::Flags,
+    VirtualMachine, World,
+};
+
+fn binop<T, W, Op, In1, Out, const SWAP: bool, const SET_FLAGS: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus
+where
+    T: Tracer,
+    Op: Binop,
+    In1: Source,
+    Out: Destination,
+{
+    boilerplate::<Op, _, _>(vm, world, tracer, |vm, args| {
+        let a = In1::get(args, &mut vm.state);
+        let b = Register2::get(args, &mut vm.state);
+        let (a, b) = if SWAP { (b, a) } else { (a, b) };
+
+        let (result, out2, flags) = Op::perform(&a, &b);
+        Out::set(args, &mut vm.state, result);
+        out2.write(args, &mut vm.state);
+        if SET_FLAGS {
+            vm.state.flags = flags;
+        }
+    })
+}
+
+pub(crate) trait Binop: OpcodeType {
+    type Out2: SecondOutput;
+    fn perform(a: &U256, b: &U256) -> (U256, Self::Out2, Flags);
+}
+
+impl Binop for Add {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let (result, overflow) = a.overflowing_add(*b);
+        (
+            result,
+            (),
+            Flags::new(overflow, result.is_zero(), !(overflow || result.is_zero())),
+        )
+    }
+    type Out2 = ();
+}
+
+impl Binop for Sub {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let (result, overflow) = a.overflowing_sub(*b);
+        (
+            result,
+            (),
+            Flags::new(overflow, result.is_zero(), !(overflow || result.is_zero())),
+        )
+    }
+    type Out2 = ();
+}
+
+impl Binop for And {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let result = *a & *b;
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for Or {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let result = *a | *b;
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for Xor {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let result = *a ^ *b;
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for ShiftLeft {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let result = *a << (b.low_u32() % 256);
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for ShiftRight {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let result = *a >> (b.low_u32() % 256);
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for RotateLeft {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let shift = b.low_u32() % 256;
+        let result = *a << shift | *a >> (256 - shift);
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+impl Binop for RotateRight {
+    #[inline(always)]
+    fn perform(a: &U256, b: &U256) -> (U256, (), Flags) {
+        let shift = b.low_u32() % 256;
+        let result = *a >> shift | *a << (256 - shift);
+        (result, (), Flags::new(false, result.is_zero(), false))
+    }
+    type Out2 = ();
+}
+
+/// Second output of a binary operation.
+pub(crate) trait SecondOutput {
+    type Destination: DestinationWriter;
+    fn write(self, args: &Arguments, state: &mut impl Addressable);
+}
+
+impl SecondOutput for () {
+    type Destination = ();
+    fn write(self, _: &Arguments, _: &mut impl Addressable) {}
+}
+
+impl DestinationWriter for () {
+    fn write_destination(&self, _: &mut Arguments) {}
+}
+
+impl SecondOutput for U256 {
+    type Destination = Register2;
+    fn write(self, args: &Arguments, state: &mut impl Addressable) {
+        Self::Destination::set(args, state, self);
+    }
+}
+
+impl Binop for Mul {
+    fn perform(a: &U256, b: &U256) -> (U256, Self::Out2, Flags) {
+        let res = a.full_mul(*b);
+        let (low_slice, high_slice) = res.0.split_at(4);
+
+        let mut low_arr = [0; 4];
+        low_arr.copy_from_slice(low_slice);
+        let low = U256(low_arr);
+
+        let mut high_arr = [0; 4];
+        high_arr.copy_from_slice(high_slice);
+        let high = U256(high_arr);
+
+        (
+            low,
+            high,
+            Flags::new(
+                !high.is_zero(),
+                low.is_zero(),
+                high.is_zero() && !low.is_zero(),
+            ),
+        )
+    }
+    type Out2 = U256;
+}
+
+impl Binop for Div {
+    fn perform(a: &U256, b: &U256) -> (U256, Self::Out2, Flags) {
+        if b.is_zero() {
+            (U256::zero(), U256::zero(), Flags::new(true, false, false))
+        } else {
+            let (quotient, remainder) = a.div_mod(*b);
+            (
+                quotient,
+                remainder,
+                Flags::new(false, quotient.is_zero(), remainder.is_zero()),
+            )
+        }
+    }
+    type Out2 = U256;
+}
+
+macro_rules! from_binop {
+    ($name:ident <$binop:ty>) => {
+        #[doc = concat!("Creates [`", stringify!($binop), "`] instruction with the provided params.")]
+        pub fn $name(
+            src1: AnySource,
+            src2: Register2,
+            out: AnyDestination,
+            arguments: Arguments,
+            swap: bool,
+            set_flags: bool,
+        ) -> Self {
+            Self::from_binop::<$binop>(src1, src2, out, &(), arguments, swap, set_flags)
+        }
+    };
+
+    ($name:ident <$binop:ty, $out2: ty>) => {
+        #[doc = concat!("Creates [`", stringify!($binop), "`] instruction with the provided params.")]
+        pub fn $name(
+            src1: AnySource,
+            src2: Register2,
+            out: AnyDestination,
+            out2: $out2,
+            arguments: Arguments,
+            swap: bool,
+            set_flags: bool,
+        ) -> Self {
+            Self::from_binop::<$binop>(src1, src2, out, &out2, arguments, swap, set_flags)
+        }
+    };
+}
+
+/// Instructions for binary operations.
+impl<T: Tracer, W: World<T>> Instruction<T, W> {
+    pub(crate) fn from_binop<Op: Binop>(
+        src1: AnySource,
+        src2: Register2,
+        out: AnyDestination,
+        out2: &<Op::Out2 as SecondOutput>::Destination,
+        arguments: Arguments,
+        swap: bool,
+        set_flags: bool,
+    ) -> Self {
+        Self {
+            handler: monomorphize!(binop [T W Op] match_source src1 match_destination out match_boolean swap match_boolean set_flags),
+            arguments: arguments
+                .write_source(&src1)
+                .write_source(&src2)
+                .write_destination(&out)
+                .write_destination(out2),
+        }
+    }
+
+    from_binop!(from_add<Add>);
+    from_binop!(from_sub<Sub>);
+    from_binop!(from_and<And>);
+    from_binop!(from_or<Or>);
+    from_binop!(from_xor<Xor>);
+    from_binop!(from_shift_left<ShiftLeft>);
+    from_binop!(from_shift_right<ShiftRight>);
+    from_binop!(from_rotate_left<RotateLeft>);
+    from_binop!(from_rotate_right<RotateRight>);
+
+    from_binop!(from_mul <Mul, Register2>);
+    from_binop!(from_div <Div, Register2>);
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/common.rs.html b/src/zksync_vm2/instruction_handlers/common.rs.html new file mode 100644 index 0000000..d5a9d0e --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/common.rs.html @@ -0,0 +1,135 @@ +common.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
use zksync_vm2_interface::{opcodes, OpcodeType, Tracer};
+
+use super::ret::free_panic;
+use crate::{addressing_modes::Arguments, instruction::ExecutionStatus, VirtualMachine};
+
+#[inline(always)]
+pub(crate) fn boilerplate<Opcode: OpcodeType, T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+    business_logic: impl FnOnce(&mut VirtualMachine<T, W>, &Arguments),
+) -> ExecutionStatus {
+    full_boilerplate::<Opcode, T, W>(vm, world, tracer, |vm, args, _, _| {
+        business_logic(vm, args);
+        ExecutionStatus::Running
+    })
+}
+
+#[inline(always)]
+pub(crate) fn boilerplate_ext<Opcode: OpcodeType, T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+    business_logic: impl FnOnce(&mut VirtualMachine<T, W>, &Arguments, &mut W, &mut T),
+) -> ExecutionStatus {
+    full_boilerplate::<Opcode, T, W>(vm, world, tracer, |vm, args, world, tracer| {
+        business_logic(vm, args, world, tracer);
+        ExecutionStatus::Running
+    })
+}
+
+#[inline(always)]
+pub(crate) fn full_boilerplate<Opcode: OpcodeType, T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+    business_logic: impl FnOnce(
+        &mut VirtualMachine<T, W>,
+        &Arguments,
+        &mut W,
+        &mut T,
+    ) -> ExecutionStatus,
+) -> ExecutionStatus {
+    let args = unsafe { &(*vm.state.current_frame.pc).arguments };
+
+    if vm.state.use_gas(args.get_static_gas_cost()).is_err()
+        || !args.mode_requirements().met(
+            vm.state.current_frame.is_kernel,
+            vm.state.current_frame.is_static,
+        )
+    {
+        return free_panic(vm, tracer);
+    }
+
+    if args.predicate().satisfied(&vm.state.flags) {
+        tracer.before_instruction::<Opcode, _>(vm);
+        vm.state.current_frame.pc = unsafe { vm.state.current_frame.pc.add(1) };
+        let result = business_logic(vm, args, world, tracer);
+        tracer.after_instruction::<Opcode, _>(vm);
+        result
+    } else {
+        tracer.before_instruction::<opcodes::Nop, _>(vm);
+        vm.state.current_frame.pc = unsafe { vm.state.current_frame.pc.add(1) };
+        tracer.after_instruction::<opcodes::Nop, _>(vm);
+        ExecutionStatus::Running
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/context.rs.html b/src/zksync_vm2/instruction_handlers/context.rs.html new file mode 100644 index 0000000..eaacebf --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/context.rs.html @@ -0,0 +1,413 @@ +context.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+
use primitive_types::{H160, U256};
+use zkevm_opcode_defs::VmMetaParameters;
+use zksync_vm2_interface::{
+    opcodes::{self, Caller, CodeAddress, ContextU128, ErgsLeft, This, SP},
+    OpcodeType, Tracer,
+};
+
+use super::common::boilerplate;
+use crate::{
+    addressing_modes::{Arguments, Destination, Register1, Source},
+    instruction::ExecutionStatus,
+    state::State,
+    Instruction, VirtualMachine,
+};
+
+pub(crate) fn address_into_u256(address: H160) -> U256 {
+    let mut buffer = [0; 32];
+    buffer[12..].copy_from_slice(address.as_bytes());
+    U256::from_big_endian(&buffer)
+}
+
+fn context<T, W, Op>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus
+where
+    T: Tracer,
+    Op: ContextOp,
+{
+    boilerplate::<Op, _, _>(vm, world, tracer, |vm, args| {
+        let result = Op::get(&vm.state);
+        Register1::set(args, &mut vm.state, result);
+    })
+}
+
+trait ContextOp: OpcodeType {
+    fn get<T, W>(state: &State<T, W>) -> U256;
+}
+
+impl ContextOp for This {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        address_into_u256(state.current_frame.address)
+    }
+}
+
+impl ContextOp for Caller {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        address_into_u256(state.current_frame.caller)
+    }
+}
+
+impl ContextOp for CodeAddress {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        address_into_u256(state.current_frame.code_address)
+    }
+}
+
+impl ContextOp for ErgsLeft {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        U256([state.current_frame.gas.into(), 0, 0, 0])
+    }
+}
+
+impl ContextOp for ContextU128 {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        state.get_context_u128().into()
+    }
+}
+
+impl ContextOp for SP {
+    fn get<T, W>(state: &State<T, W>) -> U256 {
+        state.current_frame.sp.into()
+    }
+}
+
+fn context_meta<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::ContextMeta, _, _>(vm, world, tracer, |vm, args| {
+        let result = VmMetaParameters {
+            heap_size: vm.state.current_frame.heap_size,
+            aux_heap_size: vm.state.current_frame.aux_heap_size,
+            this_shard_id: 0, // TODO properly implement shards
+            caller_shard_id: 0,
+            code_shard_id: 0,
+            // This field is actually pubdata!
+            aux_field_0: if vm.state.current_frame.is_kernel {
+                #[allow(clippy::cast_sign_loss)] // wrapping conversion is intentional
+                {
+                    vm.world_diff.pubdata.0 as u32
+                }
+            } else {
+                0
+            },
+        }
+        .to_u256();
+
+        Register1::set(args, &mut vm.state, result);
+    })
+}
+
+fn set_context_u128<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::SetContextU128, _, _>(vm, world, tracer, |vm, args| {
+        let value = Register1::get(args, &mut vm.state).low_u128();
+        vm.state.set_context_u128(value);
+    })
+}
+
+fn increment_tx_number<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::IncrementTxNumber, _, _>(vm, world, tracer, |vm, _| {
+        vm.start_new_tx();
+    })
+}
+
+fn aux_mutating<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::AuxMutating0, _, _>(vm, world, tracer, |_, _| {
+        // This instruction just crashes or nops
+    })
+}
+
+/// Context-related instructions.
+impl<T: Tracer, W> Instruction<T, W> {
+    fn from_context<Op: ContextOp>(out: Register1, arguments: Arguments) -> Self {
+        Self {
+            handler: context::<T, W, Op>,
+            arguments: arguments.write_destination(&out),
+        }
+    }
+
+    /// Creates a [`This`] instruction with the provided params.
+    pub fn from_this(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<This>(out, arguments)
+    }
+
+    /// Creates a [`Caller`] instruction with the provided params.
+    pub fn from_caller(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<Caller>(out, arguments)
+    }
+
+    /// Creates a [`CodeAddress`] instruction with the provided params.
+    pub fn from_code_address(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<CodeAddress>(out, arguments)
+    }
+
+    /// Creates an [`ErgsLeft`] instruction with the provided params.
+    pub fn from_ergs_left(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<ErgsLeft>(out, arguments)
+    }
+
+    /// Creates a [`ContextU128`] instruction with the provided params.
+    pub fn from_context_u128(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<ContextU128>(out, arguments)
+    }
+
+    /// Creates an [`SP`] instruction with the provided params.
+    pub fn from_context_sp(out: Register1, arguments: Arguments) -> Self {
+        Self::from_context::<SP>(out, arguments)
+    }
+
+    /// Creates a [`ContextMeta`](opcodes::ContextMeta) instruction with the provided params.
+    pub fn from_context_meta(out: Register1, arguments: Arguments) -> Self {
+        Self {
+            handler: context_meta,
+            arguments: arguments.write_destination(&out),
+        }
+    }
+
+    /// Creates a [`SetContextU128`](opcodes::SetContextU128) instruction with the provided params.
+    pub fn from_set_context_u128(src: Register1, arguments: Arguments) -> Self {
+        Self {
+            handler: set_context_u128,
+            arguments: arguments.write_source(&src),
+        }
+    }
+
+    /// Creates an [`IncrementTxNumber`](opcodes::IncrementTxNumber) instruction with the provided params.
+    pub fn from_increment_tx_number(arguments: Arguments) -> Self {
+        Self {
+            handler: increment_tx_number,
+            arguments,
+        }
+    }
+
+    /// Creates an [`AuxMutating0`](opcodes::AuxMutating0) instruction with the provided params.
+    pub fn from_aux_mutating(arguments: Arguments) -> Self {
+        Self {
+            handler: aux_mutating,
+            arguments,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/decommit.rs.html b/src/zksync_vm2/instruction_handlers/decommit.rs.html new file mode 100644 index 0000000..388254b --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/decommit.rs.html @@ -0,0 +1,143 @@ +decommit.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+
use primitive_types::U256;
+use zkevm_opcode_defs::{BlobSha256Format, ContractCodeSha256Format, VersionedHashLen32};
+use zksync_vm2_interface::{opcodes, Tracer};
+
+use super::common::boilerplate_ext;
+use crate::{
+    addressing_modes::{Arguments, Destination, Register1, Register2, Source},
+    fat_pointer::FatPointer,
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine, World,
+};
+
+fn decommit<T: Tracer, W: World<T>>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::Decommit, _, _>(vm, world, tracer, |vm, args, world, tracer| {
+        let code_hash = Register1::get(args, &mut vm.state);
+        let extra_cost = Register2::get(args, &mut vm.state).low_u32();
+
+        let mut buffer = [0u8; 32];
+        code_hash.to_big_endian(&mut buffer);
+
+        let preimage_len_in_bytes =
+            zkevm_opcode_defs::system_params::NEW_KERNEL_FRAME_MEMORY_STIPEND;
+
+        if vm.state.use_gas(extra_cost).is_err()
+            || (!ContractCodeSha256Format::is_valid(&buffer)
+                && !BlobSha256Format::is_valid(&buffer))
+        {
+            Register1::set(args, &mut vm.state, U256::zero());
+            return;
+        }
+
+        let (program, is_fresh) = vm.world_diff.decommit_opcode(world, tracer, code_hash);
+        if !is_fresh {
+            vm.state.current_frame.gas += extra_cost;
+        }
+
+        let heap = vm.state.heaps.allocate_with_content(program.as_ref());
+        vm.state.current_frame.heaps_i_am_keeping_alive.push(heap);
+
+        let value = FatPointer {
+            offset: 0,
+            memory_page: heap,
+            start: 0,
+            length: preimage_len_in_bytes,
+        };
+        let value = value.into_u256();
+        Register1::set_fat_ptr(args, &mut vm.state, value);
+    })
+}
+
+impl<T: Tracer, W: World<T>> Instruction<T, W> {
+    /// Creates a [`Decommit`](opcodes::Decommit) instruction with the provided params.
+    pub fn from_decommit(
+        abi: Register1,
+        burn: Register2,
+        out: Register1,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            arguments: arguments
+                .write_source(&abi)
+                .write_source(&burn)
+                .write_destination(&out),
+            handler: decommit,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/event.rs.html b/src/zksync_vm2/instruction_handlers/event.rs.html new file mode 100644 index 0000000..b202050 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/event.rs.html @@ -0,0 +1,173 @@ +event.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
use primitive_types::H160;
+use zkevm_opcode_defs::ADDRESS_EVENT_WRITER;
+use zksync_vm2_interface::{opcodes, Event, L2ToL1Log, Tracer};
+
+use super::common::boilerplate_ext;
+use crate::{
+    addressing_modes::{Arguments, Immediate1, Register1, Register2, Source},
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine,
+};
+
+fn event<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::Event, _, _>(vm, world, tracer, |vm, args, _, _| {
+        if vm.state.current_frame.address == H160::from_low_u64_be(ADDRESS_EVENT_WRITER.into()) {
+            let key = Register1::get(args, &mut vm.state);
+            let value = Register2::get(args, &mut vm.state);
+            let is_first = Immediate1::get(args, &mut vm.state).low_u32() == 1;
+
+            vm.world_diff.record_event(Event {
+                key,
+                value,
+                is_first,
+                shard_id: 0, // shards currently aren't supported
+                tx_number: vm.state.transaction_number,
+            });
+        }
+    })
+}
+
+fn l2_to_l1<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::L2ToL1Message, _, _>(vm, world, tracer, |vm, args, _, _| {
+        let key = Register1::get(args, &mut vm.state);
+        let value = Register2::get(args, &mut vm.state);
+        let is_service = Immediate1::get(args, &mut vm.state).low_u32() == 1;
+        vm.world_diff.record_l2_to_l1_log(L2ToL1Log {
+            key,
+            value,
+            is_service,
+            address: vm.state.current_frame.address,
+            shard_id: 0,
+            tx_number: vm.state.transaction_number,
+        });
+    })
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates an [`Event`](opcodes::Event) instruction with the provided params.
+    pub fn from_event(
+        key: Register1,
+        value: Register2,
+        is_first: bool,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: event,
+            arguments: arguments
+                .write_source(&key)
+                .write_source(&value)
+                .write_source(&Immediate1(is_first.into())),
+        }
+    }
+
+    /// Creates an [`L2ToL1Message`](opcodes::L2ToL1Message) instruction with the provided params.
+    pub fn from_l2_to_l1_message(
+        key: Register1,
+        value: Register2,
+        is_service: bool,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: l2_to_l1,
+            arguments: arguments
+                .write_source(&key)
+                .write_source(&value)
+                .write_source(&Immediate1(is_service.into())),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/far_call.rs.html b/src/zksync_vm2/instruction_handlers/far_call.rs.html new file mode 100644 index 0000000..a8c0892 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/far_call.rs.html @@ -0,0 +1,579 @@ +far_call.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+
use primitive_types::U256;
+use zkevm_opcode_defs::{
+    system_params::{EVM_SIMULATOR_STIPEND, MSG_VALUE_SIMULATOR_ADDITIVE_COST},
+    ADDRESS_MSG_VALUE,
+};
+use zksync_vm2_interface::{
+    opcodes::{FarCall, TypeLevelCallingMode},
+    Tracer,
+};
+
+use super::{
+    common::boilerplate_ext,
+    heap_access::grow_heap,
+    monomorphization::{match_boolean, monomorphize, parameterize},
+    ret::{panic_from_failed_far_call, RETURN_COST},
+    AuxHeap, Heap,
+};
+use crate::{
+    addressing_modes::{Arguments, Immediate1, Register1, Register2, Source},
+    decommit::{is_kernel, u256_into_address},
+    fat_pointer::FatPointer,
+    instruction::ExecutionStatus,
+    predication::Flags,
+    Instruction, VirtualMachine, World,
+};
+
+/// A call to another contract.
+///
+/// First, the code of the called contract is fetched and a fat pointer is created
+/// or and existing one is forwarded. Costs for decommitting and memory growth are paid
+/// at this point.
+///
+/// A new stack frame is pushed. At most 63/64 of the *remaining* gas is passed to the called contract.
+///
+/// Even though all errors happen before the new stack frame, they cause a panic in the new frame,
+/// not in the caller!
+fn far_call<T, W, M, const IS_STATIC: bool, const IS_SHARD: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus
+where
+    T: Tracer,
+    W: World<T>,
+    M: TypeLevelCallingMode,
+{
+    boilerplate_ext::<FarCall<M>, _, _>(vm, world, tracer, |vm, args, world, tracer| {
+        let (raw_abi, raw_abi_is_pointer) = Register1::get_with_pointer_flag(args, &mut vm.state);
+
+        let address_mask: U256 = U256::MAX >> (256 - 160);
+        let destination_address = Register2::get(args, &mut vm.state) & address_mask;
+        let exception_handler = Immediate1::get_u16(args);
+
+        let mut abi = get_far_call_arguments(raw_abi);
+        abi.is_constructor_call = abi.is_constructor_call && vm.state.current_frame.is_kernel;
+        abi.is_system_call =
+            abi.is_system_call && is_kernel(u256_into_address(destination_address));
+
+        let mut mandated_gas =
+            if abi.is_system_call && destination_address == ADDRESS_MSG_VALUE.into() {
+                MSG_VALUE_SIMULATOR_ADDITIVE_COST
+            } else {
+                0
+            };
+
+        let failing_part = (|| {
+            let decommit_result = vm.world_diff.decommit(
+                world,
+                tracer,
+                destination_address,
+                vm.settings.default_aa_code_hash,
+                vm.settings.evm_interpreter_code_hash,
+                abi.is_constructor_call,
+            );
+
+            // calldata has to be constructed even if we already know we will panic because
+            // overflowing start + length makes the heap resize even when already panicking.
+            let already_failed = decommit_result.is_none() || IS_SHARD && abi.shard_id != 0;
+
+            let maybe_calldata =
+                get_far_call_calldata(raw_abi, raw_abi_is_pointer, vm, already_failed);
+
+            // mandated gas is passed even if it means transferring more than the 63/64 rule allows
+            if let Some(gas_left) = vm.state.current_frame.gas.checked_sub(mandated_gas) {
+                vm.state.current_frame.gas = gas_left;
+            } else {
+                // If the gas is insufficient, the rest is burned
+                vm.state.current_frame.gas = 0;
+                mandated_gas = 0;
+                return None;
+            };
+
+            let calldata = maybe_calldata?;
+            let (unpaid_decommit, is_evm) = decommit_result?;
+            let program = vm.world_diff.pay_for_decommit(
+                world,
+                tracer,
+                unpaid_decommit,
+                &mut vm.state.current_frame.gas,
+            )?;
+
+            Some((calldata, program, is_evm))
+        })();
+
+        let maximum_gas = vm.state.current_frame.gas / 64 * 63;
+        let normally_passed_gas = abi.gas_to_pass.min(maximum_gas);
+        vm.state.current_frame.gas -= normally_passed_gas;
+        let new_frame_gas = normally_passed_gas + mandated_gas;
+
+        let Some((calldata, program, is_evm_interpreter)) = failing_part else {
+            vm.state.current_frame.gas += new_frame_gas.saturating_sub(RETURN_COST);
+            panic_from_failed_far_call(vm, tracer, exception_handler);
+            return;
+        };
+
+        let stipend = if is_evm_interpreter {
+            EVM_SIMULATOR_STIPEND
+        } else {
+            0
+        };
+        let new_frame_gas = new_frame_gas
+            .checked_add(stipend)
+            .expect("stipend must not cause overflow");
+
+        let new_frame_is_static = IS_STATIC || vm.state.current_frame.is_static;
+        vm.push_frame::<M>(
+            u256_into_address(destination_address),
+            program,
+            new_frame_gas,
+            stipend,
+            exception_handler,
+            new_frame_is_static && !is_evm_interpreter,
+            calldata.memory_page,
+            vm.world_diff.snapshot(),
+        );
+
+        vm.state.flags = Flags::new(false, false, false);
+
+        if abi.is_system_call {
+            // r3 to r12 are kept but they lose their pointer flags
+            vm.state.registers[13] = U256::zero();
+            vm.state.registers[14] = U256::zero();
+            vm.state.registers[15] = U256::zero();
+        } else {
+            vm.state.registers = [U256::zero(); 16];
+        }
+
+        // Only r1 is a pointer
+        vm.state.register_pointer_flags = 2;
+        vm.state.registers[1] = calldata.into_u256();
+
+        let is_static_call_to_evm_interpreter = new_frame_is_static && is_evm_interpreter;
+        let call_type = (u8::from(is_static_call_to_evm_interpreter) << 2)
+            | (u8::from(abi.is_system_call) << 1)
+            | u8::from(abi.is_constructor_call);
+
+        vm.state.registers[2] = call_type.into();
+    })
+}
+
+#[derive(Debug)]
+pub(crate) struct FarCallABI {
+    pub(crate) gas_to_pass: u32,
+    pub(crate) shard_id: u8,
+    pub(crate) is_constructor_call: bool,
+    pub(crate) is_system_call: bool,
+}
+
+#[allow(clippy::cast_possible_truncation)] // intentional
+fn get_far_call_arguments(abi: U256) -> FarCallABI {
+    let gas_to_pass = abi.0[3] as u32;
+    let settings = (abi.0[3] >> 32) as u32;
+    let [_, shard_id, constructor_call_byte, system_call_byte] = settings.to_le_bytes();
+
+    FarCallABI {
+        gas_to_pass,
+        shard_id,
+        is_constructor_call: constructor_call_byte != 0,
+        is_system_call: system_call_byte != 0,
+    }
+}
+
+/// Forms a new fat pointer or narrows an existing one, as dictated by the ABI.
+///
+/// This function needs to be called even if we already know we will panic because
+/// overflowing start + length makes the heap resize even when already panicking.
+pub(crate) fn get_far_call_calldata<T, W>(
+    raw_abi: U256,
+    is_pointer: bool,
+    vm: &mut VirtualMachine<T, W>,
+    already_failed: bool,
+) -> Option<FatPointer> {
+    let mut pointer = FatPointer::from(raw_abi);
+    #[allow(clippy::cast_possible_truncation)]
+    // intentional: the source is encoded in the lower byte of the extracted value
+    let raw_source = (raw_abi.0[3] >> 32) as u8;
+
+    match FatPointerSource::from_abi(raw_source) {
+        FatPointerSource::ForwardFatPointer => {
+            if !is_pointer || pointer.offset > pointer.length || already_failed {
+                return None;
+            }
+
+            pointer.narrow();
+        }
+        FatPointerSource::MakeNewPointer(target) => {
+            if let Some(bound) = pointer.start.checked_add(pointer.length) {
+                if is_pointer || pointer.offset != 0 || already_failed {
+                    return None;
+                }
+                match target {
+                    FatPointerTarget::ToHeap => {
+                        grow_heap::<_, _, Heap>(&mut vm.state, bound).ok()?;
+                        pointer.memory_page = vm.state.current_frame.heap;
+                    }
+                    FatPointerTarget::ToAuxHeap => {
+                        grow_heap::<_, _, AuxHeap>(&mut vm.state, bound).ok()?;
+                        pointer.memory_page = vm.state.current_frame.aux_heap;
+                    }
+                }
+            } else {
+                // The heap is grown even if the pointer goes out of the heap
+                // TODO PLA-974 revert to not growing the heap on failure as soon as zk_evm is fixed
+                let bound = u32::MAX;
+                match target {
+                    FatPointerTarget::ToHeap => {
+                        grow_heap::<_, _, Heap>(&mut vm.state, bound).ok()?;
+                    }
+                    FatPointerTarget::ToAuxHeap => {
+                        grow_heap::<_, _, AuxHeap>(&mut vm.state, bound).ok()?;
+                    }
+                }
+                return None;
+            }
+        }
+    }
+
+    Some(pointer)
+}
+
+#[derive(Debug)]
+enum FatPointerSource {
+    MakeNewPointer(FatPointerTarget),
+    ForwardFatPointer,
+}
+
+#[derive(Debug)]
+enum FatPointerTarget {
+    ToHeap,
+    ToAuxHeap,
+}
+
+impl FatPointerSource {
+    const fn from_abi(value: u8) -> Self {
+        match value {
+            1 => Self::ForwardFatPointer,
+            2 => Self::MakeNewPointer(FatPointerTarget::ToAuxHeap),
+            _ => Self::MakeNewPointer(FatPointerTarget::ToHeap), // default
+        }
+    }
+}
+
+impl FatPointer {
+    fn narrow(&mut self) {
+        self.start += self.offset;
+        self.length -= self.offset;
+        self.offset = 0;
+    }
+}
+
+impl<T: Tracer, W: World<T>> Instruction<T, W> {
+    /// Creates a [`FarCall`] instruction with the provided mode and params.
+    pub fn from_far_call<M: TypeLevelCallingMode>(
+        src1: Register1,
+        src2: Register2,
+        error_handler: Immediate1,
+        is_static: bool,
+        is_shard: bool,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: monomorphize!(far_call [T W M] match_boolean is_static match_boolean is_shard),
+            arguments: arguments
+                .write_source(&src1)
+                .write_source(&src2)
+                .write_source(&error_handler),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/heap_access.rs.html b/src/zksync_vm2/instruction_handlers/heap_access.rs.html new file mode 100644 index 0000000..fe6145f --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/heap_access.rs.html @@ -0,0 +1,589 @@ +heap_access.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+
use primitive_types::U256;
+use zksync_vm2_interface::{opcodes, HeapId, OpcodeType, Tracer};
+
+use super::{
+    common::{boilerplate, full_boilerplate},
+    monomorphization::{match_boolean, match_reg_imm, monomorphize, parameterize},
+    ret::spontaneous_panic,
+};
+use crate::{
+    addressing_modes::{
+        Arguments, Destination, DestinationWriter, Immediate1, Register1, Register2,
+        RegisterOrImmediate, Source,
+    },
+    fat_pointer::FatPointer,
+    instruction::ExecutionStatus,
+    state::State,
+    ExecutionEnd, Instruction, VirtualMachine,
+};
+
+pub(crate) trait HeapFromState {
+    type Read: OpcodeType;
+    type Write: OpcodeType;
+
+    fn get_heap<T, W>(state: &State<T, W>) -> HeapId;
+    fn get_heap_size<T, W>(state: &mut State<T, W>) -> &mut u32;
+}
+
+pub(crate) struct Heap;
+
+impl HeapFromState for Heap {
+    type Read = opcodes::HeapRead;
+    type Write = opcodes::HeapWrite;
+
+    fn get_heap<T, W>(state: &State<T, W>) -> HeapId {
+        state.current_frame.heap
+    }
+
+    fn get_heap_size<T, W>(state: &mut State<T, W>) -> &mut u32 {
+        &mut state.current_frame.heap_size
+    }
+}
+
+pub(crate) struct AuxHeap;
+
+impl HeapFromState for AuxHeap {
+    type Read = opcodes::AuxHeapRead;
+    type Write = opcodes::AuxHeapWrite;
+
+    fn get_heap<T, W>(state: &State<T, W>) -> HeapId {
+        state.current_frame.aux_heap
+    }
+
+    fn get_heap_size<T, W>(state: &mut State<T, W>) -> &mut u32 {
+        &mut state.current_frame.aux_heap_size
+    }
+}
+
+/// The last address to which 32 can be added without overflow.
+const LAST_ADDRESS: u32 = u32::MAX - 32;
+
+// Necessary because the obvious code compiles to a comparison of two 256-bit numbers.
+#[inline(always)]
+fn bigger_than_last_address(x: U256) -> bool {
+    x.0[0] > LAST_ADDRESS.into() || x.0[1] != 0 || x.0[2] != 0 || x.0[3] != 0
+}
+
+fn load<T: Tracer, W, H: HeapFromState, In: Source, const INCREMENT: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<H::Read, _, _>(vm, world, tracer, |vm, args| {
+        // Pointers need not be masked here even though we do not care about them being pointers.
+        // They will panic, though because they are larger than 2^32.
+        let (pointer, _) = In::get_with_pointer_flag(args, &mut vm.state);
+
+        let address = pointer.low_u32();
+
+        let new_bound = address.wrapping_add(32);
+        if grow_heap::<_, _, H>(&mut vm.state, new_bound).is_err() {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        };
+
+        // The heap is always grown even when the index nonsensical.
+        // TODO PLA-974 revert to not growing the heap on failure as soon as zk_evm is fixed
+        if bigger_than_last_address(pointer) {
+            let _ = vm.state.use_gas(u32::MAX);
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        }
+
+        let heap = H::get_heap(&vm.state);
+        let value = vm.state.heaps[heap].read_u256(address);
+        Register1::set(args, &mut vm.state, value);
+
+        if INCREMENT {
+            Register2::set(args, &mut vm.state, pointer + 32);
+        }
+    })
+}
+
+fn store<T, W, H, In, const INCREMENT: bool, const HOOKING_ENABLED: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus
+where
+    T: Tracer,
+    H: HeapFromState,
+    In: Source,
+{
+    full_boilerplate::<H::Write, _, _>(vm, world, tracer, |vm, args, _, _| {
+        // Pointers need not be masked here even though we do not care about them being pointers.
+        // They will panic, though because they are larger than 2^32.
+        let (pointer, _) = In::get_with_pointer_flag(args, &mut vm.state);
+
+        let address = pointer.low_u32();
+        let value = Register2::get(args, &mut vm.state);
+
+        let new_bound = address.wrapping_add(32);
+        if grow_heap::<_, _, H>(&mut vm.state, new_bound).is_err() {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return ExecutionStatus::Running;
+        }
+
+        // The heap is always grown even when the index nonsensical.
+        // TODO PLA-974 revert to not growing the heap on failure as soon as zk_evm is fixed
+        if bigger_than_last_address(pointer) {
+            let _ = vm.state.use_gas(u32::MAX);
+            vm.state.current_frame.pc = spontaneous_panic();
+            return ExecutionStatus::Running;
+        }
+
+        let heap = H::get_heap(&vm.state);
+        vm.state.heaps.write_u256(heap, address, value);
+
+        if INCREMENT {
+            Register1::set(args, &mut vm.state, pointer + 32);
+        }
+
+        if HOOKING_ENABLED && address == vm.settings.hook_address {
+            ExecutionStatus::Stopped(ExecutionEnd::SuspendedOnHook(value.as_u32()))
+        } else {
+            ExecutionStatus::Running
+        }
+    })
+}
+
+/// Pays for more heap space. Doesn't acually grow the heap.
+/// That distinction is necessary because the bootloader gets `u32::MAX` heap for free.
+pub(crate) fn grow_heap<T, W, H: HeapFromState>(
+    state: &mut State<T, W>,
+    new_bound: u32,
+) -> Result<(), ()> {
+    let already_paid = H::get_heap_size(state);
+    if *already_paid < new_bound {
+        let to_pay = new_bound - *already_paid;
+        *already_paid = new_bound;
+        state.use_gas(to_pay)?;
+    }
+
+    Ok(())
+}
+
+fn load_pointer<T: Tracer, W, const INCREMENT: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::PointerRead, _, _>(vm, world, tracer, |vm, args| {
+        let (input, input_is_pointer) = Register1::get_with_pointer_flag(args, &mut vm.state);
+        if !input_is_pointer {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        }
+        let pointer = FatPointer::from(input);
+
+        // Usually, we just read zeroes instead of out-of-bounds bytes
+        // but if offset + 32 is not representable, we panic, even if we could've read some bytes.
+        // This is not a bug, this is how it must work to be backwards compatible.
+        if pointer.offset > LAST_ADDRESS {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        };
+
+        let start = pointer.start + pointer.offset.min(pointer.length);
+        let end = start.saturating_add(32).min(pointer.start + pointer.length);
+
+        let value = vm.state.heaps[pointer.memory_page].read_u256_partially(start..end);
+        Register1::set(args, &mut vm.state, value);
+
+        if INCREMENT {
+            // This addition does not overflow because we checked that the offset is small enough above.
+            Register2::set_fat_ptr(args, &mut vm.state, input + 32);
+        }
+    })
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a [`HeapRead`](opcodes::HeapRead) instruction with the provided params.
+    pub fn from_heap_read(
+        src: RegisterOrImmediate,
+        out: Register1,
+        incremented_out: Option<Register2>,
+        arguments: Arguments,
+    ) -> Self {
+        Self::from_read::<Heap>(src, out, incremented_out, arguments)
+    }
+
+    /// Creates an [`AuxHeapRead`](opcodes::AuxHeapRead) instruction with the provided params.
+    pub fn from_aux_heap_read(
+        src: RegisterOrImmediate,
+        out: Register1,
+        incremented_out: Option<Register2>,
+        arguments: Arguments,
+    ) -> Self {
+        Self::from_read::<AuxHeap>(src, out, incremented_out, arguments)
+    }
+
+    fn from_read<H: HeapFromState>(
+        src: RegisterOrImmediate,
+        out: Register1,
+        incremented_out: Option<Register2>,
+        arguments: Arguments,
+    ) -> Self {
+        let mut arguments = arguments.write_source(&src).write_destination(&out);
+
+        let increment = incremented_out.is_some();
+        if let Some(out2) = incremented_out {
+            out2.write_destination(&mut arguments);
+        }
+
+        Self {
+            handler: monomorphize!(load [T W H] match_reg_imm src match_boolean increment),
+            arguments,
+        }
+    }
+
+    /// Creates a [`HeapWrite`](opcodes::HeapWrite) instruction with the provided params.
+    pub fn from_heap_write(
+        src1: RegisterOrImmediate,
+        src2: Register2,
+        incremented_out: Option<Register1>,
+        arguments: Arguments,
+        should_hook: bool,
+    ) -> Self {
+        Self::from_write::<Heap>(src1, src2, incremented_out, arguments, should_hook)
+    }
+
+    /// Creates an [`AuxHeapWrite`](opcodes::AuxHeapWrite) instruction with the provided params.
+    pub fn from_aux_heap_store(
+        src1: RegisterOrImmediate,
+        src2: Register2,
+        incremented_out: Option<Register1>,
+        arguments: Arguments,
+    ) -> Self {
+        Self::from_write::<AuxHeap>(src1, src2, incremented_out, arguments, false)
+    }
+
+    fn from_write<H: HeapFromState>(
+        src1: RegisterOrImmediate,
+        src2: Register2,
+        incremented_out: Option<Register1>,
+        arguments: Arguments,
+        should_hook: bool,
+    ) -> Self {
+        let increment = incremented_out.is_some();
+        Self {
+            handler: monomorphize!(store [T W H] match_reg_imm src1 match_boolean increment match_boolean should_hook),
+            arguments: arguments
+                .write_source(&src1)
+                .write_source(&src2)
+                .write_destination(&incremented_out),
+        }
+    }
+
+    /// Creates an [`PointerRead`](opcodes::PointerRead) instruction with the provided params.
+    pub fn from_pointer_read(
+        src: Register1,
+        out: Register1,
+        incremented_out: Option<Register2>,
+        arguments: Arguments,
+    ) -> Self {
+        let increment = incremented_out.is_some();
+        Self {
+            handler: monomorphize!(load_pointer [T W] match_boolean increment),
+            arguments: arguments
+                .write_source(&src)
+                .write_destination(&out)
+                .write_destination(&incremented_out),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/jump.rs.html b/src/zksync_vm2/instruction_handlers/jump.rs.html new file mode 100644 index 0000000..61c870c --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/jump.rs.html @@ -0,0 +1,85 @@ +jump.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
use zksync_vm2_interface::{opcodes, Tracer};
+
+use super::{
+    common::boilerplate,
+    monomorphization::{match_source, monomorphize, parameterize},
+};
+use crate::{
+    addressing_modes::{
+        AbsoluteStack, AdvanceStackPointer, AnySource, Arguments, CodePage, Destination,
+        Immediate1, Register1, RelativeStack, Source,
+    },
+    instruction::{ExecutionStatus, Instruction},
+    VirtualMachine,
+};
+
+fn jump<T: Tracer, W, In: Source>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::Jump, _, _>(vm, world, tracer, |vm, args| {
+        #[allow(clippy::cast_possible_truncation)] // intentional
+        let target = In::get(args, &mut vm.state).low_u32() as u16;
+
+        let next_instruction = vm.state.current_frame.get_pc_as_u16();
+        Register1::set(args, &mut vm.state, next_instruction.into());
+
+        vm.state.current_frame.set_pc_from_u16(target);
+    })
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a [`Jump`](opcodes::Jump) instruction with the provided params.
+    pub fn from_jump(source: AnySource, destination: Register1, arguments: Arguments) -> Self {
+        Self {
+            handler: monomorphize!(jump [T W] match_source source),
+            arguments: arguments
+                .write_source(&source)
+                .write_destination(&destination),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/mod.rs.html b/src/zksync_vm2/instruction_handlers/mod.rs.html new file mode 100644 index 0000000..9fa56b6 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/mod.rs.html @@ -0,0 +1,49 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+
#[cfg(feature = "single_instruction_test")]
+pub(crate) use ret::spontaneous_panic;
+
+pub(crate) use self::{
+    context::address_into_u256,
+    heap_access::{AuxHeap, Heap},
+    ret::invalid_instruction,
+};
+
+mod binop;
+mod common;
+mod context;
+mod decommit;
+mod event;
+mod far_call;
+mod heap_access;
+mod jump;
+mod monomorphization;
+mod near_call;
+mod nop;
+mod pointer;
+mod precompiles;
+mod ret;
+mod storage;
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/monomorphization.rs.html b/src/zksync_vm2/instruction_handlers/monomorphization.rs.html new file mode 100644 index 0000000..241e078 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/monomorphization.rs.html @@ -0,0 +1,135 @@ +monomorphization.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
/// Select an instantiation of a generic function based on runtime variables
+/// For example `monomorphize!(load [H] match_reg_imm src match_boolean increment)`
+macro_rules! monomorphize {
+    ($function_name: ident [$($types: tt)*] $next_matcher: ident $($rest: ident)*) => {
+        $next_matcher!([$($types)*] $($rest)* parameterize $function_name)
+    };
+
+    ($function_name: ident $($rest: ident)*) => {
+        monomorphize!($function_name [] $($rest)*)
+    };
+}
+
+macro_rules! match_source {
+    ([ $($types: tt)* ] $input_type: ident $next_matcher: ident $($rest: ident)*) => {
+        match $input_type {
+            AnySource::Register1(_) => $next_matcher!([$($types)* Register1] $($rest)*),
+            AnySource::Immediate1(_) => $next_matcher!([$($types)* Immediate1] $($rest)*),
+            AnySource::AbsoluteStack(_) => $next_matcher!([$($types)* AbsoluteStack] $($rest)*),
+            AnySource::RelativeStack(_) => $next_matcher!([$($types)* RelativeStack] $($rest)*),
+            AnySource::AdvanceStackPointer(_) => $next_matcher!([$($types)* AdvanceStackPointer] $($rest)*),
+            AnySource::CodePage(_) => $next_matcher!([$($types)* CodePage] $($rest)*),
+        }
+    };
+}
+
+macro_rules! match_reg_imm {
+    ([ $($types: tt)* ] $input_type: ident $next_matcher: ident $($rest: ident)*) => {
+        match $input_type {
+            RegisterOrImmediate::Register1(_) => $next_matcher!([$($types)* Register1] $($rest)*),
+            RegisterOrImmediate::Immediate1(_) => $next_matcher!([$($types)* Immediate1] $($rest)*),
+        }
+    };
+}
+
+macro_rules! match_destination {
+    ([ $($types: tt)* ] $input_type: ident $next_matcher: ident $($rest: ident)*) => {
+        match $input_type {
+            AnyDestination::Register1(_) => $next_matcher!([$($types)* Register1] $($rest)*),
+            AnyDestination::AbsoluteStack(_) => $next_matcher!([$($types)* AbsoluteStack] $($rest)*),
+            AnyDestination::RelativeStack(_) => $next_matcher!([$($types)* RelativeStack] $($rest)*),
+            AnyDestination::AdvanceStackPointer(_) => $next_matcher!([$($types)* AdvanceStackPointer] $($rest)*),
+        }
+    };
+}
+
+macro_rules! match_boolean {
+    ([ $($types: tt)* ] $increment: ident $next_matcher: ident $($rest: ident)*) => {
+        if $increment {
+            $next_matcher!([$($types)* {true}] $($rest)*)
+        } else {
+            $next_matcher!([$($types)* {false}] $($rest)*)
+        }
+    };
+}
+
+macro_rules! parameterize {
+    ([$($types: tt)*] $function_name:ident) => {
+        $function_name::<$($types),*>
+    };
+}
+
+pub(crate) use match_boolean;
+pub(crate) use match_destination;
+pub(crate) use match_reg_imm;
+pub(crate) use match_source;
+pub(crate) use monomorphize;
+pub(crate) use parameterize;
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/near_call.rs.html b/src/zksync_vm2/instruction_handlers/near_call.rs.html new file mode 100644 index 0000000..3d502e8 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/near_call.rs.html @@ -0,0 +1,109 @@ +near_call.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+
use zksync_vm2_interface::{opcodes, Tracer};
+
+use super::common::boilerplate;
+use crate::{
+    addressing_modes::{Arguments, Immediate1, Immediate2, Register1, Source},
+    instruction::ExecutionStatus,
+    predication::Flags,
+    Instruction, VirtualMachine,
+};
+
+fn near_call<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::NearCall, _, _>(vm, world, tracer, |vm, args| {
+        let gas_to_pass = Register1::get(args, &mut vm.state).low_u32();
+        let destination = Immediate1::get_u16(args);
+        let error_handler = Immediate2::get_u16(args);
+
+        let new_frame_gas = if gas_to_pass == 0 {
+            vm.state.current_frame.gas
+        } else {
+            gas_to_pass.min(vm.state.current_frame.gas)
+        };
+        vm.state.current_frame.push_near_call(
+            new_frame_gas,
+            error_handler,
+            vm.world_diff.snapshot(),
+        );
+
+        vm.state.flags = Flags::new(false, false, false);
+
+        vm.state.current_frame.set_pc_from_u16(destination);
+    })
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a [`NearCall`](opcodes::NearCall) instruction with the provided params.
+    pub fn from_near_call(
+        gas: Register1,
+        destination: Immediate1,
+        error_handler: Immediate2,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: near_call,
+            arguments: arguments
+                .write_source(&gas)
+                .write_source(&destination)
+                .write_source(&error_handler),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/nop.rs.html b/src/zksync_vm2/instruction_handlers/nop.rs.html new file mode 100644 index 0000000..cb18b05 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/nop.rs.html @@ -0,0 +1,77 @@ +nop.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+
use zksync_vm2_interface::{opcodes, Tracer};
+
+use super::common::boilerplate;
+use crate::{
+    addressing_modes::{destination_stack_address, AdvanceStackPointer, Arguments, Source},
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine,
+};
+
+fn nop<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::Nop, _, _>(vm, world, tracer, |vm, args| {
+        // nop's addressing modes can move the stack pointer!
+        AdvanceStackPointer::get(args, &mut vm.state);
+        vm.state.current_frame.sp = vm
+            .state
+            .current_frame
+            .sp
+            .wrapping_add(destination_stack_address(args, &mut vm.state));
+    })
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a [`Nop`](opcodes::Nop) instruction with the provided params.
+    pub fn from_nop(
+        pop: AdvanceStackPointer,
+        push: AdvanceStackPointer,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: nop,
+            arguments: arguments.write_source(&pop).write_destination(&push),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/pointer.rs.html b/src/zksync_vm2/instruction_handlers/pointer.rs.html new file mode 100644 index 0000000..234605f --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/pointer.rs.html @@ -0,0 +1,297 @@ +pointer.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+
use primitive_types::U256;
+use zksync_vm2_interface::{
+    opcodes::{PointerAdd, PointerPack, PointerShrink, PointerSub},
+    OpcodeType, Tracer,
+};
+
+use super::{
+    common::boilerplate,
+    monomorphization::{
+        match_boolean, match_destination, match_source, monomorphize, parameterize,
+    },
+    ret::spontaneous_panic,
+};
+use crate::{
+    addressing_modes::{
+        AbsoluteStack, AdvanceStackPointer, AnyDestination, AnySource, Arguments, CodePage,
+        Destination, Immediate1, Register1, Register2, RelativeStack, Source,
+    },
+    fat_pointer::FatPointer,
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine,
+};
+
+fn ptr<T: Tracer, W, Op: PtrOp, In1: Source, Out: Destination, const SWAP: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<Op, _, _>(vm, world, tracer, |vm, args| {
+        let ((a, a_is_pointer), (b, b_is_pointer)) = if SWAP {
+            (
+                Register2::get_with_pointer_flag(args, &mut vm.state),
+                In1::get_with_pointer_flag_and_erasing(args, &mut vm.state),
+            )
+        } else {
+            (
+                In1::get_with_pointer_flag(args, &mut vm.state),
+                Register2::get_with_pointer_flag_and_erasing(args, &mut vm.state),
+            )
+        };
+
+        if !a_is_pointer || b_is_pointer {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        }
+
+        let Some(result) = Op::perform(a, b) else {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        };
+
+        Out::set_fat_ptr(args, &mut vm.state, result);
+    })
+}
+
+pub(crate) trait PtrOp: OpcodeType {
+    fn perform(in1: U256, in2: U256) -> Option<U256>;
+}
+
+impl PtrOp for PointerAdd {
+    #[inline(always)]
+    fn perform(in1: U256, in2: U256) -> Option<U256> {
+        ptr_add_sub::<true>(in1, in2)
+    }
+}
+
+impl PtrOp for PointerSub {
+    #[inline(always)]
+    fn perform(in1: U256, in2: U256) -> Option<U256> {
+        ptr_add_sub::<false>(in1, in2)
+    }
+}
+
+fn ptr_add_sub<const IS_ADD: bool>(mut in1: U256, in2: U256) -> Option<U256> {
+    if in2 > u32::MAX.into() {
+        return None;
+    }
+    let pointer: &mut FatPointer = (&mut in1).into();
+
+    let new_offset = if IS_ADD {
+        pointer.offset.checked_add(in2.low_u32())
+    } else {
+        pointer.offset.checked_sub(in2.low_u32())
+    }?;
+
+    pointer.offset = new_offset;
+
+    Some(in1)
+}
+
+impl PtrOp for PointerPack {
+    #[inline(always)]
+    fn perform(in1: U256, in2: U256) -> Option<U256> {
+        if in2.low_u128() != 0 {
+            None
+        } else {
+            Some(U256([in1.0[0], in1.0[1], in2.0[2], in2.0[3]]))
+        }
+    }
+}
+
+impl PtrOp for PointerShrink {
+    #[inline(always)]
+    fn perform(mut in1: U256, in2: U256) -> Option<U256> {
+        let pointer: &mut FatPointer = (&mut in1).into();
+        pointer.length = pointer.length.checked_sub(in2.low_u32())?;
+        Some(in1)
+    }
+}
+
+macro_rules! from_ptr_op {
+    ($name:ident <$binop:ty>) => {
+        #[doc = concat!("Creates a [`", stringify!($binop), "`] instruction with the provided params.")]
+        pub fn $name(
+            src1: AnySource,
+            src2: Register2,
+            out: AnyDestination,
+            arguments: Arguments,
+            swap: bool,
+        ) -> Self {
+            Self::from_ptr::<$binop>(src1, src2, out, arguments, swap)
+        }
+    };
+}
+
+/// Pointer-related instructions.
+impl<T: Tracer, W> Instruction<T, W> {
+    from_ptr_op!(from_pointer_add<PointerAdd>);
+    from_ptr_op!(from_pointer_sub<PointerSub>);
+    from_ptr_op!(from_pointer_pack<PointerPack>);
+    from_ptr_op!(from_pointer_shrink<PointerShrink>);
+
+    pub(crate) fn from_ptr<Op: PtrOp>(
+        src1: AnySource,
+        src2: Register2,
+        out: AnyDestination,
+        arguments: Arguments,
+        swap: bool,
+    ) -> Self {
+        Self {
+            handler: monomorphize!(ptr [T W Op] match_source src1 match_destination out match_boolean swap),
+            arguments: arguments
+                .write_source(&src1)
+                .write_source(&src2)
+                .write_destination(&out),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/precompiles.rs.html b/src/zksync_vm2/instruction_handlers/precompiles.rs.html new file mode 100644 index 0000000..4f698c6 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/precompiles.rs.html @@ -0,0 +1,315 @@ +precompiles.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+
use primitive_types::{H160, U256};
+use zk_evm_abstractions::{
+    aux::Timestamp,
+    precompiles::{
+        ecrecover::ecrecover_function, keccak256::keccak256_rounds_function,
+        secp256r1_verify::secp256r1_verify_function, sha256::sha256_rounds_function,
+    },
+    queries::LogQuery,
+    vm::Memory,
+};
+use zkevm_opcode_defs::{
+    system_params::{
+        ECRECOVER_INNER_FUNCTION_PRECOMPILE_ADDRESS, KECCAK256_ROUND_FUNCTION_PRECOMPILE_ADDRESS,
+        SECP256R1_VERIFY_PRECOMPILE_ADDRESS, SHA256_ROUND_FUNCTION_PRECOMPILE_ADDRESS,
+    },
+    PrecompileAuxData, PrecompileCallABI,
+};
+use zksync_vm2_interface::{opcodes, CycleStats, HeapId, Tracer};
+
+use super::{common::boilerplate_ext, ret::spontaneous_panic};
+use crate::{
+    addressing_modes::{Arguments, Destination, Register1, Register2, Source},
+    heap::Heaps,
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine,
+};
+
+fn precompile_call<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::PrecompileCall, _, _>(vm, world, tracer, |vm, args, _, tracer| {
+        // The user gets to decide how much gas to burn
+        // This is safe because system contracts are trusted
+        let aux_data = PrecompileAuxData::from_u256(Register2::get(args, &mut vm.state));
+        let Ok(()) = vm.state.use_gas(aux_data.extra_ergs_cost) else {
+            vm.state.current_frame.pc = spontaneous_panic();
+            return;
+        };
+
+        #[allow(clippy::cast_possible_wrap)]
+        {
+            vm.world_diff.pubdata.0 += aux_data.extra_pubdata_cost as i32;
+        }
+
+        let mut abi = PrecompileCallABI::from_u256(Register1::get(args, &mut vm.state));
+        if abi.memory_page_to_read == 0 {
+            abi.memory_page_to_read = vm.state.current_frame.heap.as_u32();
+        }
+        if abi.memory_page_to_write == 0 {
+            abi.memory_page_to_write = vm.state.current_frame.heap.as_u32();
+        }
+
+        let query = LogQuery {
+            timestamp: Timestamp(0),
+            key: abi.to_u256(),
+            // only two first fields are read by the precompile
+            tx_number_in_block: Default::default(),
+            aux_byte: Default::default(),
+            shard_id: Default::default(),
+            address: H160::default(),
+            read_value: U256::default(),
+            written_value: U256::default(),
+            rw_flag: Default::default(),
+            rollback: Default::default(),
+            is_service: Default::default(),
+        };
+
+        let address_bytes = vm.state.current_frame.address.0;
+        let address_low = u16::from_le_bytes([address_bytes[19], address_bytes[18]]);
+        let heaps = &mut vm.state.heaps;
+
+        #[allow(clippy::cast_possible_truncation)]
+        // if we're having `> u32::MAX` cycles, we've got larger issues
+        match address_low {
+            KECCAK256_ROUND_FUNCTION_PRECOMPILE_ADDRESS => {
+                tracer.on_extra_prover_cycles(CycleStats::Keccak256(
+                    keccak256_rounds_function::<_, false>(0, query, heaps).0 as u32,
+                ));
+            }
+            SHA256_ROUND_FUNCTION_PRECOMPILE_ADDRESS => {
+                tracer.on_extra_prover_cycles(CycleStats::Sha256(
+                    sha256_rounds_function::<_, false>(0, query, heaps).0 as u32,
+                ));
+            }
+            ECRECOVER_INNER_FUNCTION_PRECOMPILE_ADDRESS => {
+                tracer.on_extra_prover_cycles(CycleStats::EcRecover(
+                    ecrecover_function::<_, false>(0, query, heaps).0 as u32,
+                ));
+            }
+            SECP256R1_VERIFY_PRECOMPILE_ADDRESS => {
+                tracer.on_extra_prover_cycles(CycleStats::Secp256r1Verify(
+                    secp256r1_verify_function::<_, false>(0, query, heaps).0 as u32,
+                ));
+            }
+            _ => {
+                // A precompile call may be used just to burn gas
+            }
+        }
+
+        Register1::set(args, &mut vm.state, 1.into());
+    })
+}
+
+impl Memory for Heaps {
+    fn execute_partial_query(
+        &mut self,
+        _monotonic_cycle_counter: u32,
+        mut query: zk_evm_abstractions::queries::MemoryQuery,
+    ) -> zk_evm_abstractions::queries::MemoryQuery {
+        let page = HeapId::from_u32_unchecked(query.location.page.0);
+
+        let start = query.location.index.0 * 32;
+        if query.rw_flag {
+            self.write_u256(page, start, query.value);
+        } else {
+            query.value = self[page].read_u256(start);
+            query.value_is_pointer = false;
+        }
+        query
+    }
+
+    fn specialized_code_query(
+        &mut self,
+        _monotonic_cycle_counter: u32,
+        _query: zk_evm_abstractions::queries::MemoryQuery,
+    ) -> zk_evm_abstractions::queries::MemoryQuery {
+        todo!()
+    }
+
+    fn read_code_query(
+        &self,
+        _monotonic_cycle_counter: u32,
+        _query: zk_evm_abstractions::queries::MemoryQuery,
+    ) -> zk_evm_abstractions::queries::MemoryQuery {
+        todo!()
+    }
+}
+
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a [`PrecompileCall`](opcodes::PrecompileCall) instruction with the provided params.
+    pub fn from_precompile_call(
+        abi: Register1,
+        burn: Register2,
+        out: Register1,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            arguments: arguments
+                .write_source(&abi)
+                .write_source(&burn)
+                .write_destination(&out),
+            handler: precompile_call,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/ret.rs.html b/src/zksync_vm2/instruction_handlers/ret.rs.html new file mode 100644 index 0000000..217d471 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/ret.rs.html @@ -0,0 +1,505 @@ +ret.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+
use primitive_types::U256;
+use zksync_vm2_interface::{
+    opcodes::{self, Normal, Panic, Revert, TypeLevelReturnType},
+    ReturnType, Tracer,
+};
+
+use super::{
+    common::full_boilerplate,
+    far_call::get_far_call_calldata,
+    monomorphization::{match_boolean, monomorphize, parameterize},
+};
+use crate::{
+    addressing_modes::{Arguments, Immediate1, Register1, Source, INVALID_INSTRUCTION_COST},
+    callframe::FrameRemnant,
+    instruction::{ExecutionEnd, ExecutionStatus},
+    mode_requirements::ModeRequirements,
+    predication::Flags,
+    Instruction, Predicate, VirtualMachine,
+};
+
+fn naked_ret<T: Tracer, W, RT: TypeLevelReturnType, const TO_LABEL: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    args: &Arguments,
+) -> ExecutionStatus {
+    let mut return_type = RT::VALUE;
+    let near_call_leftover_gas = vm.state.current_frame.gas;
+
+    let (snapshot, leftover_gas) = if let Some(FrameRemnant {
+        exception_handler,
+        snapshot,
+    }) = vm.state.current_frame.pop_near_call()
+    {
+        if TO_LABEL {
+            let pc = Immediate1::get_u16(args);
+            vm.state.current_frame.set_pc_from_u16(pc);
+        } else if return_type.is_failure() {
+            vm.state.current_frame.set_pc_from_u16(exception_handler);
+        }
+
+        (snapshot, near_call_leftover_gas)
+    } else {
+        let return_value_or_panic = if return_type == ReturnType::Panic {
+            None
+        } else {
+            let (raw_abi, is_pointer) = Register1::get_with_pointer_flag(args, &mut vm.state);
+            let result = get_far_call_calldata(raw_abi, is_pointer, vm, false).filter(|pointer| {
+                vm.state.current_frame.is_kernel
+                    || pointer.memory_page != vm.state.current_frame.calldata_heap
+            });
+
+            if result.is_none() {
+                return_type = ReturnType::Panic;
+            }
+            result
+        };
+
+        let leftover_gas = vm
+            .state
+            .current_frame
+            .gas
+            .saturating_sub(vm.state.current_frame.stipend);
+
+        let Some(FrameRemnant {
+            exception_handler,
+            snapshot,
+        }) = vm.pop_frame(
+            return_value_or_panic
+                .as_ref()
+                .map(|pointer| pointer.memory_page),
+        )
+        else {
+            // The initial frame is not rolled back, even if it fails.
+            // It is the caller's job to clean up when the execution as a whole fails because
+            // the caller may take external snapshots while the VM is in the initial frame and
+            // these would break were the initial frame to be rolled back.
+
+            // But to continue execution would be nonsensical and can cause UB because there
+            // is no next instruction after a panic arising from some other instruction.
+            vm.state.current_frame.pc = invalid_instruction();
+
+            return if let Some(return_value) = return_value_or_panic {
+                let output = vm.state.heaps[return_value.memory_page]
+                    .read_range_big_endian(
+                        return_value.start..return_value.start + return_value.length,
+                    )
+                    .clone();
+                if return_type == ReturnType::Revert {
+                    ExecutionStatus::Stopped(ExecutionEnd::Reverted(output))
+                } else {
+                    ExecutionStatus::Stopped(ExecutionEnd::ProgramFinished(output))
+                }
+            } else {
+                ExecutionStatus::Stopped(ExecutionEnd::Panicked)
+            };
+        };
+
+        vm.state.set_context_u128(0);
+        vm.state.registers = [U256::zero(); 16];
+
+        if let Some(return_value) = return_value_or_panic {
+            vm.state.registers[1] = return_value.into_u256();
+        }
+        vm.state.register_pointer_flags = 2;
+
+        if return_type.is_failure() {
+            vm.state.current_frame.set_pc_from_u16(exception_handler);
+        }
+
+        (snapshot, leftover_gas)
+    };
+
+    if return_type.is_failure() {
+        vm.world_diff.rollback(snapshot);
+    }
+
+    vm.state.flags = Flags::new(return_type == ReturnType::Panic, false, false);
+    vm.state.current_frame.gas += leftover_gas;
+
+    ExecutionStatus::Running
+}
+
+fn ret<T: Tracer, W, RT: TypeLevelReturnType, const TO_LABEL: bool>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    full_boilerplate::<opcodes::Ret<RT>, _, _>(vm, world, tracer, |vm, args, _, _| {
+        naked_ret::<T, W, RT, TO_LABEL>(vm, args)
+    })
+}
+
+/// Turn the current instruction into a panic at no extra cost. (Great value, I know.)
+///
+/// Call this when:
+/// - gas runs out when paying for the fixed cost of an instruction
+/// - causing side effects in a static context
+/// - using privileged instructions while not in a system call
+/// - the far call stack overflows
+///
+/// For all other panics, point the instruction pointer at [PANIC] instead.
+pub(crate) fn free_panic<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    tracer.before_instruction::<opcodes::Ret<Panic>, _>(vm);
+    // args aren't used for panics unless TO_LABEL
+    let result = naked_ret::<T, W, Panic, false>(
+        vm,
+        &Arguments::new(Predicate::Always, 0, ModeRequirements::none()),
+    );
+    tracer.after_instruction::<opcodes::Ret<Panic>, _>(vm);
+    result
+}
+
+/// Formally, a far call pushes a new frame and returns from it immediately if it panics.
+/// This function instead panics without popping a frame to save on allocation.
+pub(crate) fn panic_from_failed_far_call<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    tracer: &mut T,
+    exception_handler: u16,
+) {
+    tracer.before_instruction::<opcodes::Ret<Panic>, _>(vm);
+
+    // Gas is already subtracted in the far call code.
+    // No need to roll back, as no changes are made in this "frame".
+    vm.state.set_context_u128(0);
+    vm.state.registers = [U256::zero(); 16];
+    vm.state.register_pointer_flags = 2;
+    vm.state.flags = Flags::new(true, false, false);
+    vm.state.current_frame.set_pc_from_u16(exception_handler);
+
+    tracer.after_instruction::<opcodes::Ret<Panic>, _>(vm);
+}
+
+fn invalid<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    _: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    vm.state.current_frame.gas = 0;
+    free_panic(vm, tracer)
+}
+
+trait GenericStatics<T, W> {
+    const PANIC: Instruction<T, W>;
+    const INVALID: Instruction<T, W>;
+}
+
+impl<T: Tracer, W> GenericStatics<T, W> for () {
+    const PANIC: Instruction<T, W> = Instruction {
+        handler: ret::<T, W, Panic, false>,
+        arguments: Arguments::new(Predicate::Always, RETURN_COST, ModeRequirements::none()),
+    };
+    const INVALID: Instruction<T, W> = Instruction::from_invalid();
+}
+
+// The following functions return references that live for 'static.
+// They aren't marked as such because returning any lifetime is more ergonomic.
+
+/// Point the program counter at this instruction when a panic occurs during the logic of and instruction.
+pub(crate) fn spontaneous_panic<'a, T: Tracer, W>() -> &'a Instruction<T, W> {
+    &<()>::PANIC
+}
+
+/// Panics, burning all available gas.
+pub(crate) fn invalid_instruction<'a, T: Tracer, W>() -> &'a Instruction<T, W> {
+    &<()>::INVALID
+}
+
+pub(crate) const RETURN_COST: u32 = 5;
+
+/// Variations of [`Ret`](opcodes::Ret) instructions.
+impl<T: Tracer, W> Instruction<T, W> {
+    /// Creates a normal [`Ret`](opcodes::Ret) instruction with the provided params.
+    pub fn from_ret(src1: Register1, label: Option<Immediate1>, arguments: Arguments) -> Self {
+        let to_label = label.is_some();
+        Self {
+            handler: monomorphize!(ret [T W Normal] match_boolean to_label),
+            arguments: arguments.write_source(&src1).write_source(&label),
+        }
+    }
+
+    /// Creates a revert [`Ret`](opcodes::Ret) instruction with the provided params.
+    pub fn from_revert(src1: Register1, label: Option<Immediate1>, arguments: Arguments) -> Self {
+        let to_label = label.is_some();
+        Self {
+            handler: monomorphize!(ret [T W Revert] match_boolean to_label),
+            arguments: arguments.write_source(&src1).write_source(&label),
+        }
+    }
+
+    /// Creates a panic [`Ret`](opcodes::Ret) instruction with the provided params.
+    pub fn from_panic(label: Option<Immediate1>, arguments: Arguments) -> Self {
+        let to_label = label.is_some();
+        Self {
+            handler: monomorphize!(ret [T W Panic] match_boolean to_label),
+            arguments: arguments.write_source(&label),
+        }
+    }
+
+    /// Creates a *invalid* instruction that will panic by draining all gas.
+    pub const fn from_invalid() -> Self {
+        Self {
+            handler: invalid,
+            arguments: Arguments::new(
+                Predicate::Always,
+                INVALID_INSTRUCTION_COST,
+                ModeRequirements::none(),
+            ),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/instruction_handlers/storage.rs.html b/src/zksync_vm2/instruction_handlers/storage.rs.html new file mode 100644 index 0000000..3807583 --- /dev/null +++ b/src/zksync_vm2/instruction_handlers/storage.rs.html @@ -0,0 +1,237 @@ +storage.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+
use zksync_vm2_interface::{opcodes, Tracer};
+
+use super::common::{boilerplate, boilerplate_ext};
+use crate::{
+    addressing_modes::{
+        Arguments, Destination, Register1, Register2, Source, SLOAD_COST, SSTORE_COST,
+    },
+    instruction::ExecutionStatus,
+    Instruction, VirtualMachine, World,
+};
+
+fn sstore<T: Tracer, W: World<T>>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::StorageWrite, _, _>(vm, world, tracer, |vm, args, world, tracer| {
+        let key = Register1::get(args, &mut vm.state);
+        let value = Register2::get(args, &mut vm.state);
+
+        let refund =
+            vm.world_diff
+                .write_storage(world, tracer, vm.state.current_frame.address, key, value);
+
+        assert!(refund <= SSTORE_COST);
+        vm.state.current_frame.gas += refund;
+    })
+}
+
+fn sstore_transient<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::TransientStorageWrite, _, _>(vm, world, tracer, |vm, args| {
+        let key = Register1::get(args, &mut vm.state);
+        let value = Register2::get(args, &mut vm.state);
+
+        vm.world_diff
+            .write_transient_storage(vm.state.current_frame.address, key, value);
+    })
+}
+
+fn sload<T: Tracer, W: World<T>>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate_ext::<opcodes::StorageRead, _, _>(vm, world, tracer, |vm, args, world, tracer| {
+        let key = Register1::get(args, &mut vm.state);
+
+        let (value, refund) =
+            vm.world_diff
+                .read_storage(world, tracer, vm.state.current_frame.address, key);
+
+        assert!(refund <= SLOAD_COST);
+        vm.state.current_frame.gas += refund;
+
+        Register1::set(args, &mut vm.state, value);
+    })
+}
+
+fn sload_transient<T: Tracer, W>(
+    vm: &mut VirtualMachine<T, W>,
+    world: &mut W,
+    tracer: &mut T,
+) -> ExecutionStatus {
+    boilerplate::<opcodes::TransientStorageRead, _, _>(vm, world, tracer, |vm, args| {
+        let key = Register1::get(args, &mut vm.state);
+        let value = vm
+            .world_diff
+            .read_transient_storage(vm.state.current_frame.address, key);
+
+        Register1::set(args, &mut vm.state, value);
+    })
+}
+
+impl<T: Tracer, W: World<T>> Instruction<T, W> {
+    /// Creates a [`StorageWrite`](opcodes::StorageWrite) instruction with the provided params.
+    pub fn from_storage_write(src1: Register1, src2: Register2, arguments: Arguments) -> Self {
+        Self {
+            handler: sstore,
+            arguments: arguments.write_source(&src1).write_source(&src2),
+        }
+    }
+
+    /// Creates a [`TransientStorageWrite`](opcodes::TransientStorageWrite) instruction with the provided params.
+    pub fn from_transient_storage_write(
+        src1: Register1,
+        src2: Register2,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: sstore_transient,
+            arguments: arguments.write_source(&src1).write_source(&src2),
+        }
+    }
+
+    /// Creates a [`StorageRead`](opcodes::StorageRead) instruction with the provided params.
+    pub fn from_storage_read(src: Register1, dst: Register1, arguments: Arguments) -> Self {
+        Self {
+            handler: sload,
+            arguments: arguments.write_source(&src).write_destination(&dst),
+        }
+    }
+
+    /// Creates a [`TransientStorageRead`](opcodes::TransientStorageRead) instruction with the provided params.
+    pub fn from_transient_storage_read(
+        src: Register1,
+        dst: Register1,
+        arguments: Arguments,
+    ) -> Self {
+        Self {
+            handler: sload_transient,
+            arguments: arguments.write_source(&src).write_destination(&dst),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/lib.rs.html b/src/zksync_vm2/lib.rs.html new file mode 100644 index 0000000..cf169ef --- /dev/null +++ b/src/zksync_vm2/lib.rs.html @@ -0,0 +1,173 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
//! # High-Performance ZKsync Era VM
+//!
+//! This crate provides high-performance [`VirtualMachine`] for ZKsync Era.
+
+use std::hash::{DefaultHasher, Hash, Hasher};
+
+use primitive_types::{H160, U256};
+pub use zksync_vm2_interface as interface;
+use zksync_vm2_interface::Tracer;
+
+// Re-export missing modules if single instruction testing is enabled
+#[cfg(feature = "single_instruction_test")]
+pub(crate) use self::single_instruction_test::{heap, program, stack};
+pub use self::{
+    fat_pointer::FatPointer,
+    instruction::{ExecutionEnd, Instruction},
+    mode_requirements::ModeRequirements,
+    predication::Predicate,
+    program::Program,
+    vm::{Settings, VirtualMachine},
+    world_diff::{Snapshot, StorageChange, WorldDiff},
+};
+
+pub mod addressing_modes;
+#[cfg(not(feature = "single_instruction_test"))]
+mod bitset;
+mod callframe;
+mod decode;
+mod decommit;
+mod fat_pointer;
+#[cfg(not(feature = "single_instruction_test"))]
+mod heap;
+mod instruction;
+mod instruction_handlers;
+mod mode_requirements;
+mod predication;
+#[cfg(not(feature = "single_instruction_test"))]
+mod program;
+mod rollback;
+#[cfg(feature = "single_instruction_test")]
+pub mod single_instruction_test;
+#[cfg(not(feature = "single_instruction_test"))]
+mod stack;
+mod state;
+pub mod testonly;
+#[cfg(all(test, not(feature = "single_instruction_test")))]
+mod tests;
+mod tracing;
+mod vm;
+mod world_diff;
+
+/// VM storage access operations.
+pub trait StorageInterface {
+    /// Reads the specified slot from the storage.
+    ///
+    /// There is no write counterpart; [`WorldDiff::get_storage_changes()`] gives a list of all storage changes.
+    fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>;
+
+    /// Computes the cost of writing a storage slot.
+    fn cost_of_writing_storage(&mut self, initial_value: Option<U256>, new_value: U256) -> u32;
+
+    /// Returns if the storage slot is free both in terms of gas and pubdata.
+    fn is_free_storage_slot(&self, contract: &H160, key: &U256) -> bool;
+}
+
+/// Encapsulates VM interaction with the external world. This includes VM storage and decomitting (loading) bytecodes
+/// for execution.
+pub trait World<T: Tracer>: StorageInterface + Sized {
+    /// Loads a bytecode with the specified hash.
+    ///
+    /// This method will be called *every* time a contract is called. Caching and decoding is
+    /// the world implementor's job.
+    fn decommit(&mut self, hash: U256) -> Program<T, Self>;
+
+    /// Loads bytecode bytes for the `decommit` opcode.
+    fn decommit_code(&mut self, hash: U256) -> Vec<u8>;
+}
+
+/// Deterministic (across program runs and machines) hash that can be used for `Debug` implementations
+/// to concisely represent large amounts of data.
+#[cfg_attr(feature = "single_instruction_test", allow(dead_code))] // Currently used entirely in types overridden by `single_instruction_test` feature
+pub(crate) fn hash_for_debugging(value: &impl Hash) -> u64 {
+    let mut hasher = DefaultHasher::new();
+    value.hash(&mut hasher);
+    hasher.finish()
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/mode_requirements.rs.html b/src/zksync_vm2/mode_requirements.rs.html new file mode 100644 index 0000000..5993ff6 --- /dev/null +++ b/src/zksync_vm2/mode_requirements.rs.html @@ -0,0 +1,41 @@ +mode_requirements.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+
/// VM execution mode requirements (kernel only, not in static call) that can be placed on instructions.
+#[derive(Debug, Clone, Copy)]
+pub struct ModeRequirements(pub(crate) u8);
+
+impl ModeRequirements {
+    /// Creates new requirements.
+    pub const fn new(kernel_only: bool, cannot_use_in_static: bool) -> Self {
+        Self((kernel_only as u8) | ((cannot_use_in_static as u8) << 1))
+    }
+
+    /// Creates default requirements that always hold.
+    pub const fn none() -> Self {
+        Self::new(false, false)
+    }
+
+    pub(crate) fn met(self, is_kernel: bool, is_static: bool) -> bool {
+        let enabled_modes = u8::from(is_kernel) | (u8::from(!is_static) << 1);
+        enabled_modes & self.0 == self.0
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/predication.rs.html b/src/zksync_vm2/predication.rs.html new file mode 100644 index 0000000..e2a55c5 --- /dev/null +++ b/src/zksync_vm2/predication.rs.html @@ -0,0 +1,113 @@ +predication.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+
const LT_BIT: u8 = 1;
+const EQ_BIT: u8 = 1 << 1;
+const GT_BIT: u8 = 1 << 2;
+const ALWAYS_BIT: u8 = 1 << 3;
+
+#[derive(Debug, Clone, PartialEq)]
+pub(crate) struct Flags(u8);
+
+impl Flags {
+    pub(crate) fn new(lt_of: bool, eq: bool, gt: bool) -> Self {
+        Flags(u8::from(lt_of) | (u8::from(eq) << 1) | (u8::from(gt) << 2) | ALWAYS_BIT)
+    }
+}
+
+/// Predicate for an instruction. Encoded so that comparing it to flags is efficient.
+#[derive(Copy, Clone, Debug, Default, Hash)]
+#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
+#[repr(u8)]
+pub enum Predicate {
+    /// Always execute the associated instruction.
+    #[default]
+    Always = ALWAYS_BIT,
+    /// Execute the associated instruction if the "greater than" execution flag is set.
+    IfGT = GT_BIT,
+    /// Execute the associated instruction if the "equal" execution flag is set.
+    IfEQ = EQ_BIT,
+    /// Execute the associated instruction if the "less than" execution flag is set.
+    IfLT = LT_BIT,
+    /// Execute the associated instruction if either of "greater than" or "equal" execution flags are set.
+    IfGE = GT_BIT | EQ_BIT,
+    /// Execute the associated instruction if either of "less than" or "equal" execution flags are set.
+    IfLE = LT_BIT | EQ_BIT,
+    /// Execute the associated instruction if the "equal" execution flag is not set.
+    IfNotEQ = EQ_BIT << 4 | ALWAYS_BIT,
+    /// Execute the associated instruction if either of "less than" or "greater than" execution flags are set.
+    IfGTOrLT = GT_BIT | LT_BIT,
+}
+
+impl Predicate {
+    #[inline(always)]
+    pub(crate) fn satisfied(self, flags: &Flags) -> bool {
+        let bits = self as u8;
+        bits & flags.0 != 0 && (bits >> 4) & flags.0 == 0
+    }
+}
+
+#[cfg(feature = "single_instruction_test")]
+impl From<&Flags> for zk_evm::flags::Flags {
+    fn from(flags: &Flags) -> Self {
+        zk_evm::flags::Flags {
+            overflow_or_less_than_flag: flags.0 & LT_BIT != 0,
+            equality_flag: flags.0 & EQ_BIT != 0,
+            greater_than_flag: flags.0 & GT_BIT != 0,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/program.rs.html b/src/zksync_vm2/program.rs.html new file mode 100644 index 0000000..1ba606c --- /dev/null +++ b/src/zksync_vm2/program.rs.html @@ -0,0 +1,309 @@ +program.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
use std::{fmt, sync::Arc};
+
+use primitive_types::U256;
+use zksync_vm2_interface::Tracer;
+
+use crate::{
+    addressing_modes::Arguments, decode::decode, hash_for_debugging, instruction::ExecutionStatus,
+    Instruction, ModeRequirements, Predicate, VirtualMachine, World,
+};
+
+/// Compiled EraVM bytecode.
+///
+/// Cloning this is cheap. It is a handle to memory similar to [`Arc`].
+pub struct Program<T, W> {
+    // An internal representation that doesn't need two Arcs would be better
+    // but it would also require a lot of unsafe, so I made this wrapper to
+    // enable changing the internals later.
+    code_page: Arc<[U256]>,
+    instructions: Arc<[Instruction<T, W>]>,
+}
+
+impl<T, W> Clone for Program<T, W> {
+    fn clone(&self) -> Self {
+        Self {
+            code_page: self.code_page.clone(),
+            instructions: self.instructions.clone(),
+        }
+    }
+}
+
+impl<T, W> fmt::Debug for Program<T, W> {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        const DEBUGGED_ITEMS: usize = 16;
+
+        let mut s = formatter.debug_struct("Program");
+        if self.code_page.len() <= DEBUGGED_ITEMS {
+            s.field("code_page", &self.code_page);
+        } else {
+            s.field("code_page.len", &self.code_page.len())
+                .field("code_page.start", &&self.code_page[..DEBUGGED_ITEMS])
+                .field("code_page.hash", &hash_for_debugging(&self.code_page));
+        }
+
+        if self.instructions.len() <= DEBUGGED_ITEMS {
+            s.field("instructions", &self.instructions);
+        } else {
+            s.field("instructions.len", &self.instructions.len())
+                .field("instructions.start", &&self.instructions[..DEBUGGED_ITEMS]);
+        }
+        s.finish_non_exhaustive()
+    }
+}
+
+impl<T: Tracer, W: World<T>> Program<T, W> {
+    /// Creates a new program.
+    #[allow(clippy::missing_panics_doc)] // false positive
+    pub fn new(bytecode: &[u8], enable_hooks: bool) -> Self {
+        let instructions = decode_program(
+            &bytecode
+                .chunks_exact(8)
+                .map(|chunk| u64::from_be_bytes(chunk.try_into().unwrap()))
+                .collect::<Vec<_>>(),
+            enable_hooks,
+        );
+        let code_page = bytecode
+            .chunks_exact(32)
+            .map(U256::from_big_endian)
+            .collect::<Vec<_>>();
+        Self {
+            instructions: instructions.into(),
+            code_page: code_page.into(),
+        }
+    }
+
+    /// Creates a new program from `U256` words.
+    pub fn from_words(bytecode_words: Vec<U256>, enable_hooks: bool) -> Self {
+        let instructions = decode_program(
+            &bytecode_words
+                .iter()
+                .flat_map(|x| x.0.into_iter().rev())
+                .collect::<Vec<_>>(),
+            enable_hooks,
+        );
+        Self {
+            instructions: instructions.into(),
+            code_page: bytecode_words.into(),
+        }
+    }
+
+    #[doc(hidden)] // should only be used in low-level tests / benchmarks
+    pub fn from_raw(instructions: Vec<Instruction<T, W>>, code_page: Vec<U256>) -> Self {
+        Self {
+            instructions: instructions.into(),
+            code_page: code_page.into(),
+        }
+    }
+}
+
+impl<T, W> Program<T, W> {
+    pub(crate) fn instruction(&self, n: u16) -> Option<&Instruction<T, W>> {
+        self.instructions.get::<usize>(n.into())
+    }
+
+    /// Returns a reference to the code page of this program.
+    pub fn code_page(&self) -> &[U256] {
+        &self.code_page
+    }
+}
+
+// This implementation compares pointers instead of programs.
+//
+// That works well enough for the tests that this is written for.
+// I don't want to implement PartialEq for Instruction because
+// comparing function pointers can work in suprising ways.
+impl<T, W> PartialEq for Program<T, W> {
+    fn eq(&self, other: &Self) -> bool {
+        Arc::ptr_eq(&self.code_page, &other.code_page)
+            && Arc::ptr_eq(&self.instructions, &other.instructions)
+    }
+}
+
+/// Wraparound instruction placed at the end of programs exceeding `1 << 16` instructions to simulate the 16-bit program counter overflowing.
+/// Does not invoke tracers because it is an implementation detail, not an actual instruction.
+fn jump_to_beginning<T, W>() -> Instruction<T, W> {
+    Instruction {
+        handler: jump_to_beginning_handler,
+        arguments: Arguments::new(Predicate::Always, 0, ModeRequirements::none()),
+    }
+}
+
+fn jump_to_beginning_handler<T, W>(
+    vm: &mut VirtualMachine<T, W>,
+    _: &mut W,
+    _: &mut T,
+) -> ExecutionStatus {
+    let first_instruction = vm.state.current_frame.program.instruction(0).unwrap();
+    vm.state.current_frame.pc = first_instruction;
+    ExecutionStatus::Running
+}
+
+fn decode_program<T: Tracer, W: World<T>>(
+    raw: &[u64],
+    is_bootloader: bool,
+) -> Vec<Instruction<T, W>> {
+    raw.iter()
+        .take(1 << 16)
+        .map(|i| decode(*i, is_bootloader))
+        .chain(std::iter::once(if raw.len() >= 1 << 16 {
+            jump_to_beginning()
+        } else {
+            Instruction::from_invalid()
+        }))
+        .collect()
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/rollback.rs.html b/src/zksync_vm2/rollback.rs.html new file mode 100644 index 0000000..0ff7b2d --- /dev/null +++ b/src/zksync_vm2/rollback.rs.html @@ -0,0 +1,335 @@ +rollback.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+
use std::collections::{BTreeMap, BTreeSet};
+
+/// A trait for things that can be rolled back to snapshots
+pub(crate) trait Rollback {
+    type Snapshot;
+    fn snapshot(&self) -> Self::Snapshot;
+    fn rollback(&mut self, snapshot: Self::Snapshot);
+    fn delete_history(&mut self);
+}
+
+#[derive(Debug, Default)]
+pub(crate) struct RollbackableMap<K: Ord, V> {
+    map: BTreeMap<K, V>,
+    old_entries: Vec<(K, Option<V>)>,
+}
+
+impl<K: Ord + Clone, V: Clone> RollbackableMap<K, V> {
+    pub(crate) fn insert(&mut self, key: K, value: V) -> Option<V> {
+        let old_value = self.map.insert(key.clone(), value);
+        self.old_entries.push((key, old_value.clone()));
+        old_value
+    }
+
+    pub(crate) fn changes_after(
+        &self,
+        snapshot: <Self as Rollback>::Snapshot,
+    ) -> BTreeMap<K, (Option<V>, V)> {
+        let mut changes = BTreeMap::new();
+        for (key, old_value) in self.old_entries[snapshot..].iter().rev() {
+            changes
+                .entry(key.clone())
+                .and_modify(|(old, _): &mut (Option<V>, V)| old.clone_from(old_value))
+                .or_insert((old_value.clone(), self.map.get(key).unwrap().clone()));
+        }
+        changes
+    }
+}
+
+impl<K: Ord, V> Rollback for RollbackableMap<K, V> {
+    type Snapshot = usize;
+
+    fn snapshot(&self) -> Self::Snapshot {
+        self.old_entries.len()
+    }
+
+    fn rollback(&mut self, snapshot: Self::Snapshot) {
+        for (k, v) in self.old_entries.drain(snapshot..).rev() {
+            if let Some(old_value) = v {
+                self.map.insert(k, old_value);
+            } else {
+                self.map.remove(&k);
+            }
+        }
+    }
+
+    fn delete_history(&mut self) {
+        self.old_entries.clear();
+    }
+}
+
+impl<K: Ord, V> AsRef<BTreeMap<K, V>> for RollbackableMap<K, V> {
+    fn as_ref(&self) -> &BTreeMap<K, V> {
+        &self.map
+    }
+}
+
+#[derive(Debug, Default)]
+pub(crate) struct RollbackableSet<K: Ord> {
+    map: BTreeSet<K>,
+    old_entries: Vec<K>,
+}
+
+impl<T: Ord + Clone> RollbackableSet<T> {
+    /// Adds `key` to the set and returns if it was added (not present earlier).
+    pub(crate) fn add(&mut self, key: T) -> bool {
+        let is_new = self.map.insert(key.clone());
+        if is_new {
+            self.old_entries.push(key);
+        }
+        is_new
+    }
+}
+
+impl<K: Ord> Rollback for RollbackableSet<K> {
+    type Snapshot = usize;
+
+    fn snapshot(&self) -> Self::Snapshot {
+        self.old_entries.len()
+    }
+
+    fn rollback(&mut self, snapshot: Self::Snapshot) {
+        for k in self.old_entries.drain(snapshot..) {
+            self.map.remove(&k);
+        }
+    }
+
+    fn delete_history(&mut self) {
+        self.old_entries.clear();
+    }
+}
+
+impl<K: Ord> AsRef<BTreeSet<K>> for RollbackableSet<K> {
+    fn as_ref(&self) -> &BTreeSet<K> {
+        &self.map
+    }
+}
+
+#[derive(Debug)]
+pub(crate) struct RollbackableLog<T> {
+    entries: Vec<T>,
+}
+
+impl<T> Default for RollbackableLog<T> {
+    fn default() -> Self {
+        Self {
+            entries: Vec::default(),
+        }
+    }
+}
+
+impl<T> Rollback for RollbackableLog<T> {
+    type Snapshot = usize;
+
+    fn snapshot(&self) -> Self::Snapshot {
+        self.entries.len()
+    }
+
+    fn rollback(&mut self, snapshot: Self::Snapshot) {
+        self.entries.truncate(snapshot);
+    }
+
+    fn delete_history(&mut self) {}
+}
+
+impl<T> RollbackableLog<T> {
+    pub(crate) fn push(&mut self, entry: T) {
+        self.entries.push(entry);
+    }
+
+    pub(crate) fn logs_after(&self, snapshot: <RollbackableLog<T> as Rollback>::Snapshot) -> &[T] {
+        &self.entries[snapshot..]
+    }
+}
+
+impl<T> AsRef<[T]> for RollbackableLog<T> {
+    fn as_ref(&self) -> &[T] {
+        &self.entries
+    }
+}
+
+/// Rollbackable Plain Old Data simply stores copies of itself in snapshots.
+#[derive(Debug, Default, Copy, Clone)]
+pub(crate) struct RollbackablePod<T: Copy>(pub(crate) T);
+
+impl<T: Copy> Rollback for RollbackablePod<T> {
+    type Snapshot = T;
+
+    fn snapshot(&self) -> Self::Snapshot {
+        self.0
+    }
+
+    fn rollback(&mut self, snapshot: Self::Snapshot) {
+        self.0 = snapshot;
+    }
+
+    fn delete_history(&mut self) {}
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/stack.rs.html b/src/zksync_vm2/stack.rs.html new file mode 100644 index 0000000..21354e3 --- /dev/null +++ b/src/zksync_vm2/stack.rs.html @@ -0,0 +1,397 @@ +stack.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+
use std::{
+    alloc::{alloc, alloc_zeroed, Layout},
+    fmt,
+};
+
+use primitive_types::U256;
+
+use crate::{bitset::Bitset, fat_pointer::FatPointer, hash_for_debugging};
+
+#[derive(PartialEq)]
+pub(crate) struct Stack {
+    /// set of slots that may be interpreted as [`FatPointer`].
+    pointer_flags: Bitset,
+    dirty_areas: u64,
+    slots: [U256; 1 << 16],
+}
+
+const NUMBER_OF_DIRTY_AREAS: usize = 64;
+const DIRTY_AREA_SIZE: usize = (1 << 16) / NUMBER_OF_DIRTY_AREAS;
+
+impl Stack {
+    #[allow(clippy::cast_ptr_alignment)] // aligned per `Stack` layout
+    pub(crate) fn new() -> Box<Self> {
+        unsafe { Box::from_raw(alloc_zeroed(Layout::new::<Self>()).cast()) }
+    }
+
+    #[inline(always)]
+    pub(crate) fn get(&self, slot: u16) -> U256 {
+        self.slots[slot as usize]
+    }
+
+    #[inline(always)]
+    pub(crate) fn set(&mut self, slot: u16, value: U256) {
+        let written_area = slot as usize / DIRTY_AREA_SIZE;
+        self.dirty_areas |= 1 << written_area;
+
+        self.slots[slot as usize] = value;
+    }
+
+    fn zero(&mut self) {
+        for i in 0..NUMBER_OF_DIRTY_AREAS {
+            if self.dirty_areas & (1 << i) != 0 {
+                for slot in &mut self.slots[i * DIRTY_AREA_SIZE..(i + 1) * DIRTY_AREA_SIZE] {
+                    *slot = U256::zero();
+                }
+            }
+        }
+
+        self.dirty_areas = 0;
+        self.pointer_flags = Bitset::default();
+    }
+
+    #[inline(always)]
+    pub(crate) fn get_pointer_flag(&self, slot: u16) -> bool {
+        self.pointer_flags.get(slot)
+    }
+
+    #[inline(always)]
+    pub(crate) fn set_pointer_flag(&mut self, slot: u16) {
+        self.pointer_flags.set(slot);
+    }
+
+    #[inline(always)]
+    pub(crate) fn clear_pointer_flag(&mut self, slot: u16) {
+        self.pointer_flags.clear(slot);
+    }
+
+    pub(crate) fn snapshot(&self) -> StackSnapshot {
+        let dirty_prefix_end = NUMBER_OF_DIRTY_AREAS - self.dirty_areas.leading_zeros() as usize;
+
+        StackSnapshot {
+            pointer_flags: self.pointer_flags.clone(),
+            dirty_areas: self.dirty_areas,
+            slots: self.slots[..DIRTY_AREA_SIZE * dirty_prefix_end].into(),
+        }
+    }
+
+    pub(crate) fn rollback(&mut self, snapshot: StackSnapshot) {
+        let StackSnapshot {
+            pointer_flags,
+            dirty_areas,
+            slots,
+        } = snapshot;
+
+        self.zero();
+
+        self.pointer_flags = pointer_flags;
+        self.dirty_areas = dirty_areas;
+        self.slots[..slots.len()].copy_from_slice(&slots);
+    }
+}
+
+pub(crate) struct StackSnapshot {
+    pointer_flags: Bitset,
+    dirty_areas: u64,
+    slots: Box<[U256]>,
+}
+
+impl Clone for Box<Stack> {
+    fn clone(&self) -> Self {
+        unsafe {
+            let allocation = alloc(Layout::for_value(&**self)).cast();
+            std::ptr::copy_nonoverlapping(&**self, allocation, 1);
+            Box::from_raw(allocation)
+        }
+    }
+}
+
+#[derive(Debug, Default)]
+pub(crate) struct StackPool {
+    stacks: Vec<Box<Stack>>,
+}
+
+impl StackPool {
+    pub(crate) fn get(&mut self) -> Box<Stack> {
+        self.stacks.pop().map_or_else(Stack::new, |mut s| {
+            s.zero();
+            s
+        })
+    }
+
+    pub(crate) fn recycle(&mut self, stack: Box<Stack>) {
+        self.stacks.push(stack);
+    }
+}
+
+// region:Debug implementations
+
+/// Helper wrapper for debugging [`Stack`] / [`StackSnapshot`] contents.
+struct StackStart<I>(I);
+
+impl<I: Iterator<Item = (bool, U256)> + Clone> fmt::Debug for StackStart<I> {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut list = formatter.debug_list();
+        for (is_pointer, slot) in self.0.clone() {
+            if is_pointer {
+                list.entry(&FatPointer::from(slot));
+            } else {
+                list.entry(&slot);
+            }
+        }
+        list.finish()
+    }
+}
+
+impl fmt::Debug for Stack {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        const DEBUGGED_SLOTS: usize = 256;
+
+        let slots = (0_u16..)
+            .zip(&self.slots)
+            .map(|(idx, slot)| (self.pointer_flags.get(idx), *slot))
+            .take(DEBUGGED_SLOTS);
+        formatter
+            .debug_struct("Stack")
+            .field("start", &StackStart(slots))
+            .field(
+                "pointer_flags.hash",
+                &hash_for_debugging(&self.pointer_flags),
+            )
+            .field("slots.hash", &hash_for_debugging(&self.slots))
+            .finish_non_exhaustive()
+    }
+}
+
+impl fmt::Debug for StackSnapshot {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+        const DEBUGGED_SLOTS: usize = 256;
+
+        let slots = (0_u16..)
+            .zip(&self.slots[..])
+            .map(|(idx, slot)| (self.pointer_flags.get(idx), *slot))
+            .take(DEBUGGED_SLOTS);
+        formatter
+            .debug_struct("StackSnapshot")
+            .field("dirty_areas", &self.dirty_areas)
+            .field("start", &StackStart(slots))
+            .field(
+                "pointer_flags.hash",
+                &hash_for_debugging(&self.pointer_flags),
+            )
+            .field("slots.hash", &hash_for_debugging(&self.slots))
+            .finish_non_exhaustive()
+    }
+}
+// endregion
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    // The code produced by derive(Clone) overflows the stack in debug mode.
+    #[test]
+    fn clone_does_not_segfault() {
+        let stack = Stack::new();
+        let _ = stack.clone();
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/state.rs.html b/src/zksync_vm2/state.rs.html new file mode 100644 index 0000000..badc8a5 --- /dev/null +++ b/src/zksync_vm2/state.rs.html @@ -0,0 +1,459 @@ +state.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+
use primitive_types::{H160, U256};
+use zksync_vm2_interface::{HeapId, Tracer};
+
+use crate::{
+    addressing_modes::Addressable,
+    callframe::{Callframe, CallframeSnapshot},
+    fat_pointer::FatPointer,
+    heap::Heaps,
+    predication::Flags,
+    program::Program,
+    stack::Stack,
+    world_diff::Snapshot,
+};
+
+/// State of a [`VirtualMachine`](crate::VirtualMachine).
+#[derive(Debug)]
+pub(crate) struct State<T, W> {
+    pub(crate) registers: [U256; 16],
+    pub(crate) register_pointer_flags: u16,
+    pub(crate) flags: Flags,
+    pub(crate) current_frame: Callframe<T, W>,
+    /// Contains indices to the far call instructions currently being executed.
+    /// They are needed to continue execution from the correct spot upon return.
+    pub(crate) previous_frames: Vec<Callframe<T, W>>,
+    pub(crate) heaps: Heaps,
+    pub(crate) transaction_number: u16,
+    pub(crate) context_u128: u128,
+}
+
+impl<T, W> State<T, W> {
+    pub(crate) fn new(
+        address: H160,
+        caller: H160,
+        calldata: &[u8],
+        gas: u32,
+        program: Program<T, W>,
+        world_before_this_frame: Snapshot,
+        stack: Box<Stack>,
+    ) -> Self {
+        let mut registers: [U256; 16] = Default::default();
+        registers[1] = FatPointer {
+            memory_page: HeapId::FIRST_CALLDATA,
+            offset: 0,
+            start: 0,
+            length: u32::try_from(calldata.len()).expect("calldata length overflow"),
+        }
+        .into_u256();
+
+        Self {
+            registers,
+            register_pointer_flags: 1 << 1, // calldata is a pointer
+            flags: Flags::new(false, false, false),
+            current_frame: Callframe::new(
+                address,
+                address,
+                caller,
+                program,
+                stack,
+                HeapId::FIRST,
+                HeapId::FIRST_AUX,
+                HeapId::FIRST_CALLDATA,
+                gas,
+                0,
+                0,
+                0,
+                false,
+                world_before_this_frame,
+            ),
+            previous_frames: vec![],
+
+            heaps: Heaps::new(calldata),
+
+            transaction_number: 0,
+            context_u128: 0,
+        }
+    }
+
+    #[inline(always)]
+    pub(crate) fn use_gas(&mut self, amount: u32) -> Result<(), ()> {
+        if self.current_frame.gas >= amount {
+            self.current_frame.gas -= amount;
+            Ok(())
+        } else {
+            self.current_frame.gas = 0;
+            Err(())
+        }
+    }
+
+    pub(crate) fn set_context_u128(&mut self, value: u128) {
+        self.context_u128 = value;
+    }
+
+    pub(crate) fn get_context_u128(&self) -> u128 {
+        self.current_frame.context_u128
+    }
+}
+
+impl<T: Tracer, W> State<T, W> {
+    /// Returns the total unspent gas in the VM, including stipends.
+    pub(crate) fn total_unspent_gas(&self) -> u32 {
+        self.current_frame.gas
+            + self
+                .previous_frames
+                .iter()
+                .map(Callframe::contained_gas)
+                .sum::<u32>()
+    }
+
+    pub(crate) fn snapshot(&self) -> StateSnapshot {
+        StateSnapshot {
+            registers: self.registers,
+            register_pointer_flags: self.register_pointer_flags,
+            flags: self.flags.clone(),
+            bootloader_frame: self.current_frame.snapshot(),
+            bootloader_heap_snapshot: self.heaps.snapshot(),
+            transaction_number: self.transaction_number,
+            context_u128: self.context_u128,
+        }
+    }
+
+    pub(crate) fn rollback(&mut self, snapshot: StateSnapshot) {
+        let StateSnapshot {
+            registers,
+            register_pointer_flags,
+            flags,
+            bootloader_frame,
+            bootloader_heap_snapshot,
+            transaction_number,
+            context_u128,
+        } = snapshot;
+
+        for heap in self.current_frame.rollback(bootloader_frame) {
+            self.heaps.deallocate(heap);
+        }
+        self.heaps.rollback(bootloader_heap_snapshot);
+        self.registers = registers;
+        self.register_pointer_flags = register_pointer_flags;
+        self.flags = flags;
+        self.transaction_number = transaction_number;
+        self.context_u128 = context_u128;
+    }
+
+    pub(crate) fn delete_history(&mut self) {
+        self.heaps.delete_history();
+    }
+}
+
+impl<T, W> Clone for State<T, W> {
+    fn clone(&self) -> Self {
+        Self {
+            registers: self.registers,
+            register_pointer_flags: self.register_pointer_flags,
+            flags: self.flags.clone(),
+            current_frame: self.current_frame.clone(),
+            previous_frames: self.previous_frames.clone(),
+            heaps: self.heaps.clone(),
+            transaction_number: self.transaction_number,
+            context_u128: self.context_u128,
+        }
+    }
+}
+
+impl<T, W> PartialEq for State<T, W> {
+    fn eq(&self, other: &Self) -> bool {
+        // does not compare cycle counts to work with tests that
+        // expect no change after a rollback
+        self.registers == other.registers
+            && self.register_pointer_flags == other.register_pointer_flags
+            && self.flags == other.flags
+            && self.transaction_number == other.transaction_number
+            && self.context_u128 == other.context_u128
+            && self.current_frame == other.current_frame
+            && self.previous_frames == other.previous_frames
+            && self.heaps == other.heaps
+    }
+}
+
+impl<T, W> Addressable for State<T, W> {
+    fn registers(&mut self) -> &mut [U256; 16] {
+        &mut self.registers
+    }
+
+    fn register_pointer_flags(&mut self) -> &mut u16 {
+        &mut self.register_pointer_flags
+    }
+
+    fn read_stack(&mut self, slot: u16) -> U256 {
+        self.current_frame.stack.get(slot)
+    }
+
+    fn write_stack(&mut self, slot: u16, value: U256) {
+        self.current_frame.stack.set(slot, value);
+    }
+
+    fn stack_pointer(&mut self) -> &mut u16 {
+        &mut self.current_frame.sp
+    }
+
+    fn read_stack_pointer_flag(&mut self, slot: u16) -> bool {
+        self.current_frame.stack.get_pointer_flag(slot)
+    }
+
+    fn set_stack_pointer_flag(&mut self, slot: u16) {
+        self.current_frame.stack.set_pointer_flag(slot);
+    }
+
+    fn clear_stack_pointer_flag(&mut self, slot: u16) {
+        self.current_frame.stack.clear_pointer_flag(slot);
+    }
+
+    fn code_page(&self) -> &[U256] {
+        self.current_frame.program.code_page()
+    }
+
+    fn in_kernel_mode(&self) -> bool {
+        self.current_frame.is_kernel
+    }
+}
+
+#[derive(Debug)]
+pub(crate) struct StateSnapshot {
+    registers: [U256; 16],
+    register_pointer_flags: u16,
+    flags: Flags,
+    bootloader_frame: CallframeSnapshot,
+    bootloader_heap_snapshot: (usize, usize),
+    transaction_number: u16,
+    context_u128: u128,
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/testonly.rs.html b/src/zksync_vm2/testonly.rs.html new file mode 100644 index 0000000..55251d7 --- /dev/null +++ b/src/zksync_vm2/testonly.rs.html @@ -0,0 +1,245 @@ +testonly.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+
//! Test-only tools for EraVM.
+
+use std::{
+    collections::{hash_map::DefaultHasher, BTreeMap},
+    hash::{Hash, Hasher},
+};
+
+use primitive_types::{H160, U256};
+use zkevm_opcode_defs::{
+    ethereum_types::Address, system_params::DEPLOYER_SYSTEM_CONTRACT_ADDRESS_LOW,
+};
+use zksync_vm2_interface::Tracer;
+
+use crate::{instruction_handlers::address_into_u256, Program, StorageInterface, World};
+
+/// Test [`World`] implementation.
+#[derive(Debug)]
+pub struct TestWorld<T> {
+    pub(crate) address_to_hash: BTreeMap<U256, U256>,
+    pub(crate) hash_to_contract: BTreeMap<U256, Program<T, Self>>,
+}
+
+impl<T: Tracer> TestWorld<T> {
+    /// Creates a test world with the provided programs.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the provided `Program`s are malformed.
+    pub fn new(contracts: &[(Address, Program<T, Self>)]) -> Self {
+        let mut address_to_hash = BTreeMap::new();
+        let mut hash_to_contract = BTreeMap::new();
+        for (i, (address, code)) in contracts.iter().enumerate() {
+            // We add the index to the hash because tests may leave the code page blank.
+            let mut hasher = DefaultHasher::new();
+            i.hash(&mut hasher);
+            code.code_page().hash(&mut hasher);
+
+            let mut code_info_bytes = [0; 32];
+            code_info_bytes[24..].copy_from_slice(&hasher.finish().to_be_bytes());
+            let code_len = u16::try_from(code.code_page().len())
+                .expect("code length must not exceed u16::MAX");
+            code_info_bytes[2..=3].copy_from_slice(&code_len.to_be_bytes());
+            code_info_bytes[0] = 1;
+            let hash = U256::from_big_endian(&code_info_bytes);
+
+            address_to_hash.insert(address_into_u256(*address), hash);
+            hash_to_contract.insert(hash, code.clone());
+        }
+        Self {
+            address_to_hash,
+            hash_to_contract,
+        }
+    }
+}
+
+impl<T: Tracer> World<T> for TestWorld<T> {
+    fn decommit(&mut self, hash: U256) -> Program<T, Self> {
+        if let Some(program) = self.hash_to_contract.get(&hash) {
+            program.clone()
+        } else {
+            panic!("unexpected decommit")
+        }
+    }
+
+    fn decommit_code(&mut self, hash: U256) -> Vec<u8> {
+        self.decommit(hash)
+            .code_page()
+            .iter()
+            .flat_map(|u256| {
+                let mut buffer = [0u8; 32];
+                u256.to_big_endian(&mut buffer);
+                buffer
+            })
+            .collect()
+    }
+}
+
+impl<T> StorageInterface for TestWorld<T> {
+    fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256> {
+        let deployer_system_contract_address =
+            Address::from_low_u64_be(DEPLOYER_SYSTEM_CONTRACT_ADDRESS_LOW.into());
+
+        if contract == deployer_system_contract_address {
+            Some(
+                self.address_to_hash
+                    .get(&key)
+                    .copied()
+                    .unwrap_or(U256::zero()),
+            )
+        } else {
+            None
+        }
+    }
+
+    fn cost_of_writing_storage(&mut self, _initial_value: Option<U256>, _new_value: U256) -> u32 {
+        50
+    }
+
+    fn is_free_storage_slot(&self, _contract: &H160, _key: &U256) -> bool {
+        false
+    }
+}
+
+/// May be used to load code when the VM first starts up.
+/// Doesn't check for any errors.
+/// Doesn't cost anything but also doesn't make the code free in future decommits.
+#[doc(hidden)] // should be used only in low-level testing / benches
+pub fn initial_decommit<T: Tracer, W: World<T>>(world: &mut W, address: H160) -> Program<T, W> {
+    let deployer_system_contract_address =
+        Address::from_low_u64_be(DEPLOYER_SYSTEM_CONTRACT_ADDRESS_LOW.into());
+    let code_info = world
+        .read_storage(deployer_system_contract_address, address_into_u256(address))
+        .unwrap_or_default();
+
+    let mut code_info_bytes = [0; 32];
+    code_info.to_big_endian(&mut code_info_bytes);
+
+    code_info_bytes[1] = 0;
+    let code_key: U256 = U256::from_big_endian(&code_info_bytes);
+
+    world.decommit(code_key)
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/tracing.rs.html b/src/zksync_vm2/tracing.rs.html new file mode 100644 index 0000000..1607667 --- /dev/null +++ b/src/zksync_vm2/tracing.rs.html @@ -0,0 +1,847 @@ +tracing.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+
use std::cmp::Ordering;
+
+use primitive_types::{H160, U256};
+use zksync_vm2_interface::{
+    CallframeInterface, Event, Flags, HeapId, L2ToL1Log, StateInterface, Tracer,
+};
+
+use crate::{
+    callframe::{Callframe, NearCallFrame},
+    decommit::is_kernel,
+    predication::{self, Predicate},
+    VirtualMachine,
+};
+
+impl<T: Tracer, W> StateInterface for VirtualMachine<T, W> {
+    fn read_register(&self, register: u8) -> (U256, bool) {
+        (
+            self.state.registers[register as usize],
+            self.state.register_pointer_flags & (1 << register) != 0,
+        )
+    }
+
+    fn set_register(&mut self, register: u8, value: U256, is_pointer: bool) {
+        self.state.registers[register as usize] = value;
+
+        self.state.register_pointer_flags &= !(1 << register);
+        self.state.register_pointer_flags |= u16::from(is_pointer) << register;
+    }
+
+    fn number_of_callframes(&self) -> usize {
+        self.state
+            .previous_frames
+            .iter()
+            .map(|frame| frame.near_calls.len() + 1)
+            .sum::<usize>()
+            + self.state.current_frame.near_calls.len()
+            + 1
+    }
+
+    fn current_frame(&mut self) -> impl CallframeInterface + '_ {
+        let near_call = self.state.current_frame.near_calls.len().checked_sub(1);
+        CallframeWrapper {
+            frame: &mut self.state.current_frame,
+            near_call,
+        }
+    }
+
+    fn callframe(&mut self, mut n: usize) -> impl CallframeInterface + '_ {
+        for far_frame in std::iter::once(&mut self.state.current_frame)
+            .chain(self.state.previous_frames.iter_mut().rev())
+        {
+            let near_calls = far_frame.near_calls.len();
+            match n.cmp(&near_calls) {
+                Ordering::Less => {
+                    return CallframeWrapper {
+                        frame: far_frame,
+                        near_call: Some(near_calls - 1 - n),
+                    }
+                }
+                Ordering::Equal => {
+                    return CallframeWrapper {
+                        frame: far_frame,
+                        near_call: None,
+                    }
+                }
+                Ordering::Greater => n -= near_calls + 1,
+            }
+        }
+        panic!("Callframe index out of bounds")
+    }
+
+    fn read_heap_byte(&self, heap: HeapId, index: u32) -> u8 {
+        self.state.heaps[heap].read_byte(index)
+    }
+
+    fn read_heap_u256(&self, heap: HeapId, index: u32) -> U256 {
+        self.state.heaps[heap].read_u256(index)
+    }
+
+    fn write_heap_u256(&mut self, heap: HeapId, index: u32, value: U256) {
+        self.state.heaps.write_u256(heap, index, value);
+    }
+
+    fn flags(&self) -> Flags {
+        let flags = &self.state.flags;
+        Flags {
+            less_than: Predicate::IfLT.satisfied(flags),
+            greater: Predicate::IfGT.satisfied(flags),
+            equal: Predicate::IfEQ.satisfied(flags),
+        }
+    }
+
+    fn set_flags(&mut self, flags: Flags) {
+        self.state.flags = predication::Flags::new(flags.less_than, flags.equal, flags.greater);
+    }
+
+    fn transaction_number(&self) -> u16 {
+        self.state.transaction_number
+    }
+
+    fn set_transaction_number(&mut self, value: u16) {
+        self.state.transaction_number = value;
+    }
+
+    fn context_u128_register(&self) -> u128 {
+        self.state.context_u128
+    }
+
+    fn set_context_u128_register(&mut self, value: u128) {
+        self.state.context_u128 = value;
+    }
+
+    fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)> {
+        self.world_diff
+            .get_storage_state()
+            .iter()
+            .map(|(key, value)| (*key, *value))
+    }
+
+    fn get_transient_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)> {
+        self.world_diff
+            .get_transient_storage_state()
+            .iter()
+            .map(|(key, value)| (*key, *value))
+    }
+
+    fn get_transient_storage(&self, address: H160, slot: U256) -> U256 {
+        self.world_diff
+            .get_transient_storage_state()
+            .get(&(address, slot))
+            .copied()
+            .unwrap_or_default()
+    }
+
+    fn write_transient_storage(&mut self, address: H160, slot: U256, value: U256) {
+        self.world_diff
+            .write_transient_storage(address, slot, value);
+    }
+
+    fn events(&self) -> impl Iterator<Item = Event> {
+        self.world_diff.events().iter().copied()
+    }
+
+    fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log> {
+        self.world_diff.l2_to_l1_logs().iter().copied()
+    }
+
+    fn pubdata(&self) -> i32 {
+        self.world_diff.pubdata()
+    }
+
+    fn set_pubdata(&mut self, value: i32) {
+        self.world_diff.pubdata.0 = value;
+    }
+}
+
+struct CallframeWrapper<'a, T, W> {
+    frame: &'a mut Callframe<T, W>,
+    near_call: Option<usize>,
+}
+
+impl<T: Tracer, W> CallframeInterface for CallframeWrapper<'_, T, W> {
+    fn address(&self) -> H160 {
+        self.frame.address
+    }
+
+    fn set_address(&mut self, address: H160) {
+        self.frame.address = address;
+        self.frame.is_kernel = is_kernel(address);
+    }
+
+    fn code_address(&self) -> H160 {
+        self.frame.code_address
+    }
+
+    fn set_code_address(&mut self, address: H160) {
+        self.frame.code_address = address;
+    }
+
+    fn caller(&self) -> H160 {
+        self.frame.caller
+    }
+
+    fn set_caller(&mut self, address: H160) {
+        self.frame.caller = address;
+    }
+
+    fn is_static(&self) -> bool {
+        self.frame.is_static
+    }
+
+    fn is_kernel(&self) -> bool {
+        self.frame.is_kernel
+    }
+
+    fn stipend(&self) -> u32 {
+        self.frame.stipend
+    }
+
+    fn context_u128(&self) -> u128 {
+        self.frame.context_u128
+    }
+
+    fn set_context_u128(&mut self, value: u128) {
+        self.frame.context_u128 = value;
+    }
+
+    fn read_stack(&self, index: u16) -> (U256, bool) {
+        (
+            self.frame.stack.get(index),
+            self.frame.stack.get_pointer_flag(index),
+        )
+    }
+
+    fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool) {
+        self.frame.stack.set(index, value);
+        if is_pointer {
+            self.frame.stack.set_pointer_flag(index);
+        } else {
+            self.frame.stack.clear_pointer_flag(index);
+        }
+    }
+
+    fn heap(&self) -> HeapId {
+        self.frame.heap
+    }
+
+    fn heap_bound(&self) -> u32 {
+        self.frame.heap_size
+    }
+
+    fn set_heap_bound(&mut self, value: u32) {
+        self.frame.heap_size = value;
+    }
+
+    fn aux_heap(&self) -> HeapId {
+        self.frame.aux_heap
+    }
+
+    fn aux_heap_bound(&self) -> u32 {
+        self.frame.aux_heap_size
+    }
+
+    fn set_aux_heap_bound(&mut self, value: u32) {
+        self.frame.aux_heap_size = value;
+    }
+
+    fn read_contract_code(&self, slot: u16) -> U256 {
+        self.frame.program.code_page()[slot as usize]
+    }
+
+    // The following methods are affected by near calls
+
+    fn is_near_call(&self) -> bool {
+        self.near_call.is_some()
+    }
+
+    fn gas(&self) -> u32 {
+        if let Some(call) = self.near_call_on_top() {
+            call.previous_frame_gas
+        } else {
+            self.frame.gas
+        }
+    }
+
+    fn set_gas(&mut self, new_gas: u32) {
+        if let Some(call) = self.near_call_on_top_mut() {
+            call.previous_frame_gas = new_gas;
+        } else {
+            self.frame.gas = new_gas;
+        }
+    }
+
+    fn stack_pointer(&self) -> u16 {
+        if let Some(call) = self.near_call_on_top() {
+            call.previous_frame_sp
+        } else {
+            self.frame.sp
+        }
+    }
+
+    fn set_stack_pointer(&mut self, value: u16) {
+        if let Some(call) = self.near_call_on_top_mut() {
+            call.previous_frame_sp = value;
+        } else {
+            self.frame.sp = value;
+        }
+    }
+
+    // we don't expect the VM to run on 16-bit machines, and sign loss / wrap is checked
+    #[allow(
+        clippy::cast_sign_loss,
+        clippy::cast_possible_truncation,
+        clippy::cast_possible_wrap
+    )]
+    fn program_counter(&self) -> Option<u16> {
+        if let Some(call) = self.near_call_on_top() {
+            Some(call.previous_frame_pc)
+        } else {
+            let offset = self.frame.get_raw_pc();
+            if offset < 0
+                || offset > u16::MAX as isize
+                || self.frame.program.instruction(offset as u16).is_none()
+            {
+                None
+            } else {
+                Some(offset as u16)
+            }
+        }
+    }
+
+    fn set_program_counter(&mut self, value: u16) {
+        if let Some(call) = self.near_call_on_top_mut() {
+            call.previous_frame_pc = value;
+        } else {
+            self.frame.set_pc_from_u16(value);
+        }
+    }
+
+    fn exception_handler(&self) -> u16 {
+        if let Some(i) = self.near_call {
+            self.frame.near_calls[i].exception_handler
+        } else {
+            self.frame.exception_handler
+        }
+    }
+
+    fn set_exception_handler(&mut self, value: u16) {
+        if let Some(i) = self.near_call {
+            self.frame.near_calls[i].exception_handler = value;
+        } else {
+            self.frame.exception_handler = value;
+        }
+    }
+}
+
+impl<T, W> CallframeWrapper<'_, T, W> {
+    fn near_call_on_top(&self) -> Option<&NearCallFrame> {
+        let index = self.near_call.map_or(0, |i| i + 1);
+        self.frame.near_calls.get(index)
+    }
+
+    fn near_call_on_top_mut(&mut self) -> Option<&mut NearCallFrame> {
+        let index = self.near_call.map_or(0, |i| i + 1);
+        self.frame.near_calls.get_mut(index)
+    }
+}
+
+#[cfg(all(test, not(feature = "single_instruction_test")))]
+mod test {
+    use primitive_types::H160;
+    use zkevm_opcode_defs::ethereum_types::Address;
+    use zksync_vm2_interface::opcodes;
+
+    use super::*;
+    use crate::{
+        testonly::{initial_decommit, TestWorld},
+        Instruction, Program, VirtualMachine,
+    };
+
+    #[test]
+    fn callframe_picking() {
+        let program = Program::from_raw(vec![Instruction::from_invalid()], vec![]);
+
+        let address = Address::from_low_u64_be(0x_1234_5678_90ab_cdef);
+        let mut world = TestWorld::new(&[(address, program)]);
+        let program = initial_decommit(&mut world, address);
+
+        let mut vm = VirtualMachine::new(
+            address,
+            program.clone(),
+            Address::zero(),
+            &[],
+            1000,
+            crate::Settings {
+                default_aa_code_hash: [0; 32],
+                evm_interpreter_code_hash: [0; 32],
+                hook_address: 0,
+            },
+        );
+
+        vm.state.current_frame.gas = 0;
+        vm.state.current_frame.exception_handler = 0;
+        let mut frame_count = 1;
+
+        let add_far_frame = |vm: &mut VirtualMachine<(), TestWorld<()>>, counter: &mut u16| {
+            vm.push_frame::<opcodes::Normal>(
+                H160::from_low_u64_be(1),
+                program.clone(),
+                (*counter).into(),
+                0,
+                *counter,
+                false,
+                HeapId::from_u32_unchecked(5),
+                vm.world_diff.snapshot(),
+            );
+            assert_eq!(vm.current_frame().gas(), (*counter).into());
+            *counter += 1;
+        };
+
+        let add_near_frame = |vm: &mut VirtualMachine<(), TestWorld<()>>, counter: &mut u16| {
+            let count_u32 = (*counter).into();
+            vm.state.current_frame.gas += count_u32;
+            vm.state
+                .current_frame
+                .push_near_call(count_u32, *counter, vm.world_diff.snapshot());
+            assert_eq!(vm.current_frame().gas(), (*counter).into());
+            *counter += 1;
+        };
+
+        add_far_frame(&mut vm, &mut frame_count);
+        add_near_frame(&mut vm, &mut frame_count);
+        add_far_frame(&mut vm, &mut frame_count);
+        add_far_frame(&mut vm, &mut frame_count);
+        add_near_frame(&mut vm, &mut frame_count);
+        add_near_frame(&mut vm, &mut frame_count);
+
+        for (fwd, rev) in (0..frame_count.into()).zip((0..frame_count).rev()) {
+            assert_eq!(vm.callframe(fwd).exception_handler(), rev);
+            assert_eq!(vm.callframe(fwd).gas(), rev.into());
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/vm.rs.html b/src/zksync_vm2/vm.rs.html new file mode 100644 index 0000000..4435e6f --- /dev/null +++ b/src/zksync_vm2/vm.rs.html @@ -0,0 +1,591 @@ +vm.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+
use std::fmt;
+
+use primitive_types::H160;
+use zksync_vm2_interface::{opcodes::TypeLevelCallingMode, CallingMode, HeapId, Tracer};
+
+use crate::{
+    callframe::{Callframe, FrameRemnant},
+    decommit::u256_into_address,
+    instruction::ExecutionStatus,
+    stack::StackPool,
+    state::{State, StateSnapshot},
+    world_diff::{ExternalSnapshot, Snapshot, WorldDiff},
+    ExecutionEnd, Program, World,
+};
+
+/// [`VirtualMachine`] settings.
+#[derive(Debug, Clone)]
+pub struct Settings {
+    /// Bytecode hash of the default account abstraction contract.
+    pub default_aa_code_hash: [u8; 32],
+    /// Bytecode hash of the EVM interpreter.
+    pub evm_interpreter_code_hash: [u8; 32],
+    /// Writing to this address in the bootloader's heap suspends execution
+    pub hook_address: u32,
+}
+
+/// High-performance out-of-circuit EraVM implementation.
+#[derive(Debug)]
+pub struct VirtualMachine<T, W> {
+    pub(crate) world_diff: WorldDiff,
+    pub(crate) state: State<T, W>,
+    pub(crate) settings: Settings,
+    pub(crate) stack_pool: StackPool,
+    pub(crate) snapshot: Option<VmSnapshot>,
+}
+
+impl<T: Tracer, W: World<T>> VirtualMachine<T, W> {
+    /// Creates a new VM instance.
+    pub fn new(
+        address: H160,
+        program: Program<T, W>,
+        caller: H160,
+        calldata: &[u8],
+        gas: u32,
+        settings: Settings,
+    ) -> Self {
+        let world_diff = WorldDiff::default();
+        let world_before_this_frame = world_diff.snapshot();
+        let mut stack_pool = StackPool::default();
+
+        Self {
+            world_diff,
+            state: State::new(
+                address,
+                caller,
+                calldata,
+                gas,
+                program,
+                world_before_this_frame,
+                stack_pool.get(),
+            ),
+            settings,
+            stack_pool,
+            snapshot: None,
+        }
+    }
+
+    /// Provides a reference to the [`World`] diff accumulated by VM execution so far.
+    pub fn world_diff(&self) -> &WorldDiff {
+        &self.world_diff
+    }
+
+    /// Provides a mutable reference to the [`World`] diff accumulated by VM execution so far.
+    ///
+    /// It is unsound to mutate [`WorldDiff`] in the middle of VM execution in the general case; thus, this method should only be used in tests.
+    #[doc(hidden)]
+    pub fn world_diff_mut(&mut self) -> &mut WorldDiff {
+        &mut self.world_diff
+    }
+
+    /// Runs this VM with the specified [`World`] and [`Tracer`] until an end of execution due to a hook, or an error.
+    pub fn run(&mut self, world: &mut W, tracer: &mut T) -> ExecutionEnd {
+        unsafe {
+            loop {
+                if let ExecutionStatus::Stopped(end) =
+                    ((*self.state.current_frame.pc).handler)(self, world, tracer)
+                {
+                    return end;
+                }
+            }
+        }
+    }
+
+    /// Returns how much of the extra gas limit is left and the stop reason,
+    /// unless the extra gas limit was exceeded.
+    ///
+    /// Needed to support account validation gas limit.
+    /// We cannot simply reduce the available gas, as contracts might behave differently
+    /// depending on remaining gas.
+    pub fn resume_with_additional_gas_limit(
+        &mut self,
+        world: &mut W,
+        tracer: &mut T,
+        gas_limit: u32,
+    ) -> Option<(u32, ExecutionEnd)> {
+        let minimum_gas = self.state.total_unspent_gas().saturating_sub(gas_limit);
+
+        let end = unsafe {
+            loop {
+                if let ExecutionStatus::Stopped(end) =
+                    ((*self.state.current_frame.pc).handler)(self, world, tracer)
+                {
+                    break end;
+                }
+
+                if self.state.total_unspent_gas() < minimum_gas {
+                    return None;
+                }
+            }
+        };
+
+        self.state
+            .total_unspent_gas()
+            .checked_sub(minimum_gas)
+            .map(|left| (left, end))
+    }
+
+    /// Creates a VM snapshot. The snapshot can then be rolled back to, or discarded.
+    ///
+    /// # Panics
+    ///
+    /// - Panics if called outside the initial (bootloader) callframe.
+    /// - Panics if this VM already has a snapshot.
+    pub fn make_snapshot(&mut self) {
+        assert!(self.snapshot.is_none(), "VM already has a snapshot");
+        assert!(
+            self.state.previous_frames.is_empty(),
+            "Snapshotting is only allowed in the bootloader"
+        );
+
+        self.snapshot = Some(VmSnapshot {
+            world_snapshot: self.world_diff.external_snapshot(),
+            state_snapshot: self.state.snapshot(),
+        });
+    }
+
+    /// Returns the VM to the state it was in when [`Self::make_snapshot()`] was called.
+    ///
+    /// # Panics
+    ///
+    /// - Panics if this VM doesn't hold a snapshot.
+    /// - Panics if called outside the initial (bootloader) callframe.
+    pub fn rollback(&mut self) {
+        assert!(
+            self.state.previous_frames.is_empty(),
+            "Rolling back is only allowed in the bootloader"
+        );
+
+        let snapshot = self
+            .snapshot
+            .take()
+            .expect("`rollback()` called without a snapshot");
+        self.world_diff.external_rollback(snapshot.world_snapshot);
+        self.state.rollback(snapshot.state_snapshot);
+        self.delete_history();
+    }
+
+    /// Pops a [previously made](Self::make_snapshot()) snapshot without rolling back to it. This effectively commits
+    /// all changes made up to this point, so that they cannot be rolled back.
+    ///
+    /// # Panics
+    ///
+    /// - Panics if called outside the initial (bootloader) callframe.
+    pub fn pop_snapshot(&mut self) {
+        assert!(
+            self.state.previous_frames.is_empty(),
+            "Popping a snapshot is only allowed in the bootloader"
+        );
+        self.snapshot = None;
+        self.delete_history();
+    }
+
+    /// This must only be called when it is known that the VM cannot be rolled back,
+    /// so there must not be any external snapshots and the callstack
+    /// should ideally be empty, though in practice it sometimes contains
+    /// a near call inside the bootloader.
+    fn delete_history(&mut self) {
+        self.world_diff.delete_history();
+        self.state.delete_history();
+    }
+}
+
+impl<T: Tracer, W> VirtualMachine<T, W> {
+    #[allow(clippy::too_many_arguments)]
+    pub(crate) fn push_frame<M: TypeLevelCallingMode>(
+        &mut self,
+        code_address: H160,
+        program: Program<T, W>,
+        gas: u32,
+        stipend: u32,
+        exception_handler: u16,
+        is_static: bool,
+        calldata_heap: HeapId,
+        world_before_this_frame: Snapshot,
+    ) {
+        let mut new_frame = Callframe::new(
+            if M::VALUE == CallingMode::Delegate {
+                self.state.current_frame.address
+            } else {
+                code_address
+            },
+            code_address,
+            match M::VALUE {
+                CallingMode::Normal => self.state.current_frame.address,
+                CallingMode::Delegate => self.state.current_frame.caller,
+                CallingMode::Mimic => u256_into_address(self.state.registers[15]),
+            },
+            program,
+            self.stack_pool.get(),
+            self.state.heaps.allocate(),
+            self.state.heaps.allocate(),
+            calldata_heap,
+            gas,
+            stipend,
+            exception_handler,
+            if M::VALUE == CallingMode::Delegate {
+                self.state.current_frame.context_u128
+            } else {
+                self.state.context_u128
+            },
+            is_static,
+            world_before_this_frame,
+        );
+        self.state.context_u128 = 0;
+
+        std::mem::swap(&mut new_frame, &mut self.state.current_frame);
+        self.state.previous_frames.push(new_frame);
+    }
+
+    pub(crate) fn pop_frame(&mut self, heap_to_keep: Option<HeapId>) -> Option<FrameRemnant> {
+        self.state.previous_frames.pop().map(|mut frame| {
+            for &heap in [
+                self.state.current_frame.heap,
+                self.state.current_frame.aux_heap,
+            ]
+            .iter()
+            .chain(&self.state.current_frame.heaps_i_am_keeping_alive)
+            {
+                if Some(heap) != heap_to_keep {
+                    self.state.heaps.deallocate(heap);
+                }
+            }
+
+            std::mem::swap(&mut self.state.current_frame, &mut frame);
+            let Callframe {
+                exception_handler,
+                world_before_this_frame,
+                stack,
+                ..
+            } = frame;
+
+            self.stack_pool.recycle(stack);
+
+            self.state
+                .current_frame
+                .heaps_i_am_keeping_alive
+                .extend(heap_to_keep);
+
+            FrameRemnant {
+                exception_handler,
+                snapshot: world_before_this_frame,
+            }
+        })
+    }
+
+    pub(crate) fn start_new_tx(&mut self) {
+        self.state.transaction_number = self.state.transaction_number.wrapping_add(1);
+        self.world_diff.clear_transient_storage();
+    }
+}
+
+impl<T: fmt::Debug, W: fmt::Debug> VirtualMachine<T, W> {
+    /// Dumps an opaque representation of the current VM state.
+    #[doc(hidden)] // should only be used in tests
+    pub fn dump_state(&self) -> impl PartialEq + fmt::Debug {
+        self.state.clone()
+    }
+}
+
+/// Snapshot of a [`VirtualMachine`].
+#[derive(Debug)]
+pub(crate) struct VmSnapshot {
+    world_snapshot: ExternalSnapshot,
+    state_snapshot: StateSnapshot,
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2/world_diff.rs.html b/src/zksync_vm2/world_diff.rs.html new file mode 100644 index 0000000..51aee3a --- /dev/null +++ b/src/zksync_vm2/world_diff.rs.html @@ -0,0 +1,957 @@ +world_diff.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+
use std::collections::BTreeMap;
+
+use primitive_types::{H160, U256};
+use zkevm_opcode_defs::system_params::{
+    STORAGE_ACCESS_COLD_READ_COST, STORAGE_ACCESS_COLD_WRITE_COST, STORAGE_ACCESS_WARM_READ_COST,
+    STORAGE_ACCESS_WARM_WRITE_COST,
+};
+use zksync_vm2_interface::{CycleStats, Event, L2ToL1Log, Tracer};
+
+use crate::{
+    rollback::{Rollback, RollbackableLog, RollbackableMap, RollbackablePod, RollbackableSet},
+    StorageInterface,
+};
+
+/// Pending modifications to the global state that are executed at the end of a block.
+/// In other words, side effects.
+#[derive(Debug, Default)]
+pub struct WorldDiff {
+    // These are rolled back on revert or panic (and when the whole VM is rolled back).
+    storage_changes: RollbackableMap<(H160, U256), U256>,
+    paid_changes: RollbackableMap<(H160, U256), u32>,
+    transient_storage_changes: RollbackableMap<(H160, U256), U256>,
+    events: RollbackableLog<Event>,
+    l2_to_l1_logs: RollbackableLog<L2ToL1Log>,
+    pub(crate) pubdata: RollbackablePod<i32>,
+    storage_refunds: RollbackableLog<u32>,
+    pubdata_costs: RollbackableLog<i32>,
+
+    // The fields below are only rolled back when the whole VM is rolled back.
+    /// Values indicate whether a bytecode was successfully decommitted. When accessing decommitted hashes
+    /// for the execution state, we need to track both successful and failed decommitments; OTOH, only successful ones
+    /// matter when computing decommitment cost.
+    pub(crate) decommitted_hashes: RollbackableMap<U256, bool>,
+    read_storage_slots: RollbackableSet<(H160, U256)>,
+    written_storage_slots: RollbackableSet<(H160, U256)>,
+
+    // This is never rolled back. It is just a cache to avoid asking these from DB every time.
+    storage_initial_values: BTreeMap<(H160, U256), Option<U256>>,
+}
+
+#[derive(Debug)]
+pub(crate) struct ExternalSnapshot {
+    internal_snapshot: Snapshot,
+    pub(crate) decommitted_hashes: <RollbackableMap<U256, ()> as Rollback>::Snapshot,
+    read_storage_slots: <RollbackableMap<(H160, U256), ()> as Rollback>::Snapshot,
+    written_storage_slots: <RollbackableMap<(H160, U256), ()> as Rollback>::Snapshot,
+    storage_refunds: <RollbackableLog<u32> as Rollback>::Snapshot,
+    pubdata_costs: <RollbackableLog<i32> as Rollback>::Snapshot,
+}
+
+impl WorldDiff {
+    /// Returns the storage slot's value and a refund based on its hot/cold status.
+    pub(crate) fn read_storage(
+        &mut self,
+        world: &mut impl StorageInterface,
+        tracer: &mut impl Tracer,
+        contract: H160,
+        key: U256,
+    ) -> (U256, u32) {
+        let (value, refund) = self.read_storage_inner(world, tracer, contract, key);
+        self.storage_refunds.push(refund);
+        (value, refund)
+    }
+
+    /// Same as [`Self::read_storage()`], but without recording the refund value (which is important
+    /// because the storage is read not only from the `sload` op handler, but also from the `farcall` op handler;
+    /// the latter must not record a refund as per previous VM versions).
+    pub(crate) fn read_storage_without_refund(
+        &mut self,
+        world: &mut impl StorageInterface,
+        tracer: &mut impl Tracer,
+        contract: H160,
+        key: U256,
+    ) -> U256 {
+        self.read_storage_inner(world, tracer, contract, key).0
+    }
+
+    fn read_storage_inner(
+        &mut self,
+        world: &mut impl StorageInterface,
+        tracer: &mut impl Tracer,
+        contract: H160,
+        key: U256,
+    ) -> (U256, u32) {
+        let value = self
+            .storage_changes
+            .as_ref()
+            .get(&(contract, key))
+            .copied()
+            .unwrap_or_else(|| world.read_storage(contract, key).unwrap_or_default());
+
+        let newly_added = self.read_storage_slots.add((contract, key));
+        if newly_added {
+            tracer.on_extra_prover_cycles(CycleStats::StorageRead);
+        }
+
+        let refund = if !newly_added || world.is_free_storage_slot(&contract, &key) {
+            WARM_READ_REFUND
+        } else {
+            0
+        };
+        self.pubdata_costs.push(0);
+        (value, refund)
+    }
+
+    /// Returns the refund based the hot/cold status of the storage slot and the change in pubdata.
+    pub(crate) fn write_storage(
+        &mut self,
+        world: &mut impl StorageInterface,
+        tracer: &mut impl Tracer,
+        contract: H160,
+        key: U256,
+        value: U256,
+    ) -> u32 {
+        self.storage_changes.insert((contract, key), value);
+
+        let initial_value = self
+            .storage_initial_values
+            .entry((contract, key))
+            .or_insert_with(|| world.read_storage(contract, key));
+
+        if world.is_free_storage_slot(&contract, &key) {
+            if self.written_storage_slots.add((contract, key)) {
+                tracer.on_extra_prover_cycles(CycleStats::StorageWrite);
+            }
+            self.read_storage_slots.add((contract, key));
+
+            self.storage_refunds.push(WARM_WRITE_REFUND);
+            self.pubdata_costs.push(0);
+            return WARM_WRITE_REFUND;
+        }
+
+        let update_cost = world.cost_of_writing_storage(*initial_value, value);
+        let prepaid = self
+            .paid_changes
+            .insert((contract, key), update_cost)
+            .unwrap_or(0);
+
+        let refund = if self.written_storage_slots.add((contract, key)) {
+            tracer.on_extra_prover_cycles(CycleStats::StorageWrite);
+
+            if self.read_storage_slots.add((contract, key)) {
+                0
+            } else {
+                COLD_WRITE_AFTER_WARM_READ_REFUND
+            }
+        } else {
+            WARM_WRITE_REFUND
+        };
+
+        #[allow(clippy::cast_possible_wrap)]
+        {
+            let pubdata_cost = (update_cost as i32) - (prepaid as i32);
+            self.pubdata.0 += pubdata_cost;
+            self.storage_refunds.push(refund);
+            self.pubdata_costs.push(pubdata_cost);
+        }
+        refund
+    }
+
+    pub(crate) fn pubdata(&self) -> i32 {
+        self.pubdata.0
+    }
+
+    /// Returns recorded refunds for all storage operations.
+    pub fn storage_refunds(&self) -> &[u32] {
+        self.storage_refunds.as_ref()
+    }
+
+    /// Returns recorded pubdata costs for all storage operations.
+    pub fn pubdata_costs(&self) -> &[i32] {
+        self.pubdata_costs.as_ref()
+    }
+
+    #[doc(hidden)] // duplicates `StateInterface::get_storage_state()`, but we use random access in some places
+    pub fn get_storage_state(&self) -> &BTreeMap<(H160, U256), U256> {
+        self.storage_changes.as_ref()
+    }
+
+    /// Gets changes for all touched storage slots.
+    pub fn get_storage_changes(
+        &self,
+    ) -> impl Iterator<Item = ((H160, U256), (Option<U256>, U256))> + '_ {
+        self.storage_changes
+            .as_ref()
+            .iter()
+            .filter_map(|(key, &value)| {
+                if self.storage_initial_values[key].unwrap_or_default() == value {
+                    None
+                } else {
+                    Some((*key, (self.storage_initial_values[key], value)))
+                }
+            })
+    }
+
+    /// Gets changes for storage slots touched after the specified `snapshot` was created.
+    pub fn get_storage_changes_after(
+        &self,
+        snapshot: &Snapshot,
+    ) -> impl Iterator<Item = ((H160, U256), StorageChange)> + '_ {
+        self.storage_changes
+            .changes_after(snapshot.storage_changes)
+            .into_iter()
+            .map(|(key, (before, after))| {
+                let initial = self.storage_initial_values[&key];
+                (
+                    key,
+                    StorageChange {
+                        before: before.or(initial),
+                        after,
+                        is_initial: initial.is_none(),
+                    },
+                )
+            })
+    }
+
+    pub(crate) fn read_transient_storage(&mut self, contract: H160, key: U256) -> U256 {
+        self.pubdata_costs.push(0);
+        self.transient_storage_changes
+            .as_ref()
+            .get(&(contract, key))
+            .copied()
+            .unwrap_or_default()
+    }
+
+    pub(crate) fn write_transient_storage(&mut self, contract: H160, key: U256, value: U256) {
+        self.pubdata_costs.push(0);
+        self.transient_storage_changes
+            .insert((contract, key), value);
+    }
+
+    pub(crate) fn get_transient_storage_state(&self) -> &BTreeMap<(H160, U256), U256> {
+        self.transient_storage_changes.as_ref()
+    }
+
+    pub(crate) fn record_event(&mut self, event: Event) {
+        self.events.push(event);
+    }
+
+    pub(crate) fn events(&self) -> &[Event] {
+        self.events.as_ref()
+    }
+
+    /// Returns events emitted after the specified `snapshot` was created.
+    pub fn events_after(&self, snapshot: &Snapshot) -> &[Event] {
+        self.events.logs_after(snapshot.events)
+    }
+
+    pub(crate) fn record_l2_to_l1_log(&mut self, log: L2ToL1Log) {
+        self.l2_to_l1_logs.push(log);
+    }
+
+    pub(crate) fn l2_to_l1_logs(&self) -> &[L2ToL1Log] {
+        self.l2_to_l1_logs.as_ref()
+    }
+
+    /// Returns L2-to-L1 logs emitted after the specified `snapshot` was created.
+    pub fn l2_to_l1_logs_after(&self, snapshot: &Snapshot) -> &[L2ToL1Log] {
+        self.l2_to_l1_logs.logs_after(snapshot.l2_to_l1_logs)
+    }
+
+    /// Returns hashes of decommitted contract bytecodes in no particular order. Note that this includes
+    /// failed (out-of-gas) decommitments.
+    pub fn decommitted_hashes(&self) -> impl Iterator<Item = U256> + '_ {
+        self.decommitted_hashes.as_ref().keys().copied()
+    }
+
+    /// Get a snapshot for selecting which logs & co. to output using [`Self::events_after()`] and other methods.
+    pub fn snapshot(&self) -> Snapshot {
+        Snapshot {
+            storage_changes: self.storage_changes.snapshot(),
+            paid_changes: self.paid_changes.snapshot(),
+            events: self.events.snapshot(),
+            l2_to_l1_logs: self.l2_to_l1_logs.snapshot(),
+            transient_storage_changes: self.transient_storage_changes.snapshot(),
+            pubdata: self.pubdata.snapshot(),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)] // intentional: we require a snapshot to be rolled back to no more than once
+    pub(crate) fn rollback(&mut self, snapshot: Snapshot) {
+        self.storage_changes.rollback(snapshot.storage_changes);
+        self.paid_changes.rollback(snapshot.paid_changes);
+        self.events.rollback(snapshot.events);
+        self.l2_to_l1_logs.rollback(snapshot.l2_to_l1_logs);
+        self.transient_storage_changes
+            .rollback(snapshot.transient_storage_changes);
+        self.pubdata.rollback(snapshot.pubdata);
+    }
+
+    /// This function must only be called during the initial frame
+    /// because otherwise internal rollbacks can roll back past the external snapshot.
+    pub(crate) fn external_snapshot(&self) -> ExternalSnapshot {
+        // Rolling back to this snapshot will clear transient storage even though it is not empty
+        // after a transaction. This is ok because the next instruction in the bootloader
+        // (IncrementTxNumber) clears the transient storage anyway.
+        // This is necessary because clear_transient_storage cannot be undone.
+        ExternalSnapshot {
+            internal_snapshot: Snapshot {
+                transient_storage_changes: 0,
+                ..self.snapshot()
+            },
+            decommitted_hashes: self.decommitted_hashes.snapshot(),
+            read_storage_slots: self.read_storage_slots.snapshot(),
+            written_storage_slots: self.written_storage_slots.snapshot(),
+            storage_refunds: self.storage_refunds.snapshot(),
+            pubdata_costs: self.pubdata_costs.snapshot(),
+        }
+    }
+
+    pub(crate) fn external_rollback(&mut self, snapshot: ExternalSnapshot) {
+        self.rollback(snapshot.internal_snapshot);
+        self.storage_refunds.rollback(snapshot.storage_refunds);
+        self.pubdata_costs.rollback(snapshot.pubdata_costs);
+        self.decommitted_hashes
+            .rollback(snapshot.decommitted_hashes);
+        self.read_storage_slots
+            .rollback(snapshot.read_storage_slots);
+        self.written_storage_slots
+            .rollback(snapshot.written_storage_slots);
+    }
+
+    pub(crate) fn delete_history(&mut self) {
+        self.storage_changes.delete_history();
+        self.paid_changes.delete_history();
+        self.transient_storage_changes.delete_history();
+        self.events.delete_history();
+        self.l2_to_l1_logs.delete_history();
+        self.pubdata.delete_history();
+        self.storage_refunds.delete_history();
+        self.pubdata_costs.delete_history();
+        self.decommitted_hashes.delete_history();
+        self.read_storage_slots.delete_history();
+        self.written_storage_slots.delete_history();
+    }
+
+    pub(crate) fn clear_transient_storage(&mut self) {
+        self.transient_storage_changes = RollbackableMap::default();
+    }
+}
+
+/// Opaque snapshot of a [`WorldDiff`] output by its [eponymous method](WorldDiff::snapshot()).
+/// Can be provided to [`WorldDiff::events_after()`] etc. to get data after the snapshot was created.
+#[derive(Clone, PartialEq, Debug)]
+pub struct Snapshot {
+    storage_changes: <RollbackableMap<(H160, U256), U256> as Rollback>::Snapshot,
+    paid_changes: <RollbackableMap<(H160, U256), u32> as Rollback>::Snapshot,
+    events: <RollbackableLog<Event> as Rollback>::Snapshot,
+    l2_to_l1_logs: <RollbackableLog<L2ToL1Log> as Rollback>::Snapshot,
+    transient_storage_changes: <RollbackableMap<(H160, U256), U256> as Rollback>::Snapshot,
+    pubdata: <RollbackablePod<i32> as Rollback>::Snapshot,
+}
+
+/// Change in a single storage slot.
+#[derive(Debug, PartialEq)]
+pub struct StorageChange {
+    /// Value before the slot was written to. `None` if the slot was not written to previously.
+    pub before: Option<U256>,
+    /// Value written to the slot.
+    pub after: U256,
+    /// `true` if the slot is not set in the [`World`](crate::World).
+    /// A write may be initial even if it isn't the first write to a slot!
+    pub is_initial: bool,
+}
+
+const WARM_READ_REFUND: u32 = STORAGE_ACCESS_COLD_READ_COST - STORAGE_ACCESS_WARM_READ_COST;
+const WARM_WRITE_REFUND: u32 = STORAGE_ACCESS_COLD_WRITE_COST - STORAGE_ACCESS_WARM_WRITE_COST;
+const COLD_WRITE_AFTER_WARM_READ_REFUND: u32 = STORAGE_ACCESS_COLD_READ_COST;
+
+#[cfg(test)]
+mod tests {
+    use proptest::prelude::*;
+
+    use super::*;
+
+    proptest! {
+        #[test]
+        fn test_storage_changes(
+            initial_values in arbitrary_storage_changes(),
+            first_changes in arbitrary_storage_changes(),
+            second_changes in arbitrary_storage_changes(),
+        ) {
+            let storage_initial_values = initial_values
+                .iter()
+                .map(|(key, value)| (*key, Some(*value)))
+                .collect();
+            let mut world_diff = WorldDiff {
+                storage_initial_values,
+                ..WorldDiff::default()
+            };
+
+            let checkpoint1 = world_diff.snapshot();
+            for (key, value) in &first_changes {
+                world_diff.write_storage(&mut NoWorld, &mut (), key.0, key.1, *value);
+            }
+            assert_eq!(
+                world_diff
+                    .get_storage_changes_after(&checkpoint1)
+                    .collect::<BTreeMap<_, _>>(),
+                first_changes
+                    .iter()
+                    .map(|(key, value)| (
+                        *key,
+                        StorageChange {
+                            before: initial_values.get(key).copied(),
+                            after: *value,
+                            is_initial: !initial_values.contains_key(key),
+                        }
+                    ))
+                    .collect()
+            );
+
+            let checkpoint2 = world_diff.snapshot();
+            for (key, value) in &second_changes {
+                world_diff.write_storage(&mut NoWorld, &mut (), key.0, key.1, *value);
+            }
+            assert_eq!(
+                world_diff
+                    .get_storage_changes_after(&checkpoint2)
+                    .collect::<BTreeMap<_, _>>(),
+                second_changes
+                    .iter()
+                    .map(|(key, value)| (
+                        *key,
+                        StorageChange {
+                            before: first_changes.get(key).or(initial_values.get(key)).copied(),
+                            after: *value,
+                            is_initial: !initial_values.contains_key(key),
+                        }
+                    ))
+                    .collect()
+            );
+
+            let mut combined = first_changes
+                .into_iter()
+                .filter_map(|(key, value)| {
+                    let initial = initial_values.get(&key).copied();
+                    (initial.unwrap_or_default() != value).then_some((key, (initial, value)))
+                })
+                .collect::<BTreeMap<_, _>>();
+            for (key, value) in second_changes {
+                let initial = initial_values.get(&key).copied();
+                if initial.unwrap_or_default() == value {
+                    combined.remove(&key);
+                } else {
+                    combined.insert(key, (initial, value));
+                }
+            }
+
+            assert_eq!(combined, world_diff.get_storage_changes().collect());
+        }
+    }
+
+    fn arbitrary_storage_changes() -> impl Strategy<Value = BTreeMap<(H160, U256), U256>> {
+        any::<Vec<(([u8; 20], [u8; 32]), [u8; 32])>>().prop_map(|vec| {
+            vec.into_iter()
+                .map(|((contract, key), value)| {
+                    ((H160::from(contract), U256::from(key)), U256::from(value))
+                })
+                .collect()
+        })
+    }
+
+    struct NoWorld;
+    impl StorageInterface for NoWorld {
+        fn read_storage(&mut self, _: H160, _: U256) -> Option<U256> {
+            None
+        }
+
+        fn cost_of_writing_storage(&mut self, _: Option<U256>, _: U256) -> u32 {
+            0
+        }
+
+        fn is_free_storage_slot(&self, _: &H160, _: &U256) -> bool {
+            false
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2_interface/lib.rs.html b/src/zksync_vm2_interface/lib.rs.html new file mode 100644 index 0000000..a1d3de8 --- /dev/null +++ b/src/zksync_vm2_interface/lib.rs.html @@ -0,0 +1,183 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+
//! # EraVM Stable Interface
+//!
+//! This crate defines an interface for tracers that will never change but may be extended.
+//! To be precise, a tracer using this interface will work in any VM written against that
+//! version or a newer one. Updating the tracer to depend on a newer interface version is
+//! not necessary. In fact, tracers should depend on the oldest version that has the required
+//! features.
+//!
+//! A struct implementing [`Tracer`] may read and mutate the VM's state via [`StateInterface`]
+//! when particular opcodes are executed.
+//!
+//! ## Why is extreme backwards compatibility required here?
+//!
+//! Suppose VM1 uses stable interface version 1 and VM2 uses stable interface version 2.
+//! With any sane design it would be trivial to take a tracer written for version 1 and
+//! update it to work with version 2. However, then it can no longer be used with VM1.
+//!
+//! This exact thing caused us a lot of trouble when we put many versions of `zk_evm` in `multivm`.
+//!
+//! ## How do I add a new feature to the interface?
+//!
+//! Do not change the existing traits. In fact, you should delete existing code in the new
+//! version that you publish and import it from the previous version instead.
+//!
+//! This is how you would add a new method to [`StateInterface`] and a new opcode.
+//!
+//! ```
+//! # use zksync_vm2_interface as zksync_vm2_interface_v1;
+//! use zksync_vm2_interface_v1::{
+//!     StateInterface as StateInterfaceV1, Tracer as TracerV1, opcodes::NearCall,
+//! };
+//!
+//! trait StateInterface: StateInterfaceV1 {
+//!     fn get_some_new_field(&self) -> u32;
+//! }
+//!
+//! pub struct NewOpcode;
+//!
+//! #[derive(PartialEq, Eq)]
+//! enum Opcode {
+//!     NewOpcode,
+//!     NearCall,
+//!     // ...
+//! }
+//!
+//! trait OpcodeType {
+//!     const VALUE: Opcode;
+//! }
+//!
+//! impl OpcodeType for NewOpcode {
+//!     const VALUE: Opcode = Opcode::NewOpcode;
+//! }
+//!
+//! // Do this for every old opcode
+//! impl OpcodeType for NearCall {
+//!     const VALUE: Opcode = Opcode::NearCall;
+//! }
+//!
+//! trait Tracer {
+//!     fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+//!     fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+//! }
+//!
+//! impl<T: TracerV1> Tracer for T {
+//!     fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+//!         match OP::VALUE {
+//!             Opcode::NewOpcode => {}
+//!             // Do this for every old opcode
+//!             Opcode::NearCall => {
+//!                 <Self as TracerV1>::before_instruction::<NearCall, _>(self, state)
+//!             }
+//!         }
+//!     }
+//!     fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+//! }
+//!
+//! // Now you can use the new features by implementing TracerV2
+//! struct MyTracer;
+//! impl Tracer for MyTracer {
+//!     fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+//!         if OP::VALUE == Opcode::NewOpcode {
+//!             state.get_some_new_field();
+//!         }
+//!     }
+//! }
+//! ```
+
+pub use self::{state_interface::*, tracer_interface::*};
+
+mod state_interface;
+mod tracer_interface;
+
\ No newline at end of file diff --git a/src/zksync_vm2_interface/state_interface.rs.html b/src/zksync_vm2_interface/state_interface.rs.html new file mode 100644 index 0000000..70c4228 --- /dev/null +++ b/src/zksync_vm2_interface/state_interface.rs.html @@ -0,0 +1,847 @@ +state_interface.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+
use primitive_types::{H160, U256};
+
+/// Public interface of the VM state. Encompasses both read and write methods.
+pub trait StateInterface {
+    /// Reads a register with the specified zero-based index. Returns a value together with a pointer flag.
+    fn read_register(&self, register: u8) -> (U256, bool);
+    /// Sets a register with the specified zero-based index
+    fn set_register(&mut self, register: u8, value: U256, is_pointer: bool);
+
+    /// Returns a mutable handle to the current call frame.
+    fn current_frame(&mut self) -> impl CallframeInterface + '_;
+    /// Returns the total number of call frames.
+    fn number_of_callframes(&self) -> usize;
+    /// Returns a mutable handle to a call frame with the specified index, where
+    /// zero is the current frame, one is the frame before that etc.
+    fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_;
+
+    /// Reads a single byte from the specified heap at the specified 0-based offset.
+    fn read_heap_byte(&self, heap: HeapId, offset: u32) -> u8;
+    /// Reads an entire `U256` word in the big-endian order from the specified heap / `offset`
+    /// (which is the index of the most significant byte of the read value).
+    fn read_heap_u256(&self, heap: HeapId, offset: u32) -> U256;
+    /// Writes an entire `U256` word in the big-endian order to the specified heap at the specified `offset`
+    /// (which is the index of the most significant byte of the written value).
+    fn write_heap_u256(&mut self, heap: HeapId, offset: u32, value: U256);
+
+    /// Returns current execution flags.
+    fn flags(&self) -> Flags;
+    /// Sets current execution flags.
+    fn set_flags(&mut self, flags: Flags);
+
+    /// Returns the currently set 0-based transaction number.
+    fn transaction_number(&self) -> u16;
+    /// Sets the current transaction number.
+    fn set_transaction_number(&mut self, value: u16);
+
+    /// Returns the value of the context register.
+    fn context_u128_register(&self) -> u128;
+    /// Sets the value of the context register.
+    fn set_context_u128_register(&mut self, value: u128);
+
+    /// Iterates over storage slots read or written during VM execution.
+    fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>;
+    /// Iterates over all transient storage slots set during VM execution.
+    fn get_transient_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>;
+    /// Gets value of the specified transient storage slot.
+    fn get_transient_storage(&self, address: H160, slot: U256) -> U256;
+    /// Sets value of the specified transient storage slot.
+    fn write_transient_storage(&mut self, address: H160, slot: U256, value: U256);
+
+    /// Iterates over events emitted during VM execution.
+    fn events(&self) -> impl Iterator<Item = Event>;
+    /// Iterates over L2-to-L1 logs emitted during VM execution.
+    fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>;
+
+    /// Gets the current amount of published pubdata.
+    fn pubdata(&self) -> i32;
+    /// Sets the current amount of published pubdata.
+    fn set_pubdata(&mut self, value: i32);
+}
+
+/// VM execution flags. See the EraVM reference for more details.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Flags {
+    /// "Less than" flag.
+    pub less_than: bool,
+    /// "Equal" flag.
+    pub equal: bool,
+    /// "Greater than" flag.
+    pub greater: bool,
+}
+
+/// Public interface of an EraVM call frame.
+pub trait CallframeInterface {
+    /// Address of the storage context associated with this frame. For delegate calls, this address is inherited from the calling contract;
+    /// otherwise, it's the same as [`Self::code_address()`].
+    fn address(&self) -> H160;
+    /// Sets the address of the executing contract.
+    fn set_address(&mut self, address: H160);
+    /// Address of the contract being executed.
+    fn code_address(&self) -> H160;
+    /// Sets the address of the contract being executed. Does not cause the contract at the specified address get loaded per se, just updates
+    /// the value used internally by the VM (e.g., returned by the [`CodeAddress`](crate::opcodes::CodeAddress) opcode).
+    fn set_code_address(&mut self, address: H160);
+    /// Address of the calling contract. Respects delegate and mimic calls.
+    fn caller(&self) -> H160;
+    /// Sets the address of the calling contract.
+    fn set_caller(&mut self, address: H160);
+
+    /// Returns the current program counter (i.e., 0-based index of the instruction being executed).
+    /// During panic this returns `None`.
+    fn program_counter(&self) -> Option<u16>;
+    /// Sets the program counter.
+    /// The VM will execute an invalid instruction if you jump out of the program.
+    fn set_program_counter(&mut self, value: u16);
+
+    /// Returns the program counter that the parent frame should continue from if this frame fails.
+    fn exception_handler(&self) -> u16;
+    /// Sets the exception handler as specified [above](Self::exception_handler()).
+    fn set_exception_handler(&mut self, value: u16);
+
+    /// Checks whether the call is static.
+    fn is_static(&self) -> bool;
+    /// Checks whether the call is executed in kernel mode.
+    fn is_kernel(&self) -> bool;
+
+    /// Returns the remaining amount of gas.
+    fn gas(&self) -> u32;
+    /// Sets the remaining amount of gas.
+    fn set_gas(&mut self, new_gas: u32);
+    /// Additional gas provided for the duration of this callframe.
+    fn stipend(&self) -> u32;
+
+    /// Returns the context value for this call. This context is accessible via [`ContextU128`](crate::opcodes::ContextU128) opcode.
+    fn context_u128(&self) -> u128;
+    /// Sets the context value for this call.
+    fn set_context_u128(&mut self, value: u128);
+
+    /// Checks whether this frame corresponds to a near call.
+    fn is_near_call(&self) -> bool;
+
+    /// Reads the specified stack slot. Returns a value together with a pointer flag.
+    fn read_stack(&self, index: u16) -> (U256, bool);
+    /// Sets the value and pointer flag for the specified stack slot.
+    fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool);
+
+    /// Returns the stack pointer.
+    fn stack_pointer(&self) -> u16;
+    /// Sets the stack pointer.
+    fn set_stack_pointer(&mut self, value: u16);
+
+    /// Returns ID of the main heap used in this call.
+    fn heap(&self) -> HeapId;
+    /// Returns the main heap boundary (number of paid bytes).
+    fn heap_bound(&self) -> u32;
+    /// Sets the main heap boundary.
+    fn set_heap_bound(&mut self, value: u32);
+
+    /// Returns ID of the auxiliary heap used in this call.
+    fn aux_heap(&self) -> HeapId;
+    /// Returns the auxiliary heap boundary (number of paid bytes).
+    fn aux_heap_bound(&self) -> u32;
+    /// Sets the auxiliary heap boundary.
+    fn set_aux_heap_bound(&mut self, value: u32);
+
+    /// Reads a word from the bytecode of the executing contract.
+    fn read_contract_code(&self, slot: u16) -> U256;
+}
+
+/// Identifier of a VM heap.
+///
+/// EraVM docs sometimes refer to heaps as *heap pages*; docs in these crate don't to avoid confusion with internal heap structure.
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub struct HeapId(u32);
+
+impl HeapId {
+    /// Identifier of the calldata heap used by the first executed program (i.e., the bootloader).
+    pub const FIRST_CALLDATA: Self = Self(1);
+    /// Identifier of the heap used by the first executed program (i.e., the bootloader).
+    pub const FIRST: Self = Self(2);
+    /// Identifier of the auxiliary heap used by the first executed program (i.e., the bootloader)
+    pub const FIRST_AUX: Self = Self(3);
+
+    /// Only for dealing with external data structures, never use internally.
+    #[doc(hidden)]
+    pub const fn from_u32_unchecked(value: u32) -> Self {
+        Self(value)
+    }
+
+    /// Converts this ID to an integer value.
+    pub const fn as_u32(self) -> u32 {
+        self.0
+    }
+}
+
+/// Event emitted by EraVM.
+///
+/// There is no address field because nobody is interested in events that don't come
+/// from the event writer, so we simply do not record events coming from anywhere else.
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct Event {
+    /// Event key.
+    pub key: U256,
+    /// Event value.
+    pub value: U256,
+    /// Is this event first in a chain of events?
+    pub is_first: bool,
+    /// Shard identifier (currently, always set to 0).
+    pub shard_id: u8,
+    /// 0-based index of a transaction that has emitted this event.
+    pub tx_number: u16,
+}
+
+/// L2-to-L1 log emitted by EraVM.
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct L2ToL1Log {
+    /// Log key.
+    pub key: U256,
+    /// Log value.
+    pub value: U256,
+    /// Is this a service log?
+    pub is_service: bool,
+    /// Address of the contract that has emitted this log.
+    pub address: H160,
+    /// Shard identifier (currently, always set to 0).
+    pub shard_id: u8,
+    /// 0-based index of a transaction that has emitted this event.
+    pub tx_number: u16,
+}
+
+#[cfg(test)]
+#[derive(Debug)]
+pub struct DummyState;
+
+#[cfg(test)]
+impl StateInterface for DummyState {
+    fn read_register(&self, _: u8) -> (U256, bool) {
+        unimplemented!()
+    }
+
+    fn set_register(&mut self, _: u8, _: U256, _: bool) {
+        unimplemented!()
+    }
+
+    fn current_frame(&mut self) -> impl CallframeInterface + '_ {
+        DummyState
+    }
+
+    fn number_of_callframes(&self) -> usize {
+        unimplemented!()
+    }
+
+    fn callframe(&mut self, _: usize) -> impl CallframeInterface + '_ {
+        DummyState
+    }
+
+    fn read_heap_byte(&self, _: HeapId, _: u32) -> u8 {
+        unimplemented!()
+    }
+
+    fn read_heap_u256(&self, _: HeapId, _: u32) -> U256 {
+        unimplemented!()
+    }
+
+    fn write_heap_u256(&mut self, _: HeapId, _: u32, _: U256) {
+        unimplemented!()
+    }
+
+    fn flags(&self) -> Flags {
+        unimplemented!()
+    }
+
+    fn set_flags(&mut self, _: Flags) {
+        unimplemented!()
+    }
+
+    fn transaction_number(&self) -> u16 {
+        unimplemented!()
+    }
+
+    fn set_transaction_number(&mut self, _: u16) {
+        unimplemented!()
+    }
+
+    fn context_u128_register(&self) -> u128 {
+        unimplemented!()
+    }
+
+    fn set_context_u128_register(&mut self, _: u128) {
+        unimplemented!()
+    }
+
+    fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)> {
+        std::iter::empty()
+    }
+
+    fn get_transient_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)> {
+        std::iter::empty()
+    }
+
+    fn get_transient_storage(&self, _: H160, _: U256) -> U256 {
+        unimplemented!()
+    }
+
+    fn write_transient_storage(&mut self, _: H160, _: U256, _: U256) {
+        unimplemented!()
+    }
+
+    fn events(&self) -> impl Iterator<Item = Event> {
+        std::iter::empty()
+    }
+
+    fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log> {
+        std::iter::empty()
+    }
+
+    fn pubdata(&self) -> i32 {
+        unimplemented!()
+    }
+
+    fn set_pubdata(&mut self, _: i32) {
+        unimplemented!()
+    }
+}
+
+#[cfg(test)]
+impl CallframeInterface for DummyState {
+    fn address(&self) -> H160 {
+        unimplemented!()
+    }
+
+    fn set_address(&mut self, _: H160) {
+        unimplemented!()
+    }
+
+    fn code_address(&self) -> H160 {
+        unimplemented!()
+    }
+
+    fn set_code_address(&mut self, _: H160) {
+        unimplemented!()
+    }
+
+    fn caller(&self) -> H160 {
+        unimplemented!()
+    }
+
+    fn set_caller(&mut self, _: H160) {
+        unimplemented!()
+    }
+
+    fn program_counter(&self) -> Option<u16> {
+        unimplemented!()
+    }
+
+    fn set_program_counter(&mut self, _: u16) {
+        unimplemented!()
+    }
+
+    fn exception_handler(&self) -> u16 {
+        unimplemented!()
+    }
+
+    fn set_exception_handler(&mut self, _: u16) {
+        unimplemented!()
+    }
+
+    fn is_static(&self) -> bool {
+        unimplemented!()
+    }
+
+    fn is_kernel(&self) -> bool {
+        unimplemented!()
+    }
+
+    fn gas(&self) -> u32 {
+        unimplemented!()
+    }
+
+    fn set_gas(&mut self, _: u32) {
+        unimplemented!()
+    }
+
+    fn stipend(&self) -> u32 {
+        unimplemented!()
+    }
+
+    fn context_u128(&self) -> u128 {
+        unimplemented!()
+    }
+
+    fn set_context_u128(&mut self, _: u128) {
+        unimplemented!()
+    }
+
+    fn is_near_call(&self) -> bool {
+        unimplemented!()
+    }
+
+    fn read_stack(&self, _: u16) -> (U256, bool) {
+        unimplemented!()
+    }
+
+    fn write_stack(&mut self, _: u16, _: U256, _: bool) {
+        unimplemented!()
+    }
+
+    fn stack_pointer(&self) -> u16 {
+        unimplemented!()
+    }
+
+    fn set_stack_pointer(&mut self, _: u16) {
+        unimplemented!()
+    }
+
+    fn heap(&self) -> HeapId {
+        unimplemented!()
+    }
+
+    fn heap_bound(&self) -> u32 {
+        unimplemented!()
+    }
+
+    fn set_heap_bound(&mut self, _: u32) {
+        unimplemented!()
+    }
+
+    fn aux_heap(&self) -> HeapId {
+        unimplemented!()
+    }
+
+    fn aux_heap_bound(&self) -> u32 {
+        unimplemented!()
+    }
+
+    fn set_aux_heap_bound(&mut self, _: u32) {
+        unimplemented!()
+    }
+
+    fn read_contract_code(&self, _: u16) -> U256 {
+        unimplemented!()
+    }
+}
+
\ No newline at end of file diff --git a/src/zksync_vm2_interface/tracer_interface.rs.html b/src/zksync_vm2_interface/tracer_interface.rs.html new file mode 100644 index 0000000..ebfe511 --- /dev/null +++ b/src/zksync_vm2_interface/tracer_interface.rs.html @@ -0,0 +1,711 @@ +tracer_interface.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+
use crate::StateInterface;
+
+macro_rules! forall_simple_opcodes {
+    ($m:ident) => {
+        $m!(Nop);
+        $m!(Add);
+        $m!(Sub);
+        $m!(And);
+        $m!(Or);
+        $m!(Xor);
+        $m!(ShiftLeft);
+        $m!(ShiftRight);
+        $m!(RotateLeft);
+        $m!(RotateRight);
+        $m!(Mul);
+        $m!(Div);
+        $m!(NearCall);
+        $m!(Jump);
+        $m!(Event);
+        $m!(L2ToL1Message);
+        $m!(Decommit);
+        $m!(This);
+        $m!(Caller);
+        $m!(CodeAddress);
+        $m!(ErgsLeft);
+        $m!(SP);
+        $m!(ContextMeta);
+        $m!(ContextU128);
+        $m!(SetContextU128);
+        $m!(IncrementTxNumber);
+        $m!(AuxMutating0);
+        $m!(PrecompileCall);
+        $m!(HeapRead);
+        $m!(HeapWrite);
+        $m!(AuxHeapRead);
+        $m!(AuxHeapWrite);
+        $m!(PointerRead);
+        $m!(PointerAdd);
+        $m!(PointerSub);
+        $m!(PointerPack);
+        $m!(PointerShrink);
+        $m!(StorageRead);
+        $m!(StorageWrite);
+        $m!(TransientStorageRead);
+        $m!(TransientStorageWrite);
+    };
+}
+
+macro_rules! pub_struct {
+    ($x:ident) => {
+        #[doc = concat!("`", stringify!($x), "` opcode.")]
+        #[derive(Debug)]
+        pub struct $x;
+    };
+}
+
+/// EraVM opcodes.
+pub mod opcodes {
+    use std::marker::PhantomData;
+
+    use super::{CallingMode, ReturnType};
+
+    forall_simple_opcodes!(pub_struct);
+
+    /// `FarCall` group of opcodes distinguished by the calling mode (normal, delegate, or mimic).
+    #[derive(Debug)]
+    pub struct FarCall<M: TypeLevelCallingMode>(PhantomData<M>);
+
+    /// `Ret` group of opcodes distinguished by the return type (normal, panic, or revert).
+    #[derive(Debug)]
+    pub struct Ret<T: TypeLevelReturnType>(PhantomData<T>);
+
+    /// Normal [`Ret`]urn mode / [`FarCall`] mode.
+    #[derive(Debug)]
+    pub struct Normal;
+
+    /// Delegate [`FarCall`] mode.
+    #[derive(Debug)]
+    pub struct Delegate;
+
+    /// Mimic [`FarCall`] mode.
+    #[derive(Debug)]
+    pub struct Mimic;
+
+    /// Revert [`Ret`]urn mode.
+    #[derive(Debug)]
+    pub struct Revert;
+
+    /// Panic [`Ret`]urn mode.
+    #[derive(Debug)]
+    pub struct Panic;
+
+    /// Calling mode for the [`FarCall`] opcodes.
+    pub trait TypeLevelCallingMode {
+        /// Constant corresponding to this mode allowing to easily `match` it.
+        const VALUE: CallingMode;
+    }
+
+    impl TypeLevelCallingMode for Normal {
+        const VALUE: CallingMode = CallingMode::Normal;
+    }
+
+    impl TypeLevelCallingMode for Delegate {
+        const VALUE: CallingMode = CallingMode::Delegate;
+    }
+
+    impl TypeLevelCallingMode for Mimic {
+        const VALUE: CallingMode = CallingMode::Mimic;
+    }
+
+    /// Return type for the [`Ret`] opcodes.
+    pub trait TypeLevelReturnType {
+        /// Constant corresponding to this return type allowing to easily `match` it.
+        const VALUE: ReturnType;
+    }
+
+    impl TypeLevelReturnType for Normal {
+        const VALUE: ReturnType = ReturnType::Normal;
+    }
+
+    impl TypeLevelReturnType for Revert {
+        const VALUE: ReturnType = ReturnType::Revert;
+    }
+
+    impl TypeLevelReturnType for Panic {
+        const VALUE: ReturnType = ReturnType::Panic;
+    }
+}
+
+/// All supported EraVM opcodes in a single enumeration.
+#[allow(missing_docs)]
+#[derive(PartialEq, Eq, Debug, Copy, Clone, Hash)]
+pub enum Opcode {
+    Nop,
+    Add,
+    Sub,
+    And,
+    Or,
+    Xor,
+    ShiftLeft,
+    ShiftRight,
+    RotateLeft,
+    RotateRight,
+    Mul,
+    Div,
+    NearCall,
+    FarCall(CallingMode),
+    Ret(ReturnType),
+    Jump,
+    Event,
+    L2ToL1Message,
+    Decommit,
+    This,
+    Caller,
+    CodeAddress,
+    ErgsLeft,
+    SP,
+    ContextMeta,
+    ContextU128,
+    SetContextU128,
+    IncrementTxNumber,
+    AuxMutating0,
+    PrecompileCall,
+    HeapRead,
+    HeapWrite,
+    AuxHeapRead,
+    AuxHeapWrite,
+    PointerRead,
+    PointerAdd,
+    PointerSub,
+    PointerPack,
+    PointerShrink,
+    StorageRead,
+    StorageWrite,
+    TransientStorageRead,
+    TransientStorageWrite,
+}
+
+/// All supported calling modes for [`FarCall`](opcodes::FarCall) opcode.
+#[derive(PartialEq, Eq, Debug, Copy, Clone, Hash)]
+pub enum CallingMode {
+    /// Normal calling mode.
+    Normal,
+    /// Delegate calling mode (similar to `delegatecall` in EVM).
+    Delegate,
+    /// Mimic calling mode (can only be used by system contracts; allows to emulate `eth_call` semantics while retaining the bootloader).
+    Mimic,
+}
+
+/// All supported return types for the [`Ret`](opcodes::Ret) opcode.
+#[derive(PartialEq, Eq, Debug, Copy, Clone, Hash)]
+pub enum ReturnType {
+    /// Normal return.
+    Normal,
+    /// Revert (e.g., a result of a Solidity `revert`).
+    Revert,
+    /// Panic, i.e. a non-revert abnormal control flow termination (e.g., out of gas).
+    Panic,
+}
+
+impl ReturnType {
+    /// Checks if this return type is [normal](Self::Normal).
+    pub fn is_failure(&self) -> bool {
+        *self != ReturnType::Normal
+    }
+}
+
+/// Trait mapping opcodes as types to the corresponding variants of the [`Opcode`] enum.
+pub trait OpcodeType {
+    /// `Opcode` variant corresponding to this opcode type.
+    const VALUE: Opcode;
+}
+
+macro_rules! impl_opcode {
+    ($x:ident) => {
+        impl OpcodeType for opcodes::$x {
+            const VALUE: Opcode = Opcode::$x;
+        }
+    };
+}
+
+forall_simple_opcodes!(impl_opcode);
+
+impl<M: opcodes::TypeLevelCallingMode> OpcodeType for opcodes::FarCall<M> {
+    const VALUE: Opcode = Opcode::FarCall(M::VALUE);
+}
+
+impl<T: opcodes::TypeLevelReturnType> OpcodeType for opcodes::Ret<T> {
+    const VALUE: Opcode = Opcode::Ret(T::VALUE);
+}
+
+/// EraVM instruction tracer.
+///
+/// [`Self::before_instruction()`] is called just before the actual instruction is executed.
+/// If the instruction is skipped, `before_instruction` will be called with [`Nop`](opcodes::Nop).
+/// [`Self::after_instruction()`] is called once the instruction is executed and the program
+/// counter has advanced.
+///
+/// # Examples
+///
+/// Here `FarCallCounter` counts the number of far calls.
+///
+/// ```
+/// # use zksync_vm2_interface::{Tracer, StateInterface, OpcodeType, Opcode};
+/// struct FarCallCounter(usize);
+///
+/// impl Tracer for FarCallCounter {
+///     fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+///         match OP::VALUE {
+///             Opcode::FarCall(_) => self.0 += 1,
+///             _ => {}
+///         }
+///     }
+/// }
+/// ```
+pub trait Tracer {
+    /// Executes logic before an instruction handler.
+    ///
+    /// The default implementation does nothing.
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+    /// Executes logic after an instruction handler.
+    ///
+    /// The default implementation does nothing.
+    fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+
+    /// Provides cycle statistics for "complex" instructions from the prover perspective (mostly precompile calls).
+    ///
+    /// The default implementation does nothing.
+    fn on_extra_prover_cycles(&mut self, _stats: CycleStats) {}
+}
+
+/// Cycle statistics emitted by the VM and supplied to [`Tracer::on_extra_prover_cycles()`].
+#[derive(Debug, Clone, Copy)]
+pub enum CycleStats {
+    /// Call to the `keccak256` precompile with the specified number of hash cycles.
+    Keccak256(u32),
+    /// Call to the `sha256` precompile with the specified number of hash cycles.
+    Sha256(u32),
+    /// Call to the `ecrecover` precompile with the specified number of hash cycles.
+    EcRecover(u32),
+    /// Call to the `secp256r1_verify` precompile with the specified number of hash cycles.
+    Secp256r1Verify(u32),
+    /// Decommitting an opcode.
+    Decommit(u32),
+    /// Reading a slot from the VM storage.
+    StorageRead,
+    /// Writing a slot to the VM storage.
+    StorageWrite,
+}
+
+/// No-op tracer implementation.
+impl Tracer for () {}
+
+// Multiple tracers can be combined by building a linked list out of tuples.
+impl<A: Tracer, B: Tracer> Tracer for (A, B) {
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+        self.0.before_instruction::<OP, S>(state);
+        self.1.before_instruction::<OP, S>(state);
+    }
+
+    fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+        self.0.after_instruction::<OP, S>(state);
+        self.1.after_instruction::<OP, S>(state);
+    }
+
+    fn on_extra_prover_cycles(&mut self, stats: CycleStats) {
+        self.0.on_extra_prover_cycles(stats);
+        self.1.on_extra_prover_cycles(stats);
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{CallingMode, OpcodeType};
+    use crate::{opcodes, DummyState, Tracer};
+
+    struct FarCallCounter(usize);
+
+    impl Tracer for FarCallCounter {
+        fn before_instruction<OP: OpcodeType, S: crate::StateInterface>(&mut self, _: &mut S) {
+            if let super::Opcode::FarCall(CallingMode::Normal) = OP::VALUE {
+                self.0 += 1;
+            }
+        }
+    }
+
+    #[test]
+    fn test_tracer() {
+        let mut tracer = FarCallCounter(0);
+
+        tracer.before_instruction::<opcodes::Nop, _>(&mut DummyState);
+        assert_eq!(tracer.0, 0);
+
+        tracer.before_instruction::<opcodes::FarCall<opcodes::Normal>, _>(&mut DummyState);
+        assert_eq!(tracer.0, 1);
+
+        tracer.before_instruction::<opcodes::FarCall<opcodes::Mimic>, _>(&mut DummyState);
+        assert_eq!(tracer.0, 1);
+    }
+
+    #[test]
+    fn test_aggregate_tracer() {
+        let mut tracer = (FarCallCounter(0), (FarCallCounter(0), FarCallCounter(0)));
+
+        tracer.before_instruction::<opcodes::Nop, _>(&mut DummyState);
+        assert_eq!(tracer.0 .0, 0);
+        assert_eq!(tracer.1 .0 .0, 0);
+        assert_eq!(tracer.1 .1 .0, 0);
+
+        tracer.before_instruction::<opcodes::FarCall<opcodes::Normal>, _>(&mut DummyState);
+        assert_eq!(tracer.0 .0, 1);
+        assert_eq!(tracer.1 .0 .0, 1);
+        assert_eq!(tracer.1 .1 .0, 1);
+    }
+}
+
\ No newline at end of file diff --git a/static.files/COPYRIGHT-23e9bde6c69aea69.txt b/static.files/COPYRIGHT-23e9bde6c69aea69.txt new file mode 100644 index 0000000..1447df7 --- /dev/null +++ b/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -0,0 +1,50 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/static.files/FiraSans-LICENSE-db4b642586e02d97.txt b/static.files/FiraSans-LICENSE-db4b642586e02d97.txt new file mode 100644 index 0000000..d7e9c14 --- /dev/null +++ b/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 0000000..7a1e5fc Binary files /dev/null and b/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 0000000..e766e06 Binary files /dev/null and b/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 0000000..31aa793 --- /dev/null +++ b/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +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. diff --git a/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 0000000..1866ad4 Binary files /dev/null and b/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt b/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt new file mode 100644 index 0000000..4b3edc2 --- /dev/null +++ b/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 0000000..462c34e Binary files /dev/null and b/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt b/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt new file mode 100644 index 0000000..0d2941e --- /dev/null +++ b/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 0000000..10b558e Binary files /dev/null and b/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 0000000..5ec64ee Binary files /dev/null and b/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 0000000..181a07f Binary files /dev/null and b/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 0000000..2ae08a7 Binary files /dev/null and b/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md b/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md new file mode 100644 index 0000000..175fa4f --- /dev/null +++ b/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 0000000..0263fc3 Binary files /dev/null and b/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/static.files/favicon-2c020d218678b618.svg b/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 0000000..8b34b51 --- /dev/null +++ b/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/static.files/favicon-32x32-422f7d1d52889060.png b/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 0000000..69b8613 Binary files /dev/null and b/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/static.files/main-f9142fe437216fc3.js b/static.files/main-f9142fe437216fc3.js new file mode 100644 index 0000000..64bb24e --- /dev/null +++ b/static.files/main-f9142fe437216fc3.js @@ -0,0 +1,11 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function blurHandler(event,parentElem,hideCallback){if(!parentElem.contains(document.activeElement)&&!parentElem.contains(event.relatedTarget)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar){const mobileTitle=document.createElement("h2");mobileTitle.className="location";if(hasClass(document.querySelector(".rustdoc"),"crate")){mobileTitle.innerHTML=`Crate ${window.currentCrate}`}else if(locationTitle){mobileTitle.innerHTML=locationTitle.innerHTML}mobileTopbar.appendChild(mobileTitle)}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url,errorCallback){const script=document.createElement("script");script.src=url;if(errorCallback!==undefined){script.onerror=errorCallback}document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=").map(x=>x.replace(/\+/g," "));params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function sendSearchForm(){document.getElementsByClassName("search-form")[0].submit()}function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"),sendSearchForm);loadScript(resourcePath("search-index",".js"),sendSearchForm)}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},descShards:new Map(),loadDesc:async function({descShard,descIndex}){if(descShard.promise===null){descShard.promise=new Promise((resolve,reject)=>{descShard.resolve=resolve;const ds=descShard;const fname=`${ds.crate}-desc-${ds.shard}-`;const url=resourcePath(`search.desc/${descShard.crate}/${fname}`,".js",);loadScript(url,reject)})}const list=await descShard.promise;return list[descIndex]},loadedDescShard:function(crate,shard,data){this.descShards.get(crate)[shard].resolve(data.split("\n"))},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}if(savedHash.startsWith("impl-")){const splitAt=savedHash.indexOf("/");if(splitAt!==-1){const implId=savedHash.slice(0,splitAt);const assocId=savedHash.slice(splitAt+1);const implElem=document.getElementById(implId);if(implElem&&implElem.parentElement.tagName==="SUMMARY"&&implElem.parentElement.parentElement.tagName==="DETAILS"){onEachLazy(implElem.parentElement.parentElement.querySelectorAll(`[id^="${assocId}"]`),item=>{const numbered=/([^-]+)-([0-9]+)/.exec(item.id);if(item.id===assocId||(numbered&&numbered[1]===assocId)){openParentDetails(item);item.scrollIntoView();setTimeout(()=>{window.location.replace("#"+item.id)},0)}},)}}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":case"/":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const modpath=hasClass(document.querySelector(".rustdoc"),"mod")?"../":"";const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=`${modpath}${name}/index.html`}else{path=`${modpath}${shortty}.${name}.html`}let current_page=document.location.href.toString();if(current_page.endsWith("/")){current_page+="index.html"}const link=document.createElement("a");link.href=path;link.textContent=name;const li=document.createElement("li");if(link.href===current_page){li.classList.add("current")}li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("union","unions","Unions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("opaque","opaque-types","Opaque Types");block("attr","attributes","Attribute Macros");block("derive","derives","Derive Macros");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","),);for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}window.register_type_impls=imp=>{if(!imp||!imp[window.currentCrate]){return}window.pending_type_impls=null;const idMap=new Map();let implementations=document.getElementById("implementations-list");let trait_implementations=document.getElementById("trait-implementations-list");let trait_implementations_header=document.getElementById("trait-implementations");const script=document.querySelector("script[data-self-path]");const selfPath=script?script.getAttribute("data-self-path"):null;const mainContent=document.querySelector("#main-content");const sidebarSection=document.querySelector(".sidebar section");let methods=document.querySelector(".sidebar .block.method");let associatedTypes=document.querySelector(".sidebar .block.associatedtype");let associatedConstants=document.querySelector(".sidebar .block.associatedconstant");let sidebarTraitList=document.querySelector(".sidebar .block.trait-implementation");for(const impList of imp[window.currentCrate]){const types=impList.slice(2);const text=impList[0];const isTrait=impList[1]!==0;const traitName=impList[1];if(types.indexOf(selfPath)===-1){continue}let outputList=isTrait?trait_implementations:implementations;if(outputList===null){const outputListName=isTrait?"Trait Implementations":"Implementations";const outputListId=isTrait?"trait-implementations-list":"implementations-list";const outputListHeaderId=isTrait?"trait-implementations":"implementations";const outputListHeader=document.createElement("h2");outputListHeader.id=outputListHeaderId;outputListHeader.innerText=outputListName;outputList=document.createElement("div");outputList.id=outputListId;if(isTrait){const link=document.createElement("a");link.href=`#${outputListHeaderId}`;link.innerText="Trait Implementations";const h=document.createElement("h3");h.appendChild(link);trait_implementations=outputList;trait_implementations_header=outputListHeader;sidebarSection.appendChild(h);sidebarTraitList=document.createElement("ul");sidebarTraitList.className="block trait-implementation";sidebarSection.appendChild(sidebarTraitList);mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}else{implementations=outputList;if(trait_implementations){mainContent.insertBefore(outputListHeader,trait_implementations_header);mainContent.insertBefore(outputList,trait_implementations_header)}else{const mainContent=document.querySelector("#main-content");mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}}}const template=document.createElement("template");template.innerHTML=text;onEachLazy(template.content.querySelectorAll("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});onEachLazy(template.content.querySelectorAll("[id]"),el=>{let i=0;if(idMap.has(el.id)){i=idMap.get(el.id)}else if(document.getElementById(el.id)){i=1;while(document.getElementById(`${el.id}-${2 * i}`)){i=2*i}while(document.getElementById(`${el.id}-${i}`)){i+=1}}if(i!==0){const oldHref=`#${el.id}`;const newHref=`#${el.id}-${i}`;el.id=`${el.id}-${i}`;onEachLazy(template.content.querySelectorAll("a[href]"),link=>{if(link.getAttribute("href")===oldHref){link.href=newHref}})}idMap.set(el.id,i+1)});const templateAssocItems=template.content.querySelectorAll("section.tymethod, "+"section.method, section.associatedtype, section.associatedconstant");if(isTrait){const li=document.createElement("li");const a=document.createElement("a");a.href=`#${template.content.querySelector(".impl").id}`;a.textContent=traitName;li.appendChild(a);sidebarTraitList.append(li)}else{onEachLazy(templateAssocItems,item=>{let block=hasClass(item,"associatedtype")?associatedTypes:(hasClass(item,"associatedconstant")?associatedConstants:(methods));if(!block){const blockTitle=hasClass(item,"associatedtype")?"Associated Types":(hasClass(item,"associatedconstant")?"Associated Constants":("Methods"));const blockClass=hasClass(item,"associatedtype")?"associatedtype":(hasClass(item,"associatedconstant")?"associatedconstant":("method"));const blockHeader=document.createElement("h3");const blockLink=document.createElement("a");blockLink.href="#implementations";blockLink.innerText=blockTitle;blockHeader.appendChild(blockLink);block=document.createElement("ul");block.className=`block ${blockClass}`;const insertionReference=methods||sidebarTraitList;if(insertionReference){const insertionReferenceH=insertionReference.previousElementSibling;sidebarSection.insertBefore(blockHeader,insertionReferenceH);sidebarSection.insertBefore(block,insertionReferenceH)}else{sidebarSection.appendChild(blockHeader);sidebarSection.appendChild(block)}if(hasClass(item,"associatedtype")){associatedTypes=block}else if(hasClass(item,"associatedconstant")){associatedConstants=block}else{methods=block}}const li=document.createElement("li");const a=document.createElement("a");a.innerText=item.id.split("-")[0].split(".")[1];a.href=`#${item.id}`;li.appendChild(a);block.appendChild(li)})}outputList.appendChild(template.content)}for(const list of[methods,associatedTypes,associatedConstants,sidebarTraitList]){if(!list){continue}const newChildren=Array.prototype.slice.call(list.children);newChildren.sort((a,b)=>{const aI=a.innerText;const bI=b.innerText;return aIbI?1:0});list.replaceChildren(...newChildren)}};if(window.pending_type_impls){window.register_type_impls(window.pending_type_impls)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.textContent=crate;const li=document.createElement("li");if(window.rootPath!=="./"&&crate===window.currentCrate){li.className="current"}li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px",)}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!e.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.contains(event.relatedTarget)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(event.relatedTarget)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S / /","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){const SIDEBAR_MIN=100;const SIDEBAR_MAX=500;const RUSTDOC_MOBILE_BREAKPOINT=700;const BODY_MIN=400;const SIDEBAR_VANISH_THRESHOLD=SIDEBAR_MIN/2;const sidebarButton=document.getElementById("sidebar-button");if(sidebarButton){sidebarButton.addEventListener("click",e=>{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false");if(document.querySelector(".rustdoc.src")){window.rustdocToggleSrcSidebar()}e.preventDefault()})}let currentPointerId=null;let desiredSidebarSize=null;let pendingSidebarResizingFrame=false;const resizer=document.querySelector(".sidebar-resizer");const sidebar=document.querySelector(".sidebar");if(!resizer||!sidebar){return}const isSrcPage=hasClass(document.body,"src");function hideSidebar(){if(isSrcPage){window.rustdocCloseSourceSidebar();updateLocalStorage("src-sidebar-width",null);document.documentElement.style.removeProperty("--src-sidebar-width");sidebar.style.removeProperty("--src-sidebar-width");resizer.style.removeProperty("--src-sidebar-width")}else{addClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","true");updateLocalStorage("desktop-sidebar-width",null);document.documentElement.style.removeProperty("--desktop-sidebar-width");sidebar.style.removeProperty("--desktop-sidebar-width");resizer.style.removeProperty("--desktop-sidebar-width")}}function showSidebar(){if(isSrcPage){window.rustdocShowSourceSidebar()}else{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false")}}function changeSidebarSize(size){if(isSrcPage){updateLocalStorage("src-sidebar-width",size);sidebar.style.setProperty("--src-sidebar-width",size+"px");resizer.style.setProperty("--src-sidebar-width",size+"px")}else{updateLocalStorage("desktop-sidebar-width",size);sidebar.style.setProperty("--desktop-sidebar-width",size+"px");resizer.style.setProperty("--desktop-sidebar-width",size+"px")}}function isSidebarHidden(){return isSrcPage?!hasClass(document.documentElement,"src-sidebar-expanded"):hasClass(document.documentElement,"hide-sidebar")}function resize(e){if(currentPointerId===null||currentPointerId!==e.pointerId){return}e.preventDefault();const pos=e.clientX-3;if(pos=SIDEBAR_MIN){if(isSidebarHidden()){showSidebar()}const constrainedPos=Math.min(pos,window.innerWidth-BODY_MIN,SIDEBAR_MAX);changeSidebarSize(constrainedPos);desiredSidebarSize=constrainedPos;if(pendingSidebarResizingFrame!==false){clearTimeout(pendingSidebarResizingFrame)}pendingSidebarResizingFrame=setTimeout(()=>{if(currentPointerId===null||pendingSidebarResizingFrame===false){return}pendingSidebarResizingFrame=false;document.documentElement.style.setProperty("--resizing-sidebar-width",desiredSidebarSize+"px",)},100)}}window.addEventListener("resize",()=>{if(window.innerWidth=(window.innerWidth-BODY_MIN)){changeSidebarSize(window.innerWidth-BODY_MIN)}else if(desiredSidebarSize!==null&&desiredSidebarSize>SIDEBAR_MIN){changeSidebarSize(desiredSidebarSize)}});function stopResize(e){if(currentPointerId===null){return}if(e){e.preventDefault()}desiredSidebarSize=sidebar.getBoundingClientRect().width;removeClass(resizer,"active");window.removeEventListener("pointermove",resize,false);window.removeEventListener("pointerup",stopResize,false);removeClass(document.documentElement,"sidebar-resizing");document.documentElement.style.removeProperty("--resizing-sidebar-width");if(resizer.releasePointerCapture){resizer.releasePointerCapture(currentPointerId);currentPointerId=null}}function initResize(e){if(currentPointerId!==null||e.altKey||e.ctrlKey||e.metaKey||e.button!==0){return}if(resizer.setPointerCapture){resizer.setPointerCapture(e.pointerId);if(!resizer.hasPointerCapture(e.pointerId)){resizer.releasePointerCapture(e.pointerId);return}currentPointerId=e.pointerId}window.hideAllModals(false);e.preventDefault();window.addEventListener("pointermove",resize,false);window.addEventListener("pointercancel",stopResize,false);window.addEventListener("pointerup",stopResize,false);addClass(resizer,"active");addClass(document.documentElement,"sidebar-resizing");const pos=e.clientX-sidebar.offsetLeft-3;document.documentElement.style.setProperty("--resizing-sidebar-width",pos+"px");desiredSidebarSize=null}resizer.addEventListener("pointerdown",initResize,false)}());(function(){function copyContentToClipboard(content){const el=document.createElement("textarea");el.value=content;el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el)}function copyButtonAnimation(button){button.classList.add("clicked");if(button.reset_button_timeout!==undefined){window.clearTimeout(button.reset_button_timeout)}button.reset_button_timeout=window.setTimeout(()=>{button.reset_button_timeout=undefined;button.classList.remove("clicked")},1000)}const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});copyContentToClipboard(path.join("::"));copyButtonAnimation(but)};function copyCode(codeElem){if(!codeElem){return}copyContentToClipboard(codeElem.textContent)}function getExampleWrap(event){let elem=event.target;while(!hasClass(elem,"example-wrap")){elem=elem.parentElement;if(elem.tagName==="body"||hasClass(elem,"docblock")){return null}}return elem}function addCopyButton(event){const elem=getExampleWrap(event);if(elem===null){return}elem.removeEventListener("mouseover",addCopyButton);const parent=document.createElement("div");parent.className="button-holder";const runButton=elem.querySelector(".test-arrow");if(runButton!==null){parent.appendChild(runButton)}elem.appendChild(parent);const copyButton=document.createElement("button");copyButton.className="copy-button";copyButton.title="Copy code to clipboard";copyButton.addEventListener("click",()=>{copyCode(elem.querySelector("pre > code"));copyButtonAnimation(copyButton)});parent.appendChild(copyButton)}function showHideCodeExampleButtons(event){const elem=getExampleWrap(event);if(elem===null){return}const buttons=elem.querySelector(".button-holder");if(buttons===null){return}buttons.classList.toggle("keep-visible")}onEachLazy(document.querySelectorAll(".docblock .example-wrap"),elem=>{elem.addEventListener("mouseover",addCopyButton);elem.addEventListener("click",showHideCodeExampleButtons)})}()) \ No newline at end of file diff --git a/static.files/normalize-76eba96aa4d2e634.css b/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 0000000..469959f --- /dev/null +++ b/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/static.files/noscript-df360f571f6edeae.css b/static.files/noscript-df360f571f6edeae.css new file mode 100644 index 0000000..4c310ae --- /dev/null +++ b/static.files/noscript-df360f571f6edeae.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path,#sidebar-button,.sidebar-resizer{display:none !important;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root,:root:not([data-theme]){--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--settings-menu-filter:none;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}@media (prefers-color-scheme:dark){:root,:root:not([data-theme]){--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}} \ No newline at end of file diff --git a/static.files/rust-logo-151179464ae7ed46.svg b/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 0000000..62424d8 --- /dev/null +++ b/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/static.files/rustdoc-970bf1bf55bd1c15.css b/static.files/rustdoc-970bf1bf55bd1c15.css new file mode 100644 index 0000000..9271130 --- /dev/null +++ b/static.files/rustdoc-970bf1bf55bd1c15.css @@ -0,0 +1,46 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;--desktop-sidebar-width:200px;--src-sidebar-width:300px;--desktop-sidebar-z-index:100;--sidebar-elems-left-padding:24px;--clipboard-image:url('data:image/svg+xml,\ +\ +\ +');--copy-path-height:34px;--copy-path-width:33px;--checkmark-image:url('data:image/svg+xml,\ +\ +');--button-left-margin:4px;--button-border-radius:2px;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.src,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;}.rustdoc.src .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.logo-container{line-height:0;display:block;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 var(--desktop-sidebar-width);width:var(--desktop-sidebar-width);overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;z-index:var(--desktop-sidebar-z-index);}.rustdoc.src .sidebar{flex-basis:50px;width:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.hide-sidebar .sidebar,.hide-sidebar .sidebar-resizer{display:none;}.sidebar-resizer{touch-action:none;width:9px;cursor:col-resize;z-index:calc(var(--desktop-sidebar-z-index) + 1);position:fixed;height:100%;left:calc(var(--desktop-sidebar-width) + 1px);}.rustdoc.src .sidebar-resizer{left:49px;}.src-sidebar-expanded .src .sidebar-resizer{left:var(--src-sidebar-width);}.sidebar-resizing{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.sidebar-resizing*{cursor:col-resize !important;}.sidebar-resizing .sidebar{position:fixed;}.sidebar-resizing>body{padding-left:var(--resizing-sidebar-width);}.sidebar-resizer:hover,.sidebar-resizer:active,.sidebar-resizer:focus,.sidebar-resizer.active{width:10px;margin:0;left:var(--desktop-sidebar-width);border-left:solid 1px var(--sidebar-resizer-hover);}.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:active,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:focus,.src-sidebar-expanded .rustdoc.src .sidebar-resizer.active{left:calc(var(--src-sidebar-width) - 1px);}@media (pointer:coarse){.sidebar-resizer{display:none !important;}}.sidebar-resizer.active{padding:0 140px;width:2px;margin-left:-140px;border-left:none;}.sidebar-resizer.active:before{border-left:solid 2px var(--sidebar-resizer-active);display:block;height:100%;content:"";}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}.src .sidebar>*{visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:var(--src-sidebar-width);width:var(--src-sidebar-width);}.src-sidebar-expanded .src .sidebar>*{visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.logo-container>img{height:48px;width:48px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-right:0.25rem;border-left:solid var(--sidebar-elems-left-padding) transparent;margin-left:calc(-0.25rem - var(--sidebar-elems-left-padding));background-clip:border-box;}.sidebar h2{text-wrap:balance;overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{text-wrap:balance;overflow-wrap:anywhere;font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>.version,.sidebar>h2{padding-left:var(--sidebar-elems-left-padding);}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar .current a,.sidebar-crate a.logo-container:hover+h2 a,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.sidebar-crate{display:flex;align-items:center;justify-content:center;margin:14px 32px 1rem;row-gap:10px;column-gap:32px;flex-wrap:wrap;}.sidebar-crate h2{flex-grow:1;margin:0 -8px;align-self:start;}.sidebar-crate .logo-container{margin:0 calc(-16px - var(--sidebar-elems-left-padding));padding:0 var(--sidebar-elems-left-padding);text-align:center;}.sidebar-crate .logo-container img{margin-top:-16px;border-top:solid 16px transparent;box-sizing:content-box;position:relative;background-clip:border-box;z-index:1;}.sidebar-crate h2 a{display:block;border-left:solid var(--sidebar-elems-left-padding) transparent;background-clip:border-box;margin:0 calc(-24px + 0.25rem) 0 calc(-0.2rem - var(--sidebar-elems-left-padding));padding:calc((16px - 0.57rem ) / 2 ) 0.25rem;padding-left:0.2rem;}.sidebar-crate h2 .version{display:block;font-weight:normal;font-size:1rem;overflow-wrap:break-word;}.sidebar-crate+.version{margin-top:-1rem;margin-bottom:1rem;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap>pre{border-radius:6px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.src) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.src .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.docblock .stab,.docblock-short .stab{display:inline-block;}div.where{white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.src nav.sub{margin:0 0 15px 0;}.section-header{display:block;position:relative;}.section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.section-header>.anchor{left:-15px;padding-right:8px;}h2.section-header>.anchor{padding-right:6px;}a.doc-anchor{color:var(--main-color);display:none;position:absolute;left:-17px;padding-right:5px;padding-left:3px;}*:hover>.doc-anchor{display:block;}.top-doc>.docblock>*:first-child>.doc-anchor{display:none !important;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block li.current a{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;width:100%;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.popover{position:absolute;top:100%;right:0;z-index:calc(var(--desktop-sidebar-z-index) + 1);margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{display:block;padding:3px;margin-bottom:5px;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;vertical-align:baseline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji,.item-info .stab::before{font-size:1.25rem;}.stab .emoji{margin-right:0.3rem;}.item-info .stab::before{content:"\0";width:0;display:inline-block;color:transparent;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}.top-doc>.docblock>.warning:first-child::before{top:20px;}.example-wrap>a.test-arrow,.example-wrap .button-holder{visibility:hidden;position:absolute;top:4px;right:4px;z-index:1;}a.test-arrow{padding:5px 7px;border-radius:var(--button-border-radius);font-size:1rem;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap .button-holder{display:flex;}.example-wrap:hover>.test-arrow{padding:2px 7px;}@media not (pointer:coarse){.example-wrap:hover>.test-arrow,.example-wrap:hover>.button-holder{visibility:visible;}}.example-wrap .button-holder.keep-visible{visibility:visible;}.example-wrap .button-holder .copy-button{color:var(--copy-path-button-color);background:var(--main-background-color);height:var(--copy-path-height);width:var(--copy-path-width);margin-left:var(--button-left-margin);padding:2px 0 0 4px;border:0;cursor:pointer;border-radius:var(--button-border-radius);}.example-wrap .button-holder .copy-button::before{filter:var(--copy-path-img-filter);content:var(--clipboard-image);}.example-wrap .button-holder .copy-button:hover::before{filter:var(--copy-path-img-hover-filter);}.example-wrap .button-holder .copy-button.clicked::before{content:var(--checkmark-image);padding-right:5px;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}.src-sidebar-title{position:sticky;top:0;display:flex;padding:8px 8px 0 48px;margin-bottom:7px;background:var(--sidebar-background-color);border-bottom:1px solid var(--border-color);}#settings-menu,#help-button{margin-left:var(--button-left-margin);display:flex;}#sidebar-button{display:none;line-height:0;}.hide-sidebar #sidebar-button,.src #sidebar-button{display:flex;margin-right:4px;position:fixed;left:6px;height:34px;width:34px;background-color:var(--main-background-color);z-index:1;}.src #sidebar-button{left:8px;z-index:calc(var(--desktop-sidebar-z-index) + 1);}.hide-sidebar .src #sidebar-button{position:static;}#settings-menu>a,#help-button>a,#sidebar-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:var(--button-border-radius);color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus,#sidebar-button>a:hover,#sidebar-button>a:focus{border-color:var(--settings-button-border-focus);}#settings-menu>a{line-height:0;font-size:0;}#settings-menu>a:before{content:url('data:image/svg+xml,\ + ');width:22px;height:22px;filter:var(--settings-menu-filter);}#sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:var(--copy-path-height);width:var(--copy-path-width);margin-left:10px;padding:0;padding-left:2px;border:0;font-size:0;}#copy-path::before{filter:var(--copy-path-img-filter);content:var(--clipboard-image);}#copy-path:hover::before{filter:var(--copy-path-img-hover-filter);}#copy-path.clicked::before{content:var(--checkmark-image);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}.src #sidebar-button>a:before,.sidebar-menu-toggle:before{content:url('data:image/svg+xml,\ + ');opacity:0.75;}.sidebar-menu-toggle:hover:before,.sidebar-menu-toggle:active:before,.sidebar-menu-toggle:focus:before{opacity:1;}.src #sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');opacity:0.75;}@media (max-width:850px){#search-tabs .count{display:block;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location,.sidebar-resizer{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.src .search-form{margin-left:40px;}.hide-sidebar .search-form{margin-left:32px;}.hide-sidebar .src .search-form{margin-left:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;white-space:nowrap;text-overflow:ellipsis;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.hide-sidebar .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;border:none;line-height:0;}.hide-sidebar .sidebar-menu-toggle{display:none;}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#copy-path,#help-button{display:none;}#sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}.sidebar-menu-toggle:before{filter:var(--mobile-sidebar-menu-filter);}.sidebar-menu-toggle:hover{background:var(--main-background-color);}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{position:fixed;max-width:100vw;width:100vw;}.src .src-sidebar-title{padding-top:0;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.src nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}.item-table>li>.item-name{width:33%;}.item-table>li>div{overflow-wrap:anywhere;}}@media print{nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"],:root:not([data-theme]){--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--settings-menu-filter:none;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--settings-menu-filter:none;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--settings-menu-filter:invert(100%);--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);--sidebar-resizer-hover:hsl(34,50%,33%);--sidebar-resizer-active:hsl(34,100%,66%);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar .current a,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] .src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img,:root[data-theme="ayu"] #sidebar-button>a:before{filter:invert(100);} \ No newline at end of file diff --git a/static.files/scrape-examples-ef1e698c1d417c0c.js b/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 0000000..ba830e3 --- /dev/null +++ b/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/static.files/search-ef54e092fea9c776.js b/static.files/search-ef54e092fea9c776.js new file mode 100644 index 0000000..035d8e8 --- /dev/null +++ b/static.files/search-ef54e092fea9c776.js @@ -0,0 +1,5 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me}}(function(){const itemTypes=["keyword","primitive","mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","associatedtype","constant","associatedconstant","union","foreigntype","existential","attr","derive","traitalias","generic",];const longItemTypes=["keyword","primitive type","module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","assoc type","constant","assoc const","union","foreign type","existential type","attribute macro","derive macro","trait alias",];const TY_GENERIC=itemTypes.indexOf("generic");const TY_IMPORT=itemTypes.indexOf("import");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";const UNBOXING_LIMIT=5;const REGEX_IDENT=/\p{ID_Start}\p{ID_Continue}*|_\p{ID_Continue}+/uy;const REGEX_INVALID_TYPE_FILTER=/[^a-z]/ui;function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost,);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1,)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let searchIndexDeprecated;let searchIndexEmptyDesc;let functionTypeFingerprint;let currentResults;const typeNameIdMap=new Map();const ALIASES=new Map();const typeNameIdOfArray=buildTypeMapIndex("array");const typeNameIdOfSlice=buildTypeMapIndex("slice");const typeNameIdOfArrayOrSlice=buildTypeMapIndex("[]");const typeNameIdOfTuple=buildTypeMapIndex("tuple");const typeNameIdOfUnit=buildTypeMapIndex("unit");const typeNameIdOfTupleOrUnit=buildTypeMapIndex("()");const typeNameIdOfFn=buildTypeMapIndex("fn");const typeNameIdOfFnMut=buildTypeMapIndex("fnmut");const typeNameIdOfFnOnce=buildTypeMapIndex("fnonce");const typeNameIdOfHof=buildTypeMapIndex("->");function buildTypeMapIndex(name,isAssocType){if(name===""||name===null){return null}if(typeNameIdMap.has(name)){const obj=typeNameIdMap.get(name);obj.assocOnly=isAssocType&&obj.assocOnly;return obj.id}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,{id,assocOnly:isAssocType});return id}}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return"=,>-])".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function consumeIdent(parserState){REGEX_IDENT.lastIndex=parserState.pos;const match=parserState.userQuery.match(REGEX_IDENT);if(match){parserState.pos+=match[0].length;return true}return false}function isSeparatorCharacter(c){return c===","||c==="="}function isPathSeparator(c){return c===":"||c===" "}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(c!==" "){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}const bindingName=parserState.isInBinding;parserState.isInBinding=null;return makePrimitiveElement("never",{bindingName})}const quadcolon=/::\s*::/.exec(path);if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(quadcolon!==null){throw["Unexpected ",quadcolon[0]]}const pathSegments=path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}const bindingName=parserState.isInBinding;parserState.isInBinding=null;const bindings=new Map();const pathLast=pathSegments[pathSegments.length-1];return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast,normalizedPathLast:pathLast.replace(/_/g,""),generics:generics.filter(gen=>{if(gen.bindingName!==null){if(gen.name!==null){gen.bindingName.generics.unshift(gen)}bindings.set(gen.bindingName.name,gen.bindingName.generics);return false}return true}),bindings,typeFilter,bindingName,}}function getIdentEndPosition(parserState){let afterIdent=consumeIdent(parserState);let end=parserState.pos;let macroExclamation=-1;while(parserState.pos0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]," (not a valid identifier)"]}else{throw["Unexpected ",c," (not a valid identifier)"]}parserState.pos+=1;afterIdent=consumeIdent(parserState);end=parserState.pos}if(macroExclamation!==-1){if(parserState.typeFilter===null){parserState.typeFilter="macro"}else if(parserState.typeFilter!=="macro"){throw["Invalid search type: macro ","!"," and ",parserState.typeFilter," both specified",]}end=macroExclamation}return end}function getFilteredNextElem(query,parserState,elems,isInGenerics){const start=parserState.pos;if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){throw["Expected type filter before ",":"]}getNextElem(query,parserState,elems,isInGenerics);if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}if(elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;getNextElem(query,parserState,elems,isInGenerics)}}function getNextElem(query,parserState,elems,isInGenerics){const generics=[];skipWhitespace(parserState);let start=parserState.pos;let end;if("[(".indexOf(parserState.userQuery[parserState.pos])!==-1){let endChar=")";let name="()";let friendlyName="tuple";if(parserState.userQuery[parserState.pos]==="["){endChar="]";name="[]";friendlyName="slice"}parserState.pos+=1;const{foundSeparator}=getItemsBefore(query,parserState,generics,endChar);const typeFilter=parserState.typeFilter;const bindingName=parserState.isInBinding;parserState.typeFilter=null;parserState.isInBinding=null;for(const gen of generics){if(gen.bindingName!==null){throw["Type parameter ","=",` cannot be within ${friendlyName} `,name]}}if(name==="()"&&!foundSeparator&&generics.length===1&&typeFilter===null){elems.push(generics[0])}else if(name==="()"&&generics.length===1&&generics[0].name==="->"){generics[0].typeFilter=typeFilter;elems.push(generics[0])}else{if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive ",name," and ",typeFilter," both specified",]}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}elems.push(makePrimitiveElement(name,{bindingName,generics}))}}else if(parserState.userQuery[parserState.pos]==="&"){if(parserState.typeFilter!==null&&parserState.typeFilter!=="primitive"){throw["Invalid search type: primitive ","&"," and ",parserState.typeFilter," both specified",]}parserState.typeFilter=null;parserState.pos+=1;let c=parserState.userQuery[parserState.pos];while(c===" "&&parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}else if(parserState.pos=end){throw["Found generics without a path"]}if(parserState.isInBinding){throw["Unexpected ","("," after ","="]}parserState.pos+=1;const typeFilter=parserState.typeFilter;parserState.typeFilter=null;getItemsBefore(query,parserState,generics,")");skipWhitespace(parserState);if(isReturnArrow(parserState)){parserState.pos+=2;skipWhitespace(parserState);getFilteredNextElem(query,parserState,generics,isInGenerics);generics[generics.length-1].bindingName=makePrimitiveElement("output")}else{generics.push(makePrimitiveElement(null,{bindingName:makePrimitiveElement("output"),typeFilter:null,}))}parserState.typeFilter=typeFilter}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}if(parserState.userQuery[parserState.pos]==="="){if(parserState.isInBinding){throw["Cannot write ","="," twice in a binding"]}if(!isInGenerics){throw["Type parameter ","="," must be within generics list"]}const name=parserState.userQuery.slice(start,end).trim();if(name==="!"){throw["Type parameter ","="," key cannot be ","!"," never type"]}if(name.includes("!")){throw["Type parameter ","="," key cannot be ","!"," macro"]}if(name.includes("::")){throw["Type parameter ","="," key cannot contain ","::"," path"]}if(name.includes(":")){throw["Type parameter ","="," key cannot contain ",":"," type"]}parserState.isInBinding={name,generics}}else{elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics,),)}}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let foundSeparator=false;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;const oldIsInBinding=parserState.isInBinding;parserState.isInBinding=null;let hofParameters=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===")"){extra="("}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"," after ","="]}hofParameters=[...elems];elems.length=0;parserState.pos+=2;foundStopChar=true;foundSeparator=false;continue}else if(c===" "){parserState.pos+=1;continue}else if(isSeparatorCharacter(c)){parserState.pos+=1;foundStopChar=true;foundSeparator=true;continue}else if(c===":"&&isPathStart(parserState)){throw["Unexpected ","::",": paths cannot start with ","::"]}else if(isEndCharacter(c)){throw["Unexpected ",c," after ",extra]}if(!foundStopChar){let extra=[];if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",",",", ","=",", or ",endChar,...extra,", found ",c,]}throw["Expected ",","," or ","=",...extra,", found ",c,]}const posBefore=parserState.pos;getFilteredNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;if(hofParameters){foundSeparator=false;if([...elems,...hofParameters].some(x=>x.bindingName)||parserState.isInBinding){throw["Unexpected ","="," within ","->"]}const hofElem=makePrimitiveElement("->",{generics:hofParameters,bindings:new Map([["output",[...elems]]]),typeFilter:null,});elems.length=0;elems[0]=hofElem}parserState.typeFilter=oldTypeFilter;parserState.isInBinding=oldIsInBinding;return{foundSeparator}}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();const match=query.match(REGEX_INVALID_TYPE_FILTER);if(match){throw["Unexpected ",match[0]," in type filter (before ",":",")",]}}function parseInput(query,parserState){let foundStopChar=true;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}else if(parserState.pos>0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]]}throw["Unexpected ",c]}else if(c===" "){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;getFilteredNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,typeFingerprint:new Uint32Array(4),}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&rawSearchIndex.has(elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}for(const constraints of elem.bindings.values()){for(const constraint of constraints){convertTypeFilterOnElem(constraint)}}}userQuery=userQuery.trim().replace(/\r|\n|\t/g," ");const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,isInBinding:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}async function execQuery(parsedQuery,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=res[2]+"|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}if(obj.ty===TY_IMPORT&&duplicates.has(res[2])){continue}if(duplicates.has(res[2]+"|"+TY_IMPORT)){continue}duplicates.add(obj.fullPath);duplicates.add(res[2]);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}async function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.item=searchIndex[result.id];result.word=searchIndex[result.id].word;result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=searchIndexDeprecated.get(aaa.item.crate).contains(aaa.item.bitIndex);b=searchIndexDeprecated.get(bbb.item.crate).contains(bbb.item.bitIndex);if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=searchIndexEmptyDesc.get(aaa.item.crate).contains(aaa.item.bitIndex);b=searchIndexEmptyDesc.get(bbb.item.crate).contains(bbb.item.bitIndex);if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});return transformResults(result_list)}function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb,unboxingDepth,){if(unboxingDepth>=UNBOXING_LIMIT){return false}const mgens=mgensIn===null?null:new Map(mgensIn);if(queryElems.length===0){return!solutionCb||solutionCb(mgens)}if(!fnTypesIn||fnTypesIn.length===0){return false}const ql=queryElems.length;const fl=fnTypesIn.length;if(ql===1&&queryElems[0].generics.length===0&&queryElems[0].bindings.size===0){const queryElem=queryElems[0];for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue}if(fnType.id<0&&queryElem.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,queryElem.id);if(!solutionCb||solutionCb(mgensScratch)){return true}}else if(!solutionCb||solutionCb(mgens?new Map(mgens):null)){return true}}for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1,)){continue}if(fnType.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,0);if(unifyFunctionTypes(whereClause[(-fnType.id)-1],queryElems,whereClause,mgensScratch,solutionCb,unboxingDepth+1,)){return true}}else if(unifyFunctionTypes([...fnType.generics,...Array.from(fnType.bindings.values()).flat()],queryElems,whereClause,mgens?new Map(mgens):null,solutionCb,unboxingDepth+1,)){return true}}return false}const fnTypes=fnTypesIn.slice();const flast=fl-1;const qlast=ql-1;const queryElem=queryElems[qlast];let queryElemsTmp=null;for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==queryElem.id){continue}mgensScratch.set(fnType.id,queryElem.id)}else{mgensScratch=mgens}fnTypes[i]=fnTypes[flast];fnTypes.length=flast;if(!queryElemsTmp){queryElemsTmp=queryElems.slice(0,qlast)}const passesUnification=unifyFunctionTypes(fnTypes,queryElemsTmp,whereClause,mgensScratch,mgensScratch=>{if(fnType.generics.length===0&&queryElem.generics.length===0&&fnType.bindings.size===0&&queryElem.bindings.size===0){return!solutionCb||solutionCb(mgensScratch)}const solution=unifyFunctionTypeCheckBindings(fnType,queryElem,whereClause,mgensScratch,unboxingDepth,);if(!solution){return false}const simplifiedGenerics=solution.simplifiedGenerics;for(const simplifiedMgens of solution.mgens){const passesUnification=unifyFunctionTypes(simplifiedGenerics,queryElem.generics,whereClause,simplifiedMgens,solutionCb,unboxingDepth,);if(passesUnification){return true}}return false},unboxingDepth,);if(passesUnification){return true}fnTypes[flast]=fnTypes[i];fnTypes[i]=fnType;fnTypes.length=fl}for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1,)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==0){continue}mgensScratch.set(fnType.id,0)}else{mgensScratch=mgens}const generics=fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;const bindings=fnType.bindings?Array.from(fnType.bindings.values()).flat():[];const passesUnification=unifyFunctionTypes(fnTypes.toSpliced(i,1,...generics,...bindings),queryElems,whereClause,mgensScratch,solutionCb,unboxingDepth+1,);if(passesUnification){return true}}return false}function unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgensIn){if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false}if(fnType.id<0&&queryElem.id<0){if(mgensIn){if(mgensIn.has(fnType.id)&&mgensIn.get(fnType.id)!==queryElem.id){return false}for(const[fid,qid]of mgensIn.entries()){if(fnType.id!==fid&&queryElem.id===qid){return false}if(fnType.id===fid&&queryElem.id!==qid){return false}}}return true}else{if(queryElem.id===typeNameIdOfArrayOrSlice&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)){}else if(queryElem.id===typeNameIdOfTupleOrUnit&&(fnType.id===typeNameIdOfTuple||fnType.id===typeNameIdOfUnit)){}else if(queryElem.id===typeNameIdOfHof&&(fnType.id===typeNameIdOfFn||fnType.id===typeNameIdOfFnMut||fnType.id===typeNameIdOfFnOnce)){}else if(fnType.id!==queryElem.id||queryElem.id===null){return false}if((fnType.generics.length+fnType.bindings.size)===0&&queryElem.generics.length!==0){return false}if(fnType.bindings.size0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break}}}if(i0){let mgensSolutionSet=[mgensIn];for(const[name,constraints]of queryElem.bindings.entries()){if(mgensSolutionSet.length===0){return false}if(!fnType.bindings.has(name)){return false}const fnTypeBindings=fnType.bindings.get(name);mgensSolutionSet=mgensSolutionSet.flatMap(mgens=>{const newSolutions=[];unifyFunctionTypes(fnTypeBindings,constraints,whereClause,mgens,newMgens=>{newSolutions.push(newMgens);return false},unboxingDepth,);return newSolutions})}if(mgensSolutionSet.length===0){return false}const binds=Array.from(fnType.bindings.entries()).flatMap(entry=>{const[name,constraints]=entry;if(queryElem.bindings.has(name)){return[]}else{return constraints}});if(simplifiedGenerics.length>0){simplifiedGenerics=[...simplifiedGenerics,...binds]}else{simplifiedGenerics=binds}return{simplifiedGenerics,mgens:mgensSolutionSet}}return{simplifiedGenerics,mgens:[mgensIn]}}function unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth,){if(unboxingDepth>=UNBOXING_LIMIT){return false}if(fnType.id<0&&queryElem.id>=0){if(!whereClause){return false}if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){return false}const mgensTmp=new Map(mgens);mgensTmp.set(fnType.id,null);return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause,mgensTmp,unboxingDepth,)}else if(fnType.generics.length>0||fnType.bindings.size>0){const simplifiedGenerics=[...fnType.generics,...Array.from(fnType.bindings.values()).flat(),];return checkIfInList(simplifiedGenerics,queryElem,whereClause,mgens,unboxingDepth,)}return false}function checkIfInList(list,elem,whereClause,mgens,unboxingDepth){for(const entry of list){if(checkType(entry,elem,whereClause,mgens,unboxingDepth)){return true}}return false}function checkType(row,elem,whereClause,mgens,unboxingDepth){if(unboxingDepth>=UNBOXING_LIMIT){return false}if(row.bindings.size===0&&elem.bindings.size===0){if(elem.id<0&&mgens===null){return row.id<0||checkIfInList(row.generics,elem,whereClause,mgens,unboxingDepth+1,)}if(row.id>0&&elem.id>0&&elem.pathWithoutLast.length===0&&typePassesFilter(elem.typeFilter,row.ty)&&elem.generics.length===0&&elem.id!==typeNameIdOfArrayOrSlice&&elem.id!==typeNameIdOfTupleOrUnit&&elem.id!==typeNameIdOfHof){return row.id===elem.id||checkIfInList(row.generics,elem,whereClause,mgens,unboxingDepth,)}}return unifyFunctionTypes([row],[elem],whereClause,mgens,null,unboxingDepth)}function checkPath(contains,ty){if(contains.length===0){return 0}const maxPathEditDistance=Math.floor(contains.reduce((acc,next)=>acc+next.length,0)/3,);let ret_dist=maxPathEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;pathiter:for(let i=length-clength;i>=0;i-=1){let dist_total=0;for(let x=0;xmaxPathEditDistance){continue pathiter}dist_total+=dist}}ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}return ret_dist>maxPathEditDistance?null:ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,descShard:item.descShard,descIndex:item.descIndex,exactPath:item.exactPath,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,bitIndex:item.bitIndex,implDisambiguator:item.implDisambiguator,}}async function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{return searchIndexEmptyDesc.get(alias.crate).contains(alias.bitIndex)?"":searchState.loadDesc(alias)};const[crateDescs,descs]=await Promise.all([Promise.all(crateAliases.map(fetchDesc)),Promise.all(aliases.map(fetchDesc)),]);const pushFunc=alias=>{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach((alias,i)=>{alias.desc=descs[i]});aliases.forEach(pushFunc);crateAliases.forEach((alias,i)=>{alias.desc=crateDescs[i]});crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){if(dist<=maxEditDistance||index!==-1){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance,){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let path_dist=0;const fullId=row.id;const tfpDist=compareTypeFingerprints(fullId,parsedQuery.typeFingerprint,);if(tfpDist!==null){const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem,row.type.where_clause,null,0);const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem,row.type.where_clause,null,0);if(in_args){results_in_args.max_dist=Math.max(results_in_args.max_dist||0,tfpDist);const maxDist=results_in_args.sizenormalizedIndex&&normalizedIndex!==-1)){index=normalizedIndex}if(elem.fullPath.length>1){path_dist=checkPath(elem.pathWithoutLast,row);if(path_dist===null){return}}if(parsedQuery.literalSearch){if(row.word===elem.pathLast){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(row.normalizedName,elem.normalizedPathLast,maxEditDistance);if(index===-1&&dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}const tfpDist=compareTypeFingerprints(row.id,parsedQuery.typeFingerprint,);if(tfpDist===null){return}if(results.size>=MAX_RESULTS&&tfpDist>results.max_dist){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems,row.type.where_clause,null,mgens=>{return unifyFunctionTypes(row.type.output,parsedQuery.returned,row.type.where_clause,mgens,null,0,)},0,)){return}results.max_dist=Math.max(results.max_dist||0,tfpDist);addIntoResults(results,row.id,pos,0,tfpDist,0,Number.MAX_VALUE)}function innerRunQuery(){const queryLen=parsedQuery.elems.reduce((acc,next)=>acc+next.pathLast.length,0)+parsedQuery.returned.reduce((acc,next)=>acc+next.pathLast.length,0);const maxEditDistance=Math.floor(queryLen/3);const genericSymbols=new Map();function convertNameToId(elem,isAssocType){const loweredName=elem.pathLast.toLowerCase();if(typeNameIdMap.has(loweredName)&&(isAssocType||!typeNameIdMap.get(loweredName).assocOnly)){elem.id=typeNameIdMap.get(loweredName).id}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,{id,assocOnly}]of typeNameIdMap){const dist=Math.min(editDistance(name,loweredName,maxEditDistance),editDistance(name,elem.normalizedPathLast,maxEditDistance),);if(dist<=matchDist&&dist<=maxEditDistance&&(isAssocType||!assocOnly)){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==null){parsedQuery.correction=matchName}elem.id=match}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0&&elem.bindings.size===0)||elem.typeFilter===TY_GENERIC){if(genericSymbols.has(elem.name)){elem.id=genericSymbols.get(elem.name)}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.name,elem.id)}if(elem.typeFilter===-1&&elem.name.length>=3){const maxPartDistance=Math.floor(elem.name.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of typeNameIdMap.keys()){const dist=editDistance(name,elem.name,maxPartDistance);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue}matchDist=dist;matchName=name}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName}}elem.typeFilter=TY_GENERIC}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",]}for(const elem2 of elem.generics){convertNameToId(elem2)}elem.bindings=new Map(Array.from(elem.bindings.entries()).map(entry=>{const[name,constraints]=entry;if(!typeNameIdMap.has(name)){parsedQuery.error=["Type parameter ",name," does not exist",];return[null,[]]}for(const elem2 of constraints){convertNameToId(elem2)}return[typeNameIdMap.get(name).id,constraints]}),)}const fps=new Set();for(const elem of parsedQuery.elems){convertNameToId(elem);buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint,fps)}for(const elem of parsedQuery.returned){convertNameToId(elem);buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint,fps)}if(parsedQuery.foundElems===1&&parsedQuery.returned.length===0){if(parsedQuery.elems.length===1){const elem=parsedQuery.elems[0];for(let i=0,nSearchIndex=searchIndex.length;i0){const sortQ=(a,b)=>{const ag=a.generics.length===0&&a.bindings.size===0;const bg=b.generics.length===0&&b.bindings.size===0;if(ag!==bg){return ag-bg}const ai=a.id>0;const bi=b.id>0;return ai-bi};parsedQuery.elems.sort(sortQ);parsedQuery.returned.sort(sortQ);for(let i=0,nSearchIndex=searchIndex.length;i{const descs=await Promise.all(list.map(result=>{return searchIndexEmptyDesc.get(result.crate).contains(result.bitIndex)?"":searchState.loadDesc(result)}));for(const[i,result]of list.entries()){result.desc=descs[i]}}));if(parsedQuery.error!==null&&ret.others.length!==0){ret.query.error=null}return ret}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;let exactPath=item.exactPath;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor=type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;exactPath=`${myparent.exactPath}::${myparent.name}`;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}if(item.implDisambiguator!==null){anchor=item.implDisambiguator+"/"+anchor}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html#"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href,`${exactPath}::${name}`]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}async function addTab(array,query,display){const extraClass=display?" active":"";const output=document.createElement("div");if(array.length>0){output.className="search-results "+extraClass;for(const item of array){const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
\ +${item.alias} - see \ +
`}resultName.insertAdjacentHTML("beforeend",`
${alias}\ +${item.displayPath}${name}\ +
`);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)}}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,array.length]}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return""}return""}async function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const[ret_others,ret_in_args,ret_returned]=await Promise.all([addTab(results.others,results.query,true),addTab(results.in_args,results.query,false),addTab(results.returned,results.query,false),]);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";if(rawSearchIndex.size>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

"+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

`}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}async function search(forced){const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="\""+query.original+"\" Search - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));await showResults(await execQuery(query,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){return types.length>0?types.map(type=>buildItemSearchType(type,lowercasePaths)):EMPTY_GENERICS_ARRAY}const EMPTY_BINDINGS_MAP=new Map();const EMPTY_GENERICS_ARRAY=[];let TYPES_POOL=new Map();function buildItemSearchType(type,lowercasePaths,isAssocType){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;const BINDINGS_DATA=2;let pathIndex,generics,bindings;if(typeof type==="number"){pathIndex=type;generics=EMPTY_GENERICS_ARRAY;bindings=EMPTY_BINDINGS_MAP}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths,);if(type.length>BINDINGS_DATA&&type[BINDINGS_DATA].length>0){bindings=new Map(type[BINDINGS_DATA].map(binding=>{const[assocType,constraints]=binding;return[buildItemSearchType(assocType,lowercasePaths,true).id,buildItemSearchTypeAll(constraints,lowercasePaths),]}))}else{bindings=EMPTY_BINDINGS_MAP}}let result;if(pathIndex<0){result={id:pathIndex,ty:TY_GENERIC,path:null,exactPath:null,generics,bindings,}}else if(pathIndex===0){result={id:null,ty:null,path:null,exactPath:null,generics,bindings,}}else{const item=lowercasePaths[pathIndex-1];result={id:buildTypeMapIndex(item.name,isAssocType),ty:item.ty,path:item.path,exactPath:item.exactPath,generics,bindings,}}const cr=TYPES_POOL.get(result.id);if(cr){if(cr.generics.length===result.generics.length&&cr.generics!==result.generics&&cr.generics.every((x,i)=>result.generics[i]===x)){result.generics=cr.generics}if(cr.bindings.size===result.bindings.size&&cr.bindings!==result.bindings){let ok=true;for(const[k,v]of cr.bindings.entries()){const v2=result.bindings.get(v);if(!v2){ok=false;break}if(v!==v2&&v.length===v2.length&&v.every((x,i)=>v2[i]===x)){result.bindings.set(k,v)}else if(v!==v2){ok=false;break}}if(ok){result.bindings=cr.bindings}}if(cr.ty===result.ty&&cr.path===result.path&&cr.bindings===result.bindings&&cr.generics===result.generics&&cr.ty===result.ty){return cr}}TYPES_POOL.set(result.id,result);return result}function buildFunctionSearchTypeCallback(lowercasePaths){return functionSearchType=>{if(functionSearchType===0){return null}const INPUTS_DATA=0;const OUTPUT_DATA=1;let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[buildItemSearchType(functionSearchType[INPUTS_DATA],lowercasePaths)]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths,)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[buildItemSearchType(functionSearchType[OUTPUT_DATA],lowercasePaths)]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths,)}}else{output=[]}const where_clause=[];const l=functionSearchType.length;for(let i=2;i{k=(~~k+0x7ed55d16)+(k<<12);k=(k ^ 0xc761c23c)^(k>>>19);k=(~~k+0x165667b1)+(k<<5);k=(~~k+0xd3a2646c)^(k<<9);k=(~~k+0xfd7046c5)+(k<<3);return(k ^ 0xb55a4f09)^(k>>>16)};const hashint2=k=>{k=~k+(k<<15);k ^=k>>>12;k+=k<<2;k ^=k>>>4;k=Math.imul(k,2057);return k ^(k>>16)};if(input!==null){const h0a=hashint1(input);const h0b=hashint2(input);const h1a=~~(h0a+Math.imul(h0b,2));const h1b=~~(h0a+Math.imul(h0b,3));const h2a=~~(h0a+Math.imul(h0b,4));const h2b=~~(h0a+Math.imul(h0b,5));output[0]|=(1<<(h0a%32))|(1<<(h1b%32));output[1]|=(1<<(h1a%32))|(1<<(h2b%32));output[2]|=(1<<(h2a%32))|(1<<(h0b%32));fps.add(input)}for(const g of type.generics){buildFunctionTypeFingerprint(g,output,fps)}const fb={id:null,ty:0,generics:EMPTY_GENERICS_ARRAY,bindings:EMPTY_BINDINGS_MAP,};for(const[k,v]of type.bindings.entries()){fb.id=k;fb.generics=v;buildFunctionTypeFingerprint(fb,output,fps)}output[3]=fps.size}function compareTypeFingerprints(fullId,queryFingerprint){const fh0=functionTypeFingerprint[fullId*4];const fh1=functionTypeFingerprint[(fullId*4)+1];const fh2=functionTypeFingerprint[(fullId*4)+2];const[qh0,qh1,qh2]=queryFingerprint;const[in0,in1,in2]=[fh0&qh0,fh1&qh1,fh2&qh2];if((in0 ^ qh0)||(in1 ^ qh1)||(in2 ^ qh2)){return null}return functionTypeFingerprint[(fullId*4)+3]}class VlqHexDecoder{constructor(string,cons){this.string=string;this.cons=cons;this.offset=0;this.backrefQueue=[]}decodeList(){let c=this.string.charCodeAt(this.offset);const ret=[];while(c!==125){ret.push(this.decode());c=this.string.charCodeAt(this.offset)}this.offset+=1;return ret}decode(){let n=0;let c=this.string.charCodeAt(this.offset);if(c===123){this.offset+=1;return this.decodeList()}while(c<96){n=(n<<4)|(c&0xF);this.offset+=1;c=this.string.charCodeAt(this.offset)}n=(n<<4)|(c&0xF);const[sign,value]=[n&1,n>>1];this.offset+=1;return sign?-value:value}next(){const c=this.string.charCodeAt(this.offset);if(c>=48&&c<64){this.offset+=1;return this.backrefQueue[c-48]}if(c===96){this.offset+=1;return this.cons(0)}const result=this.cons(this.decode());this.backrefQueue.unshift(result);if(this.backrefQueue.length>16){this.backrefQueue.pop()}return result}}class RoaringBitmap{constructor(str){const strdecoded=atob(str);const u8array=new Uint8Array(strdecoded.length);for(let j=0;j=4){offsets=[];for(let j=0;j>3]&(1<<(j&0x7))){const runcount=(u8array[i]|(u8array[i+1]<<8));i+=2;this.containers.push(new RoaringBitmapRun(runcount,u8array.slice(i,i+(runcount*4)),));i+=runcount*4}else if(this.cardinalities[j]>=4096){this.containers.push(new RoaringBitmapBits(u8array.slice(i,i+8192)));i+=8192}else{const end=this.cardinalities[j]*2;this.containers.push(new RoaringBitmapArray(this.cardinalities[j],u8array.slice(i,i+end),));i+=end}}}contains(keyvalue){const key=keyvalue>>16;const value=keyvalue&0xFFFF;for(let i=0;i=start&&value<=(start+lenm1)){return true}}return false}}class RoaringBitmapArray{constructor(cardinality,array){this.cardinality=cardinality;this.array=array}contains(value){const l=this.cardinality*2;for(let i=0;i>3]&(1<<(value&7)))}}function buildIndex(rawSearchIndex){searchIndex=[];searchIndexDeprecated=new Map();searchIndexEmptyDesc=new Map();let currentIndex=0;let id=0;for(const crate of rawSearchIndex.values()){id+=crate.t.length+1}functionTypeFingerprint=new Uint32Array((id+1)*4);id=0;for(const[crate,crateCorpus]of rawSearchIndex){const itemDescShardDecoder=new VlqHexDecoder(crateCorpus.D,noop=>noop);let descShard={crate,shard:0,start:0,len:itemDescShardDecoder.next(),promise:null,resolve:null,};const descShardList=[descShard];searchIndexDeprecated.set(crate,new RoaringBitmap(crateCorpus.c));searchIndexEmptyDesc.set(crate,new RoaringBitmap(crateCorpus.e));let descIndex=0;const crateRow={crate,ty:3,name:crate,path:"",descShard,descIndex,exactPath:"",desc:crateCorpus.doc,parent:undefined,type:null,id,word:crate,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),bitIndex:0,implDisambiguator:null,};id+=1;searchIndex.push(crateRow);currentIndex+=1;if(!searchIndexEmptyDesc.get(crate).contains(0)){descIndex+=1}const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=new Map(crateCorpus.q);const itemReexports=new Map(crateCorpus.r);const itemParentIdxs=crateCorpus.i;const implDisambiguator=new Map(crateCorpus.b);const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];const itemFunctionDecoder=new VlqHexDecoder(crateCorpus.f,buildFunctionSearchTypeCallback(lowercasePaths),);let len=paths.length;let lastPath=itemPaths.get(0);for(let i=0;i2){path=itemPaths.has(elem[2])?itemPaths.get(elem[2]):lastPath;lastPath=path}const exactPath=elem.length>3?itemPaths.get(elem[3]):path;lowercasePaths.push({ty,name:name.toLowerCase(),path,exactPath});paths[i]={ty,name,path,exactPath}}lastPath="";len=itemTypes.length;for(let i=0;i=descShard.len&&!searchIndexEmptyDesc.get(crate).contains(bitIndex)){descShard={crate,shard:descShard.shard+1,start:descShard.start+descShard.len,len:itemDescShardDecoder.next(),promise:null,resolve:null,};descIndex=0;descShardList.push(descShard)}let word="";if(typeof itemNames[i]==="string"){word=itemNames[i].toLowerCase()}const path=itemPaths.has(i)?itemPaths.get(i):lastPath;const type=itemFunctionDecoder.next();if(type!==null){if(type){const fp=functionTypeFingerprint.subarray(id*4,(id+1)*4);const fps=new Set();for(const t of type.inputs){buildFunctionTypeFingerprint(t,fp,fps)}for(const t of type.output){buildFunctionTypeFingerprint(t,fp,fps)}for(const w of type.where_clause){for(const t of w){buildFunctionTypeFingerprint(t,fp,fps)}}}}const row={crate,ty:itemTypes.charCodeAt(i)-65,name:itemNames[i],path,descShard,descIndex,exactPath:itemReexports.has(i)?itemPaths.get(itemReexports.get(i)):path,parent:itemParentIdxs[i]>0?paths[itemParentIdxs[i]-1]:undefined,type,id,word,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),bitIndex,implDisambiguator:implDisambiguator.has(i)?implDisambiguator.get(i):null,};id+=1;searchIndex.push(row);lastPath=row.path;if(!searchIndexEmptyDesc.get(crate).contains(bitIndex)){descIndex+=1}}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!Object.prototype.hasOwnProperty.call(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=itemTypes.length;searchState.descShards.set(crate,descShardList)}TYPES_POOL=new Map()}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;e.preventDefault();search()}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(true)}buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch(new Map())}})() \ No newline at end of file diff --git a/static.files/settings-4313503d2e1961c2.js b/static.files/settings-4313503d2e1961c2.js new file mode 100644 index 0000000..ab425fe --- /dev/null +++ b/static.files/settings-4313503d2e1961c2.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break;case"hide-sidebar":if(value===true){addClass(document.documentElement,"hide-sidebar")}else{removeClass(document.documentElement,"hide-sidebar")}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Hide persistent navigation bar","js_name":"hide-sidebar","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display="";onEachLazy(settingsMenu.querySelectorAll("input[type='checkbox']"),el=>{const val=getSettingValue(el.id);const checked=val==="true";if(checked!==el.checked&&val!==null){el.checked=checked}})}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=event=>{event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=event=>{if(settingsMenu.contains(event.target)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/static.files/src-script-e66d777a5a92e9b2.js b/static.files/src-script-e66d777a5a92e9b2.js new file mode 100644 index 0000000..d0aebb8 --- /dev/null +++ b/static.files/src-script-e66d777a5a92e9b2.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth{removeClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","false")};window.rustdocShowSourceSidebar=()=>{addClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","true")};window.rustdocToggleSrcSidebar=()=>{if(document.documentElement.classList.contains("src-sidebar-expanded")){window.rustdocCloseSourceSidebar()}else{window.rustdocShowSourceSidebar()}};function createSrcSidebar(){const container=document.querySelector("nav.sidebar");const sidebar=document.createElement("div");sidebar.id="src-sidebar";let hasFoundFile=false;for(const[key,source]of srcIndex){source[NAME_OFFSET]=key;hasFoundFile=createDirEntry(source,sidebar,"",hasFoundFile)}container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}function highlightSrcLines(){const match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSrcLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",highlightSrcLines);onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSrcHighlight)});highlightSrcLines();window.createSrcSidebar=createSrcSidebar})() \ No newline at end of file diff --git a/static.files/storage-118b08c4c78b968e.js b/static.files/storage-118b08c4c78b968e.js new file mode 100644 index 0000000..9818946 --- /dev/null +++ b/static.files/storage-118b08c4c78b968e.js @@ -0,0 +1,24 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func){for(const elem of arr){if(func(elem)){return true}}return false}function onEachLazy(lazyArray,func){return onEach(Array.prototype.slice.call(lazyArray),func)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){const themeNames=getVar("themes").split(",").filter(t=>t);themeNames.push(...builtinThemes);if(themeNames.indexOf(newThemeName)===-1){return}if(saveTheme){updateLocalStorage("theme",newThemeName)}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null}}else{const newHref=getVar("root-path")+encodeURIComponent(newThemeName)+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme)}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded")}if(getSettingValue("hide-sidebar")==="true"){addClass(document.documentElement,"hide-sidebar")}function updateSidebarWidth(){const desktopSidebarWidth=getSettingValue("desktop-sidebar-width");if(desktopSidebarWidth&&desktopSidebarWidth!=="null"){document.documentElement.style.setProperty("--desktop-sidebar-width",desktopSidebarWidth+"px",)}const srcSidebarWidth=getSettingValue("src-sidebar-width");if(srcSidebarWidth&&srcSidebarWidth!=="null"){document.documentElement.style.setProperty("--src-sidebar-width",srcSidebarWidth+"px",)}}updateSidebarWidth();window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0);setTimeout(updateSidebarWidth,0)}});class RustdocSearchElement extends HTMLElement{constructor(){super()}connectedCallback(){const rootPath=getVar("root-path");const currentCrate=getVar("current-crate");this.innerHTML=``}}window.customElements.define("rustdoc-search",RustdocSearchElement) \ No newline at end of file diff --git a/trait.impl/core/clone/trait.Clone.js b/trait.impl/core/clone/trait.Clone.js new file mode 100644 index 0000000..6c6b1b9 --- /dev/null +++ b/trait.impl/core/clone/trait.Clone.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Clone for AnyDestination"],["impl Clone for AnySource"],["impl Clone for RegisterOrImmediate"],["impl Clone for Predicate"],["impl Clone for Box<Stack>"],["impl Clone for AbsoluteStack"],["impl Clone for AdvanceStackPointer"],["impl Clone for CodePage"],["impl Clone for Immediate1"],["impl Clone for Immediate2"],["impl Clone for Register"],["impl Clone for Register1"],["impl Clone for Register2"],["impl Clone for RegisterAndImmediate"],["impl Clone for RelativeStack"],["impl Clone for ModeRequirements"],["impl Clone for Settings"],["impl Clone for Snapshot"],["impl<T, W> Clone for Program<T, W>"]], +"zksync_vm2_interface":[["impl Clone for CallingMode"],["impl Clone for CycleStats"],["impl Clone for Opcode"],["impl Clone for ReturnType"],["impl Clone for Event"],["impl Clone for Flags"],["impl Clone for HeapId"],["impl Clone for L2ToL1Log"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.Eq.js b/trait.impl/core/cmp/trait.Eq.js new file mode 100644 index 0000000..ef3c5b5 --- /dev/null +++ b/trait.impl/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2_interface":[["impl Eq for CallingMode"],["impl Eq for Opcode"],["impl Eq for ReturnType"],["impl Eq for Flags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.PartialEq.js b/trait.impl/core/cmp/trait.PartialEq.js new file mode 100644 index 0000000..4ad9e45 --- /dev/null +++ b/trait.impl/core/cmp/trait.PartialEq.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl PartialEq for ExecutionEnd"],["impl PartialEq for Snapshot"],["impl PartialEq for StorageChange"],["impl<T, W> PartialEq for Program<T, W>"]], +"zksync_vm2_interface":[["impl PartialEq for CallingMode"],["impl PartialEq for Opcode"],["impl PartialEq for ReturnType"],["impl PartialEq for Event"],["impl PartialEq for Flags"],["impl PartialEq for HeapId"],["impl PartialEq for L2ToL1Log"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/convert/trait.From.js b/trait.impl/core/convert/trait.From.js new file mode 100644 index 0000000..0c6c298 --- /dev/null +++ b/trait.impl/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[["impl From<&mut U256> for &mut FatPointer"],["impl From<AbsoluteStack> for AnyDestination"],["impl From<AbsoluteStack> for AnySource"],["impl From<AdvanceStackPointer> for AnyDestination"],["impl From<AdvanceStackPointer> for AnySource"],["impl From<CodePage> for AnySource"],["impl From<Immediate1> for AnySource"],["impl From<Immediate1> for RegisterOrImmediate"],["impl From<Register1> for AnyDestination"],["impl From<Register1> for AnySource"],["impl From<Register1> for RegisterOrImmediate"],["impl From<RelativeStack> for AnyDestination"],["impl From<RelativeStack> for AnySource"],["impl From<U256> for FatPointer"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/convert/trait.TryFrom.js b/trait.impl/core/convert/trait.TryFrom.js new file mode 100644 index 0000000..c592564 --- /dev/null +++ b/trait.impl/core/convert/trait.TryFrom.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[["impl TryFrom<AnySource> for RegisterOrImmediate"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/convert/trait.TryInto.js b/trait.impl/core/convert/trait.TryInto.js new file mode 100644 index 0000000..3fe88ef --- /dev/null +++ b/trait.impl/core/convert/trait.TryInto.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[["impl TryInto<AbsoluteStack> for AnyDestination"],["impl TryInto<AbsoluteStack> for AnySource"],["impl TryInto<AdvanceStackPointer> for AnyDestination"],["impl TryInto<AdvanceStackPointer> for AnySource"],["impl TryInto<CodePage> for AnySource"],["impl TryInto<Immediate1> for AnySource"],["impl TryInto<Immediate1> for RegisterOrImmediate"],["impl TryInto<Register1> for AnyDestination"],["impl TryInto<Register1> for AnySource"],["impl TryInto<Register1> for RegisterOrImmediate"],["impl TryInto<RelativeStack> for AnyDestination"],["impl TryInto<RelativeStack> for AnySource"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/default/trait.Default.js b/trait.impl/core/default/trait.Default.js new file mode 100644 index 0000000..01bf39b --- /dev/null +++ b/trait.impl/core/default/trait.Default.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Default for Predicate"],["impl Default for WorldDiff"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Debug.js b/trait.impl/core/fmt/trait.Debug.js new file mode 100644 index 0000000..044536d --- /dev/null +++ b/trait.impl/core/fmt/trait.Debug.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Debug for AnyDestination"],["impl Debug for AnySource"],["impl Debug for RegisterOrImmediate"],["impl Debug for ExecutionEnd"],["impl Debug for Predicate"],["impl Debug for AbsoluteStack"],["impl Debug for AdvanceStackPointer"],["impl Debug for Arguments"],["impl Debug for CodePage"],["impl Debug for Immediate1"],["impl Debug for Immediate2"],["impl Debug for NotRegisterOrImmediate"],["impl Debug for Register"],["impl Debug for Register1"],["impl Debug for Register2"],["impl Debug for RegisterAndImmediate"],["impl Debug for RelativeStack"],["impl Debug for FatPointer"],["impl Debug for ModeRequirements"],["impl Debug for Settings"],["impl Debug for Snapshot"],["impl Debug for StorageChange"],["impl Debug for WorldDiff"],["impl<T, W> Debug for Instruction<T, W>"],["impl<T, W> Debug for Program<T, W>"],["impl<T: Debug> Debug for TestWorld<T>"],["impl<T: Debug, W: Debug> Debug for VirtualMachine<T, W>"]], +"zksync_vm2_interface":[["impl Debug for CallingMode"],["impl Debug for CycleStats"],["impl Debug for Opcode"],["impl Debug for ReturnType"],["impl Debug for Add"],["impl Debug for And"],["impl Debug for AuxHeapRead"],["impl Debug for AuxHeapWrite"],["impl Debug for AuxMutating0"],["impl Debug for Caller"],["impl Debug for CodeAddress"],["impl Debug for ContextMeta"],["impl Debug for ContextU128"],["impl Debug for Decommit"],["impl Debug for Delegate"],["impl Debug for Div"],["impl Debug for ErgsLeft"],["impl Debug for Event"],["impl Debug for HeapRead"],["impl Debug for HeapWrite"],["impl Debug for IncrementTxNumber"],["impl Debug for Jump"],["impl Debug for L2ToL1Message"],["impl Debug for Mimic"],["impl Debug for Mul"],["impl Debug for NearCall"],["impl Debug for Nop"],["impl Debug for Normal"],["impl Debug for Or"],["impl Debug for Panic"],["impl Debug for PointerAdd"],["impl Debug for PointerPack"],["impl Debug for PointerRead"],["impl Debug for PointerShrink"],["impl Debug for PointerSub"],["impl Debug for PrecompileCall"],["impl Debug for Revert"],["impl Debug for RotateLeft"],["impl Debug for RotateRight"],["impl Debug for SP"],["impl Debug for SetContextU128"],["impl Debug for ShiftLeft"],["impl Debug for ShiftRight"],["impl Debug for StorageRead"],["impl Debug for StorageWrite"],["impl Debug for Sub"],["impl Debug for This"],["impl Debug for TransientStorageRead"],["impl Debug for TransientStorageWrite"],["impl Debug for Xor"],["impl Debug for Event"],["impl Debug for Flags"],["impl Debug for HeapId"],["impl Debug for L2ToL1Log"],["impl<M: Debug + TypeLevelCallingMode> Debug for FarCall<M>"],["impl<T: Debug + TypeLevelReturnType> Debug for Ret<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/hash/trait.Hash.js b/trait.impl/core/hash/trait.Hash.js new file mode 100644 index 0000000..e7ab5e2 --- /dev/null +++ b/trait.impl/core/hash/trait.Hash.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Hash for Predicate"]], +"zksync_vm2_interface":[["impl Hash for CallingMode"],["impl Hash for Opcode"],["impl Hash for ReturnType"],["impl Hash for Flags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Copy.js b/trait.impl/core/marker/trait.Copy.js new file mode 100644 index 0000000..da5fa61 --- /dev/null +++ b/trait.impl/core/marker/trait.Copy.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Copy for AnyDestination"],["impl Copy for AnySource"],["impl Copy for RegisterOrImmediate"],["impl Copy for Predicate"],["impl Copy for AbsoluteStack"],["impl Copy for AdvanceStackPointer"],["impl Copy for CodePage"],["impl Copy for Immediate1"],["impl Copy for Immediate2"],["impl Copy for Register"],["impl Copy for Register1"],["impl Copy for Register2"],["impl Copy for RegisterAndImmediate"],["impl Copy for RelativeStack"],["impl Copy for ModeRequirements"]], +"zksync_vm2_interface":[["impl Copy for CallingMode"],["impl Copy for CycleStats"],["impl Copy for Opcode"],["impl Copy for ReturnType"],["impl Copy for Event"],["impl Copy for Flags"],["impl Copy for HeapId"],["impl Copy for L2ToL1Log"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Freeze.js b/trait.impl/core/marker/trait.Freeze.js new file mode 100644 index 0000000..51328c8 --- /dev/null +++ b/trait.impl/core/marker/trait.Freeze.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Freeze for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl Freeze for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl Freeze for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl Freeze for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl Freeze for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl Freeze for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl Freeze for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl Freeze for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl Freeze for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl Freeze for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl Freeze for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl Freeze for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl Freeze for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl Freeze for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl Freeze for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl Freeze for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl Freeze for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl Freeze for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl Freeze for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl Freeze for Settings",1,["zksync_vm2::vm::Settings"]],["impl Freeze for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl Freeze for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl Freeze for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> Freeze for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> Freeze for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> Freeze for Program<T, W>",1,["zksync_vm2::program::Program"]],["impl<T, W> Freeze for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]]], +"zksync_vm2_interface":[["impl Freeze for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl Freeze for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl Freeze for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl Freeze for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl Freeze for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl Freeze for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl Freeze for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl Freeze for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl Freeze for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl Freeze for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl Freeze for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl Freeze for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl Freeze for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl Freeze for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl Freeze for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl Freeze for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl Freeze for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl Freeze for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl Freeze for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl Freeze for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl Freeze for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl Freeze for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl Freeze for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl Freeze for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl Freeze for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl Freeze for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl Freeze for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl Freeze for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl Freeze for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl Freeze for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl Freeze for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl Freeze for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl Freeze for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl Freeze for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl Freeze for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl Freeze for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl Freeze for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl Freeze for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl Freeze for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl Freeze for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl Freeze for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl Freeze for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl Freeze for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl Freeze for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl Freeze for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl Freeze for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl Freeze for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl Freeze for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl Freeze for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl Freeze for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl Freeze for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl Freeze for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl Freeze for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl Freeze for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> Freeze for FarCall<M>",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> Freeze for Ret<T>",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Send.js b/trait.impl/core/marker/trait.Send.js new file mode 100644 index 0000000..1856bb1 --- /dev/null +++ b/trait.impl/core/marker/trait.Send.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Send for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl Send for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl Send for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl Send for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl Send for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl Send for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl Send for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl Send for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl Send for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl Send for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl Send for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl Send for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl Send for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl Send for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl Send for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl Send for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl Send for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl Send for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl Send for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl Send for Settings",1,["zksync_vm2::vm::Settings"]],["impl Send for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl Send for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl Send for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> Send for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> !Send for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]],["impl<T, W> Send for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> Send for Program<T, W>",1,["zksync_vm2::program::Program"]]], +"zksync_vm2_interface":[["impl Send for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl Send for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl Send for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl Send for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl Send for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl Send for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl Send for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl Send for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl Send for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl Send for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl Send for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl Send for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl Send for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl Send for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl Send for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl Send for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl Send for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl Send for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl Send for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl Send for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl Send for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl Send for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl Send for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl Send for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl Send for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl Send for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl Send for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl Send for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl Send for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl Send for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl Send for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl Send for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl Send for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl Send for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl Send for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl Send for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl Send for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl Send for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl Send for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl Send for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl Send for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl Send for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl Send for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl Send for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl Send for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl Send for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl Send for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl Send for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl Send for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl Send for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl Send for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl Send for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl Send for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl Send for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> Send for FarCall<M>
where\n M: Send,
",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> Send for Ret<T>
where\n T: Send,
",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.StructuralPartialEq.js b/trait.impl/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 0000000..f9c354b --- /dev/null +++ b/trait.impl/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl StructuralPartialEq for ExecutionEnd"],["impl StructuralPartialEq for Snapshot"],["impl StructuralPartialEq for StorageChange"]], +"zksync_vm2_interface":[["impl StructuralPartialEq for CallingMode"],["impl StructuralPartialEq for Opcode"],["impl StructuralPartialEq for ReturnType"],["impl StructuralPartialEq for Event"],["impl StructuralPartialEq for Flags"],["impl StructuralPartialEq for HeapId"],["impl StructuralPartialEq for L2ToL1Log"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Sync.js b/trait.impl/core/marker/trait.Sync.js new file mode 100644 index 0000000..c8c7085 --- /dev/null +++ b/trait.impl/core/marker/trait.Sync.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Sync for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl Sync for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl Sync for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl Sync for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl Sync for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl Sync for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl Sync for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl Sync for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl Sync for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl Sync for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl Sync for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl Sync for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl Sync for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl Sync for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl Sync for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl Sync for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl Sync for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl Sync for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl Sync for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl Sync for Settings",1,["zksync_vm2::vm::Settings"]],["impl Sync for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl Sync for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl Sync for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> Sync for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> !Sync for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]],["impl<T, W> Sync for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> Sync for Program<T, W>",1,["zksync_vm2::program::Program"]]], +"zksync_vm2_interface":[["impl Sync for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl Sync for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl Sync for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl Sync for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl Sync for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl Sync for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl Sync for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl Sync for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl Sync for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl Sync for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl Sync for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl Sync for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl Sync for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl Sync for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl Sync for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl Sync for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl Sync for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl Sync for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl Sync for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl Sync for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl Sync for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl Sync for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl Sync for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl Sync for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl Sync for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl Sync for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl Sync for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl Sync for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl Sync for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl Sync for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl Sync for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl Sync for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl Sync for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl Sync for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl Sync for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl Sync for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl Sync for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl Sync for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl Sync for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl Sync for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl Sync for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl Sync for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl Sync for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl Sync for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl Sync for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl Sync for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl Sync for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl Sync for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl Sync for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl Sync for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl Sync for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl Sync for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl Sync for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl Sync for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> Sync for FarCall<M>
where\n M: Sync,
",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> Sync for Ret<T>
where\n T: Sync,
",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Unpin.js b/trait.impl/core/marker/trait.Unpin.js new file mode 100644 index 0000000..a9696bb --- /dev/null +++ b/trait.impl/core/marker/trait.Unpin.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl Unpin for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl Unpin for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl Unpin for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl Unpin for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl Unpin for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl Unpin for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl Unpin for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl Unpin for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl Unpin for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl Unpin for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl Unpin for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl Unpin for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl Unpin for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl Unpin for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl Unpin for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl Unpin for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl Unpin for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl Unpin for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl Unpin for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl Unpin for Settings",1,["zksync_vm2::vm::Settings"]],["impl Unpin for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl Unpin for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl Unpin for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> Unpin for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> Unpin for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> Unpin for Program<T, W>",1,["zksync_vm2::program::Program"]],["impl<T, W> Unpin for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]]], +"zksync_vm2_interface":[["impl Unpin for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl Unpin for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl Unpin for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl Unpin for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl Unpin for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl Unpin for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl Unpin for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl Unpin for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl Unpin for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl Unpin for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl Unpin for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl Unpin for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl Unpin for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl Unpin for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl Unpin for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl Unpin for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl Unpin for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl Unpin for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl Unpin for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl Unpin for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl Unpin for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl Unpin for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl Unpin for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl Unpin for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl Unpin for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl Unpin for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl Unpin for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl Unpin for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl Unpin for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl Unpin for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl Unpin for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl Unpin for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl Unpin for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl Unpin for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl Unpin for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl Unpin for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl Unpin for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl Unpin for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl Unpin for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl Unpin for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl Unpin for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl Unpin for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl Unpin for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl Unpin for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl Unpin for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl Unpin for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl Unpin for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl Unpin for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl Unpin for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl Unpin for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl Unpin for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl Unpin for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl Unpin for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl Unpin for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> Unpin for FarCall<M>
where\n M: Unpin,
",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> Unpin for Ret<T>
where\n T: Unpin,
",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js b/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 0000000..46ba89f --- /dev/null +++ b/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl RefUnwindSafe for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl RefUnwindSafe for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl RefUnwindSafe for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl RefUnwindSafe for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl RefUnwindSafe for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl RefUnwindSafe for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl RefUnwindSafe for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl RefUnwindSafe for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl RefUnwindSafe for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl RefUnwindSafe for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl RefUnwindSafe for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl RefUnwindSafe for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl RefUnwindSafe for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl RefUnwindSafe for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl RefUnwindSafe for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl RefUnwindSafe for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl RefUnwindSafe for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl RefUnwindSafe for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl RefUnwindSafe for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl RefUnwindSafe for Settings",1,["zksync_vm2::vm::Settings"]],["impl RefUnwindSafe for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl RefUnwindSafe for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl RefUnwindSafe for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> RefUnwindSafe for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> RefUnwindSafe for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> RefUnwindSafe for Program<T, W>",1,["zksync_vm2::program::Program"]],["impl<T, W> RefUnwindSafe for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]]], +"zksync_vm2_interface":[["impl RefUnwindSafe for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl RefUnwindSafe for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl RefUnwindSafe for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl RefUnwindSafe for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl RefUnwindSafe for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl RefUnwindSafe for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl RefUnwindSafe for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl RefUnwindSafe for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl RefUnwindSafe for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl RefUnwindSafe for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl RefUnwindSafe for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl RefUnwindSafe for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl RefUnwindSafe for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl RefUnwindSafe for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl RefUnwindSafe for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl RefUnwindSafe for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl RefUnwindSafe for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl RefUnwindSafe for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl RefUnwindSafe for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl RefUnwindSafe for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl RefUnwindSafe for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl RefUnwindSafe for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl RefUnwindSafe for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl RefUnwindSafe for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl RefUnwindSafe for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl RefUnwindSafe for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl RefUnwindSafe for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl RefUnwindSafe for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl RefUnwindSafe for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl RefUnwindSafe for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl RefUnwindSafe for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl RefUnwindSafe for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl RefUnwindSafe for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl RefUnwindSafe for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl RefUnwindSafe for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl RefUnwindSafe for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl RefUnwindSafe for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl RefUnwindSafe for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl RefUnwindSafe for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl RefUnwindSafe for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl RefUnwindSafe for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl RefUnwindSafe for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl RefUnwindSafe for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl RefUnwindSafe for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl RefUnwindSafe for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl RefUnwindSafe for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl RefUnwindSafe for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl RefUnwindSafe for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl RefUnwindSafe for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl RefUnwindSafe for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl RefUnwindSafe for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl RefUnwindSafe for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl RefUnwindSafe for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl RefUnwindSafe for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> RefUnwindSafe for FarCall<M>
where\n M: RefUnwindSafe,
",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> RefUnwindSafe for Ret<T>
where\n T: RefUnwindSafe,
",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js b/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 0000000..3060023 --- /dev/null +++ b/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"zksync_vm2":[["impl UnwindSafe for AnyDestination",1,["zksync_vm2::addressing_modes::AnyDestination"]],["impl UnwindSafe for AnySource",1,["zksync_vm2::addressing_modes::AnySource"]],["impl UnwindSafe for RegisterOrImmediate",1,["zksync_vm2::addressing_modes::RegisterOrImmediate"]],["impl UnwindSafe for ExecutionEnd",1,["zksync_vm2::instruction::ExecutionEnd"]],["impl UnwindSafe for Predicate",1,["zksync_vm2::predication::Predicate"]],["impl UnwindSafe for AbsoluteStack",1,["zksync_vm2::addressing_modes::AbsoluteStack"]],["impl UnwindSafe for AdvanceStackPointer",1,["zksync_vm2::addressing_modes::AdvanceStackPointer"]],["impl UnwindSafe for Arguments",1,["zksync_vm2::addressing_modes::Arguments"]],["impl UnwindSafe for CodePage",1,["zksync_vm2::addressing_modes::CodePage"]],["impl UnwindSafe for Immediate1",1,["zksync_vm2::addressing_modes::Immediate1"]],["impl UnwindSafe for Immediate2",1,["zksync_vm2::addressing_modes::Immediate2"]],["impl UnwindSafe for NotRegisterOrImmediate",1,["zksync_vm2::addressing_modes::NotRegisterOrImmediate"]],["impl UnwindSafe for Register",1,["zksync_vm2::addressing_modes::Register"]],["impl UnwindSafe for Register1",1,["zksync_vm2::addressing_modes::Register1"]],["impl UnwindSafe for Register2",1,["zksync_vm2::addressing_modes::Register2"]],["impl UnwindSafe for RegisterAndImmediate",1,["zksync_vm2::addressing_modes::RegisterAndImmediate"]],["impl UnwindSafe for RelativeStack",1,["zksync_vm2::addressing_modes::RelativeStack"]],["impl UnwindSafe for FatPointer",1,["zksync_vm2::fat_pointer::FatPointer"]],["impl UnwindSafe for ModeRequirements",1,["zksync_vm2::mode_requirements::ModeRequirements"]],["impl UnwindSafe for Settings",1,["zksync_vm2::vm::Settings"]],["impl UnwindSafe for Snapshot",1,["zksync_vm2::world_diff::Snapshot"]],["impl UnwindSafe for StorageChange",1,["zksync_vm2::world_diff::StorageChange"]],["impl UnwindSafe for WorldDiff",1,["zksync_vm2::world_diff::WorldDiff"]],["impl<T> UnwindSafe for TestWorld<T>",1,["zksync_vm2::testonly::TestWorld"]],["impl<T, W> UnwindSafe for Instruction<T, W>",1,["zksync_vm2::instruction::Instruction"]],["impl<T, W> UnwindSafe for Program<T, W>",1,["zksync_vm2::program::Program"]],["impl<T, W> UnwindSafe for VirtualMachine<T, W>",1,["zksync_vm2::vm::VirtualMachine"]]], +"zksync_vm2_interface":[["impl UnwindSafe for CallingMode",1,["zksync_vm2_interface::tracer_interface::CallingMode"]],["impl UnwindSafe for CycleStats",1,["zksync_vm2_interface::tracer_interface::CycleStats"]],["impl UnwindSafe for Opcode",1,["zksync_vm2_interface::tracer_interface::Opcode"]],["impl UnwindSafe for ReturnType",1,["zksync_vm2_interface::tracer_interface::ReturnType"]],["impl UnwindSafe for Add",1,["zksync_vm2_interface::tracer_interface::opcodes::Add"]],["impl UnwindSafe for And",1,["zksync_vm2_interface::tracer_interface::opcodes::And"]],["impl UnwindSafe for AuxHeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapRead"]],["impl UnwindSafe for AuxHeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxHeapWrite"]],["impl UnwindSafe for AuxMutating0",1,["zksync_vm2_interface::tracer_interface::opcodes::AuxMutating0"]],["impl UnwindSafe for Caller",1,["zksync_vm2_interface::tracer_interface::opcodes::Caller"]],["impl UnwindSafe for CodeAddress",1,["zksync_vm2_interface::tracer_interface::opcodes::CodeAddress"]],["impl UnwindSafe for ContextMeta",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextMeta"]],["impl UnwindSafe for ContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::ContextU128"]],["impl UnwindSafe for Decommit",1,["zksync_vm2_interface::tracer_interface::opcodes::Decommit"]],["impl UnwindSafe for Delegate",1,["zksync_vm2_interface::tracer_interface::opcodes::Delegate"]],["impl UnwindSafe for Div",1,["zksync_vm2_interface::tracer_interface::opcodes::Div"]],["impl UnwindSafe for ErgsLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ErgsLeft"]],["impl UnwindSafe for Event",1,["zksync_vm2_interface::tracer_interface::opcodes::Event"]],["impl UnwindSafe for HeapRead",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapRead"]],["impl UnwindSafe for HeapWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::HeapWrite"]],["impl UnwindSafe for IncrementTxNumber",1,["zksync_vm2_interface::tracer_interface::opcodes::IncrementTxNumber"]],["impl UnwindSafe for Jump",1,["zksync_vm2_interface::tracer_interface::opcodes::Jump"]],["impl UnwindSafe for L2ToL1Message",1,["zksync_vm2_interface::tracer_interface::opcodes::L2ToL1Message"]],["impl UnwindSafe for Mimic",1,["zksync_vm2_interface::tracer_interface::opcodes::Mimic"]],["impl UnwindSafe for Mul",1,["zksync_vm2_interface::tracer_interface::opcodes::Mul"]],["impl UnwindSafe for NearCall",1,["zksync_vm2_interface::tracer_interface::opcodes::NearCall"]],["impl UnwindSafe for Nop",1,["zksync_vm2_interface::tracer_interface::opcodes::Nop"]],["impl UnwindSafe for Normal",1,["zksync_vm2_interface::tracer_interface::opcodes::Normal"]],["impl UnwindSafe for Or",1,["zksync_vm2_interface::tracer_interface::opcodes::Or"]],["impl UnwindSafe for Panic",1,["zksync_vm2_interface::tracer_interface::opcodes::Panic"]],["impl UnwindSafe for PointerAdd",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerAdd"]],["impl UnwindSafe for PointerPack",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerPack"]],["impl UnwindSafe for PointerRead",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerRead"]],["impl UnwindSafe for PointerShrink",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerShrink"]],["impl UnwindSafe for PointerSub",1,["zksync_vm2_interface::tracer_interface::opcodes::PointerSub"]],["impl UnwindSafe for PrecompileCall",1,["zksync_vm2_interface::tracer_interface::opcodes::PrecompileCall"]],["impl UnwindSafe for Revert",1,["zksync_vm2_interface::tracer_interface::opcodes::Revert"]],["impl UnwindSafe for RotateLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateLeft"]],["impl UnwindSafe for RotateRight",1,["zksync_vm2_interface::tracer_interface::opcodes::RotateRight"]],["impl UnwindSafe for SP",1,["zksync_vm2_interface::tracer_interface::opcodes::SP"]],["impl UnwindSafe for SetContextU128",1,["zksync_vm2_interface::tracer_interface::opcodes::SetContextU128"]],["impl UnwindSafe for ShiftLeft",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftLeft"]],["impl UnwindSafe for ShiftRight",1,["zksync_vm2_interface::tracer_interface::opcodes::ShiftRight"]],["impl UnwindSafe for StorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageRead"]],["impl UnwindSafe for StorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::StorageWrite"]],["impl UnwindSafe for Sub",1,["zksync_vm2_interface::tracer_interface::opcodes::Sub"]],["impl UnwindSafe for This",1,["zksync_vm2_interface::tracer_interface::opcodes::This"]],["impl UnwindSafe for TransientStorageRead",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageRead"]],["impl UnwindSafe for TransientStorageWrite",1,["zksync_vm2_interface::tracer_interface::opcodes::TransientStorageWrite"]],["impl UnwindSafe for Xor",1,["zksync_vm2_interface::tracer_interface::opcodes::Xor"]],["impl UnwindSafe for Event",1,["zksync_vm2_interface::state_interface::Event"]],["impl UnwindSafe for Flags",1,["zksync_vm2_interface::state_interface::Flags"]],["impl UnwindSafe for HeapId",1,["zksync_vm2_interface::state_interface::HeapId"]],["impl UnwindSafe for L2ToL1Log",1,["zksync_vm2_interface::state_interface::L2ToL1Log"]],["impl<M> UnwindSafe for FarCall<M>
where\n M: UnwindSafe,
",1,["zksync_vm2_interface::tracer_interface::opcodes::FarCall"]],["impl<T> UnwindSafe for Ret<T>
where\n T: UnwindSafe,
",1,["zksync_vm2_interface::tracer_interface::opcodes::Ret"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2/trait.StorageInterface.js b/trait.impl/zksync_vm2/trait.StorageInterface.js new file mode 100644 index 0000000..6880481 --- /dev/null +++ b/trait.impl/zksync_vm2/trait.StorageInterface.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2/trait.World.js b/trait.impl/zksync_vm2/trait.World.js new file mode 100644 index 0000000..6880481 --- /dev/null +++ b/trait.impl/zksync_vm2/trait.World.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2_interface/state_interface/trait.StateInterface.js b/trait.impl/zksync_vm2_interface/state_interface/trait.StateInterface.js new file mode 100644 index 0000000..b6c6b91 --- /dev/null +++ b/trait.impl/zksync_vm2_interface/state_interface/trait.StateInterface.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2":[["impl<T: Tracer, W> StateInterface for VirtualMachine<T, W>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.js b/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.js new file mode 100644 index 0000000..45a91e3 --- /dev/null +++ b/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2_interface":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.js b/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.js new file mode 100644 index 0000000..45a91e3 --- /dev/null +++ b/trait.impl/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2_interface":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2_interface/tracer_interface/trait.OpcodeType.js b/trait.impl/zksync_vm2_interface/tracer_interface/trait.OpcodeType.js new file mode 100644 index 0000000..45a91e3 --- /dev/null +++ b/trait.impl/zksync_vm2_interface/tracer_interface/trait.OpcodeType.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2_interface":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/zksync_vm2_interface/tracer_interface/trait.Tracer.js b/trait.impl/zksync_vm2_interface/tracer_interface/trait.Tracer.js new file mode 100644 index 0000000..45a91e3 --- /dev/null +++ b/trait.impl/zksync_vm2_interface/tracer_interface/trait.Tracer.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"zksync_vm2_interface":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/zksync_vm2/addressing_modes/enum.AnyDestination.html b/zksync_vm2/addressing_modes/enum.AnyDestination.html new file mode 100644 index 0000000..4f591bf --- /dev/null +++ b/zksync_vm2/addressing_modes/enum.AnyDestination.html @@ -0,0 +1,31 @@ +AnyDestination in zksync_vm2::addressing_modes - Rust

Enum zksync_vm2::addressing_modes::AnyDestination

source ·
pub enum AnyDestination {
+    Register1(Register1),
+    AbsoluteStack(AbsoluteStack),
+    RelativeStack(RelativeStack),
+    AdvanceStackPointer(AdvanceStackPointer),
+}
Expand description

All supported addressing modes for the first destination argument.

+

Variants§

§

Register1(Register1)

Register mode.

+
§

AbsoluteStack(AbsoluteStack)

Absolute stack addressing.

+
§

RelativeStack(RelativeStack)

Relative stack addressing.

+
§

AdvanceStackPointer(AdvanceStackPointer)

Relative stack addressing that updates the stack pointer on access.

+

Trait Implementations§

source§

impl Clone for AnyDestination

source§

fn clone(&self) -> AnyDestination

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AnyDestination

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AbsoluteStack> for AnyDestination

source§

fn from(v: AbsoluteStack) -> AnyDestination

Converts to this type from the input type.
source§

impl From<AdvanceStackPointer> for AnyDestination

source§

fn from(v: AdvanceStackPointer) -> AnyDestination

Converts to this type from the input type.
source§

impl From<Register1> for AnyDestination

source§

fn from(v: Register1) -> AnyDestination

Converts to this type from the input type.
source§

impl From<RelativeStack> for AnyDestination

source§

fn from(v: RelativeStack) -> AnyDestination

Converts to this type from the input type.
source§

impl TryInto<AbsoluteStack> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AbsoluteStack, <Self as TryInto<AbsoluteStack>>::Error>

Performs the conversion.
source§

impl TryInto<AdvanceStackPointer> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AdvanceStackPointer, <Self as TryInto<AdvanceStackPointer>>::Error>

Performs the conversion.
source§

impl TryInto<Register1> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl TryInto<RelativeStack> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<RelativeStack, <Self as TryInto<RelativeStack>>::Error>

Performs the conversion.
source§

impl Copy for AnyDestination

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/enum.AnySource.html b/zksync_vm2/addressing_modes/enum.AnySource.html new file mode 100644 index 0000000..5c058d3 --- /dev/null +++ b/zksync_vm2/addressing_modes/enum.AnySource.html @@ -0,0 +1,35 @@ +AnySource in zksync_vm2::addressing_modes - Rust

Enum zksync_vm2::addressing_modes::AnySource

source ·
pub enum AnySource {
+    Register1(Register1),
+    Immediate1(Immediate1),
+    AbsoluteStack(AbsoluteStack),
+    RelativeStack(RelativeStack),
+    AdvanceStackPointer(AdvanceStackPointer),
+    CodePage(CodePage),
+}
Expand description

All supported addressing modes for the first source argument.

+

Variants§

§

Register1(Register1)

Register mode.

+
§

Immediate1(Immediate1)

Immediate mode.

+
§

AbsoluteStack(AbsoluteStack)

Absolute stack addressing.

+
§

RelativeStack(RelativeStack)

Relative stack addressing.

+
§

AdvanceStackPointer(AdvanceStackPointer)

Relative stack addressing that updates the stack pointer on access.

+
§

CodePage(CodePage)

Addressing into the code page of the executing contract.

+

Trait Implementations§

source§

impl Clone for AnySource

source§

fn clone(&self) -> AnySource

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AnySource

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AbsoluteStack> for AnySource

source§

fn from(v: AbsoluteStack) -> AnySource

Converts to this type from the input type.
source§

impl From<AdvanceStackPointer> for AnySource

source§

fn from(v: AdvanceStackPointer) -> AnySource

Converts to this type from the input type.
source§

impl From<CodePage> for AnySource

source§

fn from(v: CodePage) -> AnySource

Converts to this type from the input type.
source§

impl From<Immediate1> for AnySource

source§

fn from(v: Immediate1) -> AnySource

Converts to this type from the input type.
source§

impl From<Register1> for AnySource

source§

fn from(v: Register1) -> AnySource

Converts to this type from the input type.
source§

impl From<RelativeStack> for AnySource

source§

fn from(v: RelativeStack) -> AnySource

Converts to this type from the input type.
source§

impl TryFrom<AnySource> for RegisterOrImmediate

§

type Error = NotRegisterOrImmediate

The type returned in the event of a conversion error.
source§

fn try_from(value: AnySource) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryInto<AbsoluteStack> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AbsoluteStack, <Self as TryInto<AbsoluteStack>>::Error>

Performs the conversion.
source§

impl TryInto<AdvanceStackPointer> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AdvanceStackPointer, <Self as TryInto<AdvanceStackPointer>>::Error>

Performs the conversion.
source§

impl TryInto<CodePage> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<CodePage, <Self as TryInto<CodePage>>::Error>

Performs the conversion.
source§

impl TryInto<Immediate1> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Immediate1, <Self as TryInto<Immediate1>>::Error>

Performs the conversion.
source§

impl TryInto<Register1> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl TryInto<RelativeStack> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<RelativeStack, <Self as TryInto<RelativeStack>>::Error>

Performs the conversion.
source§

impl Copy for AnySource

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/enum.RegisterOrImmediate.html b/zksync_vm2/addressing_modes/enum.RegisterOrImmediate.html new file mode 100644 index 0000000..fd4656b --- /dev/null +++ b/zksync_vm2/addressing_modes/enum.RegisterOrImmediate.html @@ -0,0 +1,21 @@ +RegisterOrImmediate in zksync_vm2::addressing_modes - Rust
pub enum RegisterOrImmediate {
+    Register1(Register1),
+    Immediate1(Immediate1),
+}
Expand description

Register or immediate addressing modes required by some VM instructions.

+

Variants§

§

Register1(Register1)

Register mode.

+
§

Immediate1(Immediate1)

Immediate mode.

+

Trait Implementations§

source§

impl Clone for RegisterOrImmediate

source§

fn clone(&self) -> RegisterOrImmediate

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RegisterOrImmediate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Immediate1> for RegisterOrImmediate

source§

fn from(v: Immediate1) -> RegisterOrImmediate

Converts to this type from the input type.
source§

impl From<Register1> for RegisterOrImmediate

source§

fn from(v: Register1) -> RegisterOrImmediate

Converts to this type from the input type.
source§

impl TryFrom<AnySource> for RegisterOrImmediate

§

type Error = NotRegisterOrImmediate

The type returned in the event of a conversion error.
source§

fn try_from(value: AnySource) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryInto<Immediate1> for RegisterOrImmediate

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Immediate1, <Self as TryInto<Immediate1>>::Error>

Performs the conversion.
source§

impl TryInto<Register1> for RegisterOrImmediate

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl Copy for RegisterOrImmediate

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/index.html b/zksync_vm2/addressing_modes/index.html new file mode 100644 index 0000000..a357b1e --- /dev/null +++ b/zksync_vm2/addressing_modes/index.html @@ -0,0 +1,4 @@ +zksync_vm2::addressing_modes - Rust

Module zksync_vm2::addressing_modes

source ·
Expand description

Addressing modes supported by EraVM.

+

Structs§

Enums§

  • All supported addressing modes for the first destination argument.
  • All supported addressing modes for the first source argument.
  • Register or immediate addressing modes required by some VM instructions.
\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/sidebar-items.js b/zksync_vm2/addressing_modes/sidebar-items.js new file mode 100644 index 0000000..9c0af93 --- /dev/null +++ b/zksync_vm2/addressing_modes/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AnyDestination","AnySource","RegisterOrImmediate"],"struct":["AbsoluteStack","AdvanceStackPointer","Arguments","CodePage","Immediate1","Immediate2","NotRegisterOrImmediate","Register","Register1","Register2","RegisterAndImmediate","RelativeStack"]}; \ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.AbsoluteStack.html b/zksync_vm2/addressing_modes/struct.AbsoluteStack.html new file mode 100644 index 0000000..e4edd00 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.AbsoluteStack.html @@ -0,0 +1,20 @@ +AbsoluteStack in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::AbsoluteStack

source ·
pub struct AbsoluteStack(pub RegisterAndImmediate);
Expand description

Absolute addressing into stack.

+

Tuple Fields§

§0: RegisterAndImmediate

Trait Implementations§

source§

impl Clone for AbsoluteStack

source§

fn clone(&self) -> AbsoluteStack

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AbsoluteStack

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AbsoluteStack> for AnyDestination

source§

fn from(v: AbsoluteStack) -> AnyDestination

Converts to this type from the input type.
source§

impl From<AbsoluteStack> for AnySource

source§

fn from(v: AbsoluteStack) -> AnySource

Converts to this type from the input type.
source§

impl TryInto<AbsoluteStack> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AbsoluteStack, <Self as TryInto<AbsoluteStack>>::Error>

Performs the conversion.
source§

impl TryInto<AbsoluteStack> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AbsoluteStack, <Self as TryInto<AbsoluteStack>>::Error>

Performs the conversion.
source§

impl Copy for AbsoluteStack

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.AdvanceStackPointer.html b/zksync_vm2/addressing_modes/struct.AdvanceStackPointer.html new file mode 100644 index 0000000..3d1bf33 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.AdvanceStackPointer.html @@ -0,0 +1,21 @@ +AdvanceStackPointer in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::AdvanceStackPointer

source ·
pub struct AdvanceStackPointer(pub RegisterAndImmediate);
Expand description

Same as RelativeStack, but moves the stack pointer on access (decreases it when reading data; +increases when writing data).

+

Tuple Fields§

§0: RegisterAndImmediate

Trait Implementations§

source§

impl Clone for AdvanceStackPointer

source§

fn clone(&self) -> AdvanceStackPointer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AdvanceStackPointer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AdvanceStackPointer> for AnyDestination

source§

fn from(v: AdvanceStackPointer) -> AnyDestination

Converts to this type from the input type.
source§

impl From<AdvanceStackPointer> for AnySource

source§

fn from(v: AdvanceStackPointer) -> AnySource

Converts to this type from the input type.
source§

impl TryInto<AdvanceStackPointer> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AdvanceStackPointer, <Self as TryInto<AdvanceStackPointer>>::Error>

Performs the conversion.
source§

impl TryInto<AdvanceStackPointer> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<AdvanceStackPointer, <Self as TryInto<AdvanceStackPointer>>::Error>

Performs the conversion.
source§

impl Copy for AdvanceStackPointer

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Arguments.html b/zksync_vm2/addressing_modes/struct.Arguments.html new file mode 100644 index 0000000..76e535c --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Arguments.html @@ -0,0 +1,18 @@ +Arguments in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Arguments

source ·
pub struct Arguments { /* private fields */ }
Expand description

Arguments provided to an instruction in an EraVM bytecode.

+

Implementations§

source§

impl Arguments

source

pub const fn new( + predicate: Predicate, + gas_cost: u32, + mode_requirements: ModeRequirements, +) -> Self

Creates arguments from the provided info.

+

Trait Implementations§

source§

impl Debug for Arguments

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.CodePage.html b/zksync_vm2/addressing_modes/struct.CodePage.html new file mode 100644 index 0000000..b5beb9c --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.CodePage.html @@ -0,0 +1,16 @@ +CodePage in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::CodePage

source ·
pub struct CodePage(pub RegisterAndImmediate);
Expand description

Absolute addressing into the code page of the currently executing program.

+

Tuple Fields§

§0: RegisterAndImmediate

Trait Implementations§

source§

impl Clone for CodePage

source§

fn clone(&self) -> CodePage

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CodePage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<CodePage> for AnySource

source§

fn from(v: CodePage) -> AnySource

Converts to this type from the input type.
source§

impl TryInto<CodePage> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<CodePage, <Self as TryInto<CodePage>>::Error>

Performs the conversion.
source§

impl Copy for CodePage

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Immediate1.html b/zksync_vm2/addressing_modes/struct.Immediate1.html new file mode 100644 index 0000000..ebeecbe --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Immediate1.html @@ -0,0 +1,16 @@ +Immediate1 in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Immediate1

source ·
pub struct Immediate1(pub u16);
Expand description

Immediate value passed as a first instruction arg.

+

Tuple Fields§

§0: u16

Trait Implementations§

source§

impl Clone for Immediate1

source§

fn clone(&self) -> Immediate1

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Immediate1

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Immediate1> for AnySource

source§

fn from(v: Immediate1) -> AnySource

Converts to this type from the input type.
source§

impl From<Immediate1> for RegisterOrImmediate

source§

fn from(v: Immediate1) -> RegisterOrImmediate

Converts to this type from the input type.
source§

impl TryInto<Immediate1> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Immediate1, <Self as TryInto<Immediate1>>::Error>

Performs the conversion.
source§

impl TryInto<Immediate1> for RegisterOrImmediate

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Immediate1, <Self as TryInto<Immediate1>>::Error>

Performs the conversion.
source§

impl Copy for Immediate1

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Immediate2.html b/zksync_vm2/addressing_modes/struct.Immediate2.html new file mode 100644 index 0000000..9c82b9f --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Immediate2.html @@ -0,0 +1,16 @@ +Immediate2 in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Immediate2

source ·
pub struct Immediate2(pub u16);
Expand description

Immediate value passed as a second instruction arg.

+

Tuple Fields§

§0: u16

Trait Implementations§

source§

impl Clone for Immediate2

source§

fn clone(&self) -> Immediate2

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Immediate2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Immediate2

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.NotRegisterOrImmediate.html b/zksync_vm2/addressing_modes/struct.NotRegisterOrImmediate.html new file mode 100644 index 0000000..d519661 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.NotRegisterOrImmediate.html @@ -0,0 +1,13 @@ +NotRegisterOrImmediate in zksync_vm2::addressing_modes - Rust
pub struct NotRegisterOrImmediate;
Expand description

Error converting AnySource to RegisterOrImmediate.

+

Trait Implementations§

source§

impl Debug for NotRegisterOrImmediate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Register.html b/zksync_vm2/addressing_modes/struct.Register.html new file mode 100644 index 0000000..61ec82c --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Register.html @@ -0,0 +1,19 @@ +Register in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Register

source ·
pub struct Register(/* private fields */);
Expand description

Representation of one of 16 VM registers.

+

Implementations§

source§

impl Register

source

pub const fn new(n: u8) -> Self

Creates a register with the specified 0-based index.

+
§Panics
+

Panics if n >= 16; EraVM has 16 registers.

+

Trait Implementations§

source§

impl Clone for Register

source§

fn clone(&self) -> Register

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Register

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Register

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Register1.html b/zksync_vm2/addressing_modes/struct.Register1.html new file mode 100644 index 0000000..0b26491 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Register1.html @@ -0,0 +1,18 @@ +Register1 in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Register1

source ·
pub struct Register1(pub Register);
Expand description

Register passed as a first instruction argument.

+

It must not be used simultaneously with AbsoluteStack, RelativeStack, AdvanceStackPointer, +or CodePage.

+

Tuple Fields§

§0: Register

Trait Implementations§

source§

impl Clone for Register1

source§

fn clone(&self) -> Register1

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Register1

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Register1> for AnyDestination

source§

fn from(v: Register1) -> AnyDestination

Converts to this type from the input type.
source§

impl From<Register1> for AnySource

source§

fn from(v: Register1) -> AnySource

Converts to this type from the input type.
source§

impl From<Register1> for RegisterOrImmediate

source§

fn from(v: Register1) -> RegisterOrImmediate

Converts to this type from the input type.
source§

impl TryInto<Register1> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl TryInto<Register1> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl TryInto<Register1> for RegisterOrImmediate

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Register1, <Self as TryInto<Register1>>::Error>

Performs the conversion.
source§

impl Copy for Register1

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.Register2.html b/zksync_vm2/addressing_modes/struct.Register2.html new file mode 100644 index 0000000..8793890 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.Register2.html @@ -0,0 +1,16 @@ +Register2 in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::Register2

source ·
pub struct Register2(pub Register);
Expand description

Register passed as a second instruction argument.

+

Tuple Fields§

§0: Register

Trait Implementations§

source§

impl Clone for Register2

source§

fn clone(&self) -> Register2

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Register2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Register2

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.RegisterAndImmediate.html b/zksync_vm2/addressing_modes/struct.RegisterAndImmediate.html new file mode 100644 index 0000000..a0bc39f --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.RegisterAndImmediate.html @@ -0,0 +1,22 @@ +RegisterAndImmediate in zksync_vm2::addressing_modes - Rust
pub struct RegisterAndImmediate {
+    pub immediate: u16,
+    pub register: Register,
+}
Expand description

Combination of a register and an immediate value wrapped by AbsoluteStack, RelativeStack, +AdvanceStackPointer and CodePage addressing modes.

+

Fields§

§immediate: u16

Immediate value.

+
§register: Register

Register spec.

+

Trait Implementations§

source§

impl Clone for RegisterAndImmediate

source§

fn clone(&self) -> RegisterAndImmediate

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RegisterAndImmediate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for RegisterAndImmediate

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/addressing_modes/struct.RelativeStack.html b/zksync_vm2/addressing_modes/struct.RelativeStack.html new file mode 100644 index 0000000..890c266 --- /dev/null +++ b/zksync_vm2/addressing_modes/struct.RelativeStack.html @@ -0,0 +1,20 @@ +RelativeStack in zksync_vm2::addressing_modes - Rust

Struct zksync_vm2::addressing_modes::RelativeStack

source ·
pub struct RelativeStack(pub RegisterAndImmediate);
Expand description

Relative addressing into stack (relative to the VM stack pointer).

+

Tuple Fields§

§0: RegisterAndImmediate

Trait Implementations§

source§

impl Clone for RelativeStack

source§

fn clone(&self) -> RelativeStack

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RelativeStack

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<RelativeStack> for AnyDestination

source§

fn from(v: RelativeStack) -> AnyDestination

Converts to this type from the input type.
source§

impl From<RelativeStack> for AnySource

source§

fn from(v: RelativeStack) -> AnySource

Converts to this type from the input type.
source§

impl TryInto<RelativeStack> for AnyDestination

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<RelativeStack, <Self as TryInto<RelativeStack>>::Error>

Performs the conversion.
source§

impl TryInto<RelativeStack> for AnySource

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( + self, +) -> Result<RelativeStack, <Self as TryInto<RelativeStack>>::Error>

Performs the conversion.
source§

impl Copy for RelativeStack

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/all.html b/zksync_vm2/all.html new file mode 100644 index 0000000..517923a --- /dev/null +++ b/zksync_vm2/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/zksync_vm2/enum.ExecutionEnd.html b/zksync_vm2/enum.ExecutionEnd.html new file mode 100644 index 0000000..a2118c3 --- /dev/null +++ b/zksync_vm2/enum.ExecutionEnd.html @@ -0,0 +1,23 @@ +ExecutionEnd in zksync_vm2 - Rust

Enum zksync_vm2::ExecutionEnd

source ·
pub enum ExecutionEnd {
+    ProgramFinished(Vec<u8>),
+    Reverted(Vec<u8>),
+    Panicked,
+    SuspendedOnHook(u32),
+}
Expand description

VM stop reason returned from VirtualMachine::run().

+

Variants§

§

ProgramFinished(Vec<u8>)

The executed program has finished and returned the specified data.

+
§

Reverted(Vec<u8>)

The executed program has reverted returning the specified data.

+
§

Panicked

The executed program has panicked.

+
§

SuspendedOnHook(u32)

Returned when the bootloader writes to the heap location specified by hook_address.

+

Trait Implementations§

source§

impl Debug for ExecutionEnd

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for ExecutionEnd

source§

fn eq(&self, other: &ExecutionEnd) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl StructuralPartialEq for ExecutionEnd

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/enum.Predicate.html b/zksync_vm2/enum.Predicate.html new file mode 100644 index 0000000..68784ba --- /dev/null +++ b/zksync_vm2/enum.Predicate.html @@ -0,0 +1,35 @@ +Predicate in zksync_vm2 - Rust

Enum zksync_vm2::Predicate

source ·
#[repr(u8)]
pub enum Predicate { + Always = 8, + IfGT = 4, + IfEQ = 2, + IfLT = 1, + IfGE = 6, + IfLE = 3, + IfNotEQ = 40, + IfGTOrLT = 5, +}
Expand description

Predicate for an instruction. Encoded so that comparing it to flags is efficient.

+

Variants§

§

Always = 8

Always execute the associated instruction.

+
§

IfGT = 4

Execute the associated instruction if the “greater than” execution flag is set.

+
§

IfEQ = 2

Execute the associated instruction if the “equal” execution flag is set.

+
§

IfLT = 1

Execute the associated instruction if the “less than” execution flag is set.

+
§

IfGE = 6

Execute the associated instruction if either of “greater than” or “equal” execution flags are set.

+
§

IfLE = 3

Execute the associated instruction if either of “less than” or “equal” execution flags are set.

+
§

IfNotEQ = 40

Execute the associated instruction if the “equal” execution flag is not set.

+
§

IfGTOrLT = 5

Execute the associated instruction if either of “less than” or “greater than” execution flags are set.

+

Trait Implementations§

source§

impl Clone for Predicate

source§

fn clone(&self) -> Predicate

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Predicate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Predicate

source§

fn default() -> Predicate

Returns the “default value” for a type. Read more
source§

impl Hash for Predicate

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Copy for Predicate

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/fat_pointer/struct.FatPointer.html b/zksync_vm2/fat_pointer/struct.FatPointer.html new file mode 100644 index 0000000..d3f4bbd --- /dev/null +++ b/zksync_vm2/fat_pointer/struct.FatPointer.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.FatPointer.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/index.html b/zksync_vm2/index.html new file mode 100644 index 0000000..6c4619c --- /dev/null +++ b/zksync_vm2/index.html @@ -0,0 +1,6 @@ +zksync_vm2 - Rust

Crate zksync_vm2

source ·
Expand description

§High-Performance ZKsync Era VM

+

This crate provides high-performance VirtualMachine for ZKsync Era.

+

Re-exports§

Modules§

Structs§

Enums§

Traits§

  • VM storage access operations.
  • Encapsulates VM interaction with the external world. This includes VM storage and decomitting (loading) bytecodes +for execution.
\ No newline at end of file diff --git a/zksync_vm2/instruction/enum.ExecutionEnd.html b/zksync_vm2/instruction/enum.ExecutionEnd.html new file mode 100644 index 0000000..6cd5aa2 --- /dev/null +++ b/zksync_vm2/instruction/enum.ExecutionEnd.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/enum.ExecutionEnd.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/instruction/struct.Instruction.html b/zksync_vm2/instruction/struct.Instruction.html new file mode 100644 index 0000000..f51d5ee --- /dev/null +++ b/zksync_vm2/instruction/struct.Instruction.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.Instruction.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/mode_requirements/struct.ModeRequirements.html b/zksync_vm2/mode_requirements/struct.ModeRequirements.html new file mode 100644 index 0000000..d7492ec --- /dev/null +++ b/zksync_vm2/mode_requirements/struct.ModeRequirements.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.ModeRequirements.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/predication/enum.Predicate.html b/zksync_vm2/predication/enum.Predicate.html new file mode 100644 index 0000000..f0a3334 --- /dev/null +++ b/zksync_vm2/predication/enum.Predicate.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/enum.Predicate.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/program/struct.Program.html b/zksync_vm2/program/struct.Program.html new file mode 100644 index 0000000..a06e204 --- /dev/null +++ b/zksync_vm2/program/struct.Program.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.Program.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/sidebar-items.js b/zksync_vm2/sidebar-items.js new file mode 100644 index 0000000..3221888 --- /dev/null +++ b/zksync_vm2/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ExecutionEnd","Predicate"],"mod":["addressing_modes","testonly"],"struct":["FatPointer","Instruction","ModeRequirements","Program","Settings","Snapshot","StorageChange","VirtualMachine","WorldDiff"],"trait":["StorageInterface","World"]}; \ No newline at end of file diff --git a/zksync_vm2/struct.FatPointer.html b/zksync_vm2/struct.FatPointer.html new file mode 100644 index 0000000..40e81e8 --- /dev/null +++ b/zksync_vm2/struct.FatPointer.html @@ -0,0 +1,23 @@ +FatPointer in zksync_vm2 - Rust

Struct zksync_vm2::FatPointer

source ·
#[repr(C)]
pub struct FatPointer { + pub offset: u32, + pub memory_page: HeapId, + pub start: u32, + pub length: u32, +}
Expand description

Fat pointer to a heap location.

+

Fields§

§offset: u32

Additional pointer offset inside the start..(start + length) range.

+
§memory_page: HeapId

ID of the heap this points to.

+
§start: u32

0-based index of the pointer start byte at the memory page.

+
§length: u32

Length of the pointed slice in bytes.

+

Implementations§

source§

impl FatPointer

source

pub fn into_u256(self) -> U256

Converts this pointer into a U256 word.

+

Trait Implementations§

source§

impl Debug for FatPointer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&mut U256> for &mut FatPointer

source§

fn from(value: &mut U256) -> Self

Converts to this type from the input type.
source§

impl From<U256> for FatPointer

source§

fn from(value: U256) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.Instruction.html b/zksync_vm2/struct.Instruction.html new file mode 100644 index 0000000..956525f --- /dev/null +++ b/zksync_vm2/struct.Instruction.html @@ -0,0 +1,258 @@ +Instruction in zksync_vm2 - Rust

Struct zksync_vm2::Instruction

source ·
pub struct Instruction<T, W> { /* private fields */ }
Expand description

Single EraVM instruction (an opcode + Arguments).

+

Managing instructions is warranted for low-level tests; prefer using Programs to decode instructions +from EraVM bytecodes.

+

Implementations§

source§

impl<T: Tracer, W: World<T>> Instruction<T, W>

Instructions for binary operations.

+
source

pub fn from_add( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Add instruction with the provided params.

+
source

pub fn from_sub( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Sub instruction with the provided params.

+
source

pub fn from_and( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates And instruction with the provided params.

+
source

pub fn from_or( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Or instruction with the provided params.

+
source

pub fn from_xor( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Xor instruction with the provided params.

+
source

pub fn from_shift_left( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates ShiftLeft instruction with the provided params.

+
source

pub fn from_shift_right( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates ShiftRight instruction with the provided params.

+
source

pub fn from_rotate_left( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates RotateLeft instruction with the provided params.

+
source

pub fn from_rotate_right( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates RotateRight instruction with the provided params.

+
source

pub fn from_mul( + src1: AnySource, + src2: Register2, + out: AnyDestination, + out2: Register2, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Mul instruction with the provided params.

+
source

pub fn from_div( + src1: AnySource, + src2: Register2, + out: AnyDestination, + out2: Register2, + arguments: Arguments, + swap: bool, + set_flags: bool, +) -> Self

Creates Div instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

Context-related instructions.

+
source

pub fn from_this(out: Register1, arguments: Arguments) -> Self

Creates a This instruction with the provided params.

+
source

pub fn from_caller(out: Register1, arguments: Arguments) -> Self

Creates a Caller instruction with the provided params.

+
source

pub fn from_code_address(out: Register1, arguments: Arguments) -> Self

Creates a CodeAddress instruction with the provided params.

+
source

pub fn from_ergs_left(out: Register1, arguments: Arguments) -> Self

Creates an ErgsLeft instruction with the provided params.

+
source

pub fn from_context_u128(out: Register1, arguments: Arguments) -> Self

Creates a ContextU128 instruction with the provided params.

+
source

pub fn from_context_sp(out: Register1, arguments: Arguments) -> Self

Creates an SP instruction with the provided params.

+
source

pub fn from_context_meta(out: Register1, arguments: Arguments) -> Self

Creates a ContextMeta instruction with the provided params.

+
source

pub fn from_set_context_u128(src: Register1, arguments: Arguments) -> Self

Creates a SetContextU128 instruction with the provided params.

+
source

pub fn from_increment_tx_number(arguments: Arguments) -> Self

Creates an IncrementTxNumber instruction with the provided params.

+
source

pub fn from_aux_mutating(arguments: Arguments) -> Self

Creates an AuxMutating0 instruction with the provided params.

+
source§

impl<T: Tracer, W: World<T>> Instruction<T, W>

source

pub fn from_decommit( + abi: Register1, + burn: Register2, + out: Register1, + arguments: Arguments, +) -> Self

Creates a Decommit instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_event( + key: Register1, + value: Register2, + is_first: bool, + arguments: Arguments, +) -> Self

Creates an Event instruction with the provided params.

+
source

pub fn from_l2_to_l1_message( + key: Register1, + value: Register2, + is_service: bool, + arguments: Arguments, +) -> Self

Creates an L2ToL1Message instruction with the provided params.

+
source§

impl<T: Tracer, W: World<T>> Instruction<T, W>

source

pub fn from_far_call<M: TypeLevelCallingMode>( + src1: Register1, + src2: Register2, + error_handler: Immediate1, + is_static: bool, + is_shard: bool, + arguments: Arguments, +) -> Self

Creates a FarCall instruction with the provided mode and params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_heap_read( + src: RegisterOrImmediate, + out: Register1, + incremented_out: Option<Register2>, + arguments: Arguments, +) -> Self

Creates a HeapRead instruction with the provided params.

+
source

pub fn from_aux_heap_read( + src: RegisterOrImmediate, + out: Register1, + incremented_out: Option<Register2>, + arguments: Arguments, +) -> Self

Creates an AuxHeapRead instruction with the provided params.

+
source

pub fn from_heap_write( + src1: RegisterOrImmediate, + src2: Register2, + incremented_out: Option<Register1>, + arguments: Arguments, + should_hook: bool, +) -> Self

Creates a HeapWrite instruction with the provided params.

+
source

pub fn from_aux_heap_store( + src1: RegisterOrImmediate, + src2: Register2, + incremented_out: Option<Register1>, + arguments: Arguments, +) -> Self

Creates an AuxHeapWrite instruction with the provided params.

+
source

pub fn from_pointer_read( + src: Register1, + out: Register1, + incremented_out: Option<Register2>, + arguments: Arguments, +) -> Self

Creates an PointerRead instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_jump( + source: AnySource, + destination: Register1, + arguments: Arguments, +) -> Self

Creates a Jump instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_near_call( + gas: Register1, + destination: Immediate1, + error_handler: Immediate2, + arguments: Arguments, +) -> Self

Creates a NearCall instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_nop( + pop: AdvanceStackPointer, + push: AdvanceStackPointer, + arguments: Arguments, +) -> Self

Creates a Nop instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

Pointer-related instructions.

+
source

pub fn from_pointer_add( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, +) -> Self

Creates a PointerAdd instruction with the provided params.

+
source

pub fn from_pointer_sub( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, +) -> Self

Creates a PointerSub instruction with the provided params.

+
source

pub fn from_pointer_pack( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, +) -> Self

Creates a PointerPack instruction with the provided params.

+
source

pub fn from_pointer_shrink( + src1: AnySource, + src2: Register2, + out: AnyDestination, + arguments: Arguments, + swap: bool, +) -> Self

Creates a PointerShrink instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

source

pub fn from_precompile_call( + abi: Register1, + burn: Register2, + out: Register1, + arguments: Arguments, +) -> Self

Creates a PrecompileCall instruction with the provided params.

+
source§

impl<T: Tracer, W> Instruction<T, W>

Variations of Ret instructions.

+
source

pub fn from_ret( + src1: Register1, + label: Option<Immediate1>, + arguments: Arguments, +) -> Self

Creates a normal Ret instruction with the provided params.

+
source

pub fn from_revert( + src1: Register1, + label: Option<Immediate1>, + arguments: Arguments, +) -> Self

Creates a revert Ret instruction with the provided params.

+
source

pub fn from_panic(label: Option<Immediate1>, arguments: Arguments) -> Self

Creates a panic Ret instruction with the provided params.

+
source

pub const fn from_invalid() -> Self

Creates a invalid instruction that will panic by draining all gas.

+
source§

impl<T: Tracer, W: World<T>> Instruction<T, W>

source

pub fn from_storage_write( + src1: Register1, + src2: Register2, + arguments: Arguments, +) -> Self

Creates a StorageWrite instruction with the provided params.

+
source

pub fn from_transient_storage_write( + src1: Register1, + src2: Register2, + arguments: Arguments, +) -> Self

Creates a TransientStorageWrite instruction with the provided params.

+
source

pub fn from_storage_read( + src: Register1, + dst: Register1, + arguments: Arguments, +) -> Self

Creates a StorageRead instruction with the provided params.

+
source

pub fn from_transient_storage_read( + src: Register1, + dst: Register1, + arguments: Arguments, +) -> Self

Creates a TransientStorageRead instruction with the provided params.

+

Trait Implementations§

source§

impl<T, W> Debug for Instruction<T, W>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, W> Freeze for Instruction<T, W>

§

impl<T, W> RefUnwindSafe for Instruction<T, W>

§

impl<T, W> Send for Instruction<T, W>

§

impl<T, W> Sync for Instruction<T, W>

§

impl<T, W> Unpin for Instruction<T, W>

§

impl<T, W> UnwindSafe for Instruction<T, W>

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.ModeRequirements.html b/zksync_vm2/struct.ModeRequirements.html new file mode 100644 index 0000000..9ba141a --- /dev/null +++ b/zksync_vm2/struct.ModeRequirements.html @@ -0,0 +1,18 @@ +ModeRequirements in zksync_vm2 - Rust

Struct zksync_vm2::ModeRequirements

source ·
pub struct ModeRequirements(/* private fields */);
Expand description

VM execution mode requirements (kernel only, not in static call) that can be placed on instructions.

+

Implementations§

source§

impl ModeRequirements

source

pub const fn new(kernel_only: bool, cannot_use_in_static: bool) -> Self

Creates new requirements.

+
source

pub const fn none() -> Self

Creates default requirements that always hold.

+

Trait Implementations§

source§

impl Clone for ModeRequirements

source§

fn clone(&self) -> ModeRequirements

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ModeRequirements

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for ModeRequirements

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.Program.html b/zksync_vm2/struct.Program.html new file mode 100644 index 0000000..4d93404 --- /dev/null +++ b/zksync_vm2/struct.Program.html @@ -0,0 +1,20 @@ +Program in zksync_vm2 - Rust

Struct zksync_vm2::Program

source ·
pub struct Program<T, W> { /* private fields */ }
Expand description

Compiled EraVM bytecode.

+

Cloning this is cheap. It is a handle to memory similar to Arc.

+

Implementations§

source§

impl<T: Tracer, W: World<T>> Program<T, W>

source

pub fn new(bytecode: &[u8], enable_hooks: bool) -> Self

Creates a new program.

+
source

pub fn from_words(bytecode_words: Vec<U256>, enable_hooks: bool) -> Self

Creates a new program from U256 words.

+
source§

impl<T, W> Program<T, W>

source

pub fn code_page(&self) -> &[U256]

Returns a reference to the code page of this program.

+

Trait Implementations§

source§

impl<T, W> Clone for Program<T, W>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, W> Debug for Program<T, W>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, W> PartialEq for Program<T, W>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T, W> Freeze for Program<T, W>

§

impl<T, W> RefUnwindSafe for Program<T, W>

§

impl<T, W> Send for Program<T, W>

§

impl<T, W> Sync for Program<T, W>

§

impl<T, W> Unpin for Program<T, W>

§

impl<T, W> UnwindSafe for Program<T, W>

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.Settings.html b/zksync_vm2/struct.Settings.html new file mode 100644 index 0000000..abd3ddc --- /dev/null +++ b/zksync_vm2/struct.Settings.html @@ -0,0 +1,22 @@ +Settings in zksync_vm2 - Rust

Struct zksync_vm2::Settings

source ·
pub struct Settings {
+    pub default_aa_code_hash: [u8; 32],
+    pub evm_interpreter_code_hash: [u8; 32],
+    pub hook_address: u32,
+}
Expand description

VirtualMachine settings.

+

Fields§

§default_aa_code_hash: [u8; 32]

Bytecode hash of the default account abstraction contract.

+
§evm_interpreter_code_hash: [u8; 32]

Bytecode hash of the EVM interpreter.

+
§hook_address: u32

Writing to this address in the bootloader’s heap suspends execution

+

Trait Implementations§

source§

impl Clone for Settings

source§

fn clone(&self) -> Settings

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Settings

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.Snapshot.html b/zksync_vm2/struct.Snapshot.html new file mode 100644 index 0000000..eac0cad --- /dev/null +++ b/zksync_vm2/struct.Snapshot.html @@ -0,0 +1,17 @@ +Snapshot in zksync_vm2 - Rust

Struct zksync_vm2::Snapshot

source ·
pub struct Snapshot { /* private fields */ }
Expand description

Opaque snapshot of a WorldDiff output by its eponymous method. +Can be provided to WorldDiff::events_after() etc. to get data after the snapshot was created.

+

Trait Implementations§

source§

impl Clone for Snapshot

source§

fn clone(&self) -> Snapshot

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Snapshot

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Snapshot

source§

fn eq(&self, other: &Snapshot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Snapshot

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.StorageChange.html b/zksync_vm2/struct.StorageChange.html new file mode 100644 index 0000000..c758975 --- /dev/null +++ b/zksync_vm2/struct.StorageChange.html @@ -0,0 +1,22 @@ +StorageChange in zksync_vm2 - Rust

Struct zksync_vm2::StorageChange

source ·
pub struct StorageChange {
+    pub before: Option<U256>,
+    pub after: U256,
+    pub is_initial: bool,
+}
Expand description

Change in a single storage slot.

+

Fields§

§before: Option<U256>

Value before the slot was written to. None if the slot was not written to previously.

+
§after: U256

Value written to the slot.

+
§is_initial: bool

true if the slot is not set in the World. +A write may be initial even if it isn’t the first write to a slot!

+

Trait Implementations§

source§

impl Debug for StorageChange

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for StorageChange

source§

fn eq(&self, other: &StorageChange) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl StructuralPartialEq for StorageChange

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.VirtualMachine.html b/zksync_vm2/struct.VirtualMachine.html new file mode 100644 index 0000000..6085ca0 --- /dev/null +++ b/zksync_vm2/struct.VirtualMachine.html @@ -0,0 +1,56 @@ +VirtualMachine in zksync_vm2 - Rust

Struct zksync_vm2::VirtualMachine

source ·
pub struct VirtualMachine<T, W> { /* private fields */ }
Expand description

High-performance out-of-circuit EraVM implementation.

+

Implementations§

source§

impl<T: Tracer, W: World<T>> VirtualMachine<T, W>

source

pub fn new( + address: H160, + program: Program<T, W>, + caller: H160, + calldata: &[u8], + gas: u32, + settings: Settings, +) -> Self

Creates a new VM instance.

+
source

pub fn world_diff(&self) -> &WorldDiff

Provides a reference to the World diff accumulated by VM execution so far.

+
source

pub fn run(&mut self, world: &mut W, tracer: &mut T) -> ExecutionEnd

Runs this VM with the specified World and Tracer until an end of execution due to a hook, or an error.

+
source

pub fn resume_with_additional_gas_limit( + &mut self, + world: &mut W, + tracer: &mut T, + gas_limit: u32, +) -> Option<(u32, ExecutionEnd)>

Returns how much of the extra gas limit is left and the stop reason, +unless the extra gas limit was exceeded.

+

Needed to support account validation gas limit. +We cannot simply reduce the available gas, as contracts might behave differently +depending on remaining gas.

+
source

pub fn make_snapshot(&mut self)

Creates a VM snapshot. The snapshot can then be rolled back to, or discarded.

+
§Panics
+
    +
  • Panics if called outside the initial (bootloader) callframe.
  • +
  • Panics if this VM already has a snapshot.
  • +
+
source

pub fn rollback(&mut self)

Returns the VM to the state it was in when Self::make_snapshot() was called.

+
§Panics
+
    +
  • Panics if this VM doesn’t hold a snapshot.
  • +
  • Panics if called outside the initial (bootloader) callframe.
  • +
+
source

pub fn pop_snapshot(&mut self)

Pops a previously made snapshot without rolling back to it. This effectively commits +all changes made up to this point, so that they cannot be rolled back.

+
§Panics
+
    +
  • Panics if called outside the initial (bootloader) callframe.
  • +
+

Trait Implementations§

source§

impl<T: Debug, W: Debug> Debug for VirtualMachine<T, W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Tracer, W> StateInterface for VirtualMachine<T, W>

source§

fn read_register(&self, register: u8) -> (U256, bool)

Reads a register with the specified zero-based index. Returns a value together with a pointer flag.
source§

fn set_register(&mut self, register: u8, value: U256, is_pointer: bool)

Sets a register with the specified zero-based index
source§

fn number_of_callframes(&self) -> usize

Returns the total number of call frames.
source§

fn current_frame(&mut self) -> impl CallframeInterface + '_

Returns a mutable handle to the current call frame.
source§

fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_

Returns a mutable handle to a call frame with the specified index, where +zero is the current frame, one is the frame before that etc.
source§

fn read_heap_byte(&self, heap: HeapId, index: u32) -> u8

Reads a single byte from the specified heap at the specified 0-based offset.
source§

fn read_heap_u256(&self, heap: HeapId, index: u32) -> U256

Reads an entire U256 word in the big-endian order from the specified heap / offset +(which is the index of the most significant byte of the read value).
source§

fn write_heap_u256(&mut self, heap: HeapId, index: u32, value: U256)

Writes an entire U256 word in the big-endian order to the specified heap at the specified offset +(which is the index of the most significant byte of the written value).
source§

fn flags(&self) -> Flags

Returns current execution flags.
source§

fn set_flags(&mut self, flags: Flags)

Sets current execution flags.
source§

fn transaction_number(&self) -> u16

Returns the currently set 0-based transaction number.
source§

fn set_transaction_number(&mut self, value: u16)

Sets the current transaction number.
source§

fn context_u128_register(&self) -> u128

Returns the value of the context register.
source§

fn set_context_u128_register(&mut self, value: u128)

Sets the value of the context register.
source§

fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over storage slots read or written during VM execution.
source§

fn get_transient_storage_state( + &self, +) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over all transient storage slots set during VM execution.
source§

fn get_transient_storage(&self, address: H160, slot: U256) -> U256

Gets value of the specified transient storage slot.
source§

fn write_transient_storage(&mut self, address: H160, slot: U256, value: U256)

Sets value of the specified transient storage slot.
source§

fn events(&self) -> impl Iterator<Item = Event>

Iterates over events emitted during VM execution.
source§

fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>

Iterates over L2-to-L1 logs emitted during VM execution.
source§

fn pubdata(&self) -> i32

Gets the current amount of published pubdata.
source§

fn set_pubdata(&mut self, value: i32)

Sets the current amount of published pubdata.

Auto Trait Implementations§

§

impl<T, W> Freeze for VirtualMachine<T, W>

§

impl<T, W> RefUnwindSafe for VirtualMachine<T, W>

§

impl<T, W> !Send for VirtualMachine<T, W>

§

impl<T, W> !Sync for VirtualMachine<T, W>

§

impl<T, W> Unpin for VirtualMachine<T, W>

§

impl<T, W> UnwindSafe for VirtualMachine<T, W>

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/struct.WorldDiff.html b/zksync_vm2/struct.WorldDiff.html new file mode 100644 index 0000000..e5bff49 --- /dev/null +++ b/zksync_vm2/struct.WorldDiff.html @@ -0,0 +1,28 @@ +WorldDiff in zksync_vm2 - Rust

Struct zksync_vm2::WorldDiff

source ·
pub struct WorldDiff { /* private fields */ }
Expand description

Pending modifications to the global state that are executed at the end of a block. +In other words, side effects.

+

Implementations§

source§

impl WorldDiff

source

pub fn storage_refunds(&self) -> &[u32]

Returns recorded refunds for all storage operations.

+
source

pub fn pubdata_costs(&self) -> &[i32]

Returns recorded pubdata costs for all storage operations.

+
source

pub fn get_storage_changes( + &self, +) -> impl Iterator<Item = ((H160, U256), (Option<U256>, U256))> + '_

Gets changes for all touched storage slots.

+
source

pub fn get_storage_changes_after( + &self, + snapshot: &Snapshot, +) -> impl Iterator<Item = ((H160, U256), StorageChange)> + '_

Gets changes for storage slots touched after the specified snapshot was created.

+
source

pub fn events_after(&self, snapshot: &Snapshot) -> &[Event]

Returns events emitted after the specified snapshot was created.

+
source

pub fn l2_to_l1_logs_after(&self, snapshot: &Snapshot) -> &[L2ToL1Log]

Returns L2-to-L1 logs emitted after the specified snapshot was created.

+
source

pub fn decommitted_hashes(&self) -> impl Iterator<Item = U256> + '_

Returns hashes of decommitted contract bytecodes in no particular order. Note that this includes +failed (out-of-gas) decommitments.

+
source

pub fn snapshot(&self) -> Snapshot

Get a snapshot for selecting which logs & co. to output using Self::events_after() and other methods.

+

Trait Implementations§

source§

impl Debug for WorldDiff

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for WorldDiff

source§

fn default() -> WorldDiff

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/testonly/index.html b/zksync_vm2/testonly/index.html new file mode 100644 index 0000000..7cd867e --- /dev/null +++ b/zksync_vm2/testonly/index.html @@ -0,0 +1,2 @@ +zksync_vm2::testonly - Rust

Module zksync_vm2::testonly

source ·
Expand description

Test-only tools for EraVM.

+

Structs§

\ No newline at end of file diff --git a/zksync_vm2/testonly/sidebar-items.js b/zksync_vm2/testonly/sidebar-items.js new file mode 100644 index 0000000..43d6acd --- /dev/null +++ b/zksync_vm2/testonly/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["TestWorld"]}; \ No newline at end of file diff --git a/zksync_vm2/testonly/struct.TestWorld.html b/zksync_vm2/testonly/struct.TestWorld.html new file mode 100644 index 0000000..5f4dda1 --- /dev/null +++ b/zksync_vm2/testonly/struct.TestWorld.html @@ -0,0 +1,20 @@ +TestWorld in zksync_vm2::testonly - Rust

Struct zksync_vm2::testonly::TestWorld

source ·
pub struct TestWorld<T> { /* private fields */ }
Expand description

Test World implementation.

+

Implementations§

source§

impl<T: Tracer> TestWorld<T>

source

pub fn new(contracts: &[(Address, Program<T, Self>)]) -> Self

Creates a test world with the provided programs.

+
§Panics
+

Panics if the provided Programs are malformed.

+

Trait Implementations§

source§

impl<T: Debug> Debug for TestWorld<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> StorageInterface for TestWorld<T>

source§

fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>

Reads the specified slot from the storage. Read more
source§

fn cost_of_writing_storage( + &mut self, + _initial_value: Option<U256>, + _new_value: U256, +) -> u32

Computes the cost of writing a storage slot.
source§

fn is_free_storage_slot(&self, _contract: &H160, _key: &U256) -> bool

Returns if the storage slot is free both in terms of gas and pubdata.
source§

impl<T: Tracer> World<T> for TestWorld<T>

source§

fn decommit(&mut self, hash: U256) -> Program<T, Self>

Loads a bytecode with the specified hash. Read more
source§

fn decommit_code(&mut self, hash: U256) -> Vec<u8>

Loads bytecode bytes for the decommit opcode.

Auto Trait Implementations§

§

impl<T> Freeze for TestWorld<T>

§

impl<T> RefUnwindSafe for TestWorld<T>

§

impl<T> Send for TestWorld<T>

§

impl<T> Sync for TestWorld<T>

§

impl<T> Unpin for TestWorld<T>

§

impl<T> UnwindSafe for TestWorld<T>

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2/trait.StorageInterface.html b/zksync_vm2/trait.StorageInterface.html new file mode 100644 index 0000000..81ad802 --- /dev/null +++ b/zksync_vm2/trait.StorageInterface.html @@ -0,0 +1,19 @@ +StorageInterface in zksync_vm2 - Rust

Trait zksync_vm2::StorageInterface

source ·
pub trait StorageInterface {
+    // Required methods
+    fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>;
+    fn cost_of_writing_storage(
+        &mut self,
+        initial_value: Option<U256>,
+        new_value: U256,
+    ) -> u32;
+    fn is_free_storage_slot(&self, contract: &H160, key: &U256) -> bool;
+}
Expand description

VM storage access operations.

+

Required Methods§

source

fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>

Reads the specified slot from the storage.

+

There is no write counterpart; WorldDiff::get_storage_changes() gives a list of all storage changes.

+
source

fn cost_of_writing_storage( + &mut self, + initial_value: Option<U256>, + new_value: U256, +) -> u32

Computes the cost of writing a storage slot.

+
source

fn is_free_storage_slot(&self, contract: &H160, key: &U256) -> bool

Returns if the storage slot is free both in terms of gas and pubdata.

+

Implementors§

\ No newline at end of file diff --git a/zksync_vm2/trait.World.html b/zksync_vm2/trait.World.html new file mode 100644 index 0000000..f6fceab --- /dev/null +++ b/zksync_vm2/trait.World.html @@ -0,0 +1,11 @@ +World in zksync_vm2 - Rust

Trait zksync_vm2::World

source ·
pub trait World<T: Tracer>: StorageInterface + Sized {
+    // Required methods
+    fn decommit(&mut self, hash: U256) -> Program<T, Self>;
+    fn decommit_code(&mut self, hash: U256) -> Vec<u8> ;
+}
Expand description

Encapsulates VM interaction with the external world. This includes VM storage and decomitting (loading) bytecodes +for execution.

+

Required Methods§

source

fn decommit(&mut self, hash: U256) -> Program<T, Self>

Loads a bytecode with the specified hash.

+

This method will be called every time a contract is called. Caching and decoding is +the world implementor’s job.

+
source

fn decommit_code(&mut self, hash: U256) -> Vec<u8>

Loads bytecode bytes for the decommit opcode.

+

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Tracer> World<T> for TestWorld<T>

\ No newline at end of file diff --git a/zksync_vm2/vm/struct.Settings.html b/zksync_vm2/vm/struct.Settings.html new file mode 100644 index 0000000..6049904 --- /dev/null +++ b/zksync_vm2/vm/struct.Settings.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.Settings.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/vm/struct.VirtualMachine.html b/zksync_vm2/vm/struct.VirtualMachine.html new file mode 100644 index 0000000..237e7e0 --- /dev/null +++ b/zksync_vm2/vm/struct.VirtualMachine.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.VirtualMachine.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/world_diff/struct.Snapshot.html b/zksync_vm2/world_diff/struct.Snapshot.html new file mode 100644 index 0000000..ba88dcc --- /dev/null +++ b/zksync_vm2/world_diff/struct.Snapshot.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.Snapshot.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/world_diff/struct.StorageChange.html b/zksync_vm2/world_diff/struct.StorageChange.html new file mode 100644 index 0000000..6e7a942 --- /dev/null +++ b/zksync_vm2/world_diff/struct.StorageChange.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.StorageChange.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2/world_diff/struct.WorldDiff.html b/zksync_vm2/world_diff/struct.WorldDiff.html new file mode 100644 index 0000000..8ac40c4 --- /dev/null +++ b/zksync_vm2/world_diff/struct.WorldDiff.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2/struct.WorldDiff.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/all.html b/zksync_vm2_interface/all.html new file mode 100644 index 0000000..f859fae --- /dev/null +++ b/zksync_vm2_interface/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/zksync_vm2_interface/enum.CallingMode.html b/zksync_vm2_interface/enum.CallingMode.html new file mode 100644 index 0000000..ceef188 --- /dev/null +++ b/zksync_vm2_interface/enum.CallingMode.html @@ -0,0 +1,26 @@ +CallingMode in zksync_vm2_interface - Rust

Enum zksync_vm2_interface::CallingMode

source ·
pub enum CallingMode {
+    Normal,
+    Delegate,
+    Mimic,
+}
Expand description

All supported calling modes for FarCall opcode.

+

Variants§

§

Normal

Normal calling mode.

+
§

Delegate

Delegate calling mode (similar to delegatecall in EVM).

+
§

Mimic

Mimic calling mode (can only be used by system contracts; allows to emulate eth_call semantics while retaining the bootloader).

+

Trait Implementations§

source§

impl Clone for CallingMode

source§

fn clone(&self) -> CallingMode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CallingMode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for CallingMode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for CallingMode

source§

fn eq(&self, other: &CallingMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for CallingMode

source§

impl Eq for CallingMode

source§

impl StructuralPartialEq for CallingMode

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/enum.CycleStats.html b/zksync_vm2_interface/enum.CycleStats.html new file mode 100644 index 0000000..c7f129b --- /dev/null +++ b/zksync_vm2_interface/enum.CycleStats.html @@ -0,0 +1,31 @@ +CycleStats in zksync_vm2_interface - Rust

Enum zksync_vm2_interface::CycleStats

source ·
pub enum CycleStats {
+    Keccak256(u32),
+    Sha256(u32),
+    EcRecover(u32),
+    Secp256r1Verify(u32),
+    Decommit(u32),
+    StorageRead,
+    StorageWrite,
+}
Expand description

Cycle statistics emitted by the VM and supplied to Tracer::on_extra_prover_cycles().

+

Variants§

§

Keccak256(u32)

Call to the keccak256 precompile with the specified number of hash cycles.

+
§

Sha256(u32)

Call to the sha256 precompile with the specified number of hash cycles.

+
§

EcRecover(u32)

Call to the ecrecover precompile with the specified number of hash cycles.

+
§

Secp256r1Verify(u32)

Call to the secp256r1_verify precompile with the specified number of hash cycles.

+
§

Decommit(u32)

Decommitting an opcode.

+
§

StorageRead

Reading a slot from the VM storage.

+
§

StorageWrite

Writing a slot to the VM storage.

+

Trait Implementations§

source§

impl Clone for CycleStats

source§

fn clone(&self) -> CycleStats

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CycleStats

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for CycleStats

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/enum.Opcode.html b/zksync_vm2_interface/enum.Opcode.html new file mode 100644 index 0000000..718a637 --- /dev/null +++ b/zksync_vm2_interface/enum.Opcode.html @@ -0,0 +1,63 @@ +Opcode in zksync_vm2_interface - Rust

Enum zksync_vm2_interface::Opcode

source ·
pub enum Opcode {
+
Show 43 variants Nop, + Add, + Sub, + And, + Or, + Xor, + ShiftLeft, + ShiftRight, + RotateLeft, + RotateRight, + Mul, + Div, + NearCall, + FarCall(CallingMode), + Ret(ReturnType), + Jump, + Event, + L2ToL1Message, + Decommit, + This, + Caller, + CodeAddress, + ErgsLeft, + SP, + ContextMeta, + ContextU128, + SetContextU128, + IncrementTxNumber, + AuxMutating0, + PrecompileCall, + HeapRead, + HeapWrite, + AuxHeapRead, + AuxHeapWrite, + PointerRead, + PointerAdd, + PointerSub, + PointerPack, + PointerShrink, + StorageRead, + StorageWrite, + TransientStorageRead, + TransientStorageWrite, +
}
Expand description

All supported EraVM opcodes in a single enumeration.

+

Variants§

§

Nop

§

Add

§

Sub

§

And

§

Or

§

Xor

§

ShiftLeft

§

ShiftRight

§

RotateLeft

§

RotateRight

§

Mul

§

Div

§

NearCall

§

FarCall(CallingMode)

§

Ret(ReturnType)

§

Jump

§

Event

§

L2ToL1Message

§

Decommit

§

This

§

Caller

§

CodeAddress

§

ErgsLeft

§

SP

§

ContextMeta

§

ContextU128

§

SetContextU128

§

IncrementTxNumber

§

AuxMutating0

§

PrecompileCall

§

HeapRead

§

HeapWrite

§

AuxHeapRead

§

AuxHeapWrite

§

PointerRead

§

PointerAdd

§

PointerSub

§

PointerPack

§

PointerShrink

§

StorageRead

§

StorageWrite

§

TransientStorageRead

§

TransientStorageWrite

Trait Implementations§

source§

impl Clone for Opcode

source§

fn clone(&self) -> Opcode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Opcode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Opcode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Opcode

source§

fn eq(&self, other: &Opcode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for Opcode

source§

impl Eq for Opcode

source§

impl StructuralPartialEq for Opcode

Auto Trait Implementations§

§

impl Freeze for Opcode

§

impl RefUnwindSafe for Opcode

§

impl Send for Opcode

§

impl Sync for Opcode

§

impl Unpin for Opcode

§

impl UnwindSafe for Opcode

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/enum.ReturnType.html b/zksync_vm2_interface/enum.ReturnType.html new file mode 100644 index 0000000..fbfbe66 --- /dev/null +++ b/zksync_vm2_interface/enum.ReturnType.html @@ -0,0 +1,27 @@ +ReturnType in zksync_vm2_interface - Rust

Enum zksync_vm2_interface::ReturnType

source ·
pub enum ReturnType {
+    Normal,
+    Revert,
+    Panic,
+}
Expand description

All supported return types for the Ret opcode.

+

Variants§

§

Normal

Normal return.

+
§

Revert

Revert (e.g., a result of a Solidity revert).

+
§

Panic

Panic, i.e. a non-revert abnormal control flow termination (e.g., out of gas).

+

Implementations§

source§

impl ReturnType

source

pub fn is_failure(&self) -> bool

Checks if this return type is normal.

+

Trait Implementations§

source§

impl Clone for ReturnType

source§

fn clone(&self) -> ReturnType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ReturnType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for ReturnType

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for ReturnType

source§

fn eq(&self, other: &ReturnType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for ReturnType

source§

impl Eq for ReturnType

source§

impl StructuralPartialEq for ReturnType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/index.html b/zksync_vm2_interface/index.html new file mode 100644 index 0000000..9a3ace6 --- /dev/null +++ b/zksync_vm2_interface/index.html @@ -0,0 +1,76 @@ +zksync_vm2_interface - Rust

Crate zksync_vm2_interface

source ·
Expand description

§EraVM Stable Interface

+

This crate defines an interface for tracers that will never change but may be extended. +To be precise, a tracer using this interface will work in any VM written against that +version or a newer one. Updating the tracer to depend on a newer interface version is +not necessary. In fact, tracers should depend on the oldest version that has the required +features.

+

A struct implementing Tracer may read and mutate the VM’s state via StateInterface +when particular opcodes are executed.

+

§Why is extreme backwards compatibility required here?

+

Suppose VM1 uses stable interface version 1 and VM2 uses stable interface version 2. +With any sane design it would be trivial to take a tracer written for version 1 and +update it to work with version 2. However, then it can no longer be used with VM1.

+

This exact thing caused us a lot of trouble when we put many versions of zk_evm in multivm.

+

§How do I add a new feature to the interface?

+

Do not change the existing traits. In fact, you should delete existing code in the new +version that you publish and import it from the previous version instead.

+

This is how you would add a new method to StateInterface and a new opcode.

+ +
use zksync_vm2_interface_v1::{
+    StateInterface as StateInterfaceV1, Tracer as TracerV1, opcodes::NearCall,
+};
+
+trait StateInterface: StateInterfaceV1 {
+    fn get_some_new_field(&self) -> u32;
+}
+
+pub struct NewOpcode;
+
+#[derive(PartialEq, Eq)]
+enum Opcode {
+    NewOpcode,
+    NearCall,
+    // ...
+}
+
+trait OpcodeType {
+    const VALUE: Opcode;
+}
+
+impl OpcodeType for NewOpcode {
+    const VALUE: Opcode = Opcode::NewOpcode;
+}
+
+// Do this for every old opcode
+impl OpcodeType for NearCall {
+    const VALUE: Opcode = Opcode::NearCall;
+}
+
+trait Tracer {
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+    fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+}
+
+impl<T: TracerV1> Tracer for T {
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+        match OP::VALUE {
+            Opcode::NewOpcode => {}
+            // Do this for every old opcode
+            Opcode::NearCall => {
+                <Self as TracerV1>::before_instruction::<NearCall, _>(self, state)
+            }
+        }
+    }
+    fn after_instruction<OP: OpcodeType, S: StateInterface>(&mut self, _state: &mut S) {}
+}
+
+// Now you can use the new features by implementing TracerV2
+struct MyTracer;
+impl Tracer for MyTracer {
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+        if OP::VALUE == Opcode::NewOpcode {
+            state.get_some_new_field();
+        }
+    }
+}
+

Modules§

Structs§

  • Event emitted by EraVM.
  • VM execution flags. See the EraVM reference for more details.
  • Identifier of a VM heap.
  • L2-to-L1 log emitted by EraVM.

Enums§

Traits§

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/index.html b/zksync_vm2_interface/opcodes/index.html new file mode 100644 index 0000000..4840f5d --- /dev/null +++ b/zksync_vm2_interface/opcodes/index.html @@ -0,0 +1,2 @@ +zksync_vm2_interface::opcodes - Rust

Module zksync_vm2_interface::opcodes

source ·
Expand description

EraVM opcodes.

+

Structs§

Traits§

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/sidebar-items.js b/zksync_vm2_interface/opcodes/sidebar-items.js new file mode 100644 index 0000000..560c06d --- /dev/null +++ b/zksync_vm2_interface/opcodes/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Add","And","AuxHeapRead","AuxHeapWrite","AuxMutating0","Caller","CodeAddress","ContextMeta","ContextU128","Decommit","Delegate","Div","ErgsLeft","Event","FarCall","HeapRead","HeapWrite","IncrementTxNumber","Jump","L2ToL1Message","Mimic","Mul","NearCall","Nop","Normal","Or","Panic","PointerAdd","PointerPack","PointerRead","PointerShrink","PointerSub","PrecompileCall","Ret","Revert","RotateLeft","RotateRight","SP","SetContextU128","ShiftLeft","ShiftRight","StorageRead","StorageWrite","Sub","This","TransientStorageRead","TransientStorageWrite","Xor"],"trait":["TypeLevelCallingMode","TypeLevelReturnType"]}; \ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Add.html b/zksync_vm2_interface/opcodes/struct.Add.html new file mode 100644 index 0000000..5f372a8 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Add.html @@ -0,0 +1,13 @@ +Add in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Add

source ·
pub struct Add;
Expand description

Add opcode.

+

Trait Implementations§

source§

impl Debug for Add

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Add

source§

const VALUE: Opcode = Opcode::Add

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Add

§

impl RefUnwindSafe for Add

§

impl Send for Add

§

impl Sync for Add

§

impl Unpin for Add

§

impl UnwindSafe for Add

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.And.html b/zksync_vm2_interface/opcodes/struct.And.html new file mode 100644 index 0000000..9272b13 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.And.html @@ -0,0 +1,13 @@ +And in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::And

source ·
pub struct And;
Expand description

And opcode.

+

Trait Implementations§

source§

impl Debug for And

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for And

source§

const VALUE: Opcode = Opcode::And

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for And

§

impl RefUnwindSafe for And

§

impl Send for And

§

impl Sync for And

§

impl Unpin for And

§

impl UnwindSafe for And

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.AuxHeapRead.html b/zksync_vm2_interface/opcodes/struct.AuxHeapRead.html new file mode 100644 index 0000000..fcc55a8 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.AuxHeapRead.html @@ -0,0 +1,13 @@ +AuxHeapRead in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::AuxHeapRead

source ·
pub struct AuxHeapRead;
Expand description

AuxHeapRead opcode.

+

Trait Implementations§

source§

impl Debug for AuxHeapRead

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for AuxHeapRead

source§

const VALUE: Opcode = Opcode::AuxHeapRead

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.AuxHeapWrite.html b/zksync_vm2_interface/opcodes/struct.AuxHeapWrite.html new file mode 100644 index 0000000..de61751 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.AuxHeapWrite.html @@ -0,0 +1,13 @@ +AuxHeapWrite in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::AuxHeapWrite

source ·
pub struct AuxHeapWrite;
Expand description

AuxHeapWrite opcode.

+

Trait Implementations§

source§

impl Debug for AuxHeapWrite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for AuxHeapWrite

source§

const VALUE: Opcode = Opcode::AuxHeapWrite

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.AuxMutating0.html b/zksync_vm2_interface/opcodes/struct.AuxMutating0.html new file mode 100644 index 0000000..356bf8a --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.AuxMutating0.html @@ -0,0 +1,13 @@ +AuxMutating0 in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::AuxMutating0

source ·
pub struct AuxMutating0;
Expand description

AuxMutating0 opcode.

+

Trait Implementations§

source§

impl Debug for AuxMutating0

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for AuxMutating0

source§

const VALUE: Opcode = Opcode::AuxMutating0

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Caller.html b/zksync_vm2_interface/opcodes/struct.Caller.html new file mode 100644 index 0000000..9dc4bd8 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Caller.html @@ -0,0 +1,13 @@ +Caller in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Caller

source ·
pub struct Caller;
Expand description

Caller opcode.

+

Trait Implementations§

source§

impl Debug for Caller

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Caller

source§

const VALUE: Opcode = Opcode::Caller

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Caller

§

impl RefUnwindSafe for Caller

§

impl Send for Caller

§

impl Sync for Caller

§

impl Unpin for Caller

§

impl UnwindSafe for Caller

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.CodeAddress.html b/zksync_vm2_interface/opcodes/struct.CodeAddress.html new file mode 100644 index 0000000..89d3cf0 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.CodeAddress.html @@ -0,0 +1,13 @@ +CodeAddress in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::CodeAddress

source ·
pub struct CodeAddress;
Expand description

CodeAddress opcode.

+

Trait Implementations§

source§

impl Debug for CodeAddress

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for CodeAddress

source§

const VALUE: Opcode = Opcode::CodeAddress

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.ContextMeta.html b/zksync_vm2_interface/opcodes/struct.ContextMeta.html new file mode 100644 index 0000000..6b0ad70 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.ContextMeta.html @@ -0,0 +1,13 @@ +ContextMeta in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::ContextMeta

source ·
pub struct ContextMeta;
Expand description

ContextMeta opcode.

+

Trait Implementations§

source§

impl Debug for ContextMeta

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for ContextMeta

source§

const VALUE: Opcode = Opcode::ContextMeta

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.ContextU128.html b/zksync_vm2_interface/opcodes/struct.ContextU128.html new file mode 100644 index 0000000..0cb0e8b --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.ContextU128.html @@ -0,0 +1,13 @@ +ContextU128 in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::ContextU128

source ·
pub struct ContextU128;
Expand description

ContextU128 opcode.

+

Trait Implementations§

source§

impl Debug for ContextU128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for ContextU128

source§

const VALUE: Opcode = Opcode::ContextU128

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Decommit.html b/zksync_vm2_interface/opcodes/struct.Decommit.html new file mode 100644 index 0000000..605c54a --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Decommit.html @@ -0,0 +1,13 @@ +Decommit in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Decommit

source ·
pub struct Decommit;
Expand description

Decommit opcode.

+

Trait Implementations§

source§

impl Debug for Decommit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Decommit

source§

const VALUE: Opcode = Opcode::Decommit

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Delegate.html b/zksync_vm2_interface/opcodes/struct.Delegate.html new file mode 100644 index 0000000..2313d3c --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Delegate.html @@ -0,0 +1,13 @@ +Delegate in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Delegate

source ·
pub struct Delegate;
Expand description

Delegate FarCall mode.

+

Trait Implementations§

source§

impl Debug for Delegate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TypeLevelCallingMode for Delegate

source§

const VALUE: CallingMode = CallingMode::Delegate

Constant corresponding to this mode allowing to easily match it.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Div.html b/zksync_vm2_interface/opcodes/struct.Div.html new file mode 100644 index 0000000..a0cc052 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Div.html @@ -0,0 +1,13 @@ +Div in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Div

source ·
pub struct Div;
Expand description

Div opcode.

+

Trait Implementations§

source§

impl Debug for Div

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Div

source§

const VALUE: Opcode = Opcode::Div

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Div

§

impl RefUnwindSafe for Div

§

impl Send for Div

§

impl Sync for Div

§

impl Unpin for Div

§

impl UnwindSafe for Div

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.ErgsLeft.html b/zksync_vm2_interface/opcodes/struct.ErgsLeft.html new file mode 100644 index 0000000..c566155 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.ErgsLeft.html @@ -0,0 +1,13 @@ +ErgsLeft in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::ErgsLeft

source ·
pub struct ErgsLeft;
Expand description

ErgsLeft opcode.

+

Trait Implementations§

source§

impl Debug for ErgsLeft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for ErgsLeft

source§

const VALUE: Opcode = Opcode::ErgsLeft

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Event.html b/zksync_vm2_interface/opcodes/struct.Event.html new file mode 100644 index 0000000..0d7369c --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Event.html @@ -0,0 +1,13 @@ +Event in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Event

source ·
pub struct Event;
Expand description

Event opcode.

+

Trait Implementations§

source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Event

source§

const VALUE: Opcode = Opcode::Event

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.FarCall.html b/zksync_vm2_interface/opcodes/struct.FarCall.html new file mode 100644 index 0000000..27d160e --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.FarCall.html @@ -0,0 +1,18 @@ +FarCall in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::FarCall

source ·
pub struct FarCall<M: TypeLevelCallingMode>(/* private fields */);
Expand description

FarCall group of opcodes distinguished by the calling mode (normal, delegate, or mimic).

+

Trait Implementations§

source§

impl<M: Debug + TypeLevelCallingMode> Debug for FarCall<M>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<M: TypeLevelCallingMode> OpcodeType for FarCall<M>

source§

const VALUE: Opcode = _

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl<M> Freeze for FarCall<M>

§

impl<M> RefUnwindSafe for FarCall<M>
where + M: RefUnwindSafe,

§

impl<M> Send for FarCall<M>
where + M: Send,

§

impl<M> Sync for FarCall<M>
where + M: Sync,

§

impl<M> Unpin for FarCall<M>
where + M: Unpin,

§

impl<M> UnwindSafe for FarCall<M>
where + M: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.HeapRead.html b/zksync_vm2_interface/opcodes/struct.HeapRead.html new file mode 100644 index 0000000..2dbaf71 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.HeapRead.html @@ -0,0 +1,13 @@ +HeapRead in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::HeapRead

source ·
pub struct HeapRead;
Expand description

HeapRead opcode.

+

Trait Implementations§

source§

impl Debug for HeapRead

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for HeapRead

source§

const VALUE: Opcode = Opcode::HeapRead

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.HeapWrite.html b/zksync_vm2_interface/opcodes/struct.HeapWrite.html new file mode 100644 index 0000000..e3cf89d --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.HeapWrite.html @@ -0,0 +1,13 @@ +HeapWrite in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::HeapWrite

source ·
pub struct HeapWrite;
Expand description

HeapWrite opcode.

+

Trait Implementations§

source§

impl Debug for HeapWrite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for HeapWrite

source§

const VALUE: Opcode = Opcode::HeapWrite

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.IncrementTxNumber.html b/zksync_vm2_interface/opcodes/struct.IncrementTxNumber.html new file mode 100644 index 0000000..7683865 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.IncrementTxNumber.html @@ -0,0 +1,13 @@ +IncrementTxNumber in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::IncrementTxNumber

source ·
pub struct IncrementTxNumber;
Expand description

IncrementTxNumber opcode.

+

Trait Implementations§

source§

impl Debug for IncrementTxNumber

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for IncrementTxNumber

source§

const VALUE: Opcode = Opcode::IncrementTxNumber

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Jump.html b/zksync_vm2_interface/opcodes/struct.Jump.html new file mode 100644 index 0000000..f1bdfb8 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Jump.html @@ -0,0 +1,13 @@ +Jump in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Jump

source ·
pub struct Jump;
Expand description

Jump opcode.

+

Trait Implementations§

source§

impl Debug for Jump

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Jump

source§

const VALUE: Opcode = Opcode::Jump

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Jump

§

impl RefUnwindSafe for Jump

§

impl Send for Jump

§

impl Sync for Jump

§

impl Unpin for Jump

§

impl UnwindSafe for Jump

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.L2ToL1Message.html b/zksync_vm2_interface/opcodes/struct.L2ToL1Message.html new file mode 100644 index 0000000..cd17bac --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.L2ToL1Message.html @@ -0,0 +1,13 @@ +L2ToL1Message in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::L2ToL1Message

source ·
pub struct L2ToL1Message;
Expand description

L2ToL1Message opcode.

+

Trait Implementations§

source§

impl Debug for L2ToL1Message

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for L2ToL1Message

source§

const VALUE: Opcode = Opcode::L2ToL1Message

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Mimic.html b/zksync_vm2_interface/opcodes/struct.Mimic.html new file mode 100644 index 0000000..8d6a64a --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Mimic.html @@ -0,0 +1,13 @@ +Mimic in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Mimic

source ·
pub struct Mimic;
Expand description

Mimic FarCall mode.

+

Trait Implementations§

source§

impl Debug for Mimic

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TypeLevelCallingMode for Mimic

source§

const VALUE: CallingMode = CallingMode::Mimic

Constant corresponding to this mode allowing to easily match it.

Auto Trait Implementations§

§

impl Freeze for Mimic

§

impl RefUnwindSafe for Mimic

§

impl Send for Mimic

§

impl Sync for Mimic

§

impl Unpin for Mimic

§

impl UnwindSafe for Mimic

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Mul.html b/zksync_vm2_interface/opcodes/struct.Mul.html new file mode 100644 index 0000000..17c7dad --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Mul.html @@ -0,0 +1,13 @@ +Mul in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Mul

source ·
pub struct Mul;
Expand description

Mul opcode.

+

Trait Implementations§

source§

impl Debug for Mul

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Mul

source§

const VALUE: Opcode = Opcode::Mul

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Mul

§

impl RefUnwindSafe for Mul

§

impl Send for Mul

§

impl Sync for Mul

§

impl Unpin for Mul

§

impl UnwindSafe for Mul

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.NearCall.html b/zksync_vm2_interface/opcodes/struct.NearCall.html new file mode 100644 index 0000000..70bb053 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.NearCall.html @@ -0,0 +1,13 @@ +NearCall in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::NearCall

source ·
pub struct NearCall;
Expand description

NearCall opcode.

+

Trait Implementations§

source§

impl Debug for NearCall

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for NearCall

source§

const VALUE: Opcode = Opcode::NearCall

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Nop.html b/zksync_vm2_interface/opcodes/struct.Nop.html new file mode 100644 index 0000000..b02a751 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Nop.html @@ -0,0 +1,13 @@ +Nop in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Nop

source ·
pub struct Nop;
Expand description

Nop opcode.

+

Trait Implementations§

source§

impl Debug for Nop

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Nop

source§

const VALUE: Opcode = Opcode::Nop

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Nop

§

impl RefUnwindSafe for Nop

§

impl Send for Nop

§

impl Sync for Nop

§

impl Unpin for Nop

§

impl UnwindSafe for Nop

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Normal.html b/zksync_vm2_interface/opcodes/struct.Normal.html new file mode 100644 index 0000000..07f4be3 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Normal.html @@ -0,0 +1,13 @@ +Normal in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Normal

source ·
pub struct Normal;
Expand description

Normal Return mode / FarCall mode.

+

Trait Implementations§

source§

impl Debug for Normal

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TypeLevelCallingMode for Normal

source§

const VALUE: CallingMode = CallingMode::Normal

Constant corresponding to this mode allowing to easily match it.
source§

impl TypeLevelReturnType for Normal

source§

const VALUE: ReturnType = ReturnType::Normal

Constant corresponding to this return type allowing to easily match it.

Auto Trait Implementations§

§

impl Freeze for Normal

§

impl RefUnwindSafe for Normal

§

impl Send for Normal

§

impl Sync for Normal

§

impl Unpin for Normal

§

impl UnwindSafe for Normal

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Or.html b/zksync_vm2_interface/opcodes/struct.Or.html new file mode 100644 index 0000000..a34383b --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Or.html @@ -0,0 +1,13 @@ +Or in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Or

source ·
pub struct Or;
Expand description

Or opcode.

+

Trait Implementations§

source§

impl Debug for Or

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Or

source§

const VALUE: Opcode = Opcode::Or

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Or

§

impl RefUnwindSafe for Or

§

impl Send for Or

§

impl Sync for Or

§

impl Unpin for Or

§

impl UnwindSafe for Or

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Panic.html b/zksync_vm2_interface/opcodes/struct.Panic.html new file mode 100644 index 0000000..e46eb27 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Panic.html @@ -0,0 +1,13 @@ +Panic in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Panic

source ·
pub struct Panic;
Expand description

Panic Return mode.

+

Trait Implementations§

source§

impl Debug for Panic

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TypeLevelReturnType for Panic

source§

const VALUE: ReturnType = ReturnType::Panic

Constant corresponding to this return type allowing to easily match it.

Auto Trait Implementations§

§

impl Freeze for Panic

§

impl RefUnwindSafe for Panic

§

impl Send for Panic

§

impl Sync for Panic

§

impl Unpin for Panic

§

impl UnwindSafe for Panic

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PointerAdd.html b/zksync_vm2_interface/opcodes/struct.PointerAdd.html new file mode 100644 index 0000000..39f612d --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PointerAdd.html @@ -0,0 +1,13 @@ +PointerAdd in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PointerAdd

source ·
pub struct PointerAdd;
Expand description

PointerAdd opcode.

+

Trait Implementations§

source§

impl Debug for PointerAdd

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PointerAdd

source§

const VALUE: Opcode = Opcode::PointerAdd

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PointerPack.html b/zksync_vm2_interface/opcodes/struct.PointerPack.html new file mode 100644 index 0000000..9542ec2 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PointerPack.html @@ -0,0 +1,13 @@ +PointerPack in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PointerPack

source ·
pub struct PointerPack;
Expand description

PointerPack opcode.

+

Trait Implementations§

source§

impl Debug for PointerPack

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PointerPack

source§

const VALUE: Opcode = Opcode::PointerPack

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PointerRead.html b/zksync_vm2_interface/opcodes/struct.PointerRead.html new file mode 100644 index 0000000..3744b64 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PointerRead.html @@ -0,0 +1,13 @@ +PointerRead in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PointerRead

source ·
pub struct PointerRead;
Expand description

PointerRead opcode.

+

Trait Implementations§

source§

impl Debug for PointerRead

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PointerRead

source§

const VALUE: Opcode = Opcode::PointerRead

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PointerShrink.html b/zksync_vm2_interface/opcodes/struct.PointerShrink.html new file mode 100644 index 0000000..38d519f --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PointerShrink.html @@ -0,0 +1,13 @@ +PointerShrink in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PointerShrink

source ·
pub struct PointerShrink;
Expand description

PointerShrink opcode.

+

Trait Implementations§

source§

impl Debug for PointerShrink

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PointerShrink

source§

const VALUE: Opcode = Opcode::PointerShrink

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PointerSub.html b/zksync_vm2_interface/opcodes/struct.PointerSub.html new file mode 100644 index 0000000..abdb5f8 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PointerSub.html @@ -0,0 +1,13 @@ +PointerSub in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PointerSub

source ·
pub struct PointerSub;
Expand description

PointerSub opcode.

+

Trait Implementations§

source§

impl Debug for PointerSub

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PointerSub

source§

const VALUE: Opcode = Opcode::PointerSub

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.PrecompileCall.html b/zksync_vm2_interface/opcodes/struct.PrecompileCall.html new file mode 100644 index 0000000..3facdee --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.PrecompileCall.html @@ -0,0 +1,13 @@ +PrecompileCall in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::PrecompileCall

source ·
pub struct PrecompileCall;
Expand description

PrecompileCall opcode.

+

Trait Implementations§

source§

impl Debug for PrecompileCall

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for PrecompileCall

source§

const VALUE: Opcode = Opcode::PrecompileCall

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Ret.html b/zksync_vm2_interface/opcodes/struct.Ret.html new file mode 100644 index 0000000..1ac921c --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Ret.html @@ -0,0 +1,18 @@ +Ret in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Ret

source ·
pub struct Ret<T: TypeLevelReturnType>(/* private fields */);
Expand description

Ret group of opcodes distinguished by the return type (normal, panic, or revert).

+

Trait Implementations§

source§

impl<T: Debug + TypeLevelReturnType> Debug for Ret<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: TypeLevelReturnType> OpcodeType for Ret<T>

source§

const VALUE: Opcode = _

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl<T> Freeze for Ret<T>

§

impl<T> RefUnwindSafe for Ret<T>
where + T: RefUnwindSafe,

§

impl<T> Send for Ret<T>
where + T: Send,

§

impl<T> Sync for Ret<T>
where + T: Sync,

§

impl<T> Unpin for Ret<T>
where + T: Unpin,

§

impl<T> UnwindSafe for Ret<T>
where + T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Revert.html b/zksync_vm2_interface/opcodes/struct.Revert.html new file mode 100644 index 0000000..24af408 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Revert.html @@ -0,0 +1,13 @@ +Revert in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Revert

source ·
pub struct Revert;
Expand description

Revert Return mode.

+

Trait Implementations§

source§

impl Debug for Revert

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TypeLevelReturnType for Revert

source§

const VALUE: ReturnType = ReturnType::Revert

Constant corresponding to this return type allowing to easily match it.

Auto Trait Implementations§

§

impl Freeze for Revert

§

impl RefUnwindSafe for Revert

§

impl Send for Revert

§

impl Sync for Revert

§

impl Unpin for Revert

§

impl UnwindSafe for Revert

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.RotateLeft.html b/zksync_vm2_interface/opcodes/struct.RotateLeft.html new file mode 100644 index 0000000..8cf6d22 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.RotateLeft.html @@ -0,0 +1,13 @@ +RotateLeft in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::RotateLeft

source ·
pub struct RotateLeft;
Expand description

RotateLeft opcode.

+

Trait Implementations§

source§

impl Debug for RotateLeft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for RotateLeft

source§

const VALUE: Opcode = Opcode::RotateLeft

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.RotateRight.html b/zksync_vm2_interface/opcodes/struct.RotateRight.html new file mode 100644 index 0000000..3b2ebb9 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.RotateRight.html @@ -0,0 +1,13 @@ +RotateRight in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::RotateRight

source ·
pub struct RotateRight;
Expand description

RotateRight opcode.

+

Trait Implementations§

source§

impl Debug for RotateRight

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for RotateRight

source§

const VALUE: Opcode = Opcode::RotateRight

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.SP.html b/zksync_vm2_interface/opcodes/struct.SP.html new file mode 100644 index 0000000..0618831 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.SP.html @@ -0,0 +1,13 @@ +SP in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::SP

source ·
pub struct SP;
Expand description

SP opcode.

+

Trait Implementations§

source§

impl Debug for SP

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for SP

source§

const VALUE: Opcode = Opcode::SP

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for SP

§

impl RefUnwindSafe for SP

§

impl Send for SP

§

impl Sync for SP

§

impl Unpin for SP

§

impl UnwindSafe for SP

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.SetContextU128.html b/zksync_vm2_interface/opcodes/struct.SetContextU128.html new file mode 100644 index 0000000..d2a4d2a --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.SetContextU128.html @@ -0,0 +1,13 @@ +SetContextU128 in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::SetContextU128

source ·
pub struct SetContextU128;
Expand description

SetContextU128 opcode.

+

Trait Implementations§

source§

impl Debug for SetContextU128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for SetContextU128

source§

const VALUE: Opcode = Opcode::SetContextU128

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.ShiftLeft.html b/zksync_vm2_interface/opcodes/struct.ShiftLeft.html new file mode 100644 index 0000000..434d29d --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.ShiftLeft.html @@ -0,0 +1,13 @@ +ShiftLeft in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::ShiftLeft

source ·
pub struct ShiftLeft;
Expand description

ShiftLeft opcode.

+

Trait Implementations§

source§

impl Debug for ShiftLeft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for ShiftLeft

source§

const VALUE: Opcode = Opcode::ShiftLeft

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.ShiftRight.html b/zksync_vm2_interface/opcodes/struct.ShiftRight.html new file mode 100644 index 0000000..8e141d3 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.ShiftRight.html @@ -0,0 +1,13 @@ +ShiftRight in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::ShiftRight

source ·
pub struct ShiftRight;
Expand description

ShiftRight opcode.

+

Trait Implementations§

source§

impl Debug for ShiftRight

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for ShiftRight

source§

const VALUE: Opcode = Opcode::ShiftRight

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.StorageRead.html b/zksync_vm2_interface/opcodes/struct.StorageRead.html new file mode 100644 index 0000000..0fe87c1 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.StorageRead.html @@ -0,0 +1,13 @@ +StorageRead in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::StorageRead

source ·
pub struct StorageRead;
Expand description

StorageRead opcode.

+

Trait Implementations§

source§

impl Debug for StorageRead

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for StorageRead

source§

const VALUE: Opcode = Opcode::StorageRead

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.StorageWrite.html b/zksync_vm2_interface/opcodes/struct.StorageWrite.html new file mode 100644 index 0000000..3a220c1 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.StorageWrite.html @@ -0,0 +1,13 @@ +StorageWrite in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::StorageWrite

source ·
pub struct StorageWrite;
Expand description

StorageWrite opcode.

+

Trait Implementations§

source§

impl Debug for StorageWrite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for StorageWrite

source§

const VALUE: Opcode = Opcode::StorageWrite

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Sub.html b/zksync_vm2_interface/opcodes/struct.Sub.html new file mode 100644 index 0000000..8d731e6 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Sub.html @@ -0,0 +1,13 @@ +Sub in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Sub

source ·
pub struct Sub;
Expand description

Sub opcode.

+

Trait Implementations§

source§

impl Debug for Sub

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Sub

source§

const VALUE: Opcode = Opcode::Sub

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Sub

§

impl RefUnwindSafe for Sub

§

impl Send for Sub

§

impl Sync for Sub

§

impl Unpin for Sub

§

impl UnwindSafe for Sub

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.This.html b/zksync_vm2_interface/opcodes/struct.This.html new file mode 100644 index 0000000..be7bdf2 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.This.html @@ -0,0 +1,13 @@ +This in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::This

source ·
pub struct This;
Expand description

This opcode.

+

Trait Implementations§

source§

impl Debug for This

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for This

source§

const VALUE: Opcode = Opcode::This

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for This

§

impl RefUnwindSafe for This

§

impl Send for This

§

impl Sync for This

§

impl Unpin for This

§

impl UnwindSafe for This

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.TransientStorageRead.html b/zksync_vm2_interface/opcodes/struct.TransientStorageRead.html new file mode 100644 index 0000000..582628f --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.TransientStorageRead.html @@ -0,0 +1,13 @@ +TransientStorageRead in zksync_vm2_interface::opcodes - Rust
pub struct TransientStorageRead;
Expand description

TransientStorageRead opcode.

+

Trait Implementations§

source§

impl Debug for TransientStorageRead

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for TransientStorageRead

source§

const VALUE: Opcode = Opcode::TransientStorageRead

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.TransientStorageWrite.html b/zksync_vm2_interface/opcodes/struct.TransientStorageWrite.html new file mode 100644 index 0000000..2a7571e --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.TransientStorageWrite.html @@ -0,0 +1,13 @@ +TransientStorageWrite in zksync_vm2_interface::opcodes - Rust
pub struct TransientStorageWrite;
Expand description

TransientStorageWrite opcode.

+

Trait Implementations§

source§

impl Debug for TransientStorageWrite

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for TransientStorageWrite

source§

const VALUE: Opcode = Opcode::TransientStorageWrite

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/struct.Xor.html b/zksync_vm2_interface/opcodes/struct.Xor.html new file mode 100644 index 0000000..511bd60 --- /dev/null +++ b/zksync_vm2_interface/opcodes/struct.Xor.html @@ -0,0 +1,13 @@ +Xor in zksync_vm2_interface::opcodes - Rust

Struct zksync_vm2_interface::opcodes::Xor

source ·
pub struct Xor;
Expand description

Xor opcode.

+

Trait Implementations§

source§

impl Debug for Xor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl OpcodeType for Xor

source§

const VALUE: Opcode = Opcode::Xor

Opcode variant corresponding to this opcode type.

Auto Trait Implementations§

§

impl Freeze for Xor

§

impl RefUnwindSafe for Xor

§

impl Send for Xor

§

impl Sync for Xor

§

impl Unpin for Xor

§

impl UnwindSafe for Xor

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/trait.TypeLevelCallingMode.html b/zksync_vm2_interface/opcodes/trait.TypeLevelCallingMode.html new file mode 100644 index 0000000..4b0a836 --- /dev/null +++ b/zksync_vm2_interface/opcodes/trait.TypeLevelCallingMode.html @@ -0,0 +1,5 @@ +TypeLevelCallingMode in zksync_vm2_interface::opcodes - Rust
pub trait TypeLevelCallingMode {
+    const VALUE: CallingMode;
+}
Expand description

Calling mode for the FarCall opcodes.

+

Required Associated Constants§

source

const VALUE: CallingMode

Constant corresponding to this mode allowing to easily match it.

+

Object Safety§

This trait is not object safe.

Implementors§

source§

impl TypeLevelCallingMode for Delegate

source§

const VALUE: CallingMode = CallingMode::Delegate

source§

impl TypeLevelCallingMode for Mimic

source§

const VALUE: CallingMode = CallingMode::Mimic

source§

impl TypeLevelCallingMode for Normal

source§

const VALUE: CallingMode = CallingMode::Normal

\ No newline at end of file diff --git a/zksync_vm2_interface/opcodes/trait.TypeLevelReturnType.html b/zksync_vm2_interface/opcodes/trait.TypeLevelReturnType.html new file mode 100644 index 0000000..6356972 --- /dev/null +++ b/zksync_vm2_interface/opcodes/trait.TypeLevelReturnType.html @@ -0,0 +1,5 @@ +TypeLevelReturnType in zksync_vm2_interface::opcodes - Rust
pub trait TypeLevelReturnType {
+    const VALUE: ReturnType;
+}
Expand description

Return type for the Ret opcodes.

+

Required Associated Constants§

source

const VALUE: ReturnType

Constant corresponding to this return type allowing to easily match it.

+

Object Safety§

This trait is not object safe.

Implementors§

source§

impl TypeLevelReturnType for Normal

source§

const VALUE: ReturnType = ReturnType::Normal

source§

impl TypeLevelReturnType for Panic

source§

const VALUE: ReturnType = ReturnType::Panic

source§

impl TypeLevelReturnType for Revert

source§

const VALUE: ReturnType = ReturnType::Revert

\ No newline at end of file diff --git a/zksync_vm2_interface/sidebar-items.js b/zksync_vm2_interface/sidebar-items.js new file mode 100644 index 0000000..1931b9a --- /dev/null +++ b/zksync_vm2_interface/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["CallingMode","CycleStats","Opcode","ReturnType"],"mod":["opcodes"],"struct":["Event","Flags","HeapId","L2ToL1Log"],"trait":["CallframeInterface","OpcodeType","StateInterface","Tracer"]}; \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/struct.Event.html b/zksync_vm2_interface/state_interface/struct.Event.html new file mode 100644 index 0000000..47ef358 --- /dev/null +++ b/zksync_vm2_interface/state_interface/struct.Event.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/struct.Event.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/struct.Flags.html b/zksync_vm2_interface/state_interface/struct.Flags.html new file mode 100644 index 0000000..d5fdbbb --- /dev/null +++ b/zksync_vm2_interface/state_interface/struct.Flags.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/struct.Flags.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/struct.HeapId.html b/zksync_vm2_interface/state_interface/struct.HeapId.html new file mode 100644 index 0000000..1561ed5 --- /dev/null +++ b/zksync_vm2_interface/state_interface/struct.HeapId.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/struct.HeapId.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/struct.L2ToL1Log.html b/zksync_vm2_interface/state_interface/struct.L2ToL1Log.html new file mode 100644 index 0000000..a7cae44 --- /dev/null +++ b/zksync_vm2_interface/state_interface/struct.L2ToL1Log.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/struct.L2ToL1Log.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/trait.CallframeInterface.html b/zksync_vm2_interface/state_interface/trait.CallframeInterface.html new file mode 100644 index 0000000..ced68e9 --- /dev/null +++ b/zksync_vm2_interface/state_interface/trait.CallframeInterface.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/trait.CallframeInterface.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/state_interface/trait.StateInterface.html b/zksync_vm2_interface/state_interface/trait.StateInterface.html new file mode 100644 index 0000000..ac29b0e --- /dev/null +++ b/zksync_vm2_interface/state_interface/trait.StateInterface.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/trait.StateInterface.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/struct.Event.html b/zksync_vm2_interface/struct.Event.html new file mode 100644 index 0000000..3889624 --- /dev/null +++ b/zksync_vm2_interface/struct.Event.html @@ -0,0 +1,30 @@ +Event in zksync_vm2_interface - Rust

Struct zksync_vm2_interface::Event

source ·
pub struct Event {
+    pub key: U256,
+    pub value: U256,
+    pub is_first: bool,
+    pub shard_id: u8,
+    pub tx_number: u16,
+}
Expand description

Event emitted by EraVM.

+

There is no address field because nobody is interested in events that don’t come +from the event writer, so we simply do not record events coming from anywhere else.

+

Fields§

§key: U256

Event key.

+
§value: U256

Event value.

+
§is_first: bool

Is this event first in a chain of events?

+
§shard_id: u8

Shard identifier (currently, always set to 0).

+
§tx_number: u16

0-based index of a transaction that has emitted this event.

+

Trait Implementations§

source§

impl Clone for Event

source§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Event

source§

fn eq(&self, other: &Event) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for Event

source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/struct.Flags.html b/zksync_vm2_interface/struct.Flags.html new file mode 100644 index 0000000..b1ad74f --- /dev/null +++ b/zksync_vm2_interface/struct.Flags.html @@ -0,0 +1,26 @@ +Flags in zksync_vm2_interface - Rust

Struct zksync_vm2_interface::Flags

source ·
pub struct Flags {
+    pub less_than: bool,
+    pub equal: bool,
+    pub greater: bool,
+}
Expand description

VM execution flags. See the EraVM reference for more details.

+

Fields§

§less_than: bool

“Less than” flag.

+
§equal: bool

“Equal” flag.

+
§greater: bool

“Greater than” flag.

+

Trait Implementations§

source§

impl Clone for Flags

source§

fn clone(&self) -> Flags

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Flags

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Flags

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Flags

source§

fn eq(&self, other: &Flags) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for Flags

source§

impl Eq for Flags

source§

impl StructuralPartialEq for Flags

Auto Trait Implementations§

§

impl Freeze for Flags

§

impl RefUnwindSafe for Flags

§

impl Send for Flags

§

impl Sync for Flags

§

impl Unpin for Flags

§

impl UnwindSafe for Flags

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/struct.HeapId.html b/zksync_vm2_interface/struct.HeapId.html new file mode 100644 index 0000000..e34ad00 --- /dev/null +++ b/zksync_vm2_interface/struct.HeapId.html @@ -0,0 +1,22 @@ +HeapId in zksync_vm2_interface - Rust

Struct zksync_vm2_interface::HeapId

source ·
pub struct HeapId(/* private fields */);
Expand description

Identifier of a VM heap.

+

EraVM docs sometimes refer to heaps as heap pages; docs in these crate don’t to avoid confusion with internal heap structure.

+

Implementations§

source§

impl HeapId

source

pub const FIRST_CALLDATA: Self = _

Identifier of the calldata heap used by the first executed program (i.e., the bootloader).

+
source

pub const FIRST: Self = _

Identifier of the heap used by the first executed program (i.e., the bootloader).

+
source

pub const FIRST_AUX: Self = _

Identifier of the auxiliary heap used by the first executed program (i.e., the bootloader)

+
source

pub const fn as_u32(self) -> u32

Converts this ID to an integer value.

+

Trait Implementations§

source§

impl Clone for HeapId

source§

fn clone(&self) -> HeapId

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HeapId

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for HeapId

source§

fn eq(&self, other: &HeapId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for HeapId

source§

impl StructuralPartialEq for HeapId

Auto Trait Implementations§

§

impl Freeze for HeapId

§

impl RefUnwindSafe for HeapId

§

impl Send for HeapId

§

impl Sync for HeapId

§

impl Unpin for HeapId

§

impl UnwindSafe for HeapId

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/struct.L2ToL1Log.html b/zksync_vm2_interface/struct.L2ToL1Log.html new file mode 100644 index 0000000..3e3ee5e --- /dev/null +++ b/zksync_vm2_interface/struct.L2ToL1Log.html @@ -0,0 +1,30 @@ +L2ToL1Log in zksync_vm2_interface - Rust

Struct zksync_vm2_interface::L2ToL1Log

source ·
pub struct L2ToL1Log {
+    pub key: U256,
+    pub value: U256,
+    pub is_service: bool,
+    pub address: H160,
+    pub shard_id: u8,
+    pub tx_number: u16,
+}
Expand description

L2-to-L1 log emitted by EraVM.

+

Fields§

§key: U256

Log key.

+
§value: U256

Log value.

+
§is_service: bool

Is this a service log?

+
§address: H160

Address of the contract that has emitted this log.

+
§shard_id: u8

Shard identifier (currently, always set to 0).

+
§tx_number: u16

0-based index of a transaction that has emitted this event.

+

Trait Implementations§

source§

impl Clone for L2ToL1Log

source§

fn clone(&self) -> L2ToL1Log

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for L2ToL1Log

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for L2ToL1Log

source§

fn eq(&self, other: &L2ToL1Log) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
source§

impl Copy for L2ToL1Log

source§

impl StructuralPartialEq for L2ToL1Log

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where + T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where + T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/enum.CallingMode.html b/zksync_vm2_interface/tracer_interface/enum.CallingMode.html new file mode 100644 index 0000000..80d32e6 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/enum.CallingMode.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/enum.CallingMode.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/enum.CycleStats.html b/zksync_vm2_interface/tracer_interface/enum.CycleStats.html new file mode 100644 index 0000000..144e4cf --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/enum.CycleStats.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/enum.CycleStats.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/enum.Opcode.html b/zksync_vm2_interface/tracer_interface/enum.Opcode.html new file mode 100644 index 0000000..57102db --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/enum.Opcode.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/enum.Opcode.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/enum.ReturnType.html b/zksync_vm2_interface/tracer_interface/enum.ReturnType.html new file mode 100644 index 0000000..30a598c --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/enum.ReturnType.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/enum.ReturnType.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/index.html b/zksync_vm2_interface/tracer_interface/opcodes/index.html new file mode 100644 index 0000000..f8c7d9c --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/index.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/index.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Add.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Add.html new file mode 100644 index 0000000..4c505fa --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Add.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Add.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.And.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.And.html new file mode 100644 index 0000000..8260344 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.And.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.And.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapRead.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapRead.html new file mode 100644 index 0000000..2981b07 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapRead.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.AuxHeapRead.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapWrite.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapWrite.html new file mode 100644 index 0000000..4e5bd63 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxHeapWrite.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.AuxHeapWrite.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxMutating0.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxMutating0.html new file mode 100644 index 0000000..e08a1b5 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.AuxMutating0.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.AuxMutating0.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Caller.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Caller.html new file mode 100644 index 0000000..825d5ee --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Caller.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Caller.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.CodeAddress.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.CodeAddress.html new file mode 100644 index 0000000..14bd2de --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.CodeAddress.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.CodeAddress.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextMeta.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextMeta.html new file mode 100644 index 0000000..365b1d9 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextMeta.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.ContextMeta.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextU128.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextU128.html new file mode 100644 index 0000000..43a57e9 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.ContextU128.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.ContextU128.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Decommit.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Decommit.html new file mode 100644 index 0000000..07c5de9 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Decommit.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Decommit.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Delegate.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Delegate.html new file mode 100644 index 0000000..60b52e8 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Delegate.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Delegate.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Div.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Div.html new file mode 100644 index 0000000..f8c6a75 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Div.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Div.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.ErgsLeft.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.ErgsLeft.html new file mode 100644 index 0000000..3a465cc --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.ErgsLeft.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.ErgsLeft.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Event.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Event.html new file mode 100644 index 0000000..1e7bf3c --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Event.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Event.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.FarCall.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.FarCall.html new file mode 100644 index 0000000..2381abb --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.FarCall.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.FarCall.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapRead.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapRead.html new file mode 100644 index 0000000..090238c --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapRead.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.HeapRead.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapWrite.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapWrite.html new file mode 100644 index 0000000..74667d9 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.HeapWrite.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.HeapWrite.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.IncrementTxNumber.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.IncrementTxNumber.html new file mode 100644 index 0000000..cc9ffbe --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.IncrementTxNumber.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.IncrementTxNumber.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Jump.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Jump.html new file mode 100644 index 0000000..8d77f31 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Jump.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Jump.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.L2ToL1Message.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.L2ToL1Message.html new file mode 100644 index 0000000..f7e9cb0 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.L2ToL1Message.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.L2ToL1Message.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Mimic.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Mimic.html new file mode 100644 index 0000000..4021bb4 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Mimic.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Mimic.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Mul.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Mul.html new file mode 100644 index 0000000..d1c0fcb --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Mul.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Mul.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.NearCall.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.NearCall.html new file mode 100644 index 0000000..1f1bd7b --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.NearCall.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.NearCall.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Nop.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Nop.html new file mode 100644 index 0000000..7bbe928 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Nop.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Nop.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Normal.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Normal.html new file mode 100644 index 0000000..e974c8a --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Normal.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Normal.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Or.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Or.html new file mode 100644 index 0000000..9718c12 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Or.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Or.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Panic.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Panic.html new file mode 100644 index 0000000..571b8c5 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Panic.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Panic.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerAdd.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerAdd.html new file mode 100644 index 0000000..0031918 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerAdd.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PointerAdd.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerPack.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerPack.html new file mode 100644 index 0000000..5ea2fe1 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerPack.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PointerPack.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerRead.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerRead.html new file mode 100644 index 0000000..46f530a --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerRead.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PointerRead.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerShrink.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerShrink.html new file mode 100644 index 0000000..0a6afad --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerShrink.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PointerShrink.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerSub.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerSub.html new file mode 100644 index 0000000..0a50841 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PointerSub.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PointerSub.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.PrecompileCall.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.PrecompileCall.html new file mode 100644 index 0000000..d7cbdd2 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.PrecompileCall.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.PrecompileCall.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Ret.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Ret.html new file mode 100644 index 0000000..38fe8dd --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Ret.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Ret.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Revert.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Revert.html new file mode 100644 index 0000000..9a0ffa2 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Revert.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Revert.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateLeft.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateLeft.html new file mode 100644 index 0000000..547fa29 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateLeft.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.RotateLeft.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateRight.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateRight.html new file mode 100644 index 0000000..20c67f6 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.RotateRight.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.RotateRight.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.SP.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.SP.html new file mode 100644 index 0000000..0784564 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.SP.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.SP.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.SetContextU128.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.SetContextU128.html new file mode 100644 index 0000000..fc694a5 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.SetContextU128.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.SetContextU128.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftLeft.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftLeft.html new file mode 100644 index 0000000..740f976 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftLeft.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.ShiftLeft.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftRight.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftRight.html new file mode 100644 index 0000000..c9fd37c --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.ShiftRight.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.ShiftRight.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageRead.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageRead.html new file mode 100644 index 0000000..c6ef508 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageRead.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.StorageRead.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageWrite.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageWrite.html new file mode 100644 index 0000000..ef9f5ba --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.StorageWrite.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.StorageWrite.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Sub.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Sub.html new file mode 100644 index 0000000..41e2b84 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Sub.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Sub.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.This.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.This.html new file mode 100644 index 0000000..281bf97 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.This.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.This.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageRead.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageRead.html new file mode 100644 index 0000000..729a390 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageRead.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.TransientStorageRead.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageWrite.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageWrite.html new file mode 100644 index 0000000..8b06e1a --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.TransientStorageWrite.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.TransientStorageWrite.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/struct.Xor.html b/zksync_vm2_interface/tracer_interface/opcodes/struct.Xor.html new file mode 100644 index 0000000..a24bc1a --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/struct.Xor.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/struct.Xor.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.html b/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.html new file mode 100644 index 0000000..09d0038 --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelCallingMode.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/trait.TypeLevelCallingMode.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.html b/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.html new file mode 100644 index 0000000..a1279af --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/opcodes/trait.TypeLevelReturnType.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../zksync_vm2_interface/opcodes/trait.TypeLevelReturnType.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/trait.OpcodeType.html b/zksync_vm2_interface/tracer_interface/trait.OpcodeType.html new file mode 100644 index 0000000..a31ff7a --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/trait.OpcodeType.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/trait.OpcodeType.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/tracer_interface/trait.Tracer.html b/zksync_vm2_interface/tracer_interface/trait.Tracer.html new file mode 100644 index 0000000..a6d2a9d --- /dev/null +++ b/zksync_vm2_interface/tracer_interface/trait.Tracer.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../zksync_vm2_interface/trait.Tracer.html...

+ + + \ No newline at end of file diff --git a/zksync_vm2_interface/trait.CallframeInterface.html b/zksync_vm2_interface/trait.CallframeInterface.html new file mode 100644 index 0000000..ad9e2aa --- /dev/null +++ b/zksync_vm2_interface/trait.CallframeInterface.html @@ -0,0 +1,66 @@ +CallframeInterface in zksync_vm2_interface - Rust

Trait zksync_vm2_interface::CallframeInterface

source ·
pub trait CallframeInterface {
+
Show 29 methods // Required methods + fn address(&self) -> H160; + fn set_address(&mut self, address: H160); + fn code_address(&self) -> H160; + fn set_code_address(&mut self, address: H160); + fn caller(&self) -> H160; + fn set_caller(&mut self, address: H160); + fn program_counter(&self) -> Option<u16>; + fn set_program_counter(&mut self, value: u16); + fn exception_handler(&self) -> u16; + fn set_exception_handler(&mut self, value: u16); + fn is_static(&self) -> bool; + fn is_kernel(&self) -> bool; + fn gas(&self) -> u32; + fn set_gas(&mut self, new_gas: u32); + fn stipend(&self) -> u32; + fn context_u128(&self) -> u128; + fn set_context_u128(&mut self, value: u128); + fn is_near_call(&self) -> bool; + fn read_stack(&self, index: u16) -> (U256, bool); + fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool); + fn stack_pointer(&self) -> u16; + fn set_stack_pointer(&mut self, value: u16); + fn heap(&self) -> HeapId; + fn heap_bound(&self) -> u32; + fn set_heap_bound(&mut self, value: u32); + fn aux_heap(&self) -> HeapId; + fn aux_heap_bound(&self) -> u32; + fn set_aux_heap_bound(&mut self, value: u32); + fn read_contract_code(&self, slot: u16) -> U256; +
}
Expand description

Public interface of an EraVM call frame.

+

Required Methods§

source

fn address(&self) -> H160

Address of the storage context associated with this frame. For delegate calls, this address is inherited from the calling contract; +otherwise, it’s the same as Self::code_address().

+
source

fn set_address(&mut self, address: H160)

Sets the address of the executing contract.

+
source

fn code_address(&self) -> H160

Address of the contract being executed.

+
source

fn set_code_address(&mut self, address: H160)

Sets the address of the contract being executed. Does not cause the contract at the specified address get loaded per se, just updates +the value used internally by the VM (e.g., returned by the CodeAddress opcode).

+
source

fn caller(&self) -> H160

Address of the calling contract. Respects delegate and mimic calls.

+
source

fn set_caller(&mut self, address: H160)

Sets the address of the calling contract.

+
source

fn program_counter(&self) -> Option<u16>

Returns the current program counter (i.e., 0-based index of the instruction being executed). +During panic this returns None.

+
source

fn set_program_counter(&mut self, value: u16)

Sets the program counter. +The VM will execute an invalid instruction if you jump out of the program.

+
source

fn exception_handler(&self) -> u16

Returns the program counter that the parent frame should continue from if this frame fails.

+
source

fn set_exception_handler(&mut self, value: u16)

Sets the exception handler as specified above.

+
source

fn is_static(&self) -> bool

Checks whether the call is static.

+
source

fn is_kernel(&self) -> bool

Checks whether the call is executed in kernel mode.

+
source

fn gas(&self) -> u32

Returns the remaining amount of gas.

+
source

fn set_gas(&mut self, new_gas: u32)

Sets the remaining amount of gas.

+
source

fn stipend(&self) -> u32

Additional gas provided for the duration of this callframe.

+
source

fn context_u128(&self) -> u128

Returns the context value for this call. This context is accessible via ContextU128 opcode.

+
source

fn set_context_u128(&mut self, value: u128)

Sets the context value for this call.

+
source

fn is_near_call(&self) -> bool

Checks whether this frame corresponds to a near call.

+
source

fn read_stack(&self, index: u16) -> (U256, bool)

Reads the specified stack slot. Returns a value together with a pointer flag.

+
source

fn write_stack(&mut self, index: u16, value: U256, is_pointer: bool)

Sets the value and pointer flag for the specified stack slot.

+
source

fn stack_pointer(&self) -> u16

Returns the stack pointer.

+
source

fn set_stack_pointer(&mut self, value: u16)

Sets the stack pointer.

+
source

fn heap(&self) -> HeapId

Returns ID of the main heap used in this call.

+
source

fn heap_bound(&self) -> u32

Returns the main heap boundary (number of paid bytes).

+
source

fn set_heap_bound(&mut self, value: u32)

Sets the main heap boundary.

+
source

fn aux_heap(&self) -> HeapId

Returns ID of the auxiliary heap used in this call.

+
source

fn aux_heap_bound(&self) -> u32

Returns the auxiliary heap boundary (number of paid bytes).

+
source

fn set_aux_heap_bound(&mut self, value: u32)

Sets the auxiliary heap boundary.

+
source

fn read_contract_code(&self, slot: u16) -> U256

Reads a word from the bytecode of the executing contract.

+

Implementors§

\ No newline at end of file diff --git a/zksync_vm2_interface/trait.OpcodeType.html b/zksync_vm2_interface/trait.OpcodeType.html new file mode 100644 index 0000000..00d0ef7 --- /dev/null +++ b/zksync_vm2_interface/trait.OpcodeType.html @@ -0,0 +1,5 @@ +OpcodeType in zksync_vm2_interface - Rust

Trait zksync_vm2_interface::OpcodeType

source ·
pub trait OpcodeType {
+    const VALUE: Opcode;
+}
Expand description

Trait mapping opcodes as types to the corresponding variants of the Opcode enum.

+

Required Associated Constants§

source

const VALUE: Opcode

Opcode variant corresponding to this opcode type.

+

Object Safety§

This trait is not object safe.

Implementors§

source§

impl OpcodeType for Add

source§

const VALUE: Opcode = Opcode::Add

source§

impl OpcodeType for And

source§

const VALUE: Opcode = Opcode::And

source§

impl OpcodeType for AuxHeapRead

source§

const VALUE: Opcode = Opcode::AuxHeapRead

source§

impl OpcodeType for AuxHeapWrite

source§

const VALUE: Opcode = Opcode::AuxHeapWrite

source§

impl OpcodeType for AuxMutating0

source§

const VALUE: Opcode = Opcode::AuxMutating0

source§

impl OpcodeType for Caller

source§

const VALUE: Opcode = Opcode::Caller

source§

impl OpcodeType for CodeAddress

source§

const VALUE: Opcode = Opcode::CodeAddress

source§

impl OpcodeType for ContextMeta

source§

const VALUE: Opcode = Opcode::ContextMeta

source§

impl OpcodeType for ContextU128

source§

const VALUE: Opcode = Opcode::ContextU128

source§

impl OpcodeType for Decommit

source§

const VALUE: Opcode = Opcode::Decommit

source§

impl OpcodeType for Div

source§

const VALUE: Opcode = Opcode::Div

source§

impl OpcodeType for ErgsLeft

source§

const VALUE: Opcode = Opcode::ErgsLeft

source§

impl OpcodeType for Event

source§

const VALUE: Opcode = Opcode::Event

source§

impl OpcodeType for HeapRead

source§

const VALUE: Opcode = Opcode::HeapRead

source§

impl OpcodeType for HeapWrite

source§

const VALUE: Opcode = Opcode::HeapWrite

source§

impl OpcodeType for IncrementTxNumber

source§

const VALUE: Opcode = Opcode::IncrementTxNumber

source§

impl OpcodeType for Jump

source§

const VALUE: Opcode = Opcode::Jump

source§

impl OpcodeType for L2ToL1Message

source§

const VALUE: Opcode = Opcode::L2ToL1Message

source§

impl OpcodeType for Mul

source§

const VALUE: Opcode = Opcode::Mul

source§

impl OpcodeType for NearCall

source§

const VALUE: Opcode = Opcode::NearCall

source§

impl OpcodeType for Nop

source§

const VALUE: Opcode = Opcode::Nop

source§

impl OpcodeType for Or

source§

const VALUE: Opcode = Opcode::Or

source§

impl OpcodeType for PointerAdd

source§

const VALUE: Opcode = Opcode::PointerAdd

source§

impl OpcodeType for PointerPack

source§

const VALUE: Opcode = Opcode::PointerPack

source§

impl OpcodeType for PointerRead

source§

const VALUE: Opcode = Opcode::PointerRead

source§

impl OpcodeType for PointerShrink

source§

const VALUE: Opcode = Opcode::PointerShrink

source§

impl OpcodeType for PointerSub

source§

const VALUE: Opcode = Opcode::PointerSub

source§

impl OpcodeType for PrecompileCall

source§

const VALUE: Opcode = Opcode::PrecompileCall

source§

impl OpcodeType for RotateLeft

source§

const VALUE: Opcode = Opcode::RotateLeft

source§

impl OpcodeType for RotateRight

source§

const VALUE: Opcode = Opcode::RotateRight

source§

impl OpcodeType for SP

source§

const VALUE: Opcode = Opcode::SP

source§

impl OpcodeType for SetContextU128

source§

const VALUE: Opcode = Opcode::SetContextU128

source§

impl OpcodeType for ShiftLeft

source§

const VALUE: Opcode = Opcode::ShiftLeft

source§

impl OpcodeType for ShiftRight

source§

const VALUE: Opcode = Opcode::ShiftRight

source§

impl OpcodeType for StorageRead

source§

const VALUE: Opcode = Opcode::StorageRead

source§

impl OpcodeType for StorageWrite

source§

const VALUE: Opcode = Opcode::StorageWrite

source§

impl OpcodeType for Sub

source§

const VALUE: Opcode = Opcode::Sub

source§

impl OpcodeType for This

source§

const VALUE: Opcode = Opcode::This

source§

impl OpcodeType for TransientStorageRead

source§

const VALUE: Opcode = Opcode::TransientStorageRead

source§

impl OpcodeType for TransientStorageWrite

source§

const VALUE: Opcode = Opcode::TransientStorageWrite

source§

impl OpcodeType for Xor

source§

const VALUE: Opcode = Opcode::Xor

source§

impl<M: TypeLevelCallingMode> OpcodeType for FarCall<M>

source§

impl<T: TypeLevelReturnType> OpcodeType for Ret<T>

\ No newline at end of file diff --git a/zksync_vm2_interface/trait.StateInterface.html b/zksync_vm2_interface/trait.StateInterface.html new file mode 100644 index 0000000..b86ae41 --- /dev/null +++ b/zksync_vm2_interface/trait.StateInterface.html @@ -0,0 +1,60 @@ +StateInterface in zksync_vm2_interface - Rust

Trait zksync_vm2_interface::StateInterface

source ·
pub trait StateInterface {
+
Show 22 methods // Required methods + fn read_register(&self, register: u8) -> (U256, bool); + fn set_register(&mut self, register: u8, value: U256, is_pointer: bool); + fn current_frame(&mut self) -> impl CallframeInterface + '_; + fn number_of_callframes(&self) -> usize; + fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_; + fn read_heap_byte(&self, heap: HeapId, offset: u32) -> u8; + fn read_heap_u256(&self, heap: HeapId, offset: u32) -> U256; + fn write_heap_u256(&mut self, heap: HeapId, offset: u32, value: U256); + fn flags(&self) -> Flags; + fn set_flags(&mut self, flags: Flags); + fn transaction_number(&self) -> u16; + fn set_transaction_number(&mut self, value: u16); + fn context_u128_register(&self) -> u128; + fn set_context_u128_register(&mut self, value: u128); + fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>; + fn get_transient_storage_state( + &self, + ) -> impl Iterator<Item = ((H160, U256), U256)>; + fn get_transient_storage(&self, address: H160, slot: U256) -> U256; + fn write_transient_storage( + &mut self, + address: H160, + slot: U256, + value: U256, + ); + fn events(&self) -> impl Iterator<Item = Event>; + fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>; + fn pubdata(&self) -> i32; + fn set_pubdata(&mut self, value: i32); +
}
Expand description

Public interface of the VM state. Encompasses both read and write methods.

+

Required Methods§

source

fn read_register(&self, register: u8) -> (U256, bool)

Reads a register with the specified zero-based index. Returns a value together with a pointer flag.

+
source

fn set_register(&mut self, register: u8, value: U256, is_pointer: bool)

Sets a register with the specified zero-based index

+
source

fn current_frame(&mut self) -> impl CallframeInterface + '_

Returns a mutable handle to the current call frame.

+
source

fn number_of_callframes(&self) -> usize

Returns the total number of call frames.

+
source

fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_

Returns a mutable handle to a call frame with the specified index, where +zero is the current frame, one is the frame before that etc.

+
source

fn read_heap_byte(&self, heap: HeapId, offset: u32) -> u8

Reads a single byte from the specified heap at the specified 0-based offset.

+
source

fn read_heap_u256(&self, heap: HeapId, offset: u32) -> U256

Reads an entire U256 word in the big-endian order from the specified heap / offset +(which is the index of the most significant byte of the read value).

+
source

fn write_heap_u256(&mut self, heap: HeapId, offset: u32, value: U256)

Writes an entire U256 word in the big-endian order to the specified heap at the specified offset +(which is the index of the most significant byte of the written value).

+
source

fn flags(&self) -> Flags

Returns current execution flags.

+
source

fn set_flags(&mut self, flags: Flags)

Sets current execution flags.

+
source

fn transaction_number(&self) -> u16

Returns the currently set 0-based transaction number.

+
source

fn set_transaction_number(&mut self, value: u16)

Sets the current transaction number.

+
source

fn context_u128_register(&self) -> u128

Returns the value of the context register.

+
source

fn set_context_u128_register(&mut self, value: u128)

Sets the value of the context register.

+
source

fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over storage slots read or written during VM execution.

+
source

fn get_transient_storage_state( + &self, +) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over all transient storage slots set during VM execution.

+
source

fn get_transient_storage(&self, address: H160, slot: U256) -> U256

Gets value of the specified transient storage slot.

+
source

fn write_transient_storage(&mut self, address: H160, slot: U256, value: U256)

Sets value of the specified transient storage slot.

+
source

fn events(&self) -> impl Iterator<Item = Event>

Iterates over events emitted during VM execution.

+
source

fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>

Iterates over L2-to-L1 logs emitted during VM execution.

+
source

fn pubdata(&self) -> i32

Gets the current amount of published pubdata.

+
source

fn set_pubdata(&mut self, value: i32)

Sets the current amount of published pubdata.

+

Object Safety§

This trait is not object safe.

Implementors§

\ No newline at end of file diff --git a/zksync_vm2_interface/trait.Tracer.html b/zksync_vm2_interface/trait.Tracer.html new file mode 100644 index 0000000..ad55034 --- /dev/null +++ b/zksync_vm2_interface/trait.Tracer.html @@ -0,0 +1,49 @@ +Tracer in zksync_vm2_interface - Rust

Trait zksync_vm2_interface::Tracer

source ·
pub trait Tracer {
+    // Provided methods
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(
+        &mut self,
+        _state: &mut S,
+    ) { ... }
+    fn after_instruction<OP: OpcodeType, S: StateInterface>(
+        &mut self,
+        _state: &mut S,
+    ) { ... }
+    fn on_extra_prover_cycles(&mut self, _stats: CycleStats) { ... }
+}
Expand description

EraVM instruction tracer.

+

Self::before_instruction() is called just before the actual instruction is executed. +If the instruction is skipped, before_instruction will be called with Nop. +Self::after_instruction() is called once the instruction is executed and the program +counter has advanced.

+

§Examples

+

Here FarCallCounter counts the number of far calls.

+ +
struct FarCallCounter(usize);
+
+impl Tracer for FarCallCounter {
+    fn before_instruction<OP: OpcodeType, S: StateInterface>(&mut self, state: &mut S) {
+        match OP::VALUE {
+            Opcode::FarCall(_) => self.0 += 1,
+            _ => {}
+        }
+    }
+}
+

Provided Methods§

source

fn before_instruction<OP: OpcodeType, S: StateInterface>( + &mut self, + _state: &mut S, +)

Executes logic before an instruction handler.

+

The default implementation does nothing.

+
source

fn after_instruction<OP: OpcodeType, S: StateInterface>( + &mut self, + _state: &mut S, +)

Executes logic after an instruction handler.

+

The default implementation does nothing.

+
source

fn on_extra_prover_cycles(&mut self, _stats: CycleStats)

Provides cycle statistics for “complex” instructions from the prover perspective (mostly precompile calls).

+

The default implementation does nothing.

+

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Tracer for ()

No-op tracer implementation.

+
source§

impl<A: Tracer, B: Tracer> Tracer for (A, B)

source§

fn before_instruction<OP: OpcodeType, S: StateInterface>( + &mut self, + state: &mut S, +)

source§

fn after_instruction<OP: OpcodeType, S: StateInterface>( + &mut self, + state: &mut S, +)

source§

fn on_extra_prover_cycles(&mut self, stats: CycleStats)

Implementors§

\ No newline at end of file