From df29c8f2904d4739ce37e4b41ceac0e746f53cf8 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 13:24:33 +0530 Subject: [PATCH 1/7] reorganise binary-sv2 deprecate binary-codec-sv2 and move its content to binary-sv2, add a new test module for all end-to-end test and update the derive-codec-sv2 to work accordingly --- protocols/v2/binary-sv2/Cargo.toml | 9 +- protocols/v2/binary-sv2/README.md | 20 + protocols/v2/binary-sv2/codec/.gitignore | 1 - protocols/v2/binary-sv2/codec/Cargo.toml | 27 - protocols/v2/binary-sv2/codec/README.md | 43 - protocols/v2/binary-sv2/codec/src/lib.rs | 312 ------ .../v2/binary-sv2/derive_codec/Cargo.toml | 3 - .../v2/binary-sv2/derive_codec/src/lib.rs | 15 +- .../v2/binary-sv2/examples/encode_decode.rs | 7 +- .../{codec => }/src/codec/decodable.rs | 0 .../{codec => }/src/codec/encodable.rs | 0 .../binary-sv2/{codec => }/src/codec/impls.rs | 0 .../binary-sv2/{codec => }/src/codec/mod.rs | 0 .../src/datatypes/copy_data_types.rs | 0 .../{codec => }/src/datatypes/mod.rs | 0 .../datatypes/non_copy_data_types/inner.rs | 0 .../src/datatypes/non_copy_data_types/mod.rs | 0 .../non_copy_data_types/seq_inner.rs | 0 protocols/v2/binary-sv2/src/lib.rs | 907 ++++++------------ protocols/v2/binary-sv2/tests/test.rs | 635 ++++++++++++ roles/Cargo.lock | 14 +- 21 files changed, 952 insertions(+), 1041 deletions(-) delete mode 100644 protocols/v2/binary-sv2/codec/.gitignore delete mode 100644 protocols/v2/binary-sv2/codec/Cargo.toml delete mode 100644 protocols/v2/binary-sv2/codec/README.md delete mode 100644 protocols/v2/binary-sv2/codec/src/lib.rs rename protocols/v2/binary-sv2/{codec => }/src/codec/decodable.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/codec/encodable.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/codec/impls.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/codec/mod.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/datatypes/copy_data_types.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/datatypes/mod.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/datatypes/non_copy_data_types/inner.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/datatypes/non_copy_data_types/mod.rs (100%) rename protocols/v2/binary-sv2/{codec => }/src/datatypes/non_copy_data_types/seq_inner.rs (100%) create mode 100644 protocols/v2/binary-sv2/tests/test.rs diff --git a/protocols/v2/binary-sv2/Cargo.toml b/protocols/v2/binary-sv2/Cargo.toml index 053093370a..3ebbc4f832 100644 --- a/protocols/v2/binary-sv2/Cargo.toml +++ b/protocols/v2/binary-sv2/Cargo.toml @@ -14,12 +14,15 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_codec_sv2 = { path = "codec", version = "^3.0.0" } derive_codec_sv2 = { path = "derive_codec", version = "^1.0.0" } +quickcheck = { version = "1.0.0", optional = true } +buffer_sv2 = { path = "../../../utils/buffer", optional=true, version = "^2.0.0" } [features] -prop_test = ["binary_codec_sv2/prop_test"] -with_buffer_pool = ["binary_codec_sv2/with_buffer_pool"] +no_std = [] +default = ["no_std"] +prop_test = ["quickcheck"] +with_buffer_pool = ["buffer_sv2"] [package.metadata.docs.rs] features = ["with_buffer_pool"] diff --git a/protocols/v2/binary-sv2/README.md b/protocols/v2/binary-sv2/README.md index 0dd1b63c43..58e6791405 100644 --- a/protocols/v2/binary-sv2/README.md +++ b/protocols/v2/binary-sv2/README.md @@ -12,6 +12,26 @@ - **Protocol-Specific Types**: Supports fixed and dynamically-sized SV2 types. - **Optimized Memory Use**: Supports buffer pooling to enhance memory efficiency. +## Sv2 Type Mapping + +The crate supports the following mappings between Rust and SV2 types + +| Rust Type | Sv2 Type | +|-------------|----------------| +| `bool` | `BOOL` | +| `u8` | `U8` | +| `u16` | `U16` | +| `U24` | `U24` | +| `u32` | `U32` | +| `u64` | `U64` | +| `f32` | `F32` | +| `Str0255` | `STRO_255` | +| `Signature` | `SIGNATURE` | +| `[u8]` | `BYTES` | +| `Seq0255` | `SEQ0_255[T]` | +| `Seq064K` | `SEQ0_64K[T]` | + + ## Features - **prop_test**: Adds property testing support. diff --git a/protocols/v2/binary-sv2/codec/.gitignore b/protocols/v2/binary-sv2/codec/.gitignore deleted file mode 100644 index ea8c4bf7f3..0000000000 --- a/protocols/v2/binary-sv2/codec/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/protocols/v2/binary-sv2/codec/Cargo.toml b/protocols/v2/binary-sv2/codec/Cargo.toml deleted file mode 100644 index 5b70970e5f..0000000000 --- a/protocols/v2/binary-sv2/codec/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "binary_codec_sv2" -version = "3.0.0" -authors = ["The Stratum V2 Developers"] -edition = "2021" -readme = "README.md" -description = "Sv2 data format" -documentation = "https://docs.rs/binary_codec_sv2" -license = "MIT OR Apache-2.0" -repository = "https://github.com/stratum-mining/stratum" -homepage = "https://stratumprotocol.org" -keywords = ["stratum", "mining", "bitcoin", "protocol"] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -quickcheck = { version = "1.0.0", optional = true } -buffer_sv2 = { path = "../../../../utils/buffer", optional=true, version = "^2.0.0" } - -[features] -no_std = [] -default = ["no_std"] -prop_test = ["quickcheck"] -with_buffer_pool = ["buffer_sv2"] - -[package.metadata.docs.rs] -features = ["with_buffer_pool"] diff --git a/protocols/v2/binary-sv2/codec/README.md b/protocols/v2/binary-sv2/codec/README.md deleted file mode 100644 index 8ee2a55008..0000000000 --- a/protocols/v2/binary-sv2/codec/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# binary_codec_sv2 - -[![crates.io](https://img.shields.io/crates/v/binary_codec_sv2.svg)](https://crates.io/crates/binary_codec_sv2) -[![docs.rs](https://docs.rs/binary_codec_sv2/badge.svg)](https://docs.rs/binary_codec_sv2) -[![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) -[![license](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](https://github.com/stratum-mining/stratum/blob/main/LICENSE.md) -[![codecov](https://codecov.io/gh/stratum-mining/stratum/branch/main/graph/badge.svg?flag=binary_codec_sv2-coverage)](https://codecov.io/gh/stratum-mining/stratum) - -`binary_codec_sv2` is a `no_std` Rust crate that helps serialize and de-serialize binary data into and from Stratum V2 types. - -## Key Features - -- **Comprehensive Encoding and Decoding**: Provides traits (`Encodable`, `Decodable`) for converting between Rust and SV2 data types/structures. -- **Support for Complex Data Structures**: Handles primitives, nested structures, and protocol-specific types like `U24`, `U256`,`Str0255` and rest. -- **Error Handling**: Robust mechanisms for managing encoding/decoding failures, including size mismatches and invalid data. -- **`no_std` Compatibility**: Fully supports constrained environments without the Rust standard library. - -## Sv2 Type Mapping - -The crate supports the following mappings between Rust and SV2 types - -| Rust Type | Sv2 Type | -|-------------|----------------| -| `bool` | `BOOL` | -| `u8` | `U8` | -| `u16` | `U16` | -| `U24` | `U24` | -| `u32` | `U32` | -| `u64` | `U64` | -| `f32` | `F32` | -| `Str0255` | `STRO_255` | -| `Signature` | `SIGNATURE` | -| `[u8]` | `BYTES` | -| `Seq0255` | `SEQ0_255[T]` | -| `Seq064K` | `SEQ0_64K[T]` | - -## Installation - -Add `binary_codec_sv2` to your project by running: - -```sh -cargo add binary_codec_sv2 -``` diff --git a/protocols/v2/binary-sv2/codec/src/lib.rs b/protocols/v2/binary-sv2/codec/src/lib.rs deleted file mode 100644 index cac81dacf3..0000000000 --- a/protocols/v2/binary-sv2/codec/src/lib.rs +++ /dev/null @@ -1,312 +0,0 @@ -//! Defines types, encodings, and conversions between custom datatype and standard Rust type, -//! providing abstractions for encoding, decoding, and error handling of SV2 data types. -//! -//! # Overview -//! -//! Enables conversion between various Rust types and SV2-specific data formats for efficient -//! network communication. Provides utilities to encode and decode data types according to the SV2 -//! specifications. -//! -//! ## Type Mappings -//! The following table illustrates how standard Rust types map to their SV2 counterparts: -//! -//! ```txt -//! bool <-> BOOL -//! u8 <-> U8 -//! u16 <-> U16 -//! U24 <-> U24 -//! u32 <-> U32 -//! f32 <-> F32 // Not in the spec, but used -//! u64 <-> U64 -//! U256 <-> U256 -//! Str0255 <-> STRO_255 -//! Signature<-> SIGNATURE -//! B032 <-> B0_32 -//! B0255 <-> B0_255 -//! B064K <-> B0_64K -//! B016M <-> B0_16M -//! [u8] <-> BYTES -//! Pubkey <-> PUBKEY -//! Seq0255 <-> SEQ0_255[T] -//! Seq064K <-> SEQ0_64K[T] -//! ``` -//! -//! # Encoding & Decoding -//! -//! Enables conversion between various Rust types and SV2-specific data formats for efficient -//! network communication. Provides utilities to encode and decode data types according to the SV2 -//! specifications. -//! -//! - **to_bytes**: Encodes an SV2 data type into a byte vector. -//! - **to_writer**: Encodes an SV2 data type into a byte slice. -//! - **from_bytes**: Decodes an SV2-encoded byte slice into the specified data type. -//! -//! # Error Handling -//! -//! Defines an `Error` enum for handling failure conditions during encoding, decoding, and data -//! manipulation. Common errors include: -//! - Out-of-bounds accesses -//! - Size mismatches during encoding/decoding -//! - Invalid data representations, such as non-boolean values interpreted as booleans. -//! -//! # Build Options -//! -//! Supports optional features like `no_std` for environments without standard library support. -//! Error types are conditionally compiled to work with or without `std`. -//! -//! ## Conditional Compilation -//! - With the `no_std` feature enabled, I/O-related errors use a simplified `IoError` -//! representation. -//! - Standard I/O errors (`std::io::Error`) are used when `no_std` is disabled. - -#![cfg_attr(feature = "no_std", no_std)] - -#[cfg(not(feature = "no_std"))] -use std::io::{Error as E, ErrorKind}; - -mod codec; -mod datatypes; -pub use datatypes::{ - PubKey, Seq0255, Seq064K, Signature, Str0255, Sv2DataType, Sv2Option, U32AsRef, B016M, B0255, - B032, B064K, U24, U256, -}; - -pub use crate::codec::{ - decodable::{Decodable, GetMarker}, - encodable::{Encodable, EncodableField}, - Fixed, GetSize, SizeHint, -}; - -use alloc::vec::Vec; - -/// Converts the provided SV2 data type to a byte vector based on the SV2 encoding format. -#[allow(clippy::wrong_self_convention)] -pub fn to_bytes(src: T) -> Result, Error> { - let mut result = vec![0_u8; src.get_size()]; - src.to_bytes(&mut result)?; - Ok(result) -} - -/// Encodes the SV2 data type to the provided byte slice. -#[allow(clippy::wrong_self_convention)] -pub fn to_writer(src: T, dst: &mut [u8]) -> Result<(), Error> { - src.to_bytes(dst)?; - Ok(()) -} - -/// Decodes an SV2-encoded byte slice into the specified data type. -pub fn from_bytes<'a, T: Decodable<'a>>(data: &'a mut [u8]) -> Result { - T::from_bytes(data) -} - -/// Provides an interface and implementation details for decoding complex data structures -/// from raw bytes or I/O streams. Handles deserialization of nested and primitive data -/// structures through traits, enums, and helper functions for managing the decoding process. -/// -/// # Overview -/// The [`Decodable`] trait serves as the core component, offering methods to define a type's -/// structure, decode raw byte data, and construct instances from decoded fields. It supports both -/// in-memory byte slices and I/O streams for flexibility across deserialization use cases. -/// -/// # Key Concepts and Types -/// - **[`Decodable`] Trait**: Defines methods to decode types from byte data, process individual -/// fields, and construct complete types. -/// - **[`FieldMarker`] and `PrimitiveMarker`**: Enums that represent data types or structures, -/// guiding the decoding process by defining field structures and types. -/// - **[`DecodableField`] and `DecodablePrimitive`**: Represent decoded fields as either primitives -/// or nested structures, forming the building blocks for complex data types. -/// -/// # Error Handling -/// Custom error types manage issues during decoding, such as insufficient data or unsupported -/// types. Errors are surfaced through `Result` types to ensure reliability in data parsing tasks. -/// -/// # `no_std` Support -/// Compatible with `no_std` environments through conditional compilation. Omits I/O-dependent -/// methods like `from_reader` when `no_std` is enabled, ensuring lightweight builds for constrained -/// environments. -pub mod decodable { - pub use crate::codec::decodable::{Decodable, DecodableField, FieldMarker}; - //pub use crate::codec::decodable::PrimitiveMarker; -} - -/// Provides an encoding framework for serializing various data types into bytes. -/// -/// The [`Encodable`] trait is the core of this framework, enabling types to define -/// how they serialize data into bytes. This is essential for transmitting data -/// between components or systems in a consistent, byte-oriented format. -/// -/// ## Overview -/// -/// Supports a wide variety of data types, including basic types (e.g., integers, -/// booleans, and byte arrays) and complex structures. Each type’s encoding logic is -/// encapsulated in enums like [`EncodablePrimitive`] and [`EncodableField`], enabling -/// structured and hierarchical data serialization. -/// -/// ### Key Types -/// -/// - **[`Encodable`]**: Defines methods for converting an object into a byte array or writing it -/// directly to an output stream. It supports both primitive types and complex structures. -/// - **[`EncodablePrimitive`]**: Represents basic types that can be serialized directly. Includes -/// data types like integers, booleans, and byte arrays. -/// - **[`EncodableField`]**: Extends [`EncodablePrimitive`] to support structured and nested data, -/// enabling recursive encoding of complex structures. -/// -/// ### `no_std` Compatibility -/// -/// When compiled with the `no_std` feature enabled, this module omits the `to_writer` method -/// to support environments without the standard library. Only buffer-based encoding -/// (`to_bytes`) is available in this mode. -/// -/// ## Error Handling -/// -/// Errors during encoding are handled through the [`Error`] type. Common failure scenarios include -/// buffer overflows and type-specific serialization errors. Each encoding method returns an -/// appropriate error if encoding fails, supporting comprehensive error management. -/// -/// ## Trait Details -/// -/// ### [`Encodable`] -/// - **`to_bytes`**: Encodes the instance into a byte slice, returning the number of bytes written -/// or an error if encoding fails. -/// - **`to_writer`** (requires `std`): Encodes the instance into any [`Write`] implementor, such as -/// a file or network stream. -/// -/// ### Additional Enums and Methods -/// -/// Includes utility types and methods for calculating sizes, encoding hierarchical data, -/// and supporting both owned and reference-based data variants. -/// -/// - **[`EncodablePrimitive`]**: Handles encoding logic for primitive types, addressing -/// serialization requirements specific to each type. -/// - **[`EncodableField`]**: Extends encoding to support composite types and structured data, -/// enabling recursive encoding of nested structures. -/// -/// ## Summary -/// -/// Designed for flexibility and extensibility, this module supports a wide range of data -/// serialization needs through customizable encoding strategies. Implementing the -/// [`Encodable`] trait for custom types ensures efficient and consistent data serialization -/// across applications. -pub mod encodable { - pub use crate::codec::encodable::{Encodable, EncodableField, EncodablePrimitive}; -} - -#[macro_use] -extern crate alloc; - -/// Error types used within the protocol library to indicate various failure conditions. -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum Error { - /// Indicates an attempt to read beyond a valid range. - OutOfBound, - - /// Raised when a non-binary value is interpreted as a boolean. - NotABool(u8), - - /// Occurs when an unexpected size mismatch arises during a write operation, specifying - /// expected and actual sizes. - WriteError(usize, usize), - - /// Signifies an overflow condition where a `u32` exceeds the maximum allowable `u24` value. - U24TooBig(u32), - - /// Reports a size mismatch for a signature, such as when it does not match the expected size. - InvalidSignatureSize(usize), - - /// Raised when a `u256` value is invalid, typically due to size discrepancies. - InvalidU256(usize), - - /// Indicates an invalid `u24` representation. - InvalidU24(u32), - - /// Error indicating that a byte array exceeds the maximum allowed size for `B0255`. - InvalidB0255Size(usize), - - /// Error indicating that a byte array exceeds the maximum allowed size for `B064K`. - InvalidB064KSize(usize), - - /// Error indicating that a byte array exceeds the maximum allowed size for `B016M`. - InvalidB016MSize(usize), - - /// Raised when a sequence size exceeds `0255`. - InvalidSeq0255Size(usize), - - /// Error when trying to encode a non-primitive data type. - NonPrimitiveTypeCannotBeEncoded, - - /// Generic conversion error related to primitive types. - PrimitiveConversionError, - - /// Error occurring during decoding due to conversion issues. - DecodableConversionError, - - /// Error triggered when a decoder is used without initialization. - UnInitializedDecoder, - - #[cfg(not(feature = "no_std"))] - /// Represents I/O-related errors, compatible with `no_std` mode where specific error types may - /// vary. - IoError(E), - - #[cfg(feature = "no_std")] - /// Represents I/O-related errors, compatible with `no_std` mode. - IoError, - - /// Raised when an unexpected mismatch occurs during read operations, specifying expected and - /// actual read sizes. - ReadError(usize, usize), - - /// Used as a marker error for fields that should remain void or empty. - VoidFieldMarker, - - /// Signifies a value overflow based on protocol restrictions, containing details about - /// fixed/variable size, maximum size allowed, and the offending value details. - ValueExceedsMaxSize(bool, usize, usize, usize, Vec, usize), - - /// Triggered when a sequence type (`Seq0255`, `Seq064K`) exceeds its maximum allowable size. - SeqExceedsMaxSize, - - /// Raised when no valid decodable field is provided during decoding. - NoDecodableFieldPassed, - - /// Error for protocol-specific invalid values. - ValueIsNotAValidProtocol(u8), - - /// Raised when an unsupported or unknown message type is encountered. - UnknownMessageType(u8), - - /// Indicates a protocol constraint violation where `Sv2Option` unexpectedly contains multiple - /// elements. - Sv2OptionHaveMoreThenOneElement(u8), -} - -#[cfg(not(feature = "no_std"))] -impl From for Error { - fn from(v: E) -> Self { - match v.kind() { - ErrorKind::UnexpectedEof => Error::OutOfBound, - _ => Error::IoError(v), - } - } -} - -/// Vec is used as the Sv2 type Bytes -impl GetSize for Vec { - fn get_size(&self) -> usize { - self.len() - } -} - -// Only needed for implement encodable for Frame never called -impl From> for EncodableField<'_> { - fn from(_v: Vec) -> Self { - unreachable!() - } -} - -#[cfg(feature = "with_buffer_pool")] -impl From for EncodableField<'_> { - fn from(_v: buffer_sv2::Slice) -> Self { - unreachable!() - } -} diff --git a/protocols/v2/binary-sv2/derive_codec/Cargo.toml b/protocols/v2/binary-sv2/derive_codec/Cargo.toml index 59e8891335..1faec1d42f 100644 --- a/protocols/v2/binary-sv2/derive_codec/Cargo.toml +++ b/protocols/v2/binary-sv2/derive_codec/Cargo.toml @@ -13,8 +13,5 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -binary_codec_sv2 = { path="../codec", version = "^3.0.0" } - [lib] proc-macro = true diff --git a/protocols/v2/binary-sv2/derive_codec/src/lib.rs b/protocols/v2/binary-sv2/derive_codec/src/lib.rs index 37da055224..74f0fa1b2b 100644 --- a/protocols/v2/binary-sv2/derive_codec/src/lib.rs +++ b/protocols/v2/binary-sv2/derive_codec/src/lib.rs @@ -480,7 +480,7 @@ fn parse_struct_fields(group: Vec) -> Vec { /// ```ignore /// mod impl_parse_decodable_test { /// use super::{ -/// binary_codec_sv2::{ +/// binary_sv2::{ /// decodable::{DecodableField, FieldMarker}, /// Decodable, Error, SizeHint, /// }, @@ -559,7 +559,6 @@ fn parse_struct_fields(group: Vec) -> Vec { #[proc_macro_derive(Decodable)] pub fn decodable(item: TokenStream) -> TokenStream { let parsed_struct = get_struct_properties(item); - let data_ident = RESERVED_FIELDS[0]; let offset_ident = RESERVED_FIELDS[1]; @@ -643,7 +642,7 @@ pub fn decodable(item: TokenStream) -> TokenStream { let result = format!( "mod impl_parse_decodable_{} {{ - use super::binary_codec_sv2::{{decodable::DecodableField, decodable::FieldMarker, Decodable, Error, SizeHint}}; + use super::binary_sv2::{{decodable::DecodableField, decodable::FieldMarker, Decodable, Error, SizeHint}}; use super::*; impl{} Decodable<'decoder> for {}{} {{ @@ -743,7 +742,7 @@ fn get_static_generics(gen: &str) -> &str { /// /// ```ignore /// mod impl_parse_encodable_test { -/// use super::binary_codec_sv2::{encodable::EncodableField, GetSize}; +/// use super::binary_sv2::{encodable::EncodableField, GetSize}; /// extern crate alloc; /// use alloc::vec::Vec; /// @@ -793,6 +792,7 @@ pub fn encodable(item: TokenStream) -> TokenStream { let parsed_struct = get_struct_properties(item); let fields = parsed_struct.fields.clone(); + let mut field_into_decoded_field = String::new(); // Create DecodableField from fields @@ -829,7 +829,7 @@ pub fn encodable(item: TokenStream) -> TokenStream { } else { format!( " - impl{} GetSize for {}{} {{ + impl{} super::binary_sv2::GetSize for {}{} {{ fn get_size(&self) -> usize {{ let mut size = 0; {} @@ -844,12 +844,12 @@ pub fn encodable(item: TokenStream) -> TokenStream { let result = format!( "mod impl_parse_encodable_{} {{ - use super::binary_codec_sv2::{{encodable::EncodableField, GetSize}}; + use super::binary_sv2::{{encodable::EncodableField, GetSize}}; use super::{}; extern crate alloc; use alloc::vec::Vec; - impl{} From<{}{}> for EncodableField<'decoder> {{ + impl{} From<{}{}> for super::binary_sv2::EncodableField<'decoder> {{ fn from(v: {}{}) -> Self {{ let mut fields: Vec = Vec::new(); {} @@ -873,7 +873,6 @@ pub fn encodable(item: TokenStream) -> TokenStream { // impl get_size get_size, ); - //println!("{}", result); // Never executed at runtime it ok to panic result.parse().unwrap() diff --git a/protocols/v2/binary-sv2/examples/encode_decode.rs b/protocols/v2/binary-sv2/examples/encode_decode.rs index f792b45f3c..0d456a31d2 100644 --- a/protocols/v2/binary-sv2/examples/encode_decode.rs +++ b/protocols/v2/binary-sv2/examples/encode_decode.rs @@ -1,4 +1,5 @@ -pub use binary_codec_sv2::{self, Decodable as Deserialize, Encodable as Serialize, *}; +pub use binary_sv2::{self, Decodable as Deserialize, Encodable as Serialize}; +use binary_sv2::{from_bytes, to_bytes, U24}; use core::convert::TryInto; pub use derive_codec_sv2::{Decodable as Deserialize, Encodable as Serialize}; @@ -6,7 +7,7 @@ pub use derive_codec_sv2::{Decodable as Deserialize, Encodable as Serialize}; // These macros provide the necessary methods for serializing and deserializing the struct. // // mod impl_parse_decodable_test { -// use super::binary_codec_sv2::{ +// use super::binary_sv2::{ // decodable::DecodableField, decodable::FieldMarker, Decodable, Error, SizeHint, // }; // use super::*; @@ -64,7 +65,7 @@ pub use derive_codec_sv2::{Decodable as Deserialize, Encodable as Serialize}; // } // } // mod impl_parse_encodable_test { -// use super::binary_codec_sv2::{encodable::EncodableField, GetSize}; +// use super::binary_sv2::{encodable::EncodableField, GetSize}; // use super::Test; // extern crate alloc; // use alloc::vec::Vec; diff --git a/protocols/v2/binary-sv2/codec/src/codec/decodable.rs b/protocols/v2/binary-sv2/src/codec/decodable.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/codec/decodable.rs rename to protocols/v2/binary-sv2/src/codec/decodable.rs diff --git a/protocols/v2/binary-sv2/codec/src/codec/encodable.rs b/protocols/v2/binary-sv2/src/codec/encodable.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/codec/encodable.rs rename to protocols/v2/binary-sv2/src/codec/encodable.rs diff --git a/protocols/v2/binary-sv2/codec/src/codec/impls.rs b/protocols/v2/binary-sv2/src/codec/impls.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/codec/impls.rs rename to protocols/v2/binary-sv2/src/codec/impls.rs diff --git a/protocols/v2/binary-sv2/codec/src/codec/mod.rs b/protocols/v2/binary-sv2/src/codec/mod.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/codec/mod.rs rename to protocols/v2/binary-sv2/src/codec/mod.rs diff --git a/protocols/v2/binary-sv2/codec/src/datatypes/copy_data_types.rs b/protocols/v2/binary-sv2/src/datatypes/copy_data_types.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/datatypes/copy_data_types.rs rename to protocols/v2/binary-sv2/src/datatypes/copy_data_types.rs diff --git a/protocols/v2/binary-sv2/codec/src/datatypes/mod.rs b/protocols/v2/binary-sv2/src/datatypes/mod.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/datatypes/mod.rs rename to protocols/v2/binary-sv2/src/datatypes/mod.rs diff --git a/protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/inner.rs b/protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/inner.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/inner.rs rename to protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/inner.rs diff --git a/protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/mod.rs b/protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/mod.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/mod.rs rename to protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/mod.rs diff --git a/protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs b/protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/seq_inner.rs similarity index 100% rename from protocols/v2/binary-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs rename to protocols/v2/binary-sv2/src/datatypes/non_copy_data_types/seq_inner.rs diff --git a/protocols/v2/binary-sv2/src/lib.rs b/protocols/v2/binary-sv2/src/lib.rs index 95ec5152e7..0d207944db 100644 --- a/protocols/v2/binary-sv2/src/lib.rs +++ b/protocols/v2/binary-sv2/src/lib.rs @@ -1,681 +1,330 @@ -//! Export custom implementations of the `binary_sv2` protocol, -//! enabling encoding and decoding through custom traits. +//! Defines types, encodings, and conversions between custom datatype and standard Rust type, +//! providing abstractions for encoding, decoding, and error handling of SV2 data types. //! //! # Overview //! -//! This crate will re-export implementations of the`Deserialize` and `Serialize` traits -//! from a custom implementation provided by `binary_codec_sv2` and `derive_codec_sv2`. -//! This allows for flexible integration of SV2 protocol types and binary serialization. +//! Enables conversion between various Rust types and SV2-specific data formats for efficient +//! network communication. Provides utilities to encode and decode data types according to the SV2 +//! specifications. //! -//! ## Features -//! - **prop_test**: Adds support for property testing for protocol types. -//! - **with_buffer_pool**: Enables support for buffer pooling to optimize memory usage during -//! serialization and deserialization. -#![no_std] +//! ## Type Mappings +//! The following table illustrates how standard Rust types map to their SV2 counterparts: +//! +//! ```txt +//! bool <-> BOOL +//! u8 <-> U8 +//! u16 <-> U16 +//! U24 <-> U24 +//! u32 <-> U32 +//! f32 <-> F32 // Not in the spec, but used +//! u64 <-> U64 +//! U256 <-> U256 +//! Str0255 <-> STRO_255 +//! Signature<-> SIGNATURE +//! B032 <-> B0_32 +//! B0255 <-> B0_255 +//! B064K <-> B0_64K +//! B016M <-> B0_16M +//! [u8] <-> BYTES +//! Pubkey <-> PUBKEY +//! Seq0255 <-> SEQ0_255[T] +//! Seq064K <-> SEQ0_64K[T] +//! ``` +//! +//! # Encoding & Decoding +//! +//! Enables conversion between various Rust types and SV2-specific data formats for efficient +//! network communication. Provides utilities to encode and decode data types according to the SV2 +//! specifications. +//! +//! - **to_bytes**: Encodes an SV2 data type into a byte vector. +//! - **to_writer**: Encodes an SV2 data type into a byte slice. +//! - **from_bytes**: Decodes an SV2-encoded byte slice into the specified data type. +//! +//! # Error Handling +//! +//! Defines an `Error` enum for handling failure conditions during encoding, decoding, and data +//! manipulation. Common errors include: +//! - Out-of-bounds accesses +//! - Size mismatches during encoding/decoding +//! - Invalid data representations, such as non-boolean values interpreted as booleans. +//! +//! # Build Options +//! +//! Supports optional features like `no_std` for environments without standard library support. +//! Error types are conditionally compiled to work with or without `std`. +//! +//! ## Conditional Compilation +//! - With the `no_std` feature enabled, I/O-related errors use a simplified `IoError` +//! representation. +//! - Standard I/O errors (`std::io::Error`) are used when `no_std` is disabled. -#[macro_use] -extern crate alloc; +#![cfg_attr(feature = "no_std", no_std)] -use core::convert::TryInto; +#[cfg(not(feature = "no_std"))] +use std::io::{Error as E, ErrorKind}; -pub use binary_codec_sv2::{self, Decodable as Deserialize, Encodable as Serialize, *}; +pub use decodable::Decodable as Deserialize; pub use derive_codec_sv2::{Decodable as Deserialize, Encodable as Serialize}; - -/// Does nothing and will be removed during refactor -pub fn clone_message(_: T) -> T { - todo!() +pub use encodable::Encodable as Serialize; + +mod codec; +mod datatypes; +pub use datatypes::{ + PubKey, Seq0255, Seq064K, Signature, Str0255, Sv2DataType, Sv2Option, U32AsRef, B016M, B0255, + B032, B064K, U24, U256, +}; + +pub use crate::codec::{ + decodable::{Decodable, GetMarker}, + encodable::{Encodable, EncodableField}, + Fixed, GetSize, SizeHint, +}; + +use alloc::vec::Vec; + +/// Converts the provided SV2 data type to a byte vector based on the SV2 encoding format. +#[allow(clippy::wrong_self_convention)] +pub fn to_bytes(src: T) -> Result, Error> { + let mut result = vec![0_u8; src.get_size()]; + src.to_bytes(&mut result)?; + Ok(result) } -/// Converts a value implementing the `Into` trait into a custom `U256` type. -pub fn u256_from_int>(value: V) -> U256<'static> { - // initialize u256 as a bytes vec of len 24 - let mut u256 = vec![0_u8; 24]; - let val: u64 = value.into(); - for v in &(val.to_le_bytes()) { - // add 8 bytes to u256 - u256.push(*v) - } - // Always safe cause u256 is 24 + 8 (32) bytes - let u256: U256 = u256.try_into().unwrap(); - u256 +/// Encodes the SV2 data type to the provided byte slice. +#[allow(clippy::wrong_self_convention)] +pub fn to_writer(src: T, dst: &mut [u8]) -> Result<(), Error> { + src.to_bytes(dst)?; + Ok(()) } -#[cfg(test)] -mod test { - use super::*; - use alloc::vec::Vec; - - mod test_struct { - use super::*; - use core::convert::TryInto; - - #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] - struct Test { - a: u32, - b: u8, - c: U24, - } - - #[test] - fn test_struct() { - let expected = Test { - a: 456, - b: 9, - c: 67_u32.try_into().unwrap(), - }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_f32 { - use super::*; - use core::convert::TryInto; - - #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] - struct Test { - a: u8, - b: U24, - c: f32, - } - - #[test] - fn test_struct() { - let expected = Test { - c: 0.345, - a: 9, - b: 67_u32.try_into().unwrap(), - }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_b0255 { - use super::*; - use core::convert::TryInto; - - #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] - struct Test<'decoder> { - a: B0255<'decoder>, - } - - #[test] - fn test_b0255() { - let mut b0255 = [6; 3]; - let b0255: B0255 = (&mut b0255[..]).try_into().unwrap(); - - let expected = Test { a: b0255 }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - - #[test] - fn test_b0255_max() { - let mut b0255 = [6; 255]; - let b0255: B0255 = (&mut b0255[..]).try_into().unwrap(); - - let expected = Test { a: b0255 }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_u256 { - use super::*; - use core::convert::TryInto; - - #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] - struct Test<'decoder> { - a: U256<'decoder>, - } - - #[test] - fn test_u256() { - let mut u256 = [6_u8; 32]; - let u256: U256 = (&mut u256[..]).try_into().unwrap(); - - let expected = Test { a: u256 }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_signature { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Signature<'decoder>, - } - - #[test] - fn test_signature() { - let mut s = [6; 64]; - let s: Signature = (&mut s[..]).try_into().unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_b016m { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - b: bool, - a: B016M<'decoder>, - } - - #[test] - fn test_b016m() { - let mut b = [0_u8; 70000]; - let b: B016M = (&mut b[..]).try_into().unwrap(); - //println!("{:?}", to_bytes(&b).unwrap().len()); - - let expected = Test { a: b, b: true }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - - #[test] - fn test_b016m_max() { - let mut b = vec![0_u8; 16777215]; - let b: B016M = (&mut b[..]).try_into().unwrap(); - //println!("{:?}", to_bytes(&b).unwrap().len()); - - let expected = Test { a: b, b: true }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_b064k { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - b: bool, - a: B064K<'decoder>, - } - - #[test] - fn test_b064k() { - let mut b = [1, 2, 9]; - let b: B064K = (&mut b[..]) - .try_into() - .expect("vector smaller than 64K should not fail"); - - let expected = Test { a: b, b: true }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seq0255_u256 { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, U256<'decoder>>, - } - - #[test] - fn test_seq0255_u256() { - let mut u256_1 = [6; 32]; - let mut u256_2 = [5; 32]; - let mut u256_3 = [0; 32]; - let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); - let u256_2: U256 = (&mut u256_2[..]).try_into().unwrap(); - let u256_3: U256 = (&mut u256_3[..]).try_into().unwrap(); - - let val = vec![u256_1, u256_2, u256_3]; - let s = Seq0255::new(val).unwrap(); - - let test = Test { a: s }; - - let mut bytes = to_bytes(test.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - let bytes_2 = to_bytes(deserialized.clone()).unwrap(); - - assert_eq!(bytes, bytes_2); - } - } - - mod test_0255_bool { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, bool>, - } - - #[test] - fn test_seq0255_bool() { - let s: Seq0255 = Seq0255::new(vec![true, false, true]).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seq0255_u16 { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, u16>, - } - - #[test] - fn test_seq0255_u16() { - let s: Seq0255 = Seq0255::new(vec![10, 43, 89]).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seq_0255_u24 { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, U24>, - } - - #[test] - fn test_seq0255_u24() { - let u24_1: U24 = 56_u32.try_into().unwrap(); - let u24_2: U24 = 59_u32.try_into().unwrap(); - let u24_3: U24 = 70999_u32.try_into().unwrap(); - - let val = vec![u24_1, u24_2, u24_3]; - let s: Seq0255 = Seq0255::new(val).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seqo255_u32 { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, u32>, - } - - #[test] - fn test_seq0255_u32() { - let s: Seq0255 = Seq0255::new(vec![546, 99999, 87, 32]).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seq0255_signature { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq0255<'decoder, Signature<'decoder>>, - } - - #[test] - fn test_seq0255_signature() { - let mut siganture_1 = [88_u8; 64]; - let mut siganture_2 = [99_u8; 64]; - let mut siganture_3 = [220_u8; 64]; - let siganture_1: Signature = (&mut siganture_1[..]).try_into().unwrap(); - let siganture_2: Signature = (&mut siganture_2[..]).try_into().unwrap(); - let siganture_3: Signature = (&mut siganture_3[..]).try_into().unwrap(); - - let val = vec![siganture_1, siganture_2, siganture_3]; - let s: Seq0255 = Seq0255::new(val).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - assert_eq!(deserialized, expected); - } - } - - mod test_seq_064_u256 { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, U256<'decoder>>, - } - - #[test] - fn test_seq064k_u256() { - let mut u256_1 = [6; 32]; - let mut u256_2 = [5; 32]; - let mut u256_3 = [0; 32]; - let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); - let u256_2: U256 = (&mut u256_2[..]).try_into().unwrap(); - let u256_3: U256 = (&mut u256_3[..]).try_into().unwrap(); - - let val = vec![u256_1, u256_2, u256_3]; - let s = Seq064K::new(val).unwrap(); - - let test = Test { a: s }; - - let mut bytes = to_bytes(test.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - let bytes_2 = to_bytes(deserialized.clone()).unwrap(); - - assert_eq!(bytes, bytes_2); - } - } - - mod test_064_bool { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, bool>, - } - - #[test] - fn test_seq064k_bool() { - let s: Seq064K = Seq064K::new(vec![true, false, true]).unwrap(); - let s2: Seq064K = Seq064K::new(vec![true; 64000]).unwrap(); - - let expected = Test { a: s }; - let expected2 = Test { a: s2 }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - let mut bytes2 = to_bytes(expected2.clone()).unwrap(); +/// Decodes an SV2-encoded byte slice into the specified data type. +pub fn from_bytes<'a, T: Decodable<'a>>(data: &'a mut [u8]) -> Result { + T::from_bytes(data) +} - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - let deserialized2: Test = from_bytes(&mut bytes2[..]).unwrap(); +/// Provides an interface and implementation details for decoding complex data structures +/// from raw bytes or I/O streams. Handles deserialization of nested and primitive data +/// structures through traits, enums, and helper functions for managing the decoding process. +/// +/// # Overview +/// The [`Decodable`] trait serves as the core component, offering methods to define a type's +/// structure, decode raw byte data, and construct instances from decoded fields. It supports both +/// in-memory byte slices and I/O streams for flexibility across deserialization use cases. +/// +/// # Key Concepts and Types +/// - **[`Decodable`] Trait**: Defines methods to decode types from byte data, process individual +/// fields, and construct complete types. +/// - **[`FieldMarker`] and `PrimitiveMarker`**: Enums that represent data types or structures, +/// guiding the decoding process by defining field structures and types. +/// - **[`DecodableField`] and `DecodablePrimitive`**: Represent decoded fields as either primitives +/// or nested structures, forming the building blocks for complex data types. +/// +/// # Error Handling +/// Custom error types manage issues during decoding, such as insufficient data or unsupported +/// types. Errors are surfaced through `Result` types to ensure reliability in data parsing tasks. +/// +/// # `no_std` Support +/// Compatible with `no_std` environments through conditional compilation. Omits I/O-dependent +/// methods like `from_reader` when `no_std` is enabled, ensuring lightweight builds for constrained +/// environments. +pub mod decodable { + pub use crate::codec::decodable::{Decodable, DecodableField, FieldMarker}; + //pub use crate::codec::decodable::PrimitiveMarker; +} - assert_eq!(deserialized, expected); - assert_eq!(deserialized2, expected2); - } - } +/// Provides an encoding framework for serializing various data types into bytes. +/// +/// The [`Encodable`] trait is the core of this framework, enabling types to define +/// how they serialize data into bytes. This is essential for transmitting data +/// between components or systems in a consistent, byte-oriented format. +/// +/// ## Overview +/// +/// Supports a wide variety of data types, including basic types (e.g., integers, +/// booleans, and byte arrays) and complex structures. Each type’s encoding logic is +/// encapsulated in enums like [`EncodablePrimitive`] and [`EncodableField`], enabling +/// structured and hierarchical data serialization. +/// +/// ### Key Types +/// +/// - **[`Encodable`]**: Defines methods for converting an object into a byte array or writing it +/// directly to an output stream. It supports both primitive types and complex structures. +/// - **[`EncodablePrimitive`]**: Represents basic types that can be serialized directly. Includes +/// data types like integers, booleans, and byte arrays. +/// - **[`EncodableField`]**: Extends [`EncodablePrimitive`] to support structured and nested data, +/// enabling recursive encoding of complex structures. +/// +/// ### `no_std` Compatibility +/// +/// When compiled with the `no_std` feature enabled, this module omits the `to_writer` method +/// to support environments without the standard library. Only buffer-based encoding +/// (`to_bytes`) is available in this mode. +/// +/// ## Error Handling +/// +/// Errors during encoding are handled through the [`Error`] type. Common failure scenarios include +/// buffer overflows and type-specific serialization errors. Each encoding method returns an +/// appropriate error if encoding fails, supporting comprehensive error management. +/// +/// ## Trait Details +/// +/// ### [`Encodable`] +/// - **`to_bytes`**: Encodes the instance into a byte slice, returning the number of bytes written +/// or an error if encoding fails. +/// - **`to_writer`** (requires `std`): Encodes the instance into any [`Write`] implementor, such as +/// a file or network stream. +/// +/// ### Additional Enums and Methods +/// +/// Includes utility types and methods for calculating sizes, encoding hierarchical data, +/// and supporting both owned and reference-based data variants. +/// +/// - **[`EncodablePrimitive`]**: Handles encoding logic for primitive types, addressing +/// serialization requirements specific to each type. +/// - **[`EncodableField`]**: Extends encoding to support composite types and structured data, +/// enabling recursive encoding of nested structures. +/// +/// ## Summary +/// +/// Designed for flexibility and extensibility, this module supports a wide range of data +/// serialization needs through customizable encoding strategies. Implementing the +/// [`Encodable`] trait for custom types ensures efficient and consistent data serialization +/// across applications. +pub mod encodable { + pub use crate::codec::encodable::{Encodable, EncodableField, EncodablePrimitive}; +} - mod test_se1o64k_u16 { - use super::*; +#[macro_use] +extern crate alloc; - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, u16>, - } +/// Error types used within the protocol library to indicate various failure conditions. +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum Error { + /// Indicates an attempt to read beyond a valid range. + OutOfBound, - #[test] - fn test_seq064k_u16() { - let s: Seq064K = Seq064K::new(vec![10, 43, 89]).unwrap(); + /// Raised when a non-binary value is interpreted as a boolean. + NotABool(u8), - let expected = Test { a: s }; + /// Occurs when an unexpected size mismatch arises during a write operation, specifying + /// expected and actual sizes. + WriteError(usize, usize), - let mut bytes = to_bytes(expected.clone()).unwrap(); + /// Signifies an overflow condition where a `u32` exceeds the maximum allowable `u24` value. + U24TooBig(u32), - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + /// Reports a size mismatch for a signature, such as when it does not match the expected size. + InvalidSignatureSize(usize), - assert_eq!(deserialized, expected); - } - } + /// Raised when a `u256` value is invalid, typically due to size discrepancies. + InvalidU256(usize), - mod test_seq064k_u24 { - use super::*; - use core::convert::TryInto; + /// Indicates an invalid `u24` representation. + InvalidU24(u32), - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, U24>, - } + /// Error indicating that a byte array exceeds the maximum allowed size for `B0255`. + InvalidB0255Size(usize), - #[test] - fn test_seq064k_u24() { - let u24_1: U24 = 56_u32.try_into().unwrap(); - let u24_2: U24 = 59_u32.try_into().unwrap(); - let u24_3: U24 = 70999_u32.try_into().unwrap(); + /// Error indicating that a byte array exceeds the maximum allowed size for `B064K`. + InvalidB064KSize(usize), - let val = vec![u24_1, u24_2, u24_3]; - let s: Seq064K = Seq064K::new(val).unwrap(); + /// Error indicating that a byte array exceeds the maximum allowed size for `B016M`. + InvalidB016MSize(usize), - let expected = Test { a: s }; + /// Raised when a sequence size exceeds `0255`. + InvalidSeq0255Size(usize), - let mut bytes = to_bytes(expected.clone()).unwrap(); + /// Error when trying to encode a non-primitive data type. + NonPrimitiveTypeCannotBeEncoded, - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + /// Generic conversion error related to primitive types. + PrimitiveConversionError, - assert_eq!(deserialized, expected); - } - } + /// Error occurring during decoding due to conversion issues. + DecodableConversionError, - mod test_seq064k_u32 { - use super::*; + /// Error triggered when a decoder is used without initialization. + UnInitializedDecoder, - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, u32>, - } + #[cfg(not(feature = "no_std"))] + /// Represents I/O-related errors, compatible with `no_std` mode where specific error types may + /// vary. + IoError(E), - #[test] - fn test_seq064k_u32() { - let s: Seq064K = Seq064K::new(vec![546, 99999, 87, 32]).unwrap(); + #[cfg(feature = "no_std")] + /// Represents I/O-related errors, compatible with `no_std` mode. + IoError, - let expected = Test { a: s }; + /// Raised when an unexpected mismatch occurs during read operations, specifying expected and + /// actual read sizes. + ReadError(usize, usize), - let mut bytes = to_bytes(expected.clone()).unwrap(); + /// Used as a marker error for fields that should remain void or empty. + VoidFieldMarker, - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + /// Signifies a value overflow based on protocol restrictions, containing details about + /// fixed/variable size, maximum size allowed, and the offending value details. + ValueExceedsMaxSize(bool, usize, usize, usize, Vec, usize), - assert_eq!(deserialized, expected); - } - } - mod test_seq064k_signature { - use super::*; - use core::convert::TryInto; + /// Triggered when a sequence type (`Seq0255`, `Seq064K`) exceeds its maximum allowable size. + SeqExceedsMaxSize, - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, Signature<'decoder>>, - } - - #[test] - fn test_seq064k_signature() { - let mut siganture_1 = [88_u8; 64]; - let mut siganture_2 = [99_u8; 64]; - let mut siganture_3 = [220_u8; 64]; - let siganture_1: Signature = (&mut siganture_1[..]).try_into().unwrap(); - let siganture_2: Signature = (&mut siganture_2[..]).try_into().unwrap(); - let siganture_3: Signature = (&mut siganture_3[..]).try_into().unwrap(); + /// Raised when no valid decodable field is provided during decoding. + NoDecodableFieldPassed, - let val = vec![siganture_1, siganture_2, siganture_3]; - let s: Seq064K = Seq064K::new(val).unwrap(); + /// Error for protocol-specific invalid values. + ValueIsNotAValidProtocol(u8), - let expected = Test { a: s }; + /// Raised when an unsupported or unknown message type is encountered. + UnknownMessageType(u8), - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + /// Indicates a protocol constraint violation where `Sv2Option` unexpectedly contains multiple + /// elements. + Sv2OptionHaveMoreThenOneElement(u8), +} - assert_eq!(deserialized, expected); +#[cfg(not(feature = "no_std"))] +impl From for Error { + fn from(v: E) -> Self { + match v.kind() { + ErrorKind::UnexpectedEof => Error::OutOfBound, + _ => Error::IoError(v), } } - mod test_seq064k_b016m { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Seq064K<'decoder, B016M<'decoder>>, - } - - #[test] - fn test_seq064k_b016m() { - let mut bytes_1 = [88_u8; 64]; - let mut bytes_2 = [99_u8; 64]; - let mut bytes_3 = [220_u8; 64]; - let bytes_1: B016M = (&mut bytes_1[..]).try_into().unwrap(); - let bytes_2: B016M = (&mut bytes_2[..]).try_into().unwrap(); - let bytes_3: B016M = (&mut bytes_3[..]).try_into().unwrap(); - - let val = vec![bytes_1, bytes_2, bytes_3]; - let s: Seq064K = Seq064K::new(val).unwrap(); - - let expected = Test { a: s }; - - let mut bytes = to_bytes(expected.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); +} - assert_eq!(deserialized, expected); - } +/// Vec is used as the Sv2 type Bytes +impl GetSize for Vec { + fn get_size(&self) -> usize { + self.len() } - mod test_seq_0255_in_struct { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: u8, - b: Seq0255<'decoder, u8>, - c: u32, - } +} - #[test] - fn test_seq_0255_in_struct() { - let expected = Test { - a: 89, - b: Seq0255::new(vec![]).unwrap(), - c: 32, - }; - let len = expected.get_size(); - let mut buffer = vec![0; len]; - to_writer(expected.clone(), &mut buffer).unwrap(); - let deserialized: Test = from_bytes(&mut buffer[..]).unwrap(); - assert_eq!(deserialized, expected); - } +// Only needed for implement encodable for Frame never called +impl From> for EncodableField<'_> { + fn from(_v: Vec) -> Self { + unreachable!() } - mod test_sv2_option_u256 { - use super::*; - use core::convert::TryInto; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Sv2Option<'decoder, U256<'decoder>>, - } - - #[test] - fn test_sv2_option_u256() { - let mut u256_1 = [6; 32]; - let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); - - let val = Some(u256_1); - let s = Sv2Option::new(val); - - let test = Test { a: s }; - - let mut bytes = to_bytes(test.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - let bytes_2 = to_bytes(deserialized.clone()).unwrap(); +} - assert_eq!(bytes, bytes_2); - } +#[cfg(feature = "with_buffer_pool")] +impl From for EncodableField<'_> { + fn from(_v: buffer_sv2::Slice) -> Self { + unreachable!() } - mod test_sv2_option_none { - use super::*; - - #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] - struct Test<'decoder> { - a: Sv2Option<'decoder, U256<'decoder>>, - } - - #[test] - fn test_sv2_option_none() { - let val = None; - let s = Sv2Option::new(val); - - let test = Test { a: s }; - - let mut bytes = to_bytes(test.clone()).unwrap(); - - let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); - - let bytes_2 = to_bytes(deserialized.clone()).unwrap(); +} - assert_eq!(bytes, bytes_2); - } +/// Converts a value implementing the `Into` trait into a custom `U256` type. +pub fn u256_from_int>(value: V) -> U256<'static> { + // initialize u256 as a bytes vec of len 24 + let mut u256 = vec![0_u8; 24]; + let val: u64 = value.into(); + for v in &(val.to_le_bytes()) { + // add 8 bytes to u256 + u256.push(*v) } + // Always safe cause u256 is 24 + 8 (32) bytes + let u256: U256 = u256.try_into().unwrap(); + u256 } diff --git a/protocols/v2/binary-sv2/tests/test.rs b/protocols/v2/binary-sv2/tests/test.rs new file mode 100644 index 0000000000..afdc1a9391 --- /dev/null +++ b/protocols/v2/binary-sv2/tests/test.rs @@ -0,0 +1,635 @@ +use binary_sv2::{self, *}; + +mod test_struct { + use super::*; + use core::convert::TryInto; + + #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] + struct Test { + a: u32, + b: u8, + c: U24, + } + + #[test] + fn test_struct() { + let expected = Test { + a: 456, + b: 9, + c: 67_u32.try_into().unwrap(), + }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_f32 { + use super::*; + use core::convert::TryInto; + + #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] + struct Test { + a: u8, + b: U24, + c: f32, + } + + #[test] + fn test_struct() { + let expected = Test { + c: 0.345, + a: 9, + b: 67_u32.try_into().unwrap(), + }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_b0255 { + use super::*; + use core::convert::TryInto; + + #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] + struct Test<'decoder> { + a: B0255<'decoder>, + } + + #[test] + fn test_b0255() { + let mut b0255 = [6; 3]; + let b0255: B0255 = (&mut b0255[..]).try_into().unwrap(); + + let expected = Test { a: b0255 }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } + + #[test] + fn test_b0255_max() { + let mut b0255 = [6; 255]; + let b0255: B0255 = (&mut b0255[..]).try_into().unwrap(); + + let expected = Test { a: b0255 }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_u256 { + use super::*; + use core::convert::TryInto; + + #[derive(Clone, Deserialize, Serialize, PartialEq, Debug)] + struct Test<'decoder> { + a: U256<'decoder>, + } + + #[test] + fn test_u256() { + let mut u256 = [6_u8; 32]; + let u256: U256 = (&mut u256[..]).try_into().unwrap(); + + let expected = Test { a: u256 }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_signature { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Signature<'decoder>, + } + + #[test] + fn test_signature() { + let mut s = [6; 64]; + let s: Signature = (&mut s[..]).try_into().unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_b016m { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + b: bool, + a: B016M<'decoder>, + } + + #[test] + fn test_b016m() { + let mut b = [0_u8; 70000]; + let b: B016M = (&mut b[..]).try_into().unwrap(); + //println!("{:?}", to_bytes(&b).unwrap().len()); + + let expected = Test { a: b, b: true }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } + + #[test] + fn test_b016m_max() { + let mut b = vec![0_u8; 16777215]; + let b: B016M = (&mut b[..]).try_into().unwrap(); + //println!("{:?}", to_bytes(&b).unwrap().len()); + + let expected = Test { a: b, b: true }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_b064k { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + b: bool, + a: B064K<'decoder>, + } + + #[test] + fn test_b064k() { + let mut b = [1, 2, 9]; + let b: B064K = (&mut b[..]) + .try_into() + .expect("vector smaller than 64K should not fail"); + + let expected = Test { a: b, b: true }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq0255_u256 { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, U256<'decoder>>, + } + + #[test] + fn test_seq0255_u256() { + let mut u256_1 = [6; 32]; + let mut u256_2 = [5; 32]; + let mut u256_3 = [0; 32]; + let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); + let u256_2: U256 = (&mut u256_2[..]).try_into().unwrap(); + let u256_3: U256 = (&mut u256_3[..]).try_into().unwrap(); + + let val = vec![u256_1, u256_2, u256_3]; + let s = Seq0255::new(val).unwrap(); + + let test = Test { a: s }; + + let mut bytes = to_bytes(test.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + let bytes_2 = to_bytes(deserialized.clone()).unwrap(); + + assert_eq!(bytes, bytes_2); + } +} + +mod test_0255_bool { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, bool>, + } + + #[test] + fn test_seq0255_bool() { + let s: Seq0255 = Seq0255::new(vec![true, false, true]).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq0255_u16 { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, u16>, + } + + #[test] + fn test_seq0255_u16() { + let s: Seq0255 = Seq0255::new(vec![10, 43, 89]).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq_0255_u24 { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, U24>, + } + + #[test] + fn test_seq0255_u24() { + let u24_1: U24 = 56_u32.try_into().unwrap(); + let u24_2: U24 = 59_u32.try_into().unwrap(); + let u24_3: U24 = 70999_u32.try_into().unwrap(); + + let val = vec![u24_1, u24_2, u24_3]; + let s: Seq0255 = Seq0255::new(val).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seqo255_u32 { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, u32>, + } + + #[test] + fn test_seq0255_u32() { + let s: Seq0255 = Seq0255::new(vec![546, 99999, 87, 32]).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq0255_signature { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq0255<'decoder, Signature<'decoder>>, + } + + #[test] + fn test_seq0255_signature() { + let mut siganture_1 = [88_u8; 64]; + let mut siganture_2 = [99_u8; 64]; + let mut siganture_3 = [220_u8; 64]; + let siganture_1: Signature = (&mut siganture_1[..]).try_into().unwrap(); + let siganture_2: Signature = (&mut siganture_2[..]).try_into().unwrap(); + let siganture_3: Signature = (&mut siganture_3[..]).try_into().unwrap(); + + let val = vec![siganture_1, siganture_2, siganture_3]; + let s: Seq0255 = Seq0255::new(val).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq_064_u256 { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, U256<'decoder>>, + } + + #[test] + fn test_seq064k_u256() { + let mut u256_1 = [6; 32]; + let mut u256_2 = [5; 32]; + let mut u256_3 = [0; 32]; + let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); + let u256_2: U256 = (&mut u256_2[..]).try_into().unwrap(); + let u256_3: U256 = (&mut u256_3[..]).try_into().unwrap(); + + let val = vec![u256_1, u256_2, u256_3]; + let s = Seq064K::new(val).unwrap(); + + let test = Test { a: s }; + + let mut bytes = to_bytes(test.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + let bytes_2 = to_bytes(deserialized.clone()).unwrap(); + + assert_eq!(bytes, bytes_2); + } +} + +mod test_064_bool { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, bool>, + } + + #[test] + fn test_seq064k_bool() { + let s: Seq064K = Seq064K::new(vec![true, false, true]).unwrap(); + let s2: Seq064K = Seq064K::new(vec![true; 64000]).unwrap(); + + let expected = Test { a: s }; + let expected2 = Test { a: s2 }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + let mut bytes2 = to_bytes(expected2.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + let deserialized2: Test = from_bytes(&mut bytes2[..]).unwrap(); + + assert_eq!(deserialized, expected); + assert_eq!(deserialized2, expected2); + } +} + +mod test_se1o64k_u16 { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, u16>, + } + + #[test] + fn test_seq064k_u16() { + let s: Seq064K = Seq064K::new(vec![10, 43, 89]).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq064k_u24 { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, U24>, + } + + #[test] + fn test_seq064k_u24() { + let u24_1: U24 = 56_u32.try_into().unwrap(); + let u24_2: U24 = 59_u32.try_into().unwrap(); + let u24_3: U24 = 70999_u32.try_into().unwrap(); + + let val = vec![u24_1, u24_2, u24_3]; + let s: Seq064K = Seq064K::new(val).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} + +mod test_seq064k_u32 { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, u32>, + } + + #[test] + fn test_seq064k_u32() { + let s: Seq064K = Seq064K::new(vec![546, 99999, 87, 32]).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} +mod test_seq064k_signature { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, Signature<'decoder>>, + } + + #[test] + fn test_seq064k_signature() { + let mut siganture_1 = [88_u8; 64]; + let mut siganture_2 = [99_u8; 64]; + let mut siganture_3 = [220_u8; 64]; + let siganture_1: Signature = (&mut siganture_1[..]).try_into().unwrap(); + let siganture_2: Signature = (&mut siganture_2[..]).try_into().unwrap(); + let siganture_3: Signature = (&mut siganture_3[..]).try_into().unwrap(); + + let val = vec![siganture_1, siganture_2, siganture_3]; + let s: Seq064K = Seq064K::new(val).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} +mod test_seq064k_b016m { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Seq064K<'decoder, B016M<'decoder>>, + } + + #[test] + fn test_seq064k_b016m() { + let mut bytes_1 = [88_u8; 64]; + let mut bytes_2 = [99_u8; 64]; + let mut bytes_3 = [220_u8; 64]; + let bytes_1: B016M = (&mut bytes_1[..]).try_into().unwrap(); + let bytes_2: B016M = (&mut bytes_2[..]).try_into().unwrap(); + let bytes_3: B016M = (&mut bytes_3[..]).try_into().unwrap(); + + let val = vec![bytes_1, bytes_2, bytes_3]; + let s: Seq064K = Seq064K::new(val).unwrap(); + + let expected = Test { a: s }; + + let mut bytes = to_bytes(expected.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + assert_eq!(deserialized, expected); + } +} +mod test_seq_0255_in_struct { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: u8, + b: Seq0255<'decoder, u8>, + c: u32, + } + + #[test] + fn test_seq_0255_in_struct() { + let expected = Test { + a: 89, + b: Seq0255::new(vec![]).unwrap(), + c: 32, + }; + let len = expected.get_size(); + let mut buffer = vec![0; len]; + to_writer(expected.clone(), &mut buffer).unwrap(); + let deserialized: Test = from_bytes(&mut buffer[..]).unwrap(); + assert_eq!(deserialized, expected); + } +} +mod test_sv2_option_u256 { + use super::*; + use core::convert::TryInto; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Sv2Option<'decoder, U256<'decoder>>, + } + + #[test] + fn test_sv2_option_u256() { + let mut u256_1 = [6; 32]; + let u256_1: U256 = (&mut u256_1[..]).try_into().unwrap(); + + let val = Some(u256_1); + let s = Sv2Option::new(val); + + let test = Test { a: s }; + + let mut bytes = to_bytes(test.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + let bytes_2 = to_bytes(deserialized.clone()).unwrap(); + + assert_eq!(bytes, bytes_2); + } +} +mod test_sv2_option_none { + use super::*; + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct Test<'decoder> { + a: Sv2Option<'decoder, U256<'decoder>>, + } + + #[test] + fn test_sv2_option_none() { + let val = None; + let s = Sv2Option::new(val); + + let test = Test { a: s }; + + let mut bytes = to_bytes(test.clone()).unwrap(); + + let deserialized: Test = from_bytes(&mut bytes[..]).unwrap(); + + let bytes_2 = to_bytes(deserialized.clone()).unwrap(); + + assert_eq!(bytes, bytes_2); + } +} diff --git a/roles/Cargo.lock b/roles/Cargo.lock index 0c1e7e5022..52be242171 100644 --- a/roles/Cargo.lock +++ b/roles/Cargo.lock @@ -441,13 +441,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ad24342e0abdcc463ad6ad4ac7b0ec606122c11eddf92de186a657df0114eb7" -[[package]] -name = "binary_codec_sv2" -version = "3.0.0" -dependencies = [ - "buffer_sv2 2.0.0", -] - [[package]] name = "binary_codec_sv2" version = "3.0.0" @@ -461,7 +454,7 @@ dependencies = [ name = "binary_sv2" version = "4.0.0" dependencies = [ - "binary_codec_sv2 3.0.0", + "buffer_sv2 2.0.0", "derive_codec_sv2 1.1.1", ] @@ -471,7 +464,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba8295945d51b707f3a49e17810dddef858549e2b52383c7f2c4dd036f6bc1e6" dependencies = [ - "binary_codec_sv2 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_codec_sv2 3.0.0", "derive_codec_sv2 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1055,9 +1048,6 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.1" -dependencies = [ - "binary_codec_sv2 3.0.0", -] [[package]] name = "derive_codec_sv2" From dbe92e6740042922e9f3a87b91e20af70d384c70 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 13:24:57 +0530 Subject: [PATCH 2/7] update all workflows file --- .github/workflows/coverage-protocols.yaml | 8 -------- .github/workflows/docs.yaml | 5 ----- .github/workflows/release-libs.yaml | 5 ----- .github/workflows/semver-check.yaml | 4 ---- scripts/coverage-protocols.sh | 1 - scripts/sv2-publish.sh | 1 - 6 files changed, 24 deletions(-) diff --git a/.github/workflows/coverage-protocols.yaml b/.github/workflows/coverage-protocols.yaml index 64adec08e6..4b0239e12d 100644 --- a/.github/workflows/coverage-protocols.yaml +++ b/.github/workflows/coverage-protocols.yaml @@ -28,14 +28,6 @@ jobs: file: ./protocols/target/tarpaulin-reports/cobertura.xml flags: protocols token: ${{ secrets.CODECOV_TOKEN }} - - - name: Upload binary_codec_sv2-coverage to codecov.io - uses: codecov/codecov-action@v4 - with: - directory: ./protocols/target/tarpaulin-reports/codec-coverage - file: ./protocols/target/tarpaulin-reports/codec-coverage/cobertura.xml - flags: binary_codec_sv2-coverage - token: ${{ secrets.CODECOV_TOKEN }} - name: Upload binary_sv2-coverage to codecov.io uses: codecov/codecov-action@v4 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 289d8ebadb..347b4a8293 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -39,11 +39,6 @@ jobs: cd protocols/v2/binary-sv2/derive_codec cargo doc - - name: Rust Docs crate binary_sv2 codec - run: | - cd protocols/v2/binary-sv2/codec - cargo doc --features with_buffer_pool - - name: Rust Docs crate binary_sv2 run: | cd protocols/v2/binary-sv2 diff --git a/.github/workflows/release-libs.yaml b/.github/workflows/release-libs.yaml index 236f38b278..7fbc12fa1a 100644 --- a/.github/workflows/release-libs.yaml +++ b/.github/workflows/release-libs.yaml @@ -38,11 +38,6 @@ jobs: run: | ./scripts/release-libs.sh protocols/v2/noise-sv2 - # binary_sv2 (depends on buffer_sv2) - - name: Publish crate binary_sv2 codec - run: | - ./scripts/release-libs.sh protocols/v2/binary-sv2/codec - - name: Publish crate binary_sv2 derive_codec run: | ./scripts/release-libs.sh protocols/v2/binary-sv2/derive_codec diff --git a/.github/workflows/semver-check.yaml b/.github/workflows/semver-check.yaml index a4348db654..d7865da3d5 100644 --- a/.github/workflows/semver-check.yaml +++ b/.github/workflows/semver-check.yaml @@ -45,10 +45,6 @@ jobs: working-directory: utils/buffer run: cargo semver-checks - - name: Run semver checks for protocols/v2/binary-sv2/codec - working-directory: protocols/v2/binary-sv2/codec - run: cargo semver-checks - - name: Run semver checks for protocols/v2/binary-sv2 working-directory: protocols/v2/binary-sv2 run: cargo semver-checks diff --git a/scripts/coverage-protocols.sh b/scripts/coverage-protocols.sh index 89689ba799..79c601a622 100755 --- a/scripts/coverage-protocols.sh +++ b/scripts/coverage-protocols.sh @@ -11,7 +11,6 @@ tarpaulin crates=( "v1" - "v2/binary-sv2/codec" "v2/binary-sv2/derive_codec" "v2/binary-sv2" "v2/channels-sv2" diff --git a/scripts/sv2-publish.sh b/scripts/sv2-publish.sh index 1f5a58a246..91e64398cb 100755 --- a/scripts/sv2-publish.sh +++ b/scripts/sv2-publish.sh @@ -12,7 +12,6 @@ output=$(cargo smart-release \ sv1_api \ binary_sv2 \ - binary_codec_sv2 \ derive_codec_sv2 \ codec_sv2 \ framing_sv2 \ From c88a77f772b8bf3576c05d407300ca761dcf5a14 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 13:25:33 +0530 Subject: [PATCH 3/7] control the ripple effect --- examples/ping-pong-encrypted/src/messages.rs | 2 +- examples/ping-pong/src/messages.rs | 2 +- protocols/Cargo.toml | 1 - protocols/fuzz-tests/Cargo.toml | 4 +++- protocols/fuzz-tests/src/main.rs | 4 ++-- protocols/tarpaulin.toml | 2 +- protocols/v2/codec-sv2/examples/encrypted.rs | 2 +- protocols/v2/codec-sv2/examples/unencrypted.rs | 2 +- protocols/v2/codec-sv2/src/decoder.rs | 2 +- protocols/v2/framing-sv2/examples/sv2_frame.rs | 2 +- protocols/v2/framing-sv2/src/framing.rs | 5 +---- protocols/v2/framing-sv2/src/header.rs | 2 +- .../common-messages/src/channel_endpoint_changed.rs | 2 +- protocols/v2/subprotocols/common-messages/src/reconnect.rs | 2 +- .../v2/subprotocols/common-messages/src/setup_connection.rs | 2 +- .../job-declaration/src/allocate_mining_job_token.rs | 2 +- .../subprotocols/job-declaration/src/declare_mining_job.rs | 2 +- .../job-declaration/src/provide_missing_transactions.rs | 2 +- .../v2/subprotocols/job-declaration/src/push_solution.rs | 2 +- protocols/v2/subprotocols/mining/src/close_channel.rs | 2 +- protocols/v2/subprotocols/mining/src/new_mining_job.rs | 2 +- protocols/v2/subprotocols/mining/src/open_channel.rs | 2 +- .../v2/subprotocols/mining/src/set_custom_mining_job.rs | 2 +- .../v2/subprotocols/mining/src/set_extranonce_prefix.rs | 2 +- protocols/v2/subprotocols/mining/src/set_group_channel.rs | 2 +- protocols/v2/subprotocols/mining/src/set_new_prev_hash.rs | 2 +- protocols/v2/subprotocols/mining/src/set_target.rs | 2 +- protocols/v2/subprotocols/mining/src/submit_shares.rs | 2 +- protocols/v2/subprotocols/mining/src/update_channel.rs | 2 +- .../template-distribution/src/coinbase_output_constraints.rs | 2 +- .../subprotocols/template-distribution/src/new_template.rs | 2 +- .../template-distribution/src/request_transaction_data.rs | 2 +- .../template-distribution/src/set_new_prev_hash.rs | 2 +- .../template-distribution/src/submit_solution.rs | 2 +- 34 files changed, 36 insertions(+), 38 deletions(-) diff --git a/examples/ping-pong-encrypted/src/messages.rs b/examples/ping-pong-encrypted/src/messages.rs index ea5128754c..53dd5c1d3f 100644 --- a/examples/ping-pong-encrypted/src/messages.rs +++ b/examples/ping-pong-encrypted/src/messages.rs @@ -1,6 +1,6 @@ use crate::error::Error; use stratum_apps::stratum_core::binary_sv2::{ - self as binary_sv2, binary_codec_sv2, + self as binary_sv2, decodable::{DecodableField, FieldMarker}, Deserialize, Serialize, }; diff --git a/examples/ping-pong/src/messages.rs b/examples/ping-pong/src/messages.rs index 4c819ca196..f71c8e3664 100644 --- a/examples/ping-pong/src/messages.rs +++ b/examples/ping-pong/src/messages.rs @@ -1,5 +1,5 @@ use crate::error::Error; -use stratum_apps::stratum_core::binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use stratum_apps::stratum_core::binary_sv2::{self, Deserialize, Serialize}; use rand::Rng; diff --git a/protocols/Cargo.toml b/protocols/Cargo.toml index 9dba924c2f..8095ce1205 100644 --- a/protocols/Cargo.toml +++ b/protocols/Cargo.toml @@ -4,7 +4,6 @@ resolver="2" members = [ "v1", - "v2/binary-sv2/codec", "v2/binary-sv2/derive_codec", "v2/binary-sv2", "v2/noise-sv2", diff --git a/protocols/fuzz-tests/Cargo.toml b/protocols/fuzz-tests/Cargo.toml index 4e39d60d8a..5d28609b50 100644 --- a/protocols/fuzz-tests/Cargo.toml +++ b/protocols/fuzz-tests/Cargo.toml @@ -17,7 +17,9 @@ cargo-fuzz = true libfuzzer-sys = { version = "0.4.0", features = ["arbitrary-derive"] } arbitrary = { version = "1", features = ["derive"] } rand = "0.8.3" -binary_codec_sv2 = { path = "../v2/binary-sv2/codec"} +binary_sv2 = { path = "../v2/binary-sv2"} +parsers_sv2 = { path = "../v2/parsers-sv2" } +framing_sv2 = { path = "../v2/framing-sv2" } codec_sv2 = { path = "../v2/codec-sv2", features = ["noise_sv2"]} affinity = "0.1.1" threadpool = "1.8.1" diff --git a/protocols/fuzz-tests/src/main.rs b/protocols/fuzz-tests/src/main.rs index d434a96ea1..8a3fc19155 100644 --- a/protocols/fuzz-tests/src/main.rs +++ b/protocols/fuzz-tests/src/main.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use binary_codec_sv2::{Seq064K,U256,B0255,Seq0255}; -use binary_codec_sv2::from_bytes; +use binary_sv2::{Seq064K,U256,B0255,Seq0255}; +use binary_sv2::from_bytes; use codec_sv2::StandardDecoder; use framing_sv2::framing::Sv2Frame; use parsers_sv2::AnyMessage; diff --git a/protocols/tarpaulin.toml b/protocols/tarpaulin.toml index 1a7b3b4609..cc8bb2007f 100644 --- a/protocols/tarpaulin.toml +++ b/protocols/tarpaulin.toml @@ -1,5 +1,5 @@ [default] -features = "disable_nopanic prop_test noise_sv2 with_buffer_pool derive_codec_sv2 binary_codec_sv2 default core" +features = "disable_nopanic prop_test noise_sv2 with_buffer_pool derive_codec_sv2 default core" run-types = [ "Lib" ] timeout = "120s" fail-under = 0 diff --git a/protocols/v2/codec-sv2/examples/encrypted.rs b/protocols/v2/codec-sv2/examples/encrypted.rs index 8c79f87242..58780d8527 100644 --- a/protocols/v2/codec-sv2/examples/encrypted.rs +++ b/protocols/v2/codec-sv2/examples/encrypted.rs @@ -16,7 +16,7 @@ // cargo run --example encrypted --features noise_sv2 // ``` -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use binary_sv2::{self, Deserialize, Serialize}; #[cfg(feature = "noise_sv2")] use codec_sv2::{ Error, HandshakeRole, NoiseEncoder, StandardEitherFrame, StandardNoiseDecoder, diff --git a/protocols/v2/codec-sv2/examples/unencrypted.rs b/protocols/v2/codec-sv2/examples/unencrypted.rs index b7b93cfd90..3a520b6323 100644 --- a/protocols/v2/codec-sv2/examples/unencrypted.rs +++ b/protocols/v2/codec-sv2/examples/unencrypted.rs @@ -14,7 +14,7 @@ // cargo run --example unencrypted // ``` -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use binary_sv2::{self, Deserialize, Serialize}; use codec_sv2::{Encoder, Error, StandardDecoder, StandardSv2Frame}; use framing_sv2::framing::Sv2Frame; use std::{ diff --git a/protocols/v2/codec-sv2/src/decoder.rs b/protocols/v2/codec-sv2/src/decoder.rs index 1675c77983..c27b48ffcc 100644 --- a/protocols/v2/codec-sv2/src/decoder.rs +++ b/protocols/v2/codec-sv2/src/decoder.rs @@ -417,7 +417,7 @@ impl Default for WithoutNoise { #[cfg(test)] mod tests { use super::*; - use binary_sv2::{binary_codec_sv2, Serialize}; + use binary_sv2::{self, Serialize}; #[derive(Serialize)] pub struct TestMessage {} diff --git a/protocols/v2/framing-sv2/examples/sv2_frame.rs b/protocols/v2/framing-sv2/examples/sv2_frame.rs index 4d0f84c5f0..5b59f527f3 100644 --- a/protocols/v2/framing-sv2/examples/sv2_frame.rs +++ b/protocols/v2/framing-sv2/examples/sv2_frame.rs @@ -17,7 +17,7 @@ // cargo run --example sv2_frame // ``` -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use binary_sv2::{self, Deserialize, Serialize}; use framing_sv2::framing::Sv2Frame; use std::convert::TryInto; diff --git a/protocols/v2/framing-sv2/src/framing.rs b/protocols/v2/framing-sv2/src/framing.rs index b2a59ed176..5d7758bd6e 100644 --- a/protocols/v2/framing-sv2/src/framing.rs +++ b/protocols/v2/framing-sv2/src/framing.rs @@ -17,7 +17,7 @@ use crate::{header::Header, Error}; use alloc::vec::Vec; -use binary_sv2::{to_writer, GetSize, Serialize}; +use binary_sv2::{self, to_writer, GetSize, Serialize}; use core::convert::TryFrom; #[cfg(not(feature = "with_buffer_pool"))] @@ -297,9 +297,6 @@ fn update_extension_type(extension_type: u16, channel_msg: bool) -> u16 { } } -#[cfg(test)] -use binary_sv2::binary_codec_sv2; - #[cfg(test)] #[derive(Serialize)] struct T {} diff --git a/protocols/v2/framing-sv2/src/header.rs b/protocols/v2/framing-sv2/src/header.rs index 8ee0b370cc..269ba23ba8 100644 --- a/protocols/v2/framing-sv2/src/header.rs +++ b/protocols/v2/framing-sv2/src/header.rs @@ -21,7 +21,7 @@ use crate::Error; use alloc::vec::Vec; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, U24}; +use binary_sv2::{self, Deserialize, Serialize, U24}; use core::convert::TryInto; use crate::{SV2_FRAME_CHUNK_SIZE, SV2_FRAME_HEADER_SIZE}; diff --git a/protocols/v2/subprotocols/common-messages/src/channel_endpoint_changed.rs b/protocols/v2/subprotocols/common-messages/src/channel_endpoint_changed.rs index 965368bd96..2e5c863d1a 100644 --- a/protocols/v2/subprotocols/common-messages/src/channel_endpoint_changed.rs +++ b/protocols/v2/subprotocols/common-messages/src/channel_endpoint_changed.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use binary_sv2::{self, Deserialize, Serialize}; use core::convert::TryInto; /// Message used by an upstream role for announcing a mining channel endpoint change. diff --git a/protocols/v2/subprotocols/common-messages/src/reconnect.rs b/protocols/v2/subprotocols/common-messages/src/reconnect.rs index 9e33a769a3..eff4cf95cf 100644 --- a/protocols/v2/subprotocols/common-messages/src/reconnect.rs +++ b/protocols/v2/subprotocols/common-messages/src/reconnect.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255}; +use binary_sv2::{self, Deserialize, Serialize, Str0255}; use core::convert::TryInto; /// Message used by upstream to redirect downstream connection(s) to a new host. diff --git a/protocols/v2/subprotocols/common-messages/src/setup_connection.rs b/protocols/v2/subprotocols/common-messages/src/setup_connection.rs index eb12189b1d..c3183451d0 100644 --- a/protocols/v2/subprotocols/common-messages/src/setup_connection.rs +++ b/protocols/v2/subprotocols/common-messages/src/setup_connection.rs @@ -4,7 +4,7 @@ use crate::{ }; use alloc::{fmt, vec::Vec}; use binary_sv2::{ - binary_codec_sv2, + self, decodable::{DecodableField, FieldMarker}, Deserialize, GetSize, Serialize, Str0255, }; diff --git a/protocols/v2/subprotocols/job-declaration/src/allocate_mining_job_token.rs b/protocols/v2/subprotocols/job-declaration/src/allocate_mining_job_token.rs index 15baced478..e1a9a3e47e 100644 --- a/protocols/v2/subprotocols/job-declaration/src/allocate_mining_job_token.rs +++ b/protocols/v2/subprotocols/job-declaration/src/allocate_mining_job_token.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255, B0255, B064K}; +use binary_sv2::{self, Deserialize, Serialize, Str0255, B0255, B064K}; use core::convert::TryInto; /// Message used by JDC to request an identifier for a future mining job from JDS. diff --git a/protocols/v2/subprotocols/job-declaration/src/declare_mining_job.rs b/protocols/v2/subprotocols/job-declaration/src/declare_mining_job.rs index da4c16134e..b794995f49 100644 --- a/protocols/v2/subprotocols/job-declaration/src/declare_mining_job.rs +++ b/protocols/v2/subprotocols/job-declaration/src/declare_mining_job.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq064K, Serialize, Str0255, B0255, B064K, U256}; +use binary_sv2::{self, Deserialize, Seq064K, Serialize, Str0255, B0255, B064K, U256}; use core::convert::TryInto; /// Message used by JDC to proposes a selected set of transactions to JDS they wish to diff --git a/protocols/v2/subprotocols/job-declaration/src/provide_missing_transactions.rs b/protocols/v2/subprotocols/job-declaration/src/provide_missing_transactions.rs index 6618745fc6..f707efca88 100644 --- a/protocols/v2/subprotocols/job-declaration/src/provide_missing_transactions.rs +++ b/protocols/v2/subprotocols/job-declaration/src/provide_missing_transactions.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq064K, Serialize, B016M}; +use binary_sv2::{self, Deserialize, Seq064K, Serialize, B016M}; use core::convert::TryInto; /// Message used by the JDS to ask for transactions that it did not recognize from diff --git a/protocols/v2/subprotocols/job-declaration/src/push_solution.rs b/protocols/v2/subprotocols/job-declaration/src/push_solution.rs index 7bdfa5a3cf..25db4d7351 100644 --- a/protocols/v2/subprotocols/job-declaration/src/push_solution.rs +++ b/protocols/v2/subprotocols/job-declaration/src/push_solution.rs @@ -1,5 +1,5 @@ use alloc::vec::Vec; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, B032, U256}; +use binary_sv2::{self, Deserialize, Serialize, B032, U256}; use core::{convert::TryInto, fmt}; /// Message used by JDC to push a solution to JDS as soon as it finds a new valid block. diff --git a/protocols/v2/subprotocols/mining/src/close_channel.rs b/protocols/v2/subprotocols/mining/src/close_channel.rs index a9f32c8280..d9c628d817 100644 --- a/protocols/v2/subprotocols/mining/src/close_channel.rs +++ b/protocols/v2/subprotocols/mining/src/close_channel.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255}; +use binary_sv2::{self, Deserialize, Serialize, Str0255}; use core::convert::TryInto; /// Message used by a downstream to close a mining channel. diff --git a/protocols/v2/subprotocols/mining/src/new_mining_job.rs b/protocols/v2/subprotocols/mining/src/new_mining_job.rs index 666c013726..9167be974e 100644 --- a/protocols/v2/subprotocols/mining/src/new_mining_job.rs +++ b/protocols/v2/subprotocols/mining/src/new_mining_job.rs @@ -1,5 +1,5 @@ use alloc::vec::Vec; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq0255, Serialize, Sv2Option, B064K, U256}; +use binary_sv2::{self, Deserialize, Seq0255, Serialize, Sv2Option, B064K, U256}; use core::{convert::TryInto, fmt}; /// Message used by an upstream to provide an updated mining job to downstream. diff --git a/protocols/v2/subprotocols/mining/src/open_channel.rs b/protocols/v2/subprotocols/mining/src/open_channel.rs index 0af64e43f8..f4a5404362 100644 --- a/protocols/v2/subprotocols/mining/src/open_channel.rs +++ b/protocols/v2/subprotocols/mining/src/open_channel.rs @@ -1,5 +1,5 @@ use alloc::{string::ToString, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255, U32AsRef, B032, U256}; +use binary_sv2::{self, Deserialize, Serialize, Str0255, U32AsRef, B032, U256}; use core::{convert::TryInto, fmt}; /// Message used by a downstream to request opening a Standard Channel. /// diff --git a/protocols/v2/subprotocols/mining/src/set_custom_mining_job.rs b/protocols/v2/subprotocols/mining/src/set_custom_mining_job.rs index f098dc1284..c0cc8ed667 100644 --- a/protocols/v2/subprotocols/mining/src/set_custom_mining_job.rs +++ b/protocols/v2/subprotocols/mining/src/set_custom_mining_job.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq0255, Serialize, Str0255, B0255, B064K, U256}; +use binary_sv2::{self, Deserialize, Seq0255, Serialize, Str0255, B0255, B064K, U256}; use core::convert::TryInto; /// Message used by downstream role to set a custom job to an upstream (Pool). diff --git a/protocols/v2/subprotocols/mining/src/set_extranonce_prefix.rs b/protocols/v2/subprotocols/mining/src/set_extranonce_prefix.rs index e10f617468..0f69243148 100644 --- a/protocols/v2/subprotocols/mining/src/set_extranonce_prefix.rs +++ b/protocols/v2/subprotocols/mining/src/set_extranonce_prefix.rs @@ -1,6 +1,6 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, B032}; +use binary_sv2::{self, Deserialize, Serialize, B032}; use core::convert::TryInto; diff --git a/protocols/v2/subprotocols/mining/src/set_group_channel.rs b/protocols/v2/subprotocols/mining/src/set_group_channel.rs index 2662150cd5..65b5dda14f 100644 --- a/protocols/v2/subprotocols/mining/src/set_group_channel.rs +++ b/protocols/v2/subprotocols/mining/src/set_group_channel.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq064K, Serialize}; +use binary_sv2::{self, Deserialize, Seq064K, Serialize}; use core::convert::TryInto; /// Message used by upstream to associate a set of Standard Channel(s) to a Group Channel. diff --git a/protocols/v2/subprotocols/mining/src/set_new_prev_hash.rs b/protocols/v2/subprotocols/mining/src/set_new_prev_hash.rs index 200ea4c9fb..ca2f2e1561 100644 --- a/protocols/v2/subprotocols/mining/src/set_new_prev_hash.rs +++ b/protocols/v2/subprotocols/mining/src/set_new_prev_hash.rs @@ -1,5 +1,5 @@ use alloc::vec::Vec; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, U256}; +use binary_sv2::{self, Deserialize, Serialize, U256}; use core::{convert::TryInto, fmt}; /// Message used by upstream to share or distribute the latest block hash. diff --git a/protocols/v2/subprotocols/mining/src/set_target.rs b/protocols/v2/subprotocols/mining/src/set_target.rs index 62e5b07ed7..b28f185a82 100644 --- a/protocols/v2/subprotocols/mining/src/set_target.rs +++ b/protocols/v2/subprotocols/mining/src/set_target.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, U256}; +use binary_sv2::{self, Deserialize, Serialize, U256}; use core::convert::TryInto; /// Message used by upstream to control the downstream submission rate by adjusting the difficulty diff --git a/protocols/v2/subprotocols/mining/src/submit_shares.rs b/protocols/v2/subprotocols/mining/src/submit_shares.rs index d5bd4f1f02..e11eb02a17 100644 --- a/protocols/v2/subprotocols/mining/src/submit_shares.rs +++ b/protocols/v2/subprotocols/mining/src/submit_shares.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255, B032}; +use binary_sv2::{self, Deserialize, Serialize, Str0255, B032}; use core::convert::TryInto; /// Message used by downstream to send result of its hashing work to an upstream. diff --git a/protocols/v2/subprotocols/mining/src/update_channel.rs b/protocols/v2/subprotocols/mining/src/update_channel.rs index 6ba0d1d237..294a5c39f1 100644 --- a/protocols/v2/subprotocols/mining/src/update_channel.rs +++ b/protocols/v2/subprotocols/mining/src/update_channel.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, Str0255, U256}; +use binary_sv2::{self, Deserialize, Serialize, Str0255, U256}; use core::convert::TryInto; /// Message used by downstream to notify an upstream about changes on a specified channel. diff --git a/protocols/v2/subprotocols/template-distribution/src/coinbase_output_constraints.rs b/protocols/v2/subprotocols/template-distribution/src/coinbase_output_constraints.rs index 39de20d7ce..2c81d90ded 100644 --- a/protocols/v2/subprotocols/template-distribution/src/coinbase_output_constraints.rs +++ b/protocols/v2/subprotocols/template-distribution/src/coinbase_output_constraints.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize}; +use binary_sv2::{self, Deserialize, Serialize}; use core::convert::TryInto; /// Message used by a downstream to indicate the size of the additional bytes they will need in diff --git a/protocols/v2/subprotocols/template-distribution/src/new_template.rs b/protocols/v2/subprotocols/template-distribution/src/new_template.rs index b016ded7cd..2206d885a1 100644 --- a/protocols/v2/subprotocols/template-distribution/src/new_template.rs +++ b/protocols/v2/subprotocols/template-distribution/src/new_template.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq0255, Serialize, B0255, B064K, U256}; +use binary_sv2::{self, Deserialize, Seq0255, Serialize, B0255, B064K, U256}; use core::convert::TryInto; /// Message used by an upstream(Template Provider) to provide a new template for downstream to mine diff --git a/protocols/v2/subprotocols/template-distribution/src/request_transaction_data.rs b/protocols/v2/subprotocols/template-distribution/src/request_transaction_data.rs index e775800e68..e5f394743c 100644 --- a/protocols/v2/subprotocols/template-distribution/src/request_transaction_data.rs +++ b/protocols/v2/subprotocols/template-distribution/src/request_transaction_data.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Seq064K, Serialize, Str0255, B016M, B064K}; +use binary_sv2::{self, Deserialize, Seq064K, Serialize, Str0255, B016M, B064K}; use core::convert::TryInto; /// Message used by a downstream to request data about all transactions in a block template. diff --git a/protocols/v2/subprotocols/template-distribution/src/set_new_prev_hash.rs b/protocols/v2/subprotocols/template-distribution/src/set_new_prev_hash.rs index 48fc811096..f8305b2529 100644 --- a/protocols/v2/subprotocols/template-distribution/src/set_new_prev_hash.rs +++ b/protocols/v2/subprotocols/template-distribution/src/set_new_prev_hash.rs @@ -1,5 +1,5 @@ use alloc::vec::Vec; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, U256}; +use binary_sv2::{self, Deserialize, Serialize, U256}; use core::{convert::TryInto, fmt}; /// Message used by an upstream(Template Provider) to indicate the latest block header hash diff --git a/protocols/v2/subprotocols/template-distribution/src/submit_solution.rs b/protocols/v2/subprotocols/template-distribution/src/submit_solution.rs index 255807708d..95e640286c 100644 --- a/protocols/v2/subprotocols/template-distribution/src/submit_solution.rs +++ b/protocols/v2/subprotocols/template-distribution/src/submit_solution.rs @@ -1,5 +1,5 @@ use alloc::{fmt, vec::Vec}; -use binary_sv2::{binary_codec_sv2, Deserialize, Serialize, B064K}; +use binary_sv2::{self, Deserialize, Serialize, B064K}; use core::convert::TryInto; /// Message used by a downstream to submit a successful solution to a previously provided template. From 9ff3885776dcaab74b3241cc683eed547dac7794 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 13:26:07 +0530 Subject: [PATCH 4/7] update the lock files --- protocols/fuzz-tests/Cargo.lock | 1150 +++++++++++++++++++++++++++++ test/integration-tests/Cargo.lock | 48 +- 2 files changed, 1152 insertions(+), 46 deletions(-) create mode 100644 protocols/fuzz-tests/Cargo.lock diff --git a/protocols/fuzz-tests/Cargo.lock b/protocols/fuzz-tests/Cargo.lock new file mode 100644 index 0000000000..7c93c90277 --- /dev/null +++ b/protocols/fuzz-tests/Cargo.lock @@ -0,0 +1,1150 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "affinity" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763e484feceb7dd021b21c5c6f81aee06b1594a743455ec7efbf72e6355e447b" +dependencies = [ + "cfg-if", + "errno", + "libc", + "num_cpus", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals 0.3.0", + "bitcoin_hashes 0.14.0", +] + +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + +[[package]] +name = "binary_sv2" +version = "4.0.0" +dependencies = [ + "buffer_sv2", + "derive_codec_sv2", +] + +[[package]] +name = "bitcoin" +version = "0.32.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda569d741b895131a88ee5589a467e73e9c4718e958ac9308e4f7dc44b6945" +dependencies = [ + "base58ck", + "bech32", + "bitcoin-internals 0.3.0", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes 0.14.0", + "hex-conservative 0.2.1", + "hex_lit", + "secp256k1 0.29.1", +] + +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin-internals" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" + +[[package]] +name = "bitcoin-io" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" + +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals 0.3.0", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals 0.2.0", + "hex-conservative 0.1.2", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative 0.2.1", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "buffer_sv2" +version = "2.0.0" +dependencies = [ + "aes-gcm", + "generic-array", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "channels_sv2" +version = "2.0.0" +dependencies = [ + "binary_sv2", + "bitcoin", + "common_messages_sv2", + "job_declaration_sv2", + "mining_sv2", + "primitive-types", + "template_distribution_sv2", + "tracing", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "codec_sv2" +version = "4.0.0" +dependencies = [ + "binary_sv2", + "buffer_sv2", + "framing_sv2", + "noise_sv2", + "rand", + "tracing", +] + +[[package]] +name = "common_messages_sv2" +version = "6.0.1" +dependencies = [ + "binary_sv2", +] + +[[package]] +name = "const_format" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "rand_core", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_codec_sv2" +version = "1.1.1" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "framing_sv2" +version = "5.0.1" +dependencies = [ + "binary_sv2", + "buffer_sv2", + "noise_sv2", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "fuzz-tests" +version = "1.0.1" +dependencies = [ + "affinity", + "arbitrary", + "binary_sv2", + "codec_sv2", + "framing_sv2", + "lazy_static", + "libfuzzer-sys", + "parsers_sv2", + "rand", + "roles_logic_sv2", + "threadpool", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "handlers_sv2" +version = "0.2.0" +dependencies = [ + "binary_sv2", + "common_messages_sv2", + "job_declaration_sv2", + "mining_sv2", + "parsers_sv2", + "template_distribution_sv2", + "trait-variant", +] + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex-conservative" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afe881d0527571892c4034822e59bb10c6c991cce6abe8199b6f5cf10766f55" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + +[[package]] +name = "impl-codec" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d40b9d5e17727407e55028eafc22b2dc68781786e6d7eb8a21103f5058e3a14" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "job_declaration_sv2" +version = "5.0.1" +dependencies = [ + "binary_sv2", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mining_sv2" +version = "5.0.1" +dependencies = [ + "binary_sv2", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "noise_sv2" +version = "1.4.0" +dependencies = [ + "aes-gcm", + "chacha20poly1305", + "generic-array", + "rand", + "rand_chacha", + "secp256k1 0.28.2", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "parity-scale-codec" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "const_format", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "rustversion", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parsers_sv2" +version = "0.1.1" +dependencies = [ + "binary_sv2", + "common_messages_sv2", + "framing_sv2", + "job_declaration_sv2", + "mining_sv2", + "template_distribution_sv2", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primitive-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "roles_logic_sv2" +version = "5.0.0" +dependencies = [ + "binary_sv2", + "bitcoin", + "chacha20poly1305", + "channels_sv2", + "codec_sv2", + "common_messages_sv2", + "handlers_sv2", + "hex-conservative 0.3.0", + "job_declaration_sv2", + "mining_sv2", + "nohash-hasher", + "parsers_sv2", + "primitive-types", + "template_distribution_sv2", + "tracing", +] + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "bitcoin_hashes 0.13.0", + "rand", + "secp256k1-sys 0.9.2", +] + +[[package]] +name = "secp256k1" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +dependencies = [ + "bitcoin_hashes 0.14.0", + "secp256k1-sys 0.10.1", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +dependencies = [ + "cc", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "template_distribution_sv2" +version = "4.0.1" +dependencies = [ + "binary_sv2", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "toml_datetime" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.23.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "trait-variant" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "uint" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/test/integration-tests/Cargo.lock b/test/integration-tests/Cargo.lock index 6e76d34700..802e9db75c 100644 --- a/test/integration-tests/Cargo.lock +++ b/test/integration-tests/Cargo.lock @@ -246,44 +246,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" -[[package]] -name = "binary_codec_sv2" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad24342e0abdcc463ad6ad4ac7b0ec606122c11eddf92de186a657df0114eb7" - -[[package]] -name = "binary_codec_sv2" -version = "3.0.0" -dependencies = [ - "buffer_sv2 2.0.0", -] - -[[package]] -name = "binary_codec_sv2" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16415a0a9ccee2f71820da352c1f2a7f16d9f8e3ae6fb5e97834c6d732e98cd" -dependencies = [ - "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "binary_sv2" version = "4.0.0" dependencies = [ - "binary_codec_sv2 3.0.0", - "derive_codec_sv2 1.1.1", -] - -[[package]] -name = "binary_sv2" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba8295945d51b707f3a49e17810dddef858549e2b52383c7f2c4dd036f6bc1e6" -dependencies = [ - "binary_codec_sv2 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_codec_sv2 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "buffer_sv2", + "derive_codec_sv2", ] [[package]] @@ -803,18 +771,6 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.1" -dependencies = [ - "binary_codec_sv2 3.0.0", -] - -[[package]] -name = "derive_codec_sv2" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924f288d967a5cd37956b195269ee7f710999169895cf670a736e1b2267d6137" -dependencies = [ - "binary_codec_sv2 1.2.0", -] [[package]] name = "digest" From fb0ea756a949b42fd4db186dac8af1ea3ddd75d4 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 13:34:06 +0530 Subject: [PATCH 5/7] bump the binary --- protocols/stratum-translation/Cargo.toml | 2 +- protocols/v1/Cargo.toml | 2 +- protocols/v2/binary-sv2/Cargo.toml | 2 +- .../v2/binary-sv2/derive_codec/src/lib.rs | 2 - protocols/v2/channels-sv2/Cargo.toml | 2 +- protocols/v2/codec-sv2/Cargo.toml | 2 +- protocols/v2/framing-sv2/Cargo.toml | 2 +- protocols/v2/handlers-sv2/Cargo.toml | 2 +- protocols/v2/parsers-sv2/Cargo.toml | 2 +- .../subprotocols/common-messages/Cargo.toml | 2 +- .../subprotocols/job-declaration/Cargo.toml | 2 +- protocols/v2/subprotocols/mining/Cargo.toml | 2 +- .../template-distribution/Cargo.toml | 2 +- roles/Cargo.lock | 62 +++++++++---------- stratum-core/Cargo.toml | 2 +- test/integration-tests/Cargo.lock | 2 +- 16 files changed, 45 insertions(+), 47 deletions(-) diff --git a/protocols/stratum-translation/Cargo.toml b/protocols/stratum-translation/Cargo.toml index 581833470e..79ff7bab4c 100644 --- a/protocols/stratum-translation/Cargo.toml +++ b/protocols/stratum-translation/Cargo.toml @@ -10,7 +10,7 @@ name = "stratum_translation" path = "src/lib.rs" [dependencies] -binary_sv2 = { path = "../v2/binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../v2/binary-sv2", version = "^5.0.0" } mining_sv2 = { path = "../v2/subprotocols/mining", version = "^5.0.0" } channels_sv2 = { path = "../v2/channels-sv2", version = "^2.0.0" } v1 = { path = "../v1", package = "sv1_api", version = "^2.0.0" } diff --git a/protocols/v1/Cargo.toml b/protocols/v1/Cargo.toml index ff3e569436..262293e720 100644 --- a/protocols/v1/Cargo.toml +++ b/protocols/v1/Cargo.toml @@ -20,7 +20,7 @@ hex = "0.4.3" serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] } serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] } tracing = {version = "0.1"} -binary_sv2 = { path = "../v2/binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../v2/binary-sv2", version = "^5.0.0" } [dev-dependencies] quickcheck = "1" diff --git a/protocols/v2/binary-sv2/Cargo.toml b/protocols/v2/binary-sv2/Cargo.toml index 3ebbc4f832..f3b6eb32d9 100644 --- a/protocols/v2/binary-sv2/Cargo.toml +++ b/protocols/v2/binary-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "binary_sv2" -version = "4.0.0" +version = "5.0.0" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/binary-sv2/derive_codec/src/lib.rs b/protocols/v2/binary-sv2/derive_codec/src/lib.rs index 74f0fa1b2b..f01bbc8fa3 100644 --- a/protocols/v2/binary-sv2/derive_codec/src/lib.rs +++ b/protocols/v2/binary-sv2/derive_codec/src/lib.rs @@ -42,7 +42,6 @@ //! while `Decodable` constructs the struct from binary data. Both macros provide support for //! structs with or without lifetimes, ensuring versatility in applications that require efficient, //! protocol-level data handling. - #![no_std] extern crate alloc; @@ -792,7 +791,6 @@ pub fn encodable(item: TokenStream) -> TokenStream { let parsed_struct = get_struct_properties(item); let fields = parsed_struct.fields.clone(); - let mut field_into_decoded_field = String::new(); // Create DecodableField from fields diff --git a/protocols/v2/channels-sv2/Cargo.toml b/protocols/v2/channels-sv2/Cargo.toml index 0f866d1637..c51cf3339f 100644 --- a/protocols/v2/channels-sv2/Cargo.toml +++ b/protocols/v2/channels-sv2/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_sv2 = { path = "../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../binary-sv2", version = "^5.0.0" } common_messages_sv2 = { path = "../subprotocols/common-messages", version = "^6.0.0" } mining_sv2 = { path = "../subprotocols/mining", version = "^5.0.0" } template_distribution_sv2 = { path = "../subprotocols/template-distribution", version = "^4.0.0" } diff --git a/protocols/v2/codec-sv2/Cargo.toml b/protocols/v2/codec-sv2/Cargo.toml index 11fbae3d4f..43a825111b 100644 --- a/protocols/v2/codec-sv2/Cargo.toml +++ b/protocols/v2/codec-sv2/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] [dependencies] framing_sv2 = { path = "../../../protocols/v2/framing-sv2", version = "^5.0.0" } noise_sv2 = { path = "../../../protocols/v2/noise-sv2", default-features = false, optional = true, version = "^1.0.0" } -binary_sv2 = { path = "../../../protocols/v2/binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../../protocols/v2/binary-sv2", version = "^5.0.0" } buffer_sv2 = { path = "../../../utils/buffer", version = "^2.0.0" } rand = { version = "0.8.5", default-features = false } tracing = { version = "0.1", optional = true } diff --git a/protocols/v2/framing-sv2/Cargo.toml b/protocols/v2/framing-sv2/Cargo.toml index 003c4be089..38c52d4592 100644 --- a/protocols/v2/framing-sv2/Cargo.toml +++ b/protocols/v2/framing-sv2/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_sv2 = { path = "../../../protocols/v2/binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../../protocols/v2/binary-sv2", version = "^5.0.0" } buffer_sv2 = { path = "../../../utils/buffer", optional=true, version = "^2.0.0" } noise_sv2 = { path = "../../../protocols/v2/noise-sv2", version = "^1.0.0" } diff --git a/protocols/v2/handlers-sv2/Cargo.toml b/protocols/v2/handlers-sv2/Cargo.toml index 111ea64d6f..cfa28f915c 100644 --- a/protocols/v2/handlers-sv2/Cargo.toml +++ b/protocols/v2/handlers-sv2/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] [dependencies] trait-variant = "0.1.2" parsers_sv2 = { path = "../parsers-sv2", version = "^0.1.0"} -binary_sv2 = { path = "../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../binary-sv2", version = "^5.0.0" } common_messages_sv2 = { path = "../subprotocols/common-messages", version = "^6.0.0" } mining_sv2 = { path = "../subprotocols/mining", version = "^5.0.0" } template_distribution_sv2 = { path = "../subprotocols/template-distribution", version = "^4.0.0" } diff --git a/protocols/v2/parsers-sv2/Cargo.toml b/protocols/v2/parsers-sv2/Cargo.toml index cea4ff8031..a7f93b06dc 100644 --- a/protocols/v2/parsers-sv2/Cargo.toml +++ b/protocols/v2/parsers-sv2/Cargo.toml @@ -12,7 +12,7 @@ homepage = "https://stratumprotocol.org" keywords = ["stratum", "mining", "bitcoin", "protocol"] [dependencies] -binary_sv2 = { path = "../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../binary-sv2", version = "^5.0.0" } framing_sv2 = { path = "../framing-sv2", version = "^5.0.0" } common_messages_sv2 = { path = "../subprotocols/common-messages", version = "^6.0.0" } mining_sv2 = { path = "../subprotocols/mining", version = "^5.0.0" } diff --git a/protocols/v2/subprotocols/common-messages/Cargo.toml b/protocols/v2/subprotocols/common-messages/Cargo.toml index d1a242d39a..68c5003ab9 100644 --- a/protocols/v2/subprotocols/common-messages/Cargo.toml +++ b/protocols/v2/subprotocols/common-messages/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_sv2 = { path = "../../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../binary-sv2", version = "^5.0.0" } quickcheck = { version = "1.0.3", optional = true } quickcheck_macros = { version = "1", optional = true } diff --git a/protocols/v2/subprotocols/job-declaration/Cargo.toml b/protocols/v2/subprotocols/job-declaration/Cargo.toml index 1a211b9216..a7b79aef49 100644 --- a/protocols/v2/subprotocols/job-declaration/Cargo.toml +++ b/protocols/v2/subprotocols/job-declaration/Cargo.toml @@ -13,4 +13,4 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] [dependencies] -binary_sv2 = { path = "../../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../binary-sv2", version = "^5.0.0" } diff --git a/protocols/v2/subprotocols/mining/Cargo.toml b/protocols/v2/subprotocols/mining/Cargo.toml index 50bb4217f8..bd51fcdea9 100644 --- a/protocols/v2/subprotocols/mining/Cargo.toml +++ b/protocols/v2/subprotocols/mining/Cargo.toml @@ -15,7 +15,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_sv2 = { path = "../../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../binary-sv2", version = "^5.0.0" } [dev-dependencies] quickcheck = "1.0.3" diff --git a/protocols/v2/subprotocols/template-distribution/Cargo.toml b/protocols/v2/subprotocols/template-distribution/Cargo.toml index 9fc1b057b3..9abaaa4901 100644 --- a/protocols/v2/subprotocols/template-distribution/Cargo.toml +++ b/protocols/v2/subprotocols/template-distribution/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -binary_sv2 = { path = "../../binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../../binary-sv2", version = "^5.0.0" } quickcheck = { version = "1.0.3", optional=true } quickcheck_macros = { version = "1", optional=true } diff --git a/roles/Cargo.lock b/roles/Cargo.lock index 52be242171..36292a7897 100644 --- a/roles/Cargo.lock +++ b/roles/Cargo.lock @@ -453,19 +453,19 @@ dependencies = [ [[package]] name = "binary_sv2" version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8295945d51b707f3a49e17810dddef858549e2b52383c7f2c4dd036f6bc1e6" dependencies = [ - "buffer_sv2 2.0.0", - "derive_codec_sv2 1.1.1", + "binary_codec_sv2 3.0.0", + "derive_codec_sv2 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "binary_sv2" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba8295945d51b707f3a49e17810dddef858549e2b52383c7f2c4dd036f6bc1e6" +version = "5.0.0" dependencies = [ - "binary_codec_sv2 3.0.0", - "derive_codec_sv2 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "buffer_sv2 2.0.0", + "derive_codec_sv2 1.1.1", ] [[package]] @@ -701,7 +701,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11ac02b93b5bd92a7dda2bc4b8c9d1f087e1fffc8b1018b532109135629051fc" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -715,7 +715,7 @@ dependencies = [ name = "channels_sv2" version = "2.0.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin", "common_messages_sv2 6.0.1", "job_declaration_sv2 5.0.1", @@ -809,7 +809,7 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01e6d43e79e66d0f98038922157db8b6101594921be87ac2cca3754d669f2a05" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -821,7 +821,7 @@ dependencies = [ name = "codec_sv2" version = "4.0.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "buffer_sv2 2.0.0", "framing_sv2 5.0.1", "noise_sv2 1.4.0", @@ -839,7 +839,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" name = "common_messages_sv2" version = "6.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -848,7 +848,7 @@ version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e6ec6ab527aeebf8ead273d6ab712ff181c050ee5e1082f3f6a2c65c0a10bf6" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", ] [[package]] @@ -1204,7 +1204,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" name = "framing_sv2" version = "5.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "buffer_sv2 2.0.0", "noise_sv2 1.4.0", ] @@ -1215,7 +1215,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6543955264144174b93780e0e76623ee4293037c9e180cfde3e2c155b59fa9" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1427,7 +1427,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "472824f98b68a963dbf4c77625a8b5525c322abe49afa9403dfb816e35dd4d93" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1440,7 +1440,7 @@ dependencies = [ name = "handlers_sv2" version = "0.2.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "common_messages_sv2 6.0.1", "job_declaration_sv2 5.0.1", "mining_sv2 5.0.1", @@ -1759,7 +1759,7 @@ name = "jd_server" version = "0.1.3" dependencies = [ "async-channel 1.9.0", - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "clap", "codec_sv2 3.0.1", @@ -1789,7 +1789,7 @@ dependencies = [ name = "job_declaration_sv2" version = "5.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -1798,7 +1798,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d4edc436d29e8dcac178539222de2b3681d629f9884191bd7db8831e49dd24" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", ] [[package]] @@ -1906,7 +1906,7 @@ version = "0.1.3" dependencies = [ "async-channel 1.9.0", "async-recursion", - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "clap", "codec_sv2 3.0.1", @@ -1935,7 +1935,7 @@ dependencies = [ name = "mining_sv2" version = "5.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -1944,7 +1944,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1eb3c055232f64d36e3eee4296adcaa584fb3185a57e0de11ad5807766c45edc" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", ] [[package]] @@ -2173,7 +2173,7 @@ dependencies = [ name = "parsers_sv2" version = "0.1.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "common_messages_sv2 6.0.1", "framing_sv2 5.0.1", "job_declaration_sv2 5.0.1", @@ -2187,7 +2187,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "109e80bc77241a729f61cad15f3f246f3de12e1b741b31e419fc7e02f20c2ccb" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2492,7 +2492,7 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88850ead16993f86cb4616d154ddd37b9c0d739ea23711b1cc51f40484e0e39a" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "chacha20poly1305", "channels_sv2 1.0.2", @@ -2871,7 +2871,7 @@ dependencies = [ name = "stratum-core" version = "0.1.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin", "buffer_sv2 2.0.0", "channels_sv2 2.0.0", @@ -2892,7 +2892,7 @@ dependencies = [ name = "stratum_translation" version = "0.1.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "channels_sv2 2.0.0", "mining_sv2 5.0.1", "sv1_api", @@ -2915,7 +2915,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" name = "sv1_api" version = "2.1.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin_hashes 0.3.2", "byteorder", "hex", @@ -2977,7 +2977,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" name = "template_distribution_sv2" version = "4.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -2986,7 +2986,7 @@ version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6298fc9f339b1c3b654ef3590857d5d3eff6d709891f003b7f7a701b8a64a3a4" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", ] [[package]] diff --git a/stratum-core/Cargo.toml b/stratum-core/Cargo.toml index 50436b252f..6cab53effd 100644 --- a/stratum-core/Cargo.toml +++ b/stratum-core/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"] [dependencies] buffer_sv2 = { path = "../utils/buffer", version = "^2.0.0" } bitcoin = "0.32.5" -binary_sv2 = { path = "../protocols/v2/binary-sv2", version = "^4.0.0" } +binary_sv2 = { path = "../protocols/v2/binary-sv2", version = "^5.0.0" } codec_sv2 = { path = "../protocols/v2/codec-sv2", version = "^4.0.0", features = ["noise_sv2"]} framing_sv2 = { path = "../protocols/v2/framing-sv2", version = "^5.0.0" } noise_sv2 = { path = "../protocols/v2/noise-sv2", version = "^1.0.0" } diff --git a/test/integration-tests/Cargo.lock b/test/integration-tests/Cargo.lock index 802e9db75c..549cbed32d 100644 --- a/test/integration-tests/Cargo.lock +++ b/test/integration-tests/Cargo.lock @@ -248,7 +248,7 @@ checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "binary_sv2" -version = "4.0.0" +version = "5.0.0" dependencies = [ "buffer_sv2", "derive_codec_sv2", From cdfc4a5186c4284020cf94160064952f2bb36a7c Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 21:29:15 +0530 Subject: [PATCH 6/7] Update PATCH on all crates dependent on binary_sv2 --- protocols/stratum-translation/Cargo.toml | 2 +- protocols/v1/Cargo.toml | 2 +- protocols/v2/channels-sv2/Cargo.toml | 2 +- protocols/v2/codec-sv2/Cargo.toml | 2 +- protocols/v2/framing-sv2/Cargo.toml | 2 +- protocols/v2/handlers-sv2/Cargo.toml | 2 +- protocols/v2/parsers-sv2/Cargo.toml | 2 +- .../subprotocols/common-messages/Cargo.toml | 2 +- .../subprotocols/job-declaration/Cargo.toml | 2 +- protocols/v2/subprotocols/mining/Cargo.toml | 2 +- .../template-distribution/Cargo.toml | 2 +- roles/Cargo.lock | 188 +++++++++--------- test/integration-tests/Cargo.lock | 53 ++++- 13 files changed, 156 insertions(+), 107 deletions(-) diff --git a/protocols/stratum-translation/Cargo.toml b/protocols/stratum-translation/Cargo.toml index 79ff7bab4c..1b4da3f8f4 100644 --- a/protocols/stratum-translation/Cargo.toml +++ b/protocols/stratum-translation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stratum_translation" -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "MIT OR Apache-2.0" description = "Stratum V1 ↔ Stratum V2 translation utilities for reuse across proxies, apps, and firmware" diff --git a/protocols/v1/Cargo.toml b/protocols/v1/Cargo.toml index 262293e720..5ef1b8df26 100644 --- a/protocols/v1/Cargo.toml +++ b/protocols/v1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv1_api" -version = "2.1.1" +version = "2.1.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/channels-sv2/Cargo.toml b/protocols/v2/channels-sv2/Cargo.toml index c51cf3339f..8d08df2dbc 100644 --- a/protocols/v2/channels-sv2/Cargo.toml +++ b/protocols/v2/channels-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "channels_sv2" -version = "2.0.0" +version = "2.0.1" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/codec-sv2/Cargo.toml b/protocols/v2/codec-sv2/Cargo.toml index 43a825111b..df7e18ac42 100644 --- a/protocols/v2/codec-sv2/Cargo.toml +++ b/protocols/v2/codec-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "codec_sv2" -version = "4.0.0" +version = "4.0.1" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/framing-sv2/Cargo.toml b/protocols/v2/framing-sv2/Cargo.toml index 38c52d4592..fb3ebfd996 100644 --- a/protocols/v2/framing-sv2/Cargo.toml +++ b/protocols/v2/framing-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framing_sv2" -version = "5.0.1" +version = "5.0.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/handlers-sv2/Cargo.toml b/protocols/v2/handlers-sv2/Cargo.toml index cfa28f915c..be5de4c537 100644 --- a/protocols/v2/handlers-sv2/Cargo.toml +++ b/protocols/v2/handlers-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "handlers_sv2" -version = "0.2.0" +version = "0.2.1" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/parsers-sv2/Cargo.toml b/protocols/v2/parsers-sv2/Cargo.toml index a7f93b06dc..29523032fa 100644 --- a/protocols/v2/parsers-sv2/Cargo.toml +++ b/protocols/v2/parsers-sv2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parsers_sv2" -version = "0.1.1" +version = "0.1.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/subprotocols/common-messages/Cargo.toml b/protocols/v2/subprotocols/common-messages/Cargo.toml index 68c5003ab9..dc9973dd1f 100644 --- a/protocols/v2/subprotocols/common-messages/Cargo.toml +++ b/protocols/v2/subprotocols/common-messages/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "common_messages_sv2" -version = "6.0.1" +version = "6.0.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/subprotocols/job-declaration/Cargo.toml b/protocols/v2/subprotocols/job-declaration/Cargo.toml index a7b79aef49..e87a316066 100644 --- a/protocols/v2/subprotocols/job-declaration/Cargo.toml +++ b/protocols/v2/subprotocols/job-declaration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "job_declaration_sv2" -version = "5.0.1" +version = "5.0.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/subprotocols/mining/Cargo.toml b/protocols/v2/subprotocols/mining/Cargo.toml index bd51fcdea9..090ad7f8bd 100644 --- a/protocols/v2/subprotocols/mining/Cargo.toml +++ b/protocols/v2/subprotocols/mining/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mining_sv2" -version = "5.0.1" +version = "5.0.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/protocols/v2/subprotocols/template-distribution/Cargo.toml b/protocols/v2/subprotocols/template-distribution/Cargo.toml index 9abaaa4901..d4dbd595ff 100644 --- a/protocols/v2/subprotocols/template-distribution/Cargo.toml +++ b/protocols/v2/subprotocols/template-distribution/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "template_distribution_sv2" -version = "4.0.1" +version = "4.0.2" authors = ["The Stratum V2 Developers"] edition = "2021" readme = "README.md" diff --git a/roles/Cargo.lock b/roles/Cargo.lock index 36292a7897..77c7383646 100644 --- a/roles/Cargo.lock +++ b/roles/Cargo.lock @@ -703,25 +703,25 @@ checksum = "11ac02b93b5bd92a7dda2bc4b8c9d1f087e1fffc8b1018b532109135629051fc" dependencies = [ "binary_sv2 4.0.0", "bitcoin", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] [[package]] name = "channels_sv2" -version = "2.0.0" +version = "2.0.1" dependencies = [ "binary_sv2 5.0.0", "bitcoin", - "common_messages_sv2 6.0.1", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", + "common_messages_sv2 6.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", "primitive-types", - "template_distribution_sv2 4.0.1", + "template_distribution_sv2 4.0.2", "tracing", ] @@ -811,7 +811,7 @@ checksum = "01e6d43e79e66d0f98038922157db8b6101594921be87ac2cca3754d669f2a05" dependencies = [ "binary_sv2 4.0.0", "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "framing_sv2 5.0.1", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand", "tracing", @@ -819,11 +819,11 @@ dependencies = [ [[package]] name = "codec_sv2" -version = "4.0.0" +version = "4.0.1" dependencies = [ "binary_sv2 5.0.0", "buffer_sv2 2.0.0", - "framing_sv2 5.0.1", + "framing_sv2 5.0.2", "noise_sv2 1.4.0", "rand", "tracing", @@ -838,17 +838,17 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "common_messages_sv2" version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e6ec6ab527aeebf8ead273d6ab712ff181c050ee5e1082f3f6a2c65c0a10bf6" dependencies = [ - "binary_sv2 5.0.0", + "binary_sv2 4.0.0", ] [[package]] name = "common_messages_sv2" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6ec6ab527aeebf8ead273d6ab712ff181c050ee5e1082f3f6a2c65c0a10bf6" +version = "6.0.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -1200,15 +1200,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "framing_sv2" -version = "5.0.1" -dependencies = [ - "binary_sv2 5.0.0", - "buffer_sv2 2.0.0", - "noise_sv2 1.4.0", -] - [[package]] name = "framing_sv2" version = "5.0.1" @@ -1220,6 +1211,15 @@ dependencies = [ "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "framing_sv2" +version = "5.0.2" +dependencies = [ + "binary_sv2 5.0.0", + "buffer_sv2 2.0.0", + "noise_sv2 1.4.0", +] + [[package]] name = "funty" version = "2.0.0" @@ -1428,24 +1428,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "472824f98b68a963dbf4c77625a8b5525c322abe49afa9403dfb816e35dd4d93" dependencies = [ "binary_sv2 4.0.0", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", + "parsers_sv2 0.1.1", + "template_distribution_sv2 4.0.1", "trait-variant", ] [[package]] name = "handlers_sv2" -version = "0.2.0" +version = "0.2.1" dependencies = [ "binary_sv2 5.0.0", - "common_messages_sv2 6.0.1", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", - "parsers_sv2 0.1.1", - "template_distribution_sv2 4.0.1", + "common_messages_sv2 6.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", + "parsers_sv2 0.1.2", + "template_distribution_sv2 4.0.2", "trait-variant", ] @@ -1763,18 +1763,18 @@ dependencies = [ "bitcoin", "clap", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "config", "error_handling", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "framing_sv2 5.0.1", "hashbrown 0.11.2", "hex", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "network_helpers_sv2", "nohash-hasher", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "rand", "roles_logic_sv2 5.0.0", "rpc_sv2", @@ -1788,17 +1788,17 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d4edc436d29e8dcac178539222de2b3681d629f9884191bd7db8831e49dd24" dependencies = [ - "binary_sv2 5.0.0", + "binary_sv2 4.0.0", ] [[package]] name = "job_declaration_sv2" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d4edc436d29e8dcac178539222de2b3681d629f9884191bd7db8831e49dd24" +version = "5.0.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -1910,17 +1910,17 @@ dependencies = [ "bitcoin", "clap", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "criterion", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "framing_sv2 5.0.1", "futures", "half", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mining_sv2 5.0.1", "network_helpers_sv2", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-format", "num_cpus", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", "rand", "roles_logic_sv2 5.0.0", @@ -1934,17 +1934,17 @@ dependencies = [ [[package]] name = "mining_sv2" version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eb3c055232f64d36e3eee4296adcaa584fb3185a57e0de11ad5807766c45edc" dependencies = [ - "binary_sv2 5.0.0", + "binary_sv2 4.0.0", ] [[package]] name = "mining_sv2" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb3c055232f64d36e3eee4296adcaa584fb3185a57e0de11ad5807766c45edc" +version = "5.0.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] @@ -2172,8 +2172,10 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109e80bc77241a729f61cad15f3f246f3de12e1b741b31e419fc7e02f20c2ccb" dependencies = [ - "binary_sv2 5.0.0", + "binary_sv2 4.0.0", "common_messages_sv2 6.0.1", "framing_sv2 5.0.1", "job_declaration_sv2 5.0.1", @@ -2183,16 +2185,14 @@ dependencies = [ [[package]] name = "parsers_sv2" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109e80bc77241a729f61cad15f3f246f3de12e1b741b31e419fc7e02f20c2ccb" +version = "0.1.2" dependencies = [ - "binary_sv2 4.0.0", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", + "common_messages_sv2 6.0.2", + "framing_sv2 5.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", + "template_distribution_sv2 4.0.2", ] [[package]] @@ -2474,15 +2474,15 @@ dependencies = [ "chacha20poly1305", "channels_sv2 1.0.2", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "handlers_sv2 0.1.0", "hex-conservative 0.3.0", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "nohash-hasher", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] @@ -2497,15 +2497,15 @@ dependencies = [ "chacha20poly1305", "channels_sv2 1.0.2", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "handlers_sv2 0.1.0", "hex-conservative 0.3.0", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "nohash-hasher", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] @@ -2874,27 +2874,27 @@ dependencies = [ "binary_sv2 5.0.0", "bitcoin", "buffer_sv2 2.0.0", - "channels_sv2 2.0.0", - "codec_sv2 4.0.0", - "common_messages_sv2 6.0.1", - "framing_sv2 5.0.1", - "handlers_sv2 0.2.0", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", + "channels_sv2 2.0.1", + "codec_sv2 4.0.1", + "common_messages_sv2 6.0.2", + "framing_sv2 5.0.2", + "handlers_sv2 0.2.1", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", "noise_sv2 1.4.0", - "parsers_sv2 0.1.1", + "parsers_sv2 0.1.2", "stratum_translation", "sv1_api", - "template_distribution_sv2 4.0.1", + "template_distribution_sv2 4.0.2", ] [[package]] name = "stratum_translation" -version = "0.1.0" +version = "0.1.1" dependencies = [ "binary_sv2 5.0.0", - "channels_sv2 2.0.0", - "mining_sv2 5.0.1", + "channels_sv2 2.0.1", + "mining_sv2 5.0.2", "sv1_api", "tracing", ] @@ -2913,7 +2913,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" -version = "2.1.1" +version = "2.1.2" dependencies = [ "binary_sv2 5.0.0", "bitcoin_hashes 0.3.2", @@ -2976,17 +2976,17 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "template_distribution_sv2" version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6298fc9f339b1c3b654ef3590857d5d3eff6d709891f003b7f7a701b8a64a3a4" dependencies = [ - "binary_sv2 5.0.0", + "binary_sv2 4.0.0", ] [[package]] name = "template_distribution_sv2" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6298fc9f339b1c3b654ef3590857d5d3eff6d709891f003b7f7a701b8a64a3a4" +version = "4.0.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", ] [[package]] diff --git a/test/integration-tests/Cargo.lock b/test/integration-tests/Cargo.lock index 549cbed32d..648174f32e 100644 --- a/test/integration-tests/Cargo.lock +++ b/test/integration-tests/Cargo.lock @@ -570,6 +570,13 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "common_messages_sv2" +version = "6.0.2" +dependencies = [ + "binary_sv2 4.0.0", +] + [[package]] name = "common_messages_sv2" version = "6.0.1" @@ -889,6 +896,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "framing_sv2" +version = "5.0.2" +dependencies = [ + "binary_sv2 4.0.0", + "buffer_sv2 2.0.0", + "noise_sv2 1.4.0", +] + [[package]] name = "framing_sv2" version = "5.0.1" @@ -1407,6 +1423,13 @@ dependencies = [ "tracing", ] +[[package]] +name = "job_declaration_sv2" +version = "5.0.2" +dependencies = [ + "binary_sv2 4.0.0", +] + [[package]] name = "job_declaration_sv2" version = "5.0.1" @@ -1539,6 +1562,13 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "mining_sv2" +version = "5.0.2" +dependencies = [ + "binary_sv2 4.0.0", +] + [[package]] name = "mining_sv2" version = "5.0.1" @@ -1762,6 +1792,18 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "parsers_sv2" +version = "0.1.2" +dependencies = [ + "binary_sv2 4.0.0", + "common_messages_sv2 6.0.1", + "framing_sv2 5.0.1", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", + "template_distribution_sv2 4.0.1", +] + [[package]] name = "parsers_sv2" version = "0.1.1" @@ -2450,7 +2492,7 @@ dependencies = [ [[package]] name = "stratum_translation" -version = "0.1.0" +version = "0.1.1" dependencies = [ "binary_sv2 4.0.0", "channels_sv2 2.0.0", @@ -2473,7 +2515,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" -version = "2.1.1" +version = "2.1.2" dependencies = [ "binary_sv2 4.0.0", "bitcoin_hashes 0.3.2", @@ -2555,6 +2597,13 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "template_distribution_sv2" +version = "4.0.2" +dependencies = [ + "binary_sv2 4.0.0", +] + [[package]] name = "template_distribution_sv2" version = "4.0.1" From b7802fd30c82bd1dcd34fe8363eae3b845f11497 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 17 Oct 2025 23:43:36 +0530 Subject: [PATCH 7/7] update integrationt test lock file --- test/integration-tests/Cargo.lock | 281 ++++++++++++++---------------- 1 file changed, 133 insertions(+), 148 deletions(-) diff --git a/test/integration-tests/Cargo.lock b/test/integration-tests/Cargo.lock index 648174f32e..add84820d6 100644 --- a/test/integration-tests/Cargo.lock +++ b/test/integration-tests/Cargo.lock @@ -246,12 +246,37 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +[[package]] +name = "binary_codec_sv2" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad24342e0abdcc463ad6ad4ac7b0ec606122c11eddf92de186a657df0114eb7" + +[[package]] +name = "binary_codec_sv2" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16415a0a9ccee2f71820da352c1f2a7f16d9f8e3ae6fb5e97834c6d732e98cd" +dependencies = [ + "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "binary_sv2" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8295945d51b707f3a49e17810dddef858549e2b52383c7f2c4dd036f6bc1e6" +dependencies = [ + "binary_codec_sv2 3.0.0", + "derive_codec_sv2 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "binary_sv2" version = "5.0.0" dependencies = [ - "buffer_sv2", - "derive_codec_sv2", + "buffer_sv2 2.0.0", + "derive_codec_sv2 1.1.1", ] [[package]] @@ -463,27 +488,27 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11ac02b93b5bd92a7dda2bc4b8c9d1f087e1fffc8b1018b532109135629051fc" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] [[package]] name = "channels_sv2" -version = "2.0.0" +version = "2.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin", - "common_messages_sv2 6.0.1", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", + "common_messages_sv2 6.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", "primitive-types", - "template_distribution_sv2 4.0.1", + "template_distribution_sv2 4.0.2", "tracing", ] @@ -544,9 +569,9 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01e6d43e79e66d0f98038922157db8b6101594921be87ac2cca3754d669f2a05" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "framing_sv2 5.0.1", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "tracing", @@ -554,11 +579,11 @@ dependencies = [ [[package]] name = "codec_sv2" -version = "4.0.0" +version = "4.0.1" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "buffer_sv2 2.0.0", - "framing_sv2 5.0.1", + "framing_sv2 5.0.2", "noise_sv2 1.4.0", "rand 0.8.5", "tracing", @@ -570,27 +595,20 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" -[[package]] -name = "common_messages_sv2" -version = "6.0.2" -dependencies = [ - "binary_sv2 4.0.0", -] - [[package]] name = "common_messages_sv2" version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e6ec6ab527aeebf8ead273d6ab712ff181c050ee5e1082f3f6a2c65c0a10bf6" dependencies = [ "binary_sv2 4.0.0", ] [[package]] name = "common_messages_sv2" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6ec6ab527aeebf8ead273d6ab712ff181c050ee5e1082f3f6a2c65c0a10bf6" +version = "6.0.2" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", ] [[package]] @@ -779,6 +797,15 @@ dependencies = [ name = "derive_codec_sv2" version = "1.1.1" +[[package]] +name = "derive_codec_sv2" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924f288d967a5cd37956b195269ee7f710999169895cf670a736e1b2267d6137" +dependencies = [ + "binary_codec_sv2 1.2.0", +] + [[package]] name = "digest" version = "0.9.0" @@ -898,33 +925,24 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "framing_sv2" -version = "5.0.2" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6543955264144174b93780e0e76623ee4293037c9e180cfde3e2c155b59fa9" dependencies = [ "binary_sv2 4.0.0", - "buffer_sv2 2.0.0", - "noise_sv2 1.4.0", + "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "framing_sv2" -version = "5.0.1" +version = "5.0.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "buffer_sv2 2.0.0", "noise_sv2 1.4.0", ] -[[package]] -name = "framing_sv2" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6543955264144174b93780e0e76623ee4293037c9e180cfde3e2c155b59fa9" -dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "buffer_sv2 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "funty" version = "2.0.0" @@ -1093,19 +1111,6 @@ name = "handlers_sv2" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "472824f98b68a963dbf4c77625a8b5525c322abe49afa9403dfb816e35dd4d93" -dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trait-variant", -] - -[[package]] -name = "handlers_sv2" -version = "0.2.0" dependencies = [ "binary_sv2 4.0.0", "common_messages_sv2 6.0.1", @@ -1116,6 +1121,19 @@ dependencies = [ "trait-variant", ] +[[package]] +name = "handlers_sv2" +version = "0.2.1" +dependencies = [ + "binary_sv2 5.0.0", + "common_messages_sv2 6.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", + "parsers_sv2 0.1.2", + "template_distribution_sv2 4.0.2", + "trait-variant", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -1397,22 +1415,22 @@ name = "jd_server" version = "0.1.3" dependencies = [ "async-channel", - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "clap", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "config", "error_handling", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "framing_sv2 5.0.1", "hashbrown 0.11.2", "hex", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "network_helpers_sv2", "nohash-hasher", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "rand 0.8.5", "roles_logic_sv2 5.0.0", "rpc_sv2", @@ -1423,27 +1441,20 @@ dependencies = [ "tracing", ] -[[package]] -name = "job_declaration_sv2" -version = "5.0.2" -dependencies = [ - "binary_sv2 4.0.0", -] - [[package]] name = "job_declaration_sv2" version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d4edc436d29e8dcac178539222de2b3681d629f9884191bd7db8831e49dd24" dependencies = [ "binary_sv2 4.0.0", ] [[package]] name = "job_declaration_sv2" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d4edc436d29e8dcac178539222de2b3681d629f9884191bd7db8831e49dd24" +version = "5.0.2" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", ] [[package]] @@ -1540,18 +1551,18 @@ version = "0.1.3" dependencies = [ "async-channel", "async-recursion", - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "clap", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", + "framing_sv2 5.0.1", "futures", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mining_sv2 5.0.1", "network_helpers_sv2", "noise_sv2 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-format", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", "rand 0.8.5", "roles_logic_sv2 5.0.0", @@ -1562,27 +1573,20 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "mining_sv2" -version = "5.0.2" -dependencies = [ - "binary_sv2 4.0.0", -] - [[package]] name = "mining_sv2" version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eb3c055232f64d36e3eee4296adcaa584fb3185a57e0de11ad5807766c45edc" dependencies = [ "binary_sv2 4.0.0", ] [[package]] name = "mining_sv2" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb3c055232f64d36e3eee4296adcaa584fb3185a57e0de11ad5807766c45edc" +version = "5.0.2" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", ] [[package]] @@ -1792,21 +1796,11 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "parsers_sv2" -version = "0.1.2" -dependencies = [ - "binary_sv2 4.0.0", - "common_messages_sv2 6.0.1", - "framing_sv2 5.0.1", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", - "template_distribution_sv2 4.0.1", -] - [[package]] name = "parsers_sv2" version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109e80bc77241a729f61cad15f3f246f3de12e1b741b31e419fc7e02f20c2ccb" dependencies = [ "binary_sv2 4.0.0", "common_messages_sv2 6.0.1", @@ -1818,16 +1812,14 @@ dependencies = [ [[package]] name = "parsers_sv2" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109e80bc77241a729f61cad15f3f246f3de12e1b741b31e419fc7e02f20c2ccb" +version = "0.1.2" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "framing_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", + "common_messages_sv2 6.0.2", + "framing_sv2 5.0.2", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", + "template_distribution_sv2 4.0.2", ] [[package]] @@ -2105,15 +2097,15 @@ dependencies = [ "chacha20poly1305", "channels_sv2 1.0.2", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "handlers_sv2 0.1.0", "hex-conservative 0.3.0", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "nohash-hasher", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] @@ -2123,20 +2115,20 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88850ead16993f86cb4616d154ddd37b9c0d739ea23711b1cc51f40484e0e39a" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 4.0.0", "bitcoin", "chacha20poly1305", "channels_sv2 1.0.2", "codec_sv2 3.0.1", - "common_messages_sv2 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "common_messages_sv2 6.0.1", "handlers_sv2 0.1.0", "hex-conservative 0.3.0", - "job_declaration_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mining_sv2 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "job_declaration_sv2 5.0.1", + "mining_sv2 5.0.1", "nohash-hasher", - "parsers_sv2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parsers_sv2 0.1.1", "primitive-types", - "template_distribution_sv2 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "template_distribution_sv2 4.0.1", "tracing", ] @@ -2473,30 +2465,30 @@ dependencies = [ name = "stratum-core" version = "0.1.0" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin", "buffer_sv2 2.0.0", - "channels_sv2 2.0.0", - "codec_sv2 4.0.0", - "common_messages_sv2 6.0.1", - "framing_sv2 5.0.1", - "handlers_sv2 0.2.0", - "job_declaration_sv2 5.0.1", - "mining_sv2 5.0.1", + "channels_sv2 2.0.1", + "codec_sv2 4.0.1", + "common_messages_sv2 6.0.2", + "framing_sv2 5.0.2", + "handlers_sv2 0.2.1", + "job_declaration_sv2 5.0.2", + "mining_sv2 5.0.2", "noise_sv2 1.4.0", - "parsers_sv2 0.1.1", + "parsers_sv2 0.1.2", "stratum_translation", "sv1_api", - "template_distribution_sv2 4.0.1", + "template_distribution_sv2 4.0.2", ] [[package]] name = "stratum_translation" version = "0.1.1" dependencies = [ - "binary_sv2 4.0.0", - "channels_sv2 2.0.0", - "mining_sv2 5.0.1", + "binary_sv2 5.0.0", + "channels_sv2 2.0.1", + "mining_sv2 5.0.2", "sv1_api", "tracing", ] @@ -2517,7 +2509,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" name = "sv1_api" version = "2.1.2" dependencies = [ - "binary_sv2 4.0.0", + "binary_sv2 5.0.0", "bitcoin_hashes 0.3.2", "byteorder", "hex", @@ -2597,27 +2589,20 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "template_distribution_sv2" -version = "4.0.2" -dependencies = [ - "binary_sv2 4.0.0", -] - [[package]] name = "template_distribution_sv2" version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6298fc9f339b1c3b654ef3590857d5d3eff6d709891f003b7f7a701b8a64a3a4" dependencies = [ "binary_sv2 4.0.0", ] [[package]] name = "template_distribution_sv2" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6298fc9f339b1c3b654ef3590857d5d3eff6d709891f003b7f7a701b8a64a3a4" +version = "4.0.2" dependencies = [ - "binary_sv2 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "binary_sv2 5.0.0", ] [[package]]