Add check for number of type variables in type signature (#512)

* Fix tvar string generation

* Add check for number of tvars in a single type signature

The number of tvars is limited by serialization (u8) to 255

* Added a comment in CHANGELOG

* Docs fixes

* Adding docs about the limitation on number of tvars

* Limit is 256, not 255

* Update CHANGELOG.md

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>

---------

Co-authored-by: Gaith Hallak <gaithhallak@gmail.com>
This commit is contained in:
Hans Svensson
2024-08-26 13:34:02 +02:00
committed by GitHub
parent 16308a7840
commit 927cd42592
6 changed files with 98 additions and 5 deletions
+4
View File
@@ -1302,6 +1302,10 @@ failing_contracts() ->
<<?Pos(3,9)
"The name of the compile-time constant cannot have pattern matching">>
])
, ?TYPE_ERROR(too_many_tvars,
[<<?Pos(2,3)
"Too many type variables (max 256) in definition of `too_many`">>
])
].
validation_test_() ->
+60
View File
@@ -0,0 +1,60 @@
contract C =
entrypoint too_many(
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _)) = 0
entrypoint not_too_many(
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _, _, _, _, _),
(_, _, _, _, _, _)) = 0