Canonical V1 payload bytes: magic prefix + deterministic encoding.
(&self)
| 289 | impl GitStateBindingPayload { |
| 290 | /// Canonical V1 payload bytes: magic prefix + deterministic encoding. |
| 291 | pub fn canonical_payload_bytes(&self) -> Result<Vec<u8>, BindingEncodeError> { |
| 292 | let encoded = postcard::to_allocvec(self) |
| 293 | .map_err(|error| BindingEncodeError::Encode(error.to_string()))?; |
| 294 | let mut bytes = Vec::with_capacity(BINDING_MAGIC.len() + encoded.len()); |
| 295 | bytes.extend_from_slice(BINDING_MAGIC); |
| 296 | bytes.extend_from_slice(&encoded); |
| 297 | Ok(bytes) |
| 298 | } |
| 299 | |
| 300 | /// Recompute `closure_root` over the ordered change hashes. |
| 301 | pub fn compute_closure_root(&self) -> Hash { |