atproto utils for zig zat.dev
atproto sdk zig

mst: keep (cid, encoded) cache consistent in nodeCid master

the encoding-cache commit had a corruption bug: nodeCid (the rootCid path) re-serializes dirty nodes and clears dirty, but did not refresh Node.encoded — so a subsequent collectBlocks paired the NEW cid with the STALE cached bytes. any CAR written after the second commit cycle failed reload with BadBlockHash. nodeCid now caches the encoding alongside the cid. invariant stated in a comment: anything clearing dirty after serializing must keep the (cid, encoded) pair consistent. adds a regression test that runs five put/rootCid/collectBlocks cycles and verifies every emitted block hashes to its declared cid. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>


+36 -1
1 changed file