port phase0 forkchocie changes to merge
This commit is contained in:
parent
eb00f8f735
commit
3d4ece44df
|
@ -186,17 +186,5 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||
# Update finalized checkpoint
|
||||
if state.finalized_checkpoint.epoch > store.finalized_checkpoint.epoch:
|
||||
store.finalized_checkpoint = state.finalized_checkpoint
|
||||
|
||||
# Potentially update justified if different from store
|
||||
if store.justified_checkpoint != state.current_justified_checkpoint:
|
||||
# Update justified if new justified is later than store justified
|
||||
if state.current_justified_checkpoint.epoch > store.justified_checkpoint.epoch:
|
||||
store.justified_checkpoint = state.current_justified_checkpoint
|
||||
return
|
||||
|
||||
# Update justified if store justified is not in chain with finalized checkpoint
|
||||
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
|
||||
ancestor_at_finalized_slot = get_ancestor(store, store.justified_checkpoint.root, finalized_slot)
|
||||
if ancestor_at_finalized_slot != store.finalized_checkpoint.root:
|
||||
store.justified_checkpoint = state.current_justified_checkpoint
|
||||
```
|
||||
|
|
|
@ -386,9 +386,6 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||
|
||||
# Update finalized checkpoint
|
||||
if state.finalized_checkpoint.epoch > store.finalized_checkpoint.epoch:
|
||||
print("made it")
|
||||
print(state.finalized_checkpoint)
|
||||
print(state.current_justified_checkpoint)
|
||||
store.finalized_checkpoint = state.finalized_checkpoint
|
||||
store.justified_checkpoint = state.current_justified_checkpoint
|
||||
```
|
||||
|
|
|
@ -694,21 +694,13 @@ def test_new_finalized_slot_is_justified_checkpoint_ancestor(spec, state):
|
|||
|
||||
pre_store_justified_checkpoint_root = store.justified_checkpoint.root
|
||||
for block in all_blocks:
|
||||
# FIXME: Once `on_block` and `on_attestation` logic is fixed,
|
||||
# fix test case and remove allow_invalid_attestations flag
|
||||
yield from tick_and_add_block(spec, store, block, test_steps)
|
||||
|
||||
finalized_slot = spec.compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
|
||||
ancestor_at_finalized_slot = spec.get_ancestor(store, pre_store_justified_checkpoint_root, finalized_slot)
|
||||
assert ancestor_at_finalized_slot == store.finalized_checkpoint.root
|
||||
|
||||
print(store.finalized_checkpoint)
|
||||
print(store.justified_checkpoint)
|
||||
print(another_state.current_justified_checkpoint)
|
||||
print('spec.get_head(store)', spec.get_head(store))
|
||||
|
||||
assert store.finalized_checkpoint == another_state.finalized_checkpoint
|
||||
# Thus should fail with the fix. Once show fail, swap to ==
|
||||
assert store.justified_checkpoint == another_state.current_justified_checkpoint
|
||||
|
||||
yield 'steps', test_steps
|
||||
|
|
Loading…
Reference in New Issue