diff --git a/lib/spec/runners/helpers/ssz_static_containers/small_test_struct.ex b/lib/spec/runners/helpers/ssz_static_containers/small_test_struct.ex index c2f83c00b..b54f8e8d7 100644 --- a/lib/spec/runners/helpers/ssz_static_containers/small_test_struct.ex +++ b/lib/spec/runners/helpers/ssz_static_containers/small_test_struct.ex @@ -9,14 +9,12 @@ defmodule Helpers.SszStaticContainers.SmallTestStruct do :B ] - @type uint16 :: 0..unquote(2 ** 16 - 1) - @enforce_keys fields defstruct fields @type t :: %__MODULE__{ - A: uint16(), - B: uint16() + A: SszTypes.uint16(), + B: SszTypes.uint16() } @impl LambdaEthereumConsensus.Container diff --git a/lib/spec/runners/helpers/ssz_static_containers/var_test_struct.ex b/lib/spec/runners/helpers/ssz_static_containers/var_test_struct.ex index f9ddc0816..60d750e41 100644 --- a/lib/spec/runners/helpers/ssz_static_containers/var_test_struct.ex +++ b/lib/spec/runners/helpers/ssz_static_containers/var_test_struct.ex @@ -10,14 +10,12 @@ defmodule Helpers.SszStaticContainers.VarTestStruct do :C ] - @type uint16 :: 0..unquote(2 ** 16 - 1) - @enforce_keys fields defstruct fields @type t :: %__MODULE__{ - A: uint16(), - B: list(uint16()), + A: SszTypes.uint16(), + B: list(SszTypes.uint16()), C: SszTypes.uint8() } diff --git a/lib/spec/runners/ssz_generic.ex b/lib/spec/runners/ssz_generic.ex index b53c49537..75a99e13b 100644 --- a/lib/spec/runners/ssz_generic.ex +++ b/lib/spec/runners/ssz_generic.ex @@ -96,20 +96,25 @@ defmodule SszGenericTestRunner do "containers" -> [name] = Regex.run(~r/^[^_]+(?=_)/, cse) {:container, Module.concat(Helpers.SszStaticContainers, name)} + + # TODO enable when basic_vector and bitlist tests are enable # "basic_vector" -> # case cse do # "vec_" <> rest -> # case String.split(rest, "_") do - # ["bool", max_size | _] -> {:vector, :bool, String.to_integer(max_size)} + # ["bool", max_size | _] -> + # {:vector, :bool, String.to_integer(max_size)} + # # ["uint" <> size, max_size | _] -> - # {:vector, {:int, String.to_integer(size)}, String.to_integer(max_size)} + # {:vector, {:int, String.to_integer(size)}, String.to_integer(max_size)} # end # end + # # "bitlist" -> # case cse do # "bitlist_" <> rest -> # [size | _] = String.split(rest, "_") - # {:bitlist, :bool, String.to_integer(size)} + # {:bitlist, String.to_integer(size)} # end end end diff --git a/lib/ssz_types/mod.ex b/lib/ssz_types/mod.ex index b471ac074..9da84782e 100644 --- a/lib/ssz_types/mod.ex +++ b/lib/ssz_types/mod.ex @@ -6,6 +6,7 @@ defmodule SszTypes do # Primitive types ## Integer types @type uint8 :: 0..unquote(2 ** 8 - 1) + @type uint16 :: 0..unquote(2 ** 16 - 1) @type uint64 :: 0..unquote(2 ** 64 - 1) @type uint256 :: 0..unquote(2 ** 256 - 1)