From 0d136b0bd745b338f6efc3e30e97f961a91907df Mon Sep 17 00:00:00 2001 From: Marco Stronati Date: Wed, 13 Jun 2018 16:49:02 +0200 Subject: [PATCH] Environment: add Data_encoding.check_size --- src/lib_protocol_environment/sigs/v1/data_encoding.mli | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib_protocol_environment/sigs/v1/data_encoding.mli b/src/lib_protocol_environment/sigs/v1/data_encoding.mli index 99ee369be..aefcc4f89 100644 --- a/src/lib_protocol_environment/sigs/v1/data_encoding.mli +++ b/src/lib_protocol_environment/sigs/v1/data_encoding.mli @@ -263,3 +263,9 @@ module Binary : sig exception Write_error of write_error end + +(** [check_size size encoding] ensures that the binary encoding + of a value will not be allowed to exceed [size] bytes. The reader + and the writer fails otherwise. This function do not modify + the JSON encoding. *) +val check_size : int -> 'a encoding -> 'a encoding