From 8cde4c81e1d9c21861af4d0ddba3217737ded83c Mon Sep 17 00:00:00 2001 From: James Wilson Date: Mon, 18 Nov 2024 15:19:01 +0000 Subject: [PATCH] Prep to release 3.7.0 (#646) * Prep to release 3.7.1 * Consistify some fields and version across workspace * require only derive 3.6.8 or above to avoid ddry-run CI issue. 3.7.1 should be selected anyway * Go down to 3.7.0 - that version wasn't released yet * Add other recent changes * trailing newline * Set MSRV to 1.79 since we get compile errors on earlier versions * Add CountedInput to changelog Co-authored-by: Guillaume Thiolliere * clippy * update release date --------- Co-authored-by: Guillaume Thiolliere --- CHANGELOG.md | 16 ++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 25 +++++++++++++++++-------- derive/Cargo.toml | 12 ++++++------ src/counted_input.rs | 6 ++---- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a09d55d..99bbd26f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ All notable changes to this crate are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this crate adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.7.0] - 2024-11-18 + +### Added + +- Allow decoding with a memory limit. ([616](https://github.com/paritytech/parity-scale-codec/pull/616)) +- Introduce `CountedInput`, an wrapper on `Input` that counts the bytes read. ([630](https://github.com/paritytech/parity-scale-codec/pull/630)) + +### Changed + +- This release bumps some dependencies, primarily bumping `syn` to 2. ([#640](https://github.com/paritytech/parity-scale-codec/pull/640)). + +### Fixed + +- Fix MaxEncodedLen derive macro for enum with skipped variant ([#622](https://github.com/paritytech/parity-scale-codec/pull/622)) +- Use MAX_PREALLOCATION consistently [#605](https://github.com/paritytech/parity-scale-codec/pull/605) + ## [3.6.4] - 2023-07-14 ### Added diff --git a/Cargo.lock b/Cargo.lock index 8e15ef8c..dcfe71ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -597,7 +597,7 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.8" +version = "3.7.0" dependencies = [ "parity-scale-codec", "proc-macro-crate", diff --git a/Cargo.toml b/Cargo.toml index d55431be..470c963e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,19 @@ [package] name = "parity-scale-codec" description = "SCALE - Simple Concatenating Aggregated Little Endians" -version = "3.7.0" -authors = ["Parity Technologies "] -license = "Apache-2.0" -repository = "https://github.com/paritytech/parity-scale-codec" -categories = ["encoding"] -edition = "2021" +version.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +categories.workspace = true +edition.workspace = true build = "build.rs" -rust-version = "1.60.0" +rust-version.workspace = true [dependencies] arrayvec = { version = "0.7", default-features = false } serde = { version = "1.0.215", default-features = false, optional = true } -parity-scale-codec-derive = { path = "derive", version = ">= 3.6.8", default-features = false, optional = true } +parity-scale-codec-derive = { path = "derive", version = "3.6.8", default-features = false, optional = true } bitvec = { version = "1", default-features = false, features = ["alloc"], optional = true } bytes = { version = "1", default-features = false, optional = true } byte-slice-cast = { version = "1.2.2", default-features = false } @@ -62,3 +62,12 @@ full = [] [workspace] members = ["derive", "fuzzer"] + +[workspace.package] +version = "3.7.0" +authors = ["Parity Technologies "] +license = "Apache-2.0" +repository = "https://github.com/paritytech/parity-scale-codec" +categories = ["encoding"] +edition = "2021" +rust-version = "1.79.0" diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 5255b4a3..e930d088 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "parity-scale-codec-derive" description = "Serialization and deserialization derive macro for Parity SCALE Codec" -version = "3.6.8" -authors = ["Parity Technologies "] -license = "Apache-2.0" -edition = "2021" -rust-version = "1.56.1" -repository = "https://github.com/paritytech/parity-scale-codec" +version.workspace = true +authors.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true +rust-version.workspace = true [lib] proc-macro = true diff --git a/src/counted_input.rs b/src/counted_input.rs index d25cb410..7cbae64b 100644 --- a/src/counted_input.rs +++ b/src/counted_input.rs @@ -40,16 +40,14 @@ impl crate::Input for CountedInput<'_, I> { } fn read(&mut self, into: &mut [u8]) -> Result<(), crate::Error> { - self.input.read(into).map(|r| { + self.input.read(into).inspect(|_r| { self.counter = self.counter.saturating_add(into.len().try_into().unwrap_or(u64::MAX)); - r }) } fn read_byte(&mut self) -> Result { - self.input.read_byte().map(|r| { + self.input.read_byte().inspect(|_r| { self.counter = self.counter.saturating_add(1); - r }) }