diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index f0169f1d2..16d8048aa 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -480,6 +480,7 @@ class BeaconBlockBody(Container): deposits: List[Deposit, MAX_DEPOSITS] voluntary_exits: List[VoluntaryExit, MAX_VOLUNTARY_EXITS] transfers: List[Transfer, MAX_TRANSFERS] + # @shard_receipts ``` #### `BeaconBlock` @@ -533,6 +534,8 @@ class BeaconState(Container): previous_justified_checkpoint: Checkpoint # Previous epoch snapshot current_justified_checkpoint: Checkpoint finalized_checkpoint: Checkpoint + + # @persistent_committee_fields ``` ## Helper functions @@ -1237,6 +1240,7 @@ def process_epoch(state: BeaconState) -> None: # @process_reveal_deadlines # @process_challenge_deadlines process_slashings(state) + # @update_persistent_committee process_final_updates(state) # @after_process_final_updates ``` @@ -1598,6 +1602,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: (body.deposits, process_deposit), (body.voluntary_exits, process_voluntary_exit), (body.transfers, process_transfer), + # @process_shard_receipts ): for operation in operations: function(state, operation) diff --git a/specs/core/1_beacon-chain-misc.md b/specs/core/1_beacon-chain-misc.md index 4aa1796b6..f816c6259 100644 --- a/specs/core/1_beacon-chain-misc.md +++ b/specs/core/1_beacon-chain-misc.md @@ -159,15 +159,23 @@ def process_shard_receipt(state: BeaconState, receipt_proof: ShardReceiptProof): Add to the beacon state the following fields: -* `previous_persistent_committee_root: Hash` -* `current_persistent_committee_root: Hash` -* `next_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` +```python +# begin insert @persistent_committee_fields + previous_persistent_committee_root: Hash + 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 -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. """ @@ -183,8 +191,18 @@ def update_persistent_committee(state: BeaconState): ### 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. + +```python +# begin insert @process_shard_receipts + (body.shard_receipts, process_shard_receipts), +# end insert @process_shard_receipts +```