package octez-shell-libs

  1. Overview
  2. Docs
Octez shell libraries

Install

Dune Dependency

Authors

Maintainers

Sources

octez-19.0.tar.gz
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13

doc/octez-shell-libs.p2p/Tezos_p2p/P2p_message/index.html

Module Tezos_p2p.P2p_messageSource

This module defines the messages of the P2p layers.

P2p messages are parameterized by a generic upper-layer message type 'msg. The P2p layer serializes these 'msg using a 'msg encoding' provided by the client of this lib.

The P2p protocol is simple and can be deduced mostly from the message type. To make the network topology more dynamic, it implements a simple peer swapping mechanism which works as follows.

Peer A sends a message : Swap_request (point, peer) to B. If B is already connected to the peer, the message is ignored. Otherwise B picks a peer peer' at point point' and connect to peer. If successful, it sends a response Swap_ack (point', peer') to A. Upon reception of Swap_ack. B tries to connected to peer'. If successful, it disconnect from peer.

Sourcetype 'msg t =
  1. | Bootstrap
    (*

    Welcome message sent by a peer upon connection

    *)
  2. | Advertise of Tezos_base.TzPervasives.P2p_point.Id.t list
    (*

    Response to a Bootstrap message, contains list of known points

    *)
  3. | Swap_request of Tezos_base.TzPervasives.P2p_point.Id.t * Tezos_base.TzPervasives.P2p_peer.Id.t
    (*

    Propose new peer/point and ask a peer/point to swap with

    *)
  4. | Swap_ack of Tezos_base.TzPervasives.P2p_point.Id.t * Tezos_base.TzPervasives.P2p_peer.Id.t
    (*

    Response to a swap request and propose peer/point to swap with.

    *)
  5. | Message of 'msg
    (*

    Generic upper-layer message

    *)
  6. | Disconnect
    (*

    Ending of connection, unused for now

    *)
Sourceval encoding : 'a Tezos_base.TzPervasives.P2p_params.app_message_encoding list -> 'a t Tezos_base.TzPervasives.Data_encoding.t
OCaml

Innovation. Community. Security.