diff --git a/components/persistent_data/README.md b/components/persistent_data/README.md index 54de4c3511..2d615a65be 100644 --- a/components/persistent_data/README.md +++ b/components/persistent_data/README.md @@ -175,10 +175,11 @@ A version number reused for a different layout therefore loads with `layout_mismatch` instead of producing garbage, and a reader without the C++ type (a Python tool) can compute the same fingerprint from a field spec. -alpaca's own `with_version` option is deliberately not used: its hash folds -`sizeof(struct)` in, which differs between a 32-bit ESP32 and a 64-bit host -(a struct of a string, a vector and an integer is 40 bytes on the ESP32, 56 on -macOS and 64 on Linux), so a file written on one would not load on the other. +alpaca's own `with_version` option is not used: the fingerprint above covers +more (enum underlying types, array lengths) and is computable from a field spec +by a reader without the C++ type. (Before alpaca #56 the alpaca hash also folded +`sizeof(struct)` in, which differs between a 32-bit ESP32 and a 64-bit host, so +a file written on one would not have loaded on the other.) ## Errors diff --git a/components/persistent_data/include/detail/persistent_data_codec.hpp b/components/persistent_data/include/detail/persistent_data_codec.hpp index b2214f4f10..5e57f10be9 100644 --- a/components/persistent_data/include/detail/persistent_data_codec.hpp +++ b/components/persistent_data/include/detail/persistent_data_codec.hpp @@ -42,11 +42,12 @@ namespace espp::persistent_data { /// @brief Serialization options used for the payload. /// @details `strict` rejects payloads that are shorter than the type; /// `fixed_length_encoding` keeps the encoding independent of the -/// values stored. alpaca's own `with_version` is deliberately not used: -/// its hash folds `sizeof(struct)` in, which differs between a 32-bit -/// ESP32 and a 64-bit host, so a file written on one would not load on -/// the other. The header's layout fingerprint (see layout::fingerprint) -/// plays that role portably. +/// values stored. alpaca's own `with_version` is not used: the header's +/// layout fingerprint (see layout::fingerprint) plays that role, and it +/// also encodes enum underlying types and array lengths and can be +/// computed from a field spec by a reader without the C++ type. (Before +/// alpaca #56 the alpaca hash also folded `sizeof(struct)` in, which +/// differs between a 32-bit ESP32 and a 64-bit host.) inline constexpr alpaca::options SERIALIZATION_OPTIONS = alpaca::options::fixed_length_encoding | alpaca::options::strict; diff --git a/components/serialization/detail/alpaca b/components/serialization/detail/alpaca index 83a592f0c3..8f022bdb51 160000 --- a/components/serialization/detail/alpaca +++ b/components/serialization/detail/alpaca @@ -1 +1 @@ -Subproject commit 83a592f0c3807500f1aaf3b07fd48105a01e2780 +Subproject commit 8f022bdb510600f3e569bf05fc33b11dd7bd27c4