Crate roles_logic_sv2

source ·
Expand description

Provides all relevant types, traits and functions to implement a valid SV2 role.

  • For channel and job management, see channel_logic, which utilizes job_creator and job_dispatcher
  • For message handling, the traits in handlers should be implemented
  • For basic traits every implementation should use, see common_properties
  • Routers in routing_logic are used by the traits in handlers to decide which downstream/upstream to relay/send by using selectors
  • For serializing/deserializing messages, see parsers
  • see utils for helpers such as safe locking, target and merkle root calculations
 MiningDevice:
     common_properties::IsUpstream +
     common_properties::IsMiningUpstream +
     handlers::common::ParseUpstreamCommonMessages +
     handlers::mining::ParseUpstreamMiningMessages +

 Pool:
     common_properties::IsDownstream +
     common_properties::IsMiningDownstream +
     handlers::common::ParseDownstreamCommonMessages +
     handlers::mining::ParseDownstreamMiningMessages +

 ProxyDownstreamConnetion:
     common_properties::IsDownstream +
     common_properties::IsMiningDownstream +
     handlers::common::ParseDownstreamCommonMessages +
     handlers::mining::ParseDownstreamMiningMessages +

 ProxyUpstreamConnetion:
     common_properties::IsUpstream +
     common_properties::IsMiningUpstream +
     handlers::common::ParseUpstreamCommonMessages +
     handlers::mining::ParseUpstreamMiningMessages +

Re-exports§

Modules§

  • Traits that implements very basic properties that every implementation should use
  • Errors specific to this crate
  • Handlers are divided per (sub)protocol and per Downstream/Upstream. Each (sup)protocol defines a handler for both the Upstream node and the Downstream node Handlers are a trait called Parse[Downstream/Upstream][(sub)protocol] (eg. ParseDownstreamCommonMessages).
  • The job creator module provides logic to create extended mining jobs given a template from a template provider as well as logic to clean up old templates when new blocks are mined
  • The Job Dispatcher contains relevant logic to maintain group channels in proxy roles such as:
  • The parsers modules provides logic to convert raw SV2 message data into rust types as well as logic to handle conversions among SV2 rust types
  • The routing logic code is used by the handler to determine where a message should be relayed or responded to
  • Selectors are used from the routing logic in order to chose to which remote or set of remotes a message should be ralyied, or to which remote or set of remotes a message should be sent.