Skip to content

Commit f42ceb5

Browse files
authored
Merge pull request #1459 from Shourya742/2025-02-06-remove-binary_sv2_serde
remove binary sv2 serde
2 parents 19f26e3 + 49c78e3 commit f42ceb5

File tree

84 files changed

+115
-4943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+115
-4943
lines changed

.github/workflows/coverage-protocols.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ jobs:
4444
file: ./protocols/target/tarpaulin-reports/binary-sv2-coverage/cobertura.xml
4545
flags: binary_sv2-coverage
4646
token: ${{ secrets.CODECOV_TOKEN }}
47-
48-
- name: Upload binary_serde_sv2-coverage to codecov.io
49-
uses: codecov/codecov-action@v4
50-
with:
51-
directory: ./protocols/target/tarpaulin-reports/serde-sv2-coverage
52-
file: ./protocols/target/tarpaulin-reports/serde-sv2-coverage/cobertura.xml
53-
flags: binary_serde_sv2-coverage
54-
token: ${{ secrets.CODECOV_TOKEN }}
5547

5648
- name: Upload codec_sv2-coverage to codecov.io
5749
uses: codecov/codecov-action@v4

.github/workflows/docs.yaml

+6-11
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,20 @@ jobs:
3434
cd utils/buffer
3535
cargo doc
3636
37-
- name: Rust Docs crate no_serde_sv2_derive_codec
37+
- name: Rust Docs crate binary_sv2 derive_codec
3838
run: |
39-
cd protocols/v2/binary-sv2/no-serde-sv2/derive_codec
39+
cd protocols/v2/binary-sv2/derive_codec
4040
cargo doc
4141
42-
- name: Rust Docs crate no_serde_sv2_codec
42+
- name: Rust Docs crate binary_sv2 codec
4343
run: |
44-
cd protocols/v2/binary-sv2/no-serde-sv2/codec
44+
cd protocols/v2/binary-sv2/codec
4545
cargo doc --features with_buffer_pool
4646
47-
- name: Rust Docs crate serde_sv2
48-
run: |
49-
cd protocols/v2/binary-sv2/serde-sv2
50-
cargo doc
51-
5247
- name: Rust Docs crate binary_sv2
5348
run: |
54-
cd protocols/v2/binary-sv2/binary-sv2
55-
cargo doc --features core,with_buffer_pool
49+
cd protocols/v2/binary-sv2
50+
cargo doc --features with_buffer_pool
5651
5752
- name: Rust Docs crate const_sv2
5853
run: |

.github/workflows/release-libs.yaml

+5-9
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,17 @@ jobs:
3737
run: |
3838
./scripts/release-libs.sh utils/buffer
3939
40-
- name: Publish crate no_serde_sv2_derive_codec
40+
- name: Publish crate binary_sv2 derive_codec
4141
run: |
42-
./scripts/release-libs.sh protocols/v2/binary-sv2/no-serde-sv2/derive_codec
42+
./scripts/release-libs.sh protocols/v2/binary-sv2/derive_codec
4343
44-
- name: Publish crate no_serde_sv2_codec
44+
- name: Publish crate binary_sv2 codec
4545
run: |
46-
./scripts/release-libs.sh protocols/v2/binary-sv2/no-serde-sv2/codec
47-
48-
- name: Publish crate serde_sv2
49-
run: |
50-
./scripts/release-libs.sh protocols/v2/binary-sv2/serde-sv2
46+
./scripts/release-libs.sh protocols/v2/binary-sv2/codec
5147
5248
- name: Publish crate binary_sv2
5349
run: |
54-
./scripts/release-libs.sh protocols/v2/binary-sv2/binary-sv2
50+
./scripts/release-libs.sh protocols/v2/binary-sv2
5551
5652
- name: Publish crate const_sv2
5753
run: |

.github/workflows/semver-check.yaml

+4-8
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,12 @@ jobs:
4949
working-directory: utils/buffer
5050
run: cargo semver-checks
5151

52-
- name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec
53-
working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec
52+
- name: Run semver checks for protocols/v2/binary-sv2/codec
53+
working-directory: protocols/v2/binary-sv2/codec
5454
run: cargo semver-checks
5555

56-
- name: Run semver checks for protocols/v2/binary-sv2/serde-sv2
57-
working-directory: protocols/v2/binary-sv2/serde-sv2
58-
run: cargo semver-checks
59-
60-
- name: Run semver checks for protocols/v2/binary-sv2/binary-sv2
61-
working-directory: protocols/v2/binary-sv2/binary-sv2
56+
- name: Run semver checks for protocols/v2/binary-sv2
57+
working-directory: protocols/v2/binary-sv2
6258
run: cargo semver-checks
6359

6460
- name: Run semver checks for protocols/v2/const-sv2

benches/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ num-bigint = "0.4.3"
1818
num-traits = "0.2.15"
1919
bitcoin="0.28.1"
2020
codec_sv2 = { path = "../protocols/v2/codec-sv2", features=["noise_sv2"] }
21-
binary_sv2 = { path = "../protocols/v2/binary-sv2/binary-sv2" }
21+
binary_sv2 = { path = "../protocols/v2/binary-sv2" }
2222
network_helpers_sv2 = { path = "../roles/roles-utils/network-helpers" }
2323
rand = "0.8.4"
2424

examples/interop-cpp-no-cargo/rust-build-script.sh

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rustc \
2727
rustc \
2828
--crate-name binary_codec_sv2 \
2929
--edition=2018 \
30-
$ROOT/binary-sv2/no-serde-sv2/codec/src/lib.rs \
30+
$ROOT/binary-sv2/codec/src/lib.rs \
3131
--error-format=json \
3232
--json=diagnostic-rendered-ansi \
3333
--crate-type lib \
@@ -40,7 +40,7 @@ rustc \
4040
rustc \
4141
--crate-name binary_codec_sv2 \
4242
--edition=2018 \
43-
$ROOT/binary-sv2/no-serde-sv2/codec/src/lib.rs \
43+
$ROOT/binary-sv2/codec/src/lib.rs \
4444
--error-format=json \
4545
--json=diagnostic-rendered-ansi,artifacts \
4646
--crate-type lib \
@@ -66,7 +66,7 @@ rustc \
6666
rustc \
6767
--crate-name derive_codec_sv2 \
6868
--edition=2018 \
69-
$ROOT/binary-sv2/no-serde-sv2/derive_codec/src/lib.rs \
69+
$ROOT/binary-sv2/derive_codec/src/lib.rs \
7070
--error-format=json \
7171
--json=diagnostic-rendered-ansi \
7272
--crate-type proc-macro \
@@ -82,17 +82,14 @@ rustc \
8282
rustc \
8383
--crate-name binary_sv2 \
8484
--edition=2018 \
85-
$ROOT/binary-sv2/binary-sv2/src/lib.rs \
85+
$ROOT/binary-sv2/src/lib.rs \
8686
--error-format=json \
8787
--json=diagnostic-rendered-ansi,artifacts \
8888
--crate-type lib \
8989
--emit=dep-info,metadata,link \
9090
-C opt-level=3 \
9191
-C embed-bitcode=no \
92-
--cfg 'feature="binary_codec_sv2"' \
93-
--cfg 'feature="core"' \
9492
--cfg 'feature="default"' \
95-
--cfg 'feature="derive_codec_sv2"' \
9693
--out-dir $DEPS \
9794
-L dependency=$DEPS \
9895
--extern binary_codec_sv2=$DEPS/libbinary_codec_sv2.rmeta \

examples/interop-cpp/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ publish = false
1010
[dependencies]
1111
codec_sv2 = { path = "../../protocols/v2/codec-sv2" }
1212
const_sv2 = { path = "../../protocols/v2/const-sv2" }
13-
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
13+
binary_sv2 = { path = "../../protocols/v2/binary-sv2" }
1414
common_messages_sv2 = { path = "../../protocols/v2/subprotocols/common-messages" }
1515
template_distribution_sv2 = { path = "../../protocols/v2/subprotocols/template-distribution" }

examples/ping-pong-encrypted/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [ "SRI Community" ]
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
10+
binary_sv2 = { path = "../../protocols/v2/binary-sv2" }
1111
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = [ "noise_sv2" ] }
1212
noise_sv2 = { path = "../../protocols/v2/noise-sv2" }
1313
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }

examples/ping-pong/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [ "SRI Community" ]
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
10+
binary_sv2 = { path = "../../protocols/v2/binary-sv2" }
1111
codec_sv2 = { path = "../../protocols/v2/codec-sv2" }
1212

1313
rand = "0.8"

protocols/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ resolver="2"
44

55
members = [
66
"v1",
7-
"v2/binary-sv2/serde-sv2",
8-
"v2/binary-sv2/no-serde-sv2/codec",
9-
"v2/binary-sv2/no-serde-sv2/derive_codec",
10-
"v2/binary-sv2/binary-sv2",
7+
"v2/binary-sv2/codec",
8+
"v2/binary-sv2/derive_codec",
9+
"v2/binary-sv2",
1110
"v2/noise-sv2",
1211
"v2/framing-sv2",
1312
"v2/codec-sv2",

protocols/fuzz-tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cargo-fuzz = true
1717
libfuzzer-sys = { version = "0.4.0", features = ["arbitrary-derive"] }
1818
arbitrary = { version = "1", features = ["derive"] }
1919
rand = "0.8.3"
20-
binary_codec_sv2 = { path = "../v2/binary-sv2/no-serde-sv2/codec"}
20+
binary_codec_sv2 = { path = "../v2/binary-sv2/codec"}
2121
codec_sv2 = { path = "../v2/codec-sv2", features = ["noise_sv2"]}
2222
roles_logic_sv2 = { path = "../v2/roles-logic-sv2"}
2323
affinity = "0.1.1"

protocols/v1/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ hex = "0.4.3"
2020
serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] }
2121
serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] }
2222
tracing = {version = "0.1"}
23-
binary_sv2 = { path = "../v2/binary-sv2/binary-sv2" }
23+
binary_sv2 = { path = "../v2/binary-sv2" }
2424

2525
[dev-dependencies]
2626
quickcheck = "1"
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
[package]
2-
name = "serde_sv2"
2+
name = "binary_sv2"
33
version = "2.0.0"
44
authors = ["The Stratum V2 Developers"]
55
edition = "2018"
66
readme = "README.md"
7-
description = "Serlializer and Deserializer for Stratum V2 data format"
8-
documentation = "https://docs.rs/serde_sv2"
7+
description = "Sv2 data format"
8+
documentation = "https://docs.rs/binary_sv2"
99
license = "MIT OR Apache-2.0"
1010
repository = "https://github.com/stratum-mining/stratum"
1111
homepage = "https://stratumprotocol.org"
1212
keywords = ["stratum", "mining", "bitcoin", "protocol"]
1313

14-
1514
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1615

1716
[dependencies]
18-
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false }
19-
buffer_sv2 = { path = "../../../../utils/buffer"}
17+
binary_codec_sv2 = { path = "codec" }
18+
derive_codec_sv2 = { path = "derive_codec" }
19+
20+
[features]
21+
prop_test = ["binary_codec_sv2/prop_test"]
22+
with_buffer_pool = ["binary_codec_sv2/with_buffer_pool"]
23+
24+
[package.metadata.docs.rs]
25+
features = ["with_buffer_pool"]

protocols/v2/binary-sv2/binary-sv2/README.md protocols/v2/binary-sv2/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![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)
66
[![license](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](https://github.com/stratum-mining/stratum/blob/main/LICENSE.md)
77

8-
`binary-sv2` is a Rust `no-std` crate that helps encode and decode binary data into Stratum V2 messages — either through `serde` or custom trait-based setup. Allowing it to be used in environment(s) where std or/and serde are not available.
8+
`binary-sv2` is a Rust `no-std` crate that helps encode and decode binary data into Stratum V2 messages
99

1010
## Key Capabilities
1111

@@ -14,8 +14,6 @@
1414

1515
## Features
1616

17-
- **with_serde**: Enables `serde`-based encoding and decoding.
18-
- **core**: Activates non-`serde` implementations via `binary_codec_sv2` and `derive_codec_sv2`.(default)
1917
- **prop_test**: Adds property testing support.
2018
- **with_buffer_pool**: Optimizes memory usage during encoding.
2119

protocols/v2/binary-sv2/binary-sv2/Cargo.toml

-30
This file was deleted.

protocols/v2/binary-sv2/no-serde-sv2/codec/Cargo.toml protocols/v2/binary-sv2/codec/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"]
1515

1616
[dependencies]
1717
quickcheck = { version = "1.0.0", optional = true }
18-
buffer_sv2 = { path = "../../../../../utils/buffer", optional=true }
18+
buffer_sv2 = { path = "../../../../utils/buffer", optional=true }
1919

2020
[features]
2121
no_std = []

protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/inner.rs protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/inner.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ pub enum Inner<
7474
Owned(Vec<u8>),
7575
}
7676

77-
// TODO add test for that and implement it also with serde!!!!
7877
impl<'a, const SIZE: usize> Inner<'a, true, SIZE, 0, 0> {
7978
// Converts the inner data to a vector, either by cloning the referenced slice or
8079
// returning a clone of the owned vector.
@@ -101,7 +100,7 @@ impl<'a, const SIZE: usize> Inner<'a, true, SIZE, 0, 0> {
101100
}
102101
}
103102
}
104-
// TODO add test for that and implement it also with serde!!!!
103+
105104
impl<'a, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize>
106105
Inner<'a, false, SIZE, HEADERSIZE, MAXSIZE>
107106
{

protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs

+8-16
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
// - `impl_into_encodable_field_for_seq!`: Implements conversions to `EncodableField` for a
3737
// sequence, adapting the sequence for inclusion in serialized structures.
3838
//
39-
// ## Notes on Serialization
40-
//
41-
// Types are designed to interoperate with the `serde-sv2` framework, using lifetimes
42-
// (`'a`) for compatibility with external lifetimes and ensuring the types can be converted into
43-
// various serialized forms with or without `serde` support.
44-
//
4539
// ## Build Options
4640
//
4741
// - `prop_test`: Enables property-based testing compatibility by implementing `TryFrom` for `Vec`
@@ -60,7 +54,7 @@ use crate::{
6054
};
6155
use core::marker::PhantomData;
6256

63-
// TODO add test for that and implement it also with serde!!!!
57+
// TODO add test for that
6458
impl<'a, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize>
6559
Seq0255<'a, super::inner::Inner<'a, false, SIZE, HEADERSIZE, MAXSIZE>>
6660
{
@@ -74,7 +68,7 @@ impl<'a, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize>
7468
}
7569
}
7670

77-
// TODO add test for that and implement it also with serde!!!!
71+
// TODO add test for that
7872
impl<'a, const SIZE: usize> Seq0255<'a, super::inner::Inner<'a, true, SIZE, 0, 0>> {
7973
/// Converts the inner types to owned vector, and collects.
8074
pub fn to_vec(&self) -> Vec<Vec<u8>> {
@@ -86,7 +80,7 @@ impl<'a, const SIZE: usize> Seq0255<'a, super::inner::Inner<'a, true, SIZE, 0, 0
8680
self.0.iter().map(|x| x.inner_as_ref()).collect()
8781
}
8882
}
89-
// TODO add test for that and implement it also with serde!!!!
83+
// TODO add test for that
9084
impl<'a, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize>
9185
Seq064K<'a, super::inner::Inner<'a, false, SIZE, HEADERSIZE, MAXSIZE>>
9286
{
@@ -101,7 +95,7 @@ impl<'a, const SIZE: usize, const HEADERSIZE: usize, const MAXSIZE: usize>
10195
}
10296
}
10397

104-
// TODO add test for that and implement it also with serde!!!!
98+
// TODO add test for that
10599
impl<'a, const SIZE: usize> Seq064K<'a, super::inner::Inner<'a, true, SIZE, 0, 0>> {
106100
/// Converts the inner types to owned vector, and collects.
107101
pub fn to_vec(&self) -> Vec<Vec<u8>> {
@@ -118,8 +112,7 @@ impl<'a, const SIZE: usize> Seq064K<'a, super::inner::Inner<'a, true, SIZE, 0, 0
118112
use std::io::Read;
119113

120114
/// [`Seq0255`] represents a sequence with a maximum length of 255 elements.
121-
/// This structure uses a generic type `T` and a lifetime parameter `'a`
122-
/// to ensure compatibility with `serde-sv2`.
115+
/// This structure uses a generic type `T` and a lifetime parameter `'a`.
123116
#[repr(C)]
124117
#[derive(Debug, Clone, Eq, PartialEq)]
125118
pub struct Seq0255<'a, T>(pub Vec<T>, PhantomData<&'a T>);
@@ -163,8 +156,7 @@ impl<'a, T: GetSize> GetSize for Seq0255<'a, T> {
163156
}
164157

165158
/// [`Seq064K`] represents a sequence with a maximum length of 65535 elements.
166-
/// This structure uses a generic type `T` and a lifetime parameter `'a`
167-
/// to ensure compatibility with `serde-sv2`.
159+
/// This structure uses a generic type `T` and a lifetime parameter `'a`.
168160
#[derive(Debug, Clone, Eq, PartialEq)]
169161
pub struct Seq064K<'a, T>(pub(crate) Vec<T>, PhantomData<&'a T>);
170162

@@ -455,12 +447,12 @@ impl<'a, const ISFIXED: bool, const SIZE: usize, const HEADERSIZE: usize, const
455447
}
456448
}
457449

458-
/// The liftime is here only for type compatibility with serde-sv2
450+
/// The lifetime 'a is defined.
459451
#[repr(C)]
460452
#[derive(Debug, Clone, Eq, PartialEq)]
461453
pub struct Sv2Option<'a, T>(pub Vec<T>, PhantomData<&'a T>);
462454

463-
// TODO add test for that and implement it also with serde!!!!
455+
// TODO add test for that
464456
impl<'a, const SIZE: usize> Sv2Option<'a, super::inner::Inner<'a, true, SIZE, 0, 0>> {
465457
/// Gets the owned first element of the sequence, if present
466458
pub fn to_option(&self) -> Option<Vec<u8>> {

0 commit comments

Comments
 (0)