Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file faked_services.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357openTezos_shell_servicesmoduleDirectory=Tezos_rpc.DirectorymoduleChain_services=Tezos_shell_services.Chain_servicesmoduleBlock_services=Tezos_shell_services.Block_servicesmoduleBlock_services_alpha=Protocol_client_context.Alpha_block_servicesmoduletypeMocked_services_hooks=sigtypemempool=Mockup.M.Block_services.Mempool.t(** The baker relies on this stream to be notified of new
valid blocks. *)valmonitor_validated_blocks:unit->(Chain_id.t*Block_hash.t*Block_header.t*Operation.tlistlist)Tezos_rpc.Answer.stream(** The baker relies on this stream to be notified of new
heads. *)valmonitor_heads:unit->(Block_hash.t*Block_header.t)Tezos_rpc.Answer.stream(** Returns current and next protocol for a block. *)valprotocols:Block_services.block->Block_services.protocolstzresultLwt.t(** [raw_header] returns the byte encoded block header of the block
associated to the given block specification. *)valraw_header:Block_services.block->bytestzresultLwt.t(** [header] returns the block header of the block associated to the given
block specification. *)valheader:Block_services.block->Mockup.M.Block_services.block_headertzresultLwt.t(** [resulting_context_hash] returns the context resulting hash of the given block. *)valresulting_context_hash:Block_services.block->Context_hash.ttzresultLwt.t(** [operations] returns all operations included in the block. *)valoperations:Block_services.block->Mockup.M.Block_services.operationlistlisttzresultLwt.t(** [inject_block_callback] is called when an RPC is performed on
[Tezos_shell_services.Injection_services.S.block], after checking that
the block header can be deserialized. *)valinject_block:Block_hash.t->Block_header.t->Operation.ttracetrace->unittzresultLwt.t(** [inject_operation] is used by the baker (or the client) to inject
operations, including attestations. *)valinject_operation:Operation.t->Operation_hash.ttzresultLwt.t(** [pending_operations] returns the current contents of the mempool. It
is used by the baker to fetch operations to potentially include in the
block being baked. These operations might include attestations. If
there aren't enough attestations, the baker waits on
[monitor_operations]. *)valpending_operations:unit->mempoolLwt.t(** Return a stream of list of operations. Used by the baker to wait on
attestations. Invariant: the stream becomes empty when the node changes
head. *)valmonitor_operations:version:Block_services.version->validated:bool->branch_delayed:bool->branch_refused:bool->refused:bool->(Block_services.version*((Operation_hash.t*Mockup.M.Protocol.operation)*errortraceoption)list)Tezos_rpc.Answer.stream(** Lists block hashes from the chain, up to the last checkpoint, sorted
with decreasing fitness. Without arguments it returns the head of the
chain. Optional arguments allow to return the list of predecessors of a
given block or of a set of blocks. *)vallist_blocks:heads:Block_hash.tlist->length:intoption->min_date:Time.Protocol.toption->Block_hash.tlistlisttzresultLwt.t(** List the ancestors of the given block which, if referred to as
the branch in an operation header, are recent enough for that
operation to be included in the current block. *)vallive_blocks:Block_services.block->Block_hash.Set.ttzresultLwt.t(** [rpc_context_callback] is used in the implementations of several
RPCs (see local_services.ml). It should correspond to the
rpc_context constructed from the context at the requested block. *)valrpc_context_callback:Block_services.block->Tezos_protocol_environment.rpc_contexttzresultLwt.t(** Return raw protocol data as a block. *)valraw_protocol_data:Block_services.block->Bytes.ttzresultLwt.t(** Broadcast block manually to nodes [dests] (given by their
number, starting from 0). If [dests] is not provided, broadcast
to all nodes. *)valbroadcast_block:?dests:intlist->Block_hash.t->Block_header.t->Operation.ttracetrace->unittzresultLwt.t(** Broadcast operation manually to nodes [dests] (given by their
number, starting from 0). If [dests] is not provided, broadcast
to all nodes. *)valbroadcast_operation:?dests:intlist->Alpha_context.packed_operation->unittzresultLwt.t(** Simulate waiting for the node to be bootstrapped. Because the
simulated node is already bootstrapped, returns the current head
immediately. *)valmonitor_bootstrapped:unit->(Block_hash.t*Time.Protocol.t)Tezos_rpc.Answer.streamendtypehooks=(moduleMocked_services_hooks)moduleMake(Hooks:Mocked_services_hooks)=structletmonitor_validated_blocks=Directory.gen_register0Directory.emptyMonitor_services.S.validated_blocks(fun_next_protocol_->Tezos_rpc.Answer.return_stream(Hooks.monitor_validated_blocks()))letmonitor_heads=Directory.gen_register1Directory.emptyMonitor_services.S.heads(fun_chain_next_protocol()->Tezos_rpc.Answer.return_stream(Hooks.monitor_heads()))letmonitor_bootstrapped=Directory.gen_register0Directory.emptyMonitor_services.S.bootstrapped(fun()()->Tezos_rpc.Answer.return_stream(Hooks.monitor_bootstrapped()))letprotocols=letpath=letopenTezos_rpc.PathinprefixBlock_services.chain_pathBlock_services.pathinletservice=Tezos_rpc.Service.prefixpathBlock_services.Empty.S.protocolsinDirectory.registerDirectory.emptyservice(fun(_,block)()()->Hooks.protocolsblock)letraw_header=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyMockup.M.Block_services.S.raw_header(fun(((),_chain),block)__->Hooks.raw_headerblock)letheader=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyMockup.M.Block_services.S.header(fun(((),_chain),block)__->Hooks.headerblock)letresulting_context_hash=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyMockup.M.Block_services.S.resulting_context_hash(fun(((),_chain),block)__->Hooks.resulting_context_hashblock)letoperations=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyMockup.M.Block_services.S.Operations.operations(fun(((),_chain),block)q()->letopenLwt_result_syntaxinlet*ops=Hooks.operationsblockinreturn(q#version,ops))lethash=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyBlock_services.Empty.S.hash(fun(((),_chain),block)()()->Hooks.headerblock>>=?funx->returnx.hash)letshell_header=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyMockup.M.Block_services.S.Header.shell_header(fun(((),_chain),block)__->Hooks.headerblock>>=?funx->returnx.shell)letchainchain_id=Directory.prefixChain_services.path(Directory.registerDirectory.emptyChain_services.S.chain_id(fun_chain()()->returnchain_id))letinject_block=Directory.registerDirectory.emptyInjection_services.S.block(fun()_chain(bytes,operations)->matchBlock_header.of_bytesbyteswith|None->failwith"faked_services.inject_block: can't deserialize"|Someblock_header->letblock_hash=Block_hash.hash_bytes[bytes]inHooks.inject_blockblock_hashblock_headeroperations>>=?fun()->returnblock_hash)letinject_operation=Directory.registerDirectory.emptyInjection_services.S.operation(fun()_chainbytes->matchData_encoding.Binary.of_bytes_optOperation.encodingbyteswith|None->failwith"faked_services.inject_operation: can't deserialize"|Someoperation->Hooks.inject_operationoperation)letbroadcast_block=Directory.registerDirectory.emptyBroadcast_services.S.block(fun()dests(block_header,operations)->letbytes=Block_header.to_bytesblock_headerinletblock_hash=Block_hash.hash_bytes[bytes]inletdests=matchdests#destswith[]->None|dests->SomedestsinHooks.broadcast_block?destsblock_hashblock_headeroperations)letbroadcast_operation=Directory.registerDirectory.emptyBroadcast_services.S.operation(fun()destsoperation->letdests=matchdests#destswith[]->None|dests->SomedestsinHooks.broadcast_operation?destsoperation)letpending_operations=Directory.gen_registerDirectory.empty(Mockup.M.Block_services.S.Mempool.pending_operations@@Block_services.mempool_pathBlock_services.chain_path)(fun((),_chain)params()->Hooks.pending_operations()>>=funmempool->Tezos_rpc.Answer.return(params#version,mempool))letmonitor_operations=Directory.gen_registerDirectory.empty(Block_services_alpha.S.Mempool.monitor_operations@@Block_services.mempool_pathBlock_services.chain_path)(fun((),_chain)flags()->letstream=Hooks.monitor_operations~version:flags#version~validated:flags#validated~branch_delayed:flags#branch_delayed~branch_refused:flags#branch_refused~refused:flags#refusedinTezos_rpc.Answer.return_streamstream)letlist_blocks=Directory.prefixChain_services.path(Directory.registerDirectory.emptyChain_services.S.Blocks.list(fun((),_chain)flags()->Hooks.list_blocks~heads:flags#heads~length:flags#length~min_date:flags#min_date))letlive_blocks=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyBlock_services.Empty.S.live_blocks(fun(_,block)_()->Hooks.live_blocksblock)letraw_protocol_data=Directory.prefix(Tezos_rpc.Path.prefixChain_services.pathBlock_services.path)@@Directory.registerDirectory.emptyBlock_services.Empty.S.Header.raw_protocol_data(fun(_,block)()()->Hooks.raw_protocol_datablock)letshell_directorychain_id=List.fold_leftDirectory.mergeDirectory.empty[monitor_validated_blocks;monitor_heads;protocols;raw_header;header;operations;hash;shell_header;resulting_context_hash;chainchain_id;inject_block;inject_operation;monitor_operations;list_blocks;live_blocks;raw_protocol_data;broadcast_block;broadcast_operation;monitor_bootstrapped;]letdirectorychain_id=letproto_directory=Directory.prefixChain_services.path(Directory.prefixBlock_services.path(Directory.map(fun(((),_chain),block)->Hooks.rpc_context_callbackblock>>=function|Error_->assertfalse|Okrpc_context->Lwt.returnrpc_context)Mockup.M.directory))inletbase=Directory.merge(shell_directorychain_id)proto_directoryinTezos_rpc.Directory.register_describe_directory_servicebaseTezos_rpc.Service.description_serviceend