Skip to content

Commit

Permalink
fix small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
f3r10 committed Dec 11, 2023
1 parent 4011efb commit c57aafc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
11 changes: 8 additions & 3 deletions lib/spec/runners/ssz_generic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/ssz_types/mod.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c57aafc

Please sign in to comment.