Skip to content

Commit 95d739b

Browse files
authored
feat: implement SyncAggregatorSelectionData container (#900)
1 parent 9ff447a commit 95d739b

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
defmodule Types.SyncAggregatorSelectionData do
2+
@moduledoc """
3+
Struct definition for `SyncAggregatorSelectionData`.
4+
"""
5+
use LambdaEthereumConsensus.Container
6+
7+
fields = [:slot, :subcommittee_index]
8+
9+
@enforce_keys fields
10+
defstruct fields
11+
12+
@type t :: %__MODULE__{
13+
slot: Types.slot(),
14+
subcommittee_index: Types.uint64()
15+
}
16+
17+
@impl LambdaEthereumConsensus.Container
18+
def schema do
19+
[
20+
slot: TypeAliases.slot(),
21+
subcommittee_index: TypeAliases.uint64()
22+
]
23+
end
24+
end

test/spec/runners/ssz_static.ex

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ defmodule SszStaticTestRunner do
1515
use ExUnit.CaseTemplate
1616
use TestRunner
1717

18+
@only_ssz_ex [Types.Eth1Block, Types.SyncAggregatorSelectionData]
19+
1820
@disabled [
1921
# "DepositData",
2022
# "DepositMessage",
@@ -50,19 +52,18 @@ defmodule SszStaticTestRunner do
5052
# "BeaconBlockBody",
5153
# "BeaconState",
5254
# "SignedAggregateAndProof",
55+
# "Eth1Block",
56+
# "SyncAggregatorSelectionData",
5357
# -- not defined yet
5458
"LightClientBootstrap",
5559
"LightClientOptimisticUpdate",
5660
"LightClientUpdate",
57-
# "Eth1Block",
61+
"LightClientFinalityUpdate",
62+
"LightClientHeader",
5863
"PowBlock",
5964
"SignedContributionAndProof",
60-
"SignedData",
61-
"SyncAggregatorSelectionData",
6265
"SyncCommitteeContribution",
6366
"ContributionAndProof",
64-
"LightClientFinalityUpdate",
65-
"LightClientHeader",
6667
"SyncCommitteeMessage"
6768
]
6869

@@ -120,7 +121,7 @@ defmodule SszStaticTestRunner do
120121
{:ok, serialized_by_ssz_ex} = SszEx.encode(real_deserialized, schema)
121122
assert serialized_by_ssz_ex == real_serialized
122123

123-
if schema not in [Types.Eth1Block] do
124+
if schema not in @only_ssz_ex do
124125
{:ok, deserialized_by_nif} = Ssz.from_ssz(real_serialized, schema)
125126
assert Diff.diff(deserialized_by_ssz_ex, deserialized_by_nif) == :unchanged
126127

0 commit comments

Comments
 (0)