@@ -6,17 +6,25 @@ defmodule Fixtures.Block do
6
6
alias Fixtures.Random
7
7
alias LambdaEthereumConsensus.Utils.BitVector
8
8
9
- @ spec signed_beacon_block :: Types.SignedBeaconBlock . t ( )
9
+ alias Types.BeaconBlock
10
+ alias Types.BeaconBlockBody
11
+ alias Types.BeaconState
12
+ alias Types.ExecutionPayload
13
+ alias Types.ExecutionPayloadHeader
14
+ alias Types.SignedBeaconBlock
15
+ use HardForkAliasInjection
16
+
17
+ @ spec signed_beacon_block :: SignedBeaconBlock . t ( )
10
18
def signed_beacon_block do
11
- % Types. SignedBeaconBlock{
19
+ % SignedBeaconBlock {
12
20
message: beacon_block ( ) ,
13
21
signature: Random . bls_signature ( )
14
22
}
15
23
end
16
24
17
- @ spec beacon_block :: Types. BeaconBlock. t ( )
25
+ @ spec beacon_block :: BeaconBlock . t ( )
18
26
def beacon_block do
19
- % Types. BeaconBlock{
27
+ % BeaconBlock {
20
28
parent_root: Random . root ( ) ,
21
29
slot: Random . uint64 ( ) ,
22
30
proposer_index: Random . uint64 ( ) ,
@@ -25,21 +33,29 @@ defmodule Fixtures.Block do
25
33
}
26
34
end
27
35
28
- @ spec beacon_block_body :: Types. BeaconBlockBody. t ( )
36
+ @ spec beacon_block_body :: BeaconBlockBody . t ( )
29
37
def beacon_block_body do
30
- % Types.BeaconBlockBody {
31
- randao_reveal: Random . bls_signature ( ) ,
32
- eth1_data: eth1_data ( ) ,
33
- graffiti: Random . hash32 ( ) ,
34
- proposer_slashings: [ ] ,
35
- attester_slashings: [ ] ,
36
- attestations: [ ] ,
37
- deposits: [ ] ,
38
- voluntary_exits: [ ] ,
39
- sync_aggregate: sync_aggregate ( ) ,
40
- execution_payload: execution_payload ( ) ,
41
- bls_to_execution_changes: [ ]
42
- }
38
+ fields =
39
+ [
40
+ randao_reveal: Random . bls_signature ( ) ,
41
+ eth1_data: eth1_data ( ) ,
42
+ graffiti: Random . hash32 ( ) ,
43
+ proposer_slashings: [ ] ,
44
+ attester_slashings: [ ] ,
45
+ attestations: [ ] ,
46
+ deposits: [ ] ,
47
+ voluntary_exits: [ ] ,
48
+ sync_aggregate: sync_aggregate ( ) ,
49
+ execution_payload: execution_payload ( ) ,
50
+ bls_to_execution_changes: [ ]
51
+ ] ++
52
+ HardForkAliasInjection . on_deneb do
53
+ [ blob_kzg_commitments: [ ] ]
54
+ else
55
+ [ ]
56
+ end
57
+
58
+ struct! ( BeaconBlockBody , fields )
43
59
end
44
60
45
61
@ spec eth1_data :: Types.Eth1Data . t ( )
@@ -59,25 +75,33 @@ defmodule Fixtures.Block do
59
75
}
60
76
end
61
77
62
- @ spec execution_payload :: Types. ExecutionPayload. t ( )
78
+ @ spec execution_payload :: ExecutionPayload . t ( )
63
79
def execution_payload do
64
- % Types.ExecutionPayload {
65
- parent_hash: Random . hash32 ( ) ,
66
- fee_recipient: Random . execution_address ( ) ,
67
- state_root: Random . root ( ) ,
68
- receipts_root: Random . root ( ) ,
69
- logs_bloom: Random . binary ( 256 ) ,
70
- prev_randao: Random . hash32 ( ) ,
71
- block_number: Random . uint64 ( ) ,
72
- gas_limit: Random . uint64 ( ) ,
73
- gas_used: Random . uint64 ( ) ,
74
- timestamp: Random . uint64 ( ) ,
75
- extra_data: Random . binary ( 30 ) ,
76
- base_fee_per_gas: Random . uint64 ( ) ,
77
- block_hash: Random . binary ( 32 ) ,
78
- transactions: [ ] ,
79
- withdrawals: [ ]
80
- }
80
+ fields =
81
+ [
82
+ parent_hash: Random . hash32 ( ) ,
83
+ fee_recipient: Random . execution_address ( ) ,
84
+ state_root: Random . root ( ) ,
85
+ receipts_root: Random . root ( ) ,
86
+ logs_bloom: Random . binary ( 256 ) ,
87
+ prev_randao: Random . hash32 ( ) ,
88
+ block_number: Random . uint64 ( ) ,
89
+ gas_limit: Random . uint64 ( ) ,
90
+ gas_used: Random . uint64 ( ) ,
91
+ timestamp: Random . uint64 ( ) ,
92
+ extra_data: Random . binary ( 30 ) ,
93
+ base_fee_per_gas: Random . uint64 ( ) ,
94
+ block_hash: Random . binary ( 32 ) ,
95
+ transactions: [ ] ,
96
+ withdrawals: [ ]
97
+ ] ++
98
+ HardForkAliasInjection . on_deneb do
99
+ [ blob_gas_used: 0 , excess_blob_gas: 0 ]
100
+ else
101
+ [ ]
102
+ end
103
+
104
+ struct! ( ExecutionPayload , fields )
81
105
end
82
106
83
107
@ spec fork :: Types.Fork . t ( )
@@ -124,30 +148,38 @@ defmodule Fixtures.Block do
124
148
}
125
149
end
126
150
127
- @ spec execution_payload_header :: Types. ExecutionPayloadHeader. t ( )
151
+ @ spec execution_payload_header :: ExecutionPayloadHeader . t ( )
128
152
def execution_payload_header do
129
- % Types.ExecutionPayloadHeader {
130
- parent_hash: Random . binary ( 32 ) ,
131
- fee_recipient: Random . binary ( 20 ) ,
132
- state_root: Random . root ( ) ,
133
- receipts_root: Random . root ( ) ,
134
- logs_bloom: Random . binary ( 256 ) ,
135
- prev_randao: Random . binary ( 32 ) ,
136
- block_number: Random . uint64 ( ) ,
137
- gas_limit: Random . uint64 ( ) ,
138
- gas_used: Random . uint64 ( ) ,
139
- timestamp: Random . uint64 ( ) ,
140
- extra_data: Random . binary ( 30 ) ,
141
- base_fee_per_gas: Random . uint256 ( ) ,
142
- block_hash: Random . binary ( 32 ) ,
143
- transactions_root: Random . root ( ) ,
144
- withdrawals_root: Random . root ( )
145
- }
153
+ fields =
154
+ [
155
+ parent_hash: Random . binary ( 32 ) ,
156
+ fee_recipient: Random . binary ( 20 ) ,
157
+ state_root: Random . root ( ) ,
158
+ receipts_root: Random . root ( ) ,
159
+ logs_bloom: Random . binary ( 256 ) ,
160
+ prev_randao: Random . binary ( 32 ) ,
161
+ block_number: Random . uint64 ( ) ,
162
+ gas_limit: Random . uint64 ( ) ,
163
+ gas_used: Random . uint64 ( ) ,
164
+ timestamp: Random . uint64 ( ) ,
165
+ extra_data: Random . binary ( 30 ) ,
166
+ base_fee_per_gas: Random . uint256 ( ) ,
167
+ block_hash: Random . binary ( 32 ) ,
168
+ transactions_root: Random . root ( ) ,
169
+ withdrawals_root: Random . root ( )
170
+ ] ++
171
+ HardForkAliasInjection . on_deneb do
172
+ [ blob_gas_used: 0 , excess_blob_gas: 0 ]
173
+ else
174
+ [ ]
175
+ end
176
+
177
+ struct! ( ExecutionPayloadHeader , fields )
146
178
end
147
179
148
- @ spec beacon_state :: Types. BeaconState. t ( )
180
+ @ spec beacon_state :: BeaconState . t ( )
149
181
def beacon_state do
150
- % Types. BeaconState{
182
+ % BeaconState {
151
183
genesis_time: Random . uint64 ( ) ,
152
184
genesis_validators_root: Random . root ( ) ,
153
185
slot: Random . uint64 ( ) ,
0 commit comments