Skip to content

Commit 568f7df

Browse files
authored
Merge pull request #1263 from plebhash/roles-logic-sv2-docs
docs `roles_logic_sv2`
2 parents feee603 + db12082 commit 568f7df

19 files changed

+1316
-513
lines changed

protocols/v2/roles-logic-sv2/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ toml = {git = "https://github.com/diondokter/toml-rs", default-features = false
3535

3636
[features]
3737
with_serde = [ "serde",
38+
"framing_sv2/with_serde",
3839
"binary_sv2/with_serde",
3940
"common_messages_sv2/with_serde",
4041
"template_distribution_sv2/with_serde",
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# `roles_logic_sv2`
2+
3+
[![crates.io](https://img.shields.io/crates/v/roles_logic_sv2.svg)](https://crates.io/crates/roles_logic_sv2)
4+
[![docs.rs](https://docs.rs/roles_logic_sv2/badge.svg)](https://docs.rs/roles_logic_sv2)
5+
[![rustc+](https://img.shields.io/badge/rustc-1.75.0%2B-lightgrey.svg)](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
6+
[![license](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](https://github.com/stratum-mining/stratum/blob/main/LICENSE.md)
7+
[![codecov](https://codecov.io/gh/stratum-mining/stratum/branch/main/graph/badge.svg?flag=roles_logic_sv2-coverage)](https://codecov.io/gh/stratum-mining/stratum)
8+
9+
`roles_logic_sv2` provides the core logic and utilities for implementing roles in the Stratum V2 (Sv2) protocol, such as miners, pools, and proxies. It abstracts message handling, channel management, job creation, and routing logic, enabling efficient and secure communication across upstream and downstream connections.
10+
11+
## Main Components
12+
13+
- **Channel Logic**: Manages the lifecycle and settings of communication channels (standard, extended, and group ones) between roles.
14+
- **Handlers**: Provides traits for handling logic of Sv2 protocol messages.
15+
- **Job Management**: Facilitates the creation, validation, and dispatching of mining jobs.
16+
- **Parsers**: Handles serialization and deserialization of Sv2 messages via [`binary_sv2`](https://docs.rs/binary_sv2/latest/binary_sv2/index.html).
17+
- **Routing Logic**: Implements message routing and downstream/upstream selector utilities. Useful for advanced proxy implementations with multiplexing of Standard Channels across different upstreams.
18+
- **Utilities**: Provides helpers for safe mutex locking, mining-specific calculations, and more.
19+
20+
## Usage
21+
22+
To include this crate in your project, run:
23+
24+
```bash
25+
cargo add roles_logic_sv2
26+
```
27+
28+
This crate can be built with the following feature flags:
29+
30+
- `with_serde`: Enables serialization and deserialization support using the serde library. This feature flag also activates the with_serde feature for dependent crates such as `binary_sv2`, `common_messages_sv2`, `template_distribution_sv2`, `job_declaration_sv2`, and `mining_sv2`.
31+
Note that this feature flag is only used for the Message Generator, and deprecated
32+
for any other kind of usage. It will likely be fully deprecated in the future.
33+
- `prop_test`: Enables property-based testing features for template distribution logic, leveraging dependencies' testing capabilities such as `template_distribution_sv2` crate.
34+
- `disable_nopanic`: Disables the nopanic logic in scenarios where code coverage tools might conflict with it.

0 commit comments

Comments
 (0)