Skip to main content

is_backward_readable

Function is_backward_readable 

Source
pub fn is_backward_readable(
    older: &LayoutManifest,
    newer: &LayoutManifest,
) -> bool
Expand description

Check if accounts written by newer can still be parsed by code expecting older.

Backward-readable means:

  • Same discriminator
  • All fields in older exist in newer with the same name, type, and size
  • No fields were reordered (shared prefix is intact)

This is useful for progressive rollouts: if backward-readable, both V(N) and V(N+1) code can coexist, reading each other’s accounts (V(N) ignores extra fields at the end).

Note: This does NOT mean no migration is needed – the layout_id will still differ, so strict loaders will reject the data. This checks the wire-level compatibility of the prefix.