Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add digestable witnesses of binary codecs #32

Open
craigfe opened this issue Jan 4, 2021 · 0 comments · May be fixed by #34
Open

Add digestable witnesses of binary codecs #32

craigfe opened this issue Jan 4, 2021 · 0 comments · May be fixed by #34

Comments

@craigfe
Copy link
Member

craigfe commented Jan 4, 2021

Currently, there is no clean way to test that a refactoring of represented types does not change the binary encoding of those types. This requires us to be very cautious when changing types that might effect production systems – e.g. Tezos – and is particularly problematic when using ppx_repr, where the type representation does not show up in diffs.

To fix this problem, we should expose something like a "witness" of a particular binary codec that can be checked for equality:

type shape [@@deriving repr]
val of_type : 'a ty -> shape

with the idea being that equality of shapes implies equivalence of derived binary codecs. User libraries could then write expect tests of the digests of these shapes, providing some assurance of codec compatibility across revisions.

@craigfe craigfe linked a pull request Jan 6, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant