use codeblock syntax for misc beacon updates
This commit is contained in:
parent
a273d9e09d
commit
2ae7323183
|
@ -480,6 +480,7 @@ class BeaconBlockBody(Container):
|
||||||
deposits: List[Deposit, MAX_DEPOSITS]
|
deposits: List[Deposit, MAX_DEPOSITS]
|
||||||
voluntary_exits: List[VoluntaryExit, MAX_VOLUNTARY_EXITS]
|
voluntary_exits: List[VoluntaryExit, MAX_VOLUNTARY_EXITS]
|
||||||
transfers: List[Transfer, MAX_TRANSFERS]
|
transfers: List[Transfer, MAX_TRANSFERS]
|
||||||
|
# @shard_receipts
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `BeaconBlock`
|
#### `BeaconBlock`
|
||||||
|
@ -533,6 +534,8 @@ class BeaconState(Container):
|
||||||
previous_justified_checkpoint: Checkpoint # Previous epoch snapshot
|
previous_justified_checkpoint: Checkpoint # Previous epoch snapshot
|
||||||
current_justified_checkpoint: Checkpoint
|
current_justified_checkpoint: Checkpoint
|
||||||
finalized_checkpoint: Checkpoint
|
finalized_checkpoint: Checkpoint
|
||||||
|
|
||||||
|
# @persistent_committee_fields
|
||||||
```
|
```
|
||||||
|
|
||||||
## Helper functions
|
## Helper functions
|
||||||
|
@ -1237,6 +1240,7 @@ def process_epoch(state: BeaconState) -> None:
|
||||||
# @process_reveal_deadlines
|
# @process_reveal_deadlines
|
||||||
# @process_challenge_deadlines
|
# @process_challenge_deadlines
|
||||||
process_slashings(state)
|
process_slashings(state)
|
||||||
|
# @update_persistent_committee
|
||||||
process_final_updates(state)
|
process_final_updates(state)
|
||||||
# @after_process_final_updates
|
# @after_process_final_updates
|
||||||
```
|
```
|
||||||
|
@ -1598,6 +1602,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
|
||||||
(body.deposits, process_deposit),
|
(body.deposits, process_deposit),
|
||||||
(body.voluntary_exits, process_voluntary_exit),
|
(body.voluntary_exits, process_voluntary_exit),
|
||||||
(body.transfers, process_transfer),
|
(body.transfers, process_transfer),
|
||||||
|
# @process_shard_receipts
|
||||||
):
|
):
|
||||||
for operation in operations:
|
for operation in operations:
|
||||||
function(state, operation)
|
function(state, operation)
|
||||||
|
|
|
@ -159,15 +159,23 @@ def process_shard_receipt(state: BeaconState, receipt_proof: ShardReceiptProof):
|
||||||
|
|
||||||
Add to the beacon state the following fields:
|
Add to the beacon state the following fields:
|
||||||
|
|
||||||
* `previous_persistent_committee_root: Hash`
|
```python
|
||||||
* `current_persistent_committee_root: Hash`
|
# begin insert @persistent_committee_fields
|
||||||
* `next_persistent_committee_root: Hash`
|
previous_persistent_committee_root: Hash
|
||||||
* `next_shard_receipt_period: Vector[uint, SHARD_COUNT]`, values initialized to `PHASE_1_FORK_SLOT // SLOTS_PER_EPOCH // EPOCHS_PER_SHARD_PERIOD`
|
current_persistent_committee_root: Hash
|
||||||
|
next_persistent_committee_root: Hash
|
||||||
|
next_shard_receipt_period: Vector[uint, SHARD_COUNT]
|
||||||
|
# end insert @persistent_committee_fields
|
||||||
|
```
|
||||||
|
`next_shard_receipt_period` values initialized to `PHASE_1_FORK_SLOT // SLOTS_PER_EPOCH // EPOCHS_PER_SHARD_PERIOD`
|
||||||
|
|
||||||
Process the following function before `process_final_updates`:
|
Run `update_persistent_committee` immediately before `process_final_updates`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def update_persistent_committee(state: BeaconState):
|
# begin insert @update_persistent_committee
|
||||||
|
update_persistent_committee(state)
|
||||||
|
# end insert @update_persistent_committee
|
||||||
|
def update_persistent_committee(state: BeaconState) -> None:
|
||||||
"""
|
"""
|
||||||
Updates persistent committee roots at boundary blocks.
|
Updates persistent committee roots at boundary blocks.
|
||||||
"""
|
"""
|
||||||
|
@ -183,8 +191,18 @@ def update_persistent_committee(state: BeaconState):
|
||||||
|
|
||||||
### Shard receipt processing
|
### Shard receipt processing
|
||||||
|
|
||||||
Add to the beacon block body the following object:
|
Add the `shard_receipts` operation to `BeaconBlockBody`:
|
||||||
|
|
||||||
* `shard_receipts: List[ShardReceipt, MAX_SHARD_RECEIPTS]`
|
```python
|
||||||
|
# begin insert @shard_receipts
|
||||||
|
shard_receipts: List[ShardReceipt, MAX_SHARD_RECEIPTS]
|
||||||
|
# end insert @shard_receipts
|
||||||
|
```
|
||||||
|
|
||||||
Use `process_shard_receipt` to process each receipt.
|
Use `process_shard_receipt` to process each receipt.
|
||||||
|
|
||||||
|
```python
|
||||||
|
# begin insert @process_shard_receipts
|
||||||
|
(body.shard_receipts, process_shard_receipts),
|
||||||
|
# end insert @process_shard_receipts
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue