MCPcopy
hub / github.com/ethereum/research / build_attestation_data

Function build_attestation_data

spec_pythonizer/sanity_check.py:155–180  ·  view source on GitHub ↗
(state, slot, shard)

Source from the content-addressed store, hash-verified

153
154
155def build_attestation_data(state, slot, shard):
156 assert state.slot >= slot
157
158 block_root = construct_empty_block_for_next_slot(state).previous_block_root
159
160 epoch_start_slot = get_epoch_start_slot(get_current_epoch(state))
161 if epoch_start_slot == slot:
162 epoch_boundary_root = block_root
163 else:
164 get_block_root(state, epoch_start_slot)
165
166 if slot < epoch_start_slot:
167 justified_block_root = state.previous_justified_root
168 else:
169 justified_block_root = state.current_justified_root
170
171 return AttestationData(
172 slot=slot,
173 shard=shard,
174 beacon_block_root=block_root,
175 source_epoch=state.current_justified_epoch,
176 source_root=justified_block_root,
177 target_root=epoch_boundary_root,
178 crosslink_data_root=spec.ZERO_HASH,
179 previous_crosslink=deepcopy(state.latest_crosslinks[shard]),
180 )
181
182
183# @timeit

Callers 1

test_attestationFunction · 0.85

Calls 2

deepcopyFunction · 0.85

Tested by 1

test_attestationFunction · 0.68