diff --git a/Cargo.lock b/Cargo.lock index c088db5d5..831bc4bb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -447,7 +447,7 @@ dependencies = [ [[package]] name = "dash-num" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "ambassador", "bitcoin-consensus-encoding", @@ -497,7 +497,7 @@ dependencies = [ [[package]] name = "dash-pkc" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "aes", "base58ck", @@ -574,7 +574,7 @@ dependencies = [ [[package]] name = "dash-types" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "base58ck", "bitcoin-consensus-encoding", diff --git a/docs/samples/Cargo.lock b/docs/samples/Cargo.lock index 6a3af0df1..567556a64 100644 --- a/docs/samples/Cargo.lock +++ b/docs/samples/Cargo.lock @@ -199,7 +199,7 @@ dependencies = [ [[package]] name = "dash-num" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "ambassador", "bitcoin-consensus-encoding", @@ -212,7 +212,7 @@ dependencies = [ [[package]] name = "dash-pkc" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "aes", "base58ck", @@ -304,7 +304,7 @@ dependencies = [ [[package]] name = "dash-types" -version = "0.1.0-beta" +version = "0.2.0-beta" dependencies = [ "base58ck", "bitcoin-consensus-encoding", diff --git a/docs/samples/parser/Cargo.toml b/docs/samples/parser/Cargo.toml index d3a2052d9..64d884cac 100644 --- a/docs/samples/parser/Cargo.toml +++ b/docs/samples/parser/Cargo.toml @@ -22,7 +22,7 @@ full = ["std"] dash-primitives = { version = "0.0.0", path = "../../../pkgs/primitives", default-features = false, features = [ "serde", ] } -dash-types = { version = "0.1.0-beta", path = "../../../pkgs/types", default-features = false } +dash-types = { version = "0.2.0-beta", path = "../../../pkgs/types", default-features = false } hex-conservative = { version = "1.3", default-features = false, features = [ "alloc", ] } diff --git a/docs/samples/solver/Cargo.toml b/docs/samples/solver/Cargo.toml index 118a2f85d..ff8594e4e 100644 --- a/docs/samples/solver/Cargo.toml +++ b/docs/samples/solver/Cargo.toml @@ -22,11 +22,11 @@ full = ["std"] bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] } bitcoin-primitives = { workspace = true, features = ["alloc"] } bitcoin-units = { workspace = true, features = ["alloc"] } -dash-num = { version = "0.1.0-beta", path = "../../../pkgs/num", default-features = false } +dash-num = { version = "0.2.0-beta", path = "../../../pkgs/num", default-features = false } dash-pow = { version = "0.0.0", path = "../../../pkgs/pow", default-features = false } dash-primitives = { version = "0.0.0", path = "../../../pkgs/primitives", default-features = false } dash-script = { version = "0.0.0", path = "../../../pkgs/script", default-features = false } -dash-types = { version = "0.1.0-beta", path = "../../../pkgs/types", default-features = false } +dash-types = { version = "0.2.0-beta", path = "../../../pkgs/types", default-features = false } hex-conservative = { version = "1.3", default-features = false, features = [ "alloc", ] } diff --git a/maint/codeql/rust/codeql-config.yml b/maint/codeql/rust/codeql-config.yml index a44eb2e03..da2c0c08a 100644 --- a/maint/codeql/rust/codeql-config.yml +++ b/maint/codeql/rust/codeql-config.yml @@ -1,5 +1,6 @@ disable-default-queries: true paths-ignore: - public + - target queries: - uses: ./maint/codeql/rust diff --git a/pkgs/dev/Cargo.toml b/pkgs/dev/Cargo.toml index 78e2c6b91..e34d6d344 100644 --- a/pkgs/dev/Cargo.toml +++ b/pkgs/dev/Cargo.toml @@ -50,7 +50,7 @@ bin = [ [build-dependencies] built = { version = "0.7", features = ["dependency-tree", "git2"] } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "codec", ] } proc-macro2 = "1" @@ -60,13 +60,13 @@ xxhash-rust = { version = "0.8", features = ["xxh32"] } [dependencies] bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] } cfg-if = "1" -dash-num = { version = "0.1.0-beta", path = "../num", optional = true, features = [ +dash-num = { version = "0.2.0-beta", path = "../num", optional = true, features = [ "codec", ] } dash-params = { version = "0.0.0", path = "../params", optional = true } dash-pow = { version = "0.0.0", path = "../pow", optional = true } dash-primitives = { version = "0.0.0", path = "../primitives" } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "codec", ] } hex-conservative = { workspace = true, features = [ diff --git a/pkgs/num/CHANGELOG.md b/pkgs/num/CHANGELOG.md index 3c540addb..be944c599 100644 --- a/pkgs/num/CHANGELOG.md +++ b/pkgs/num/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +## [0.2.0-beta] - 2026-10-20 + ### Added - `CompactTarget::block_proof`, the work contributed by a block with that target, zero for negative, overflowing or @@ -21,12 +23,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Changed - **The minimum supported Rust version is raised from 1.85 to 1.89.** -- `HashBlob`, `make_hash!` types and `Arith256` serialize as their little-endian storage bytes for machine-readable - formats, JSON retains hex encoded big-endian string encoding. -- `CompactTarget::from_str` requires exactly 8 hex digits, optionally `0x`/`0X`-prefixed. Shorter input is now - rejected with `ParseHexError::OddLength` or `ParseHexError::InvalidLength`. -- The `serde` feature no longer implies `codec`. `CompactTarget` implements `Serialize` and `Deserialize` without +- **`HashBlob`, `make_hash!` types and `Arith256` serialize as their little-endian storage bytes for machine-readable + formats.** JSON retains the hex-encoded big-endian string. +- **The `serde` feature no longer implies `codec`.** `CompactTarget` implements `Serialize` and `Deserialize` without `codec`. Callers that relied on `serde` to enable `codec` must enable it explicitly. +- `CompactTarget::from_str` requires exactly 8 hex digits, optionally `0x`/`0X`-prefixed. Shorter input is rejected + with `ParseHexError::OddLength` or `ParseHexError::InvalidLength`. +- `Arith256::to_f64` rounds like the reference implementation, where it was one ULP off on roughly 1% of inputs. ### Removed @@ -34,13 +37,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - The `dash_types::Numeric` re-export in favour of a wholesale crate re-export. `dash_num::Numeric` imports must switch to `dash_num::__deps::dash_types::Numeric` or depend on `dash-types` directly. -### Fixed - -- `Arith256::to_f64` rounds like the reference implementation. It was one ULP off on roughly 1% of inputs. - ## [0.1.0-beta] - 2026-09-14 - Initial release. -[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-num-0.1.0-beta...HEAD +[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-num-0.2.0-beta...HEAD +[0.2.0-beta]: https://github.com/dashpay/base-sdk/compare/dash-num-0.1.0-beta...dash-num-0.2.0-beta [0.1.0-beta]: https://github.com/dashpay/base-sdk/releases/tag/dash-num-0.1.0-beta diff --git a/pkgs/num/Cargo.toml b/pkgs/num/Cargo.toml index 963fe70b4..8d6117513 100644 --- a/pkgs/num/Cargo.toml +++ b/pkgs/num/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-num" -version = "0.1.0-beta" +version = "0.2.0-beta" description = "Wide-integer blob and arithmetic types for the Dash Base SDK" keywords = ["base-sdk", "dash", "dashcore", "dashpay"] categories = [ @@ -52,7 +52,7 @@ serde = [ ambassador = { workspace = true } bitcoin-consensus-encoding = { workspace = true, optional = true } bitcoin-internals = { workspace = true } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false } +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false } delegate = { workspace = true } hex-conservative = { workspace = true } serde = { workspace = true, features = [ diff --git a/pkgs/num/README.md b/pkgs/num/README.md index 1ed5204c3..4d7026277 100644 --- a/pkgs/num/README.md +++ b/pkgs/num/README.md @@ -15,7 +15,7 @@ This crate supplies the wide blob and arithmetic types used by the Dash Base SDK To import `dash-num` to your project, add the following to the `[dependencies]` section in `Cargo.toml` ```toml -dash-num = "0.1.0-beta" +dash-num = "0.2.0-beta" ``` To use an unpublished revision of this crate, identify the commit hash to pin against and use the following replacing diff --git a/pkgs/p2p_core/Cargo.toml b/pkgs/p2p_core/Cargo.toml index 9abb89337..a8abbe373 100644 --- a/pkgs/p2p_core/Cargo.toml +++ b/pkgs/p2p_core/Cargo.toml @@ -39,12 +39,12 @@ portable = [ [dependencies] bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] } cfg-if = "1" -dash-num = { version = "0.1.0-beta", path = "../num", features = ["codec"] } -dash-pkc = { version = "0.1.0-beta", path = "../pkc", features = ["codec"] } +dash-num = { version = "0.2.0-beta", path = "../num", features = ["codec"] } +dash-pkc = { version = "0.2.0-beta", path = "../pkc", features = ["codec"] } dash-script = { version = "0.0.0", path = "../script" } dash-params = { version = "0.0.0", path = "../params" } dash-primitives = { version = "0.0.0", path = "../primitives" } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "codec", ] } serde = { workspace = true, features = [ diff --git a/pkgs/params/Cargo.toml b/pkgs/params/Cargo.toml index 3caef4c88..a77305fd2 100644 --- a/pkgs/params/Cargo.toml +++ b/pkgs/params/Cargo.toml @@ -21,10 +21,10 @@ portable = ["dash-primitives/portable", "dash-script/portable"] [dependencies] bitcoin-primitives = { workspace = true, features = ["alloc"] } bitcoin-units = { workspace = true, features = ["alloc"] } -dash-num = { version = "0.1.0-beta", path = "../num", features = ["codec"] } +dash-num = { version = "0.2.0-beta", path = "../num", features = ["codec"] } dash-primitives = { version = "0.0.0", path = "../primitives" } dash-script = { version = "0.0.0", path = "../script" } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "codec", ] } hex-conservative = { workspace = true } diff --git a/pkgs/pkc/CHANGELOG.md b/pkgs/pkc/CHANGELOG.md index 03ea7e3d8..a1ca2b9aa 100644 --- a/pkgs/pkc/CHANGELOG.md +++ b/pkgs/pkc/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +## [0.2.0-beta] - 2026-10-20 + ### Added - `Bls{Public,Secret}Key::negate`, `BlsSecretKey::mul_tweak`, `EcdsaPublicKey::negate` and `EcdsaSecretKey::mul_tweak`. @@ -26,43 +28,46 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - **The minimum supported Rust version is raised from 1.85 to 1.89.** - **`bls` requires ADX on x86_64 unless `portable` is enabled.** -- Decoding `BlsIesMultiBytes` rejects more than `MAX_IES_RECIPIENTS` ciphertexts, the most any operation accepts. -- `BlsSecretKey::sign`, `BlsSkShare::sign`, `BlsPublicKey::verify` and `BlsSignature::{fast,secure}_verify_aggregates` - gain a `_digest` suffix and take a 32-byte hashed message. `BlsSignature::verify_aggregates` is renamed to - `verify_aggregates_digests` and takes `&[[u8; 32]]`. `BlsScheme::msg_ref` is renamed to `digest_msg`, and - `BlsScheme::Msg` is passed by value as `Msg<'a>`. -- `EcdsaSecretKey::sign` and `EcdsaPublicKey::verify` are renamed to `sign_digest` and `verify_digest`. - `EddsaSecretKey::sign` and `EddsaPublicKey::verify` are renamed to `sign_message` and `verify_message`. -- `BlsScheme::sk_to_bytes` returns `Zeroizing<[u8; 32]>` instead of a bare array. Code that binds the result as - `[u8; 32]` must dereference it. -- `EcdsaSecretKey::negate` takes `&self` and returns the negated key as `Result` instead of negating - in place and returning `()`, matching the other tweaks. A call that drops the return value still compiles, warned of - only by `unused_must_use`, but leaves the key as it was. Callers must bind the result, e.g. `sk = sk.negate()?`. -- The following types serialize as raw bytes for machine-readable formats, following changes to `dash-types` and +- **Signing and verification methods are renamed to name their input.** + - `BlsSecretKey::sign`, `BlsSkShare::sign`, `BlsPublicKey::verify` and + `BlsSignature::{fast,secure}_verify_aggregates` gain a `_digest` suffix and take a 32-byte hashed message. + - `BlsSignature::verify_aggregates` is renamed to `verify_aggregates_digests` and takes `&[[u8; 32]]`. + - `BlsScheme::msg_ref` is renamed to `digest_msg`, and `BlsScheme::Msg` is passed by value as `Msg<'a>`. + - `EcdsaSecretKey::sign` and `EcdsaPublicKey::verify` are renamed to `sign_digest` and `verify_digest`. + - `EddsaSecretKey::sign` and `EddsaPublicKey::verify` are renamed to `sign_message` and `verify_message`. +- **`EcdsaSecretKey::negate` takes `&self` and returns the negated key as `Result`.** It previously + negated in place and returned `()`, and now matches the other tweaks. A call that drops the return value still + compiles, though warned if `unused_must_use` is enabled, but would otherwise leave the key as-is. Callers must bind + the result, e.g. `sk = sk.negate()?`. +- **`EcdsaPublicKey::verify_digest` normalizes S before verifying**, so a high-S signature verifies like its low-S + twin. Callers refusing malleable signatures should check with `EcdsaSignature::is_low_s`. +- **`BlsPkBytes`, `BlsSkBytes`, `BlsSigBytes`, `BlsPkHash`, `BlsDhBytes`, `BlsIesBlobBytes` and `BlsIesMultiBytes` drop + their scheme parameter.** Callers drop the type argument and define the scheme when they exercise the operational + type with `to::()`. +- **The following types serialize as raw bytes for machine-readable formats**, following changes to `dash-types` and `dash-num`. JSON and other human-readable formats are unaffected by this change. `BlsPkBytes`, `BlsSigBytes`, `BlsPkHash`, `BlsShareId`, `BlsIes{Blob,Multi}Bytes`, `BlsPublicKey`, `BlsSignature`, `Bls{Pk,Sig}Share`, `BlsIes{Blob,Multi}`, `EcdsaPkBytes`, `EcdsaSigBytes`, `EcdsaRecSigBytes`, `EcdsaPkHash`, `EcdsaPublicKey`, `EcdsaSignature`, `EcdsaRecSignature`, `EddsaPkBytes`, `EddsaSigBytes`, `EddsaPkHash`, `EddsaPublicKey`, `EddsaSignature`. -- The `serde` feature no longer implies `codec`. `BlsIes{Blob,Multi}` and `BlsIes{Blob,Multi}Bytes` serialize as - their wire image and implement `Serialize` and `Deserialize` only with both features. Callers that relied on `serde` - to enable `codec` must enable it explicitly. -- `BlsPkBytes`, `BlsSkBytes`, `BlsSigBytes`, `BlsPkHash`, `BlsDhBytes`, `BlsIesBlobBytes` and `BlsIesMultiBytes` drop - their scheme parameter. Callers remove the type argument and pick the scheme when they convert with `to::()`. -- `EcdsaRecSigBytes::from_raw` is renamed to `from_bytes`, with unchanged behaviour. +- **The `serde` feature no longer implies `codec`.** `BlsIes{Blob,Multi}` and `BlsIes{Blob,Multi}Bytes` serialize as + their wire image and implement `Serialize` and `Deserialize` only with `serde` and `codec` enabled, serving as the exception. -### Fixed - -- Decoding `BlsIes{Blob,Multi}Bytes`, and so `BlsIes{Blob,Multi}`, rejects a ciphertext length, blob count or blob - length above `MAX_SER_SIZE` even when enough bytes remain, and reports one past the remaining input as - `DecodeError::Eof`. -- `EcdsaPublicKey::verify_digest` normalizes S before verifying, so a high-S signature verifies like its low-S twin. - Callers refusing malleable signatures check `EcdsaSignature::is_low_s`. + - Callers that relied on `serde` + to enable `codec` must enable it explicitly. +- Decoding `BlsIes{Blob,Multi}Bytes` (and by extension `BlsIes{Blob,Multi}`), enforces limits on lengths and counts. + - A ciphertext length, blob count or blob length above `MAX_SER_SIZE` is rejected even when enough bytes remain. + - A value past the remaining input is reported as `DecodeError::Eof`. + - `BlsIesMultiBytes` rejects more than `MAX_IES_RECIPIENTS` ciphertexts. +- `BlsScheme::sk_to_bytes` returns `Zeroizing<[u8; 32]>` instead of a bare array. Code that binds the result as + `[u8; 32]` must dereference it. +- `EcdsaRecSigBytes::from_raw` is renamed to `from_bytes`. ## [0.1.0-beta] - 2026-09-15 - Initial release. -[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-pkc-0.1.0-beta...HEAD +[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-pkc-0.2.0-beta...HEAD +[0.2.0-beta]: https://github.com/dashpay/base-sdk/compare/dash-pkc-0.1.0-beta...dash-pkc-0.2.0-beta [0.1.0-beta]: https://github.com/dashpay/base-sdk/releases/tag/dash-pkc-0.1.0-beta diff --git a/pkgs/pkc/Cargo.toml b/pkgs/pkc/Cargo.toml index 2ee321836..e10c6faab 100644 --- a/pkgs/pkc/Cargo.toml +++ b/pkgs/pkc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-pkc" -version = "0.1.0-beta" +version = "0.2.0-beta" description = "Cryptographic primitives for the Dash Base SDK" keywords = ["base-sdk", "dash", "dashcore", "dashpay"] categories = [ @@ -33,8 +33,8 @@ base58ck = { workspace = true, optional = true, features = ["alloc"] } bitcoin_hashes = { workspace = true, features = ["alloc"] } blst = { version = "0.3", default-features = false, optional = true } cfg-if = "1" -dash-num = { version = "0.1.0-beta", path = "../num", default-features = false } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false } +dash-num = { version = "0.2.0-beta", path = "../num", default-features = false } +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false } ed25519-dalek = { version = "3", default-features = false, features = [ "fast", "rand_core", diff --git a/pkgs/pkc/README.md b/pkgs/pkc/README.md index 929c3a6e2..edb50ea2f 100644 --- a/pkgs/pkc/README.md +++ b/pkgs/pkc/README.md @@ -28,7 +28,7 @@ consensus-stable types, including To import `dash-pkc` to your project, add the following to the `[dependencies]` section in `Cargo.toml` ```toml -dash-pkc = "0.1.0-beta" +dash-pkc = "0.2.0-beta" ``` To use an unpublished revision of this crate, identify the commit hash to pin against and use the following replacing diff --git a/pkgs/primitives/Cargo.toml b/pkgs/primitives/Cargo.toml index d13af793c..4a3f776a1 100644 --- a/pkgs/primitives/Cargo.toml +++ b/pkgs/primitives/Cargo.toml @@ -42,15 +42,15 @@ bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] } bitcoin-primitives = { workspace = true, features = ["alloc"] } bitcoin_hashes = { workspace = true, features = ["alloc"] } bitcoin-units = { workspace = true, features = ["alloc"] } -dash-num = { version = "0.1.0-beta", path = "../num", features = ["codec"] } -dash-pkc = { version = "0.1.0-beta", path = "../pkc", default-features = false, features = [ +dash-num = { version = "0.2.0-beta", path = "../num", features = ["codec"] } +dash-pkc = { version = "0.2.0-beta", path = "../pkc", default-features = false, features = [ "bls", "codec", "ecdsa", ] } dash-pow = { version = "0.0.0", path = "../pow" } dash-script = { version = "0.0.0", path = "../script" } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "bitcoin-primitives", "codec", ] } diff --git a/pkgs/script/Cargo.toml b/pkgs/script/Cargo.toml index 391469c64..adcdeaddb 100644 --- a/pkgs/script/Cargo.toml +++ b/pkgs/script/Cargo.toml @@ -27,11 +27,11 @@ serde = ["dep:serde", "dash-pkc/serde", "dash-types/serde"] [dependencies] base58ck = { workspace = true, features = ["alloc"] } bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] } -dash-num = { version = "0.1.0-beta", path = "../num", default-features = false } -dash-pkc = { version = "0.1.0-beta", path = "../pkc", default-features = false, features = [ +dash-num = { version = "0.2.0-beta", path = "../num", default-features = false } +dash-pkc = { version = "0.2.0-beta", path = "../pkc", default-features = false, features = [ "codec", ] } -dash-types = { version = "0.1.0-beta", path = "../types", default-features = false, features = [ +dash-types = { version = "0.2.0-beta", path = "../types", default-features = false, features = [ "bitcoin-primitives", "codec", ] } diff --git a/pkgs/types/CHANGELOG.md b/pkgs/types/CHANGELOG.md index 9859efed0..20658402e 100644 --- a/pkgs/types/CHANGELOG.md +++ b/pkgs/types/CHANGELOG.md @@ -8,66 +8,69 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +## [0.2.0-beta] - 2026-10-20 + ### Added - Implementation of `LowerHex`, `UpperHex`, `FromStr`, `From<&[u8; N]>` and `TryFrom<&[u8]>` for `{derive,make}_bytes!`. - `ParseHexError` is moved from `dash-num`, superseding `dash_num::ParseHexError`. - `serialize::hex::serialize_as` and `serialize::hex::deserialize_as`, to permit caller-defined handling of human-readable encoding while sharing common machine-readable encoding. -- `CompactSize::decode_unbounded`, which decodes a value read as a number rather than a size, such as service flags, +- `CompactSize::decode_unbounded`, decoding a value read as a number rather than a size, such as service flags, without the `MAX_SER_SIZE` range check. -- `CompactSize::decode_len`, which decodes a length or count prefix range-checked as by `CompactSize::decode` and +- `CompactSize::decode_len`, decoding a length or count prefix range-checked like `CompactSize::decode` and bounded by a caller limit and the remaining input. - `Signable`, a trait for consensus types that hold a signature. `Signable::payload` returns the 32-byte digest the - key signs, `Signable::set_signature` stores a signature only if it verifies against the supplied key and - `Signable::reset_signature` removes it. -- `CompactSize::decode_as`, with the sealed `CompactUint` trait, for CompactSize-encoded integer fields bounded by both + key signs, `Signable::set_signature` stores a signature if it verifies against the supplied key and + `Signable::reset_signature` drops the signature. +- `CompactSize::decode_as`, with the sealed `CompactUint` trait, for `CompactSize`-encoded integer fields bounded by both `MAX_SER_SIZE` and their type. -- `codec::decode_vec`, which reads a CompactSize-prefixed vector and rejects a count above a caller limit before any +- `codec::decode_vec` reads a CompactSize-prefixed vector and rejects a count above a caller limit before any element is decoded or allocated. ### Changed - **The minimum supported Rust version is raised from 1.85 to 1.89.** -- **Decoding a `CompactSize` rejects a value above `MAX_SER_SIZE`.** Callers reading a value as a number rather than a - size must switch to `CompactSize::decode_unbounded`. -- `{derive,make}_bytes!`-defined types serialize as their raw storage bytes for machine-readable formats. JSON and - other human-readable formats retain hex in storage order for `fwd` and in reverse storage order for `rev`. -- `derive_bytes!` emits `From<[u8; N]>` in place of `impl_bytes!`, and `make_sbytes!` emits the implementation itself. - Callers of `impl_bytes!` without `derive_bytes!` must now write the conversion manually. - - As a result, both `make_bytes!` and `make_sbytes!` carry it with `nocodec` tag and without the `codec` feature and - callers that wrote the conversion manually for those configurations must drop it. -- The `serde` feature no longer implies `codec`. `impl_num!` is available without `codec` and emits its `serde` - implementation independently, as does `make_num!`. Callers that relied on `serde` to enable `codec` must enable it +- **Decoding a `CompactSize` rejects a value above `MAX_SER_SIZE`.** Callers reading a value as a number (instead of a + size) must switch to `CompactSize::decode_unbounded`. +- **Machine-readable formats receive raw bytes in place of hex or strings.** JSON and other human-readable formats are + unaffected unless noted. + - `{derive,make}_bytes!`-defined types serialize as their raw storage bytes. Human-readable formats retain hex in + storage order for `fwd` and in reverse storage order for `rev`. + - `serialize::hex` writes raw bytes instead of a hex-encoded string. + - `serialize::str_u64` writes a native `u64` to work around number-precision limitations in JSON and is now + confined to human-readable formats. + - `serialize::utf8_lossy` writes raw bytes, or a string only for human-readable formats and valid UTF-8, and reads + back in the same manner so round trips succeed. +- **The `serde` feature no longer implies `codec`.** `impl_num!` and `make_num!` are available without `codec` and emit + their `serde` implementation independently. Callers that relied on `serde` to enable `codec` must enable it explicitly. -- The `zeroize` export is moved from the crate root to `__deps`. Callers must switch to `dash_types::__deps::zeroize`. -- Types using `derive_bytes!` that implemented `From<&[u8; N]>`, `TryFrom<&[u8]>`, `FromStr`, `LowerHex` or `UpperHex` - manually must drop those implementations, as `derive_bytes!` now emits them. -- `serialize::hex` writes raw bytes for machine-readable formats instead of emitting a hex-encoded string. +- `bool` decodes any non-zero byte as `true` instead of rejecting bytes above `1`. Encoding still writes `0` or + `1`, so a decoded byte above `1` **does not round-trip**. +- Decoding `Vec`, `String` and script buffers treats length prefixes differently. + - A prefix above `MAX_SER_SIZE` is rejected even when enough bytes remain. + - A prefix past the remaining input is reported as `DecodeError::Eof` instead of `CompactSizeExceedsLimit`. + - `Vec` reserves each batch exactly rather than growing its capacity geometrically past the batch. +- `derive_bytes!` emits `From<[u8; N]>` in place of `impl_bytes!`. `make_sbytes!` emits the implementation itself. + Callers of `impl_bytes!` without `derive_bytes!` must now write the conversion manually. + - `make_bytes!` and `make_sbytes!` therefore emit `From<[u8; N]>` even with the `nocodec` tag or without the `codec` + feature, where it was previously absent. Callers that wrote the conversion manually for those configurations must + drop it. + - `derive_bytes!` (and by extension `make_bytes!`) also emits `From<&[u8; N]>`, `TryFrom<&[u8]>`, `FromStr`, + `LowerHex` and `UpperHex`, while `make_sbytes!` does not. Types using `derive_bytes!` or `make_bytes!` that + implemented them manually must drop those implementations. - `serialize::hex::deserialize` returns any `T` built from a byte slice instead of `Vec`. Callers that relied on `Vec` as the fixed return type must now mention it explicitly. -- `serialize::str_u64` writes a native `u64` to machine-readable formats. `str_u64` is a workaround for number-precision - limitations in JSON and is now contained only for human-readable formats. -- Decoding `Vec`, `String` and script buffers reports a length prefix past the remaining input as - `DecodeError::Eof` rather than as `CompactSizeExceedsLimit`. -- Decoding `Vec` reserves each batch exactly rather than growing its capacity geometrically past the batch. -- **`bool` decodes any non-zero byte as `true` instead of rejecting bytes above `1`.** Encoding still writes `0` or - `1`, so a decoded byte above `1` does not round-trip. +- The `zeroize` export is moved from the crate root to `__deps`. Callers must switch to `dash_types::__deps::zeroize`. ### Removed - The `codec::Checkable` and `codec::Hashable` compatibility aliases in favour of exports from the crate root. -### Fixed - -- Decoding `Vec`, `String` and script buffers rejects a length prefix above `MAX_SER_SIZE` even when enough bytes - remain. -- `serialize::utf8_lossy`'s serializer and deserializer arms were not in sync, writing valid UTF-8 as a string for - machine-readable formats but expecting byte buffers when reading, failing round trips. This has since been resolved. - ## [0.1.0-beta] - 2026-09-14 - Initial release. -[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-types-0.1.0-beta...HEAD +[unreleased]: https://github.com/dashpay/base-sdk/compare/dash-types-0.2.0-beta...HEAD +[0.2.0-beta]: https://github.com/dashpay/base-sdk/compare/dash-types-0.1.0-beta...dash-types-0.2.0-beta [0.1.0-beta]: https://github.com/dashpay/base-sdk/releases/tag/dash-types-0.1.0-beta diff --git a/pkgs/types/Cargo.toml b/pkgs/types/Cargo.toml index a30e2ee2b..9983328b2 100644 --- a/pkgs/types/Cargo.toml +++ b/pkgs/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-types" -version = "0.1.0-beta" +version = "0.2.0-beta" description = "Fixed-width and buffered type (de)serialization for the Dash Base SDK" keywords = ["base-sdk", "dash", "dashcore", "dashpay"] categories = [ diff --git a/pkgs/types/README.md b/pkgs/types/README.md index 306efdd16..0647e61a9 100644 --- a/pkgs/types/README.md +++ b/pkgs/types/README.md @@ -19,7 +19,7 @@ for the Base SDK's higher level types, including To import `dash-types` to your project, add the following to the `[dependencies]` section in `Cargo.toml` ```toml -dash-types = "0.1.0-beta" +dash-types = "0.2.0-beta" ``` To use an unpublished revision of this crate, identify the commit hash to pin against and use the following replacing