Skip to content

Add Borsh serialization snapshot tests for contract state compatibility #2315

@gilcu3

Description

@gilcu3

Background

We have ABI snapshot tests (abi__abi_has_not_changed) that catch JSON schema changes, but there are no equivalent tests for Borsh serialization. Since the contract uses Borsh for on-chain state encoding (MpcContract and its nested types like ProtocolContractState, SignatureRequest, CKDRequest, VerifyForeignTransactionRequest, ProposedUpdates, etc.), an accidental change to Borsh layout (e.g. reordering fields, changing enum discriminants) could silently break contract state compatibility without any test failing.

For example, changing payload_version from u8 to a #[repr(u8)] enum is Borsh-compatible, but nothing currently verifies that.

Acceptance Criteria

  • Borsh serialization snapshot tests covering the full MpcContract state tree — all types reachable from MpcContract that are Borsh-serialized on chain
  • Tests fail when Borsh encoding changes unexpectedly

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions