Movement has merged a critical bug fix in Aptos Core that resolves an asymmetry in the Move VM value codec for enum (RuntimeVariants) values. The issue allowed serialization to silently accept out-of-range variant tags that deserialization would later reject, creating a dangerous serialize/deserialize mismatch.
The Problem
A RuntimeVariants value carries a u16 variant tag. When a value was serialized against a layout that did not describe its tag—for example, a layout cached from before an enum upgrade introduced the variant—the resulting bytes would be rejected during deserialization. This asymmetry could wedge state (a resource that could be written but never read back) or contribute to block-level failures.
The specific gap was zero-field out-of-range tags: a tag with a non-empty payload was already caught by existing field-count checks, but a zero-field tag slipped through and silently serialized as a unit variant, becoming indistinguishable from a valid variant.
The Fix
PR #411, authored by seanyoung, updates serialization to reject out-of-range variant tags, ensuring both halves of the codec agree. Testing includes unit tests verifying that zero-field out-of-range tags (3, 4, 100, u16::MAX) fail to serialize while genuine unit variants still round-trip correctly. End-to-end tests confirm the fix handles enum upgrades and variant mutations correctly, even when performed in the same block.
This fix strengthens the resilience of the Movement network's core VM by eliminating a subtle but potentially catastrophic serialization vulnerability.
