Merge branch 'dev' into dankrad-custody-256bit

# Conflicts:
#	specs/phase1/beacon-chain.md
This commit is contained in:
Dankrad Feist 2020-06-12 12:29:57 +01:00
commit 29c1569251
No known key found for this signature in database
GPG Key ID: 6815E6A20BEBBABA
2 changed files with 57 additions and 12 deletions

View File

@ -371,15 +371,19 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
# Update finalized checkpoint # Update finalized checkpoint
if state.finalized_checkpoint.epoch > store.finalized_checkpoint.epoch: if state.finalized_checkpoint.epoch > store.finalized_checkpoint.epoch:
store.finalized_checkpoint = state.finalized_checkpoint store.finalized_checkpoint = state.finalized_checkpoint
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
# Update justified if new justified is later than store justified # Potentially update justified if different from store
# or if store justified is not in chain with finalized checkpoint if store.justified_checkpoint != state.current_justified_checkpoint:
if ( # Update justified if new justified is later than store justified
state.current_justified_checkpoint.epoch > store.justified_checkpoint.epoch if state.current_justified_checkpoint.epoch > store.justified_checkpoint.epoch:
or get_ancestor(store, store.justified_checkpoint.root, finalized_slot) != store.finalized_checkpoint.root store.justified_checkpoint = state.current_justified_checkpoint
): return
store.justified_checkpoint = state.current_justified_checkpoint
# 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
``` ```
#### `on_attestation` #### `on_attestation`

View File

@ -12,6 +12,11 @@
- [Custom types](#custom-types) - [Custom types](#custom-types)
- [Configuration](#configuration) - [Configuration](#configuration)
- [Misc](#misc) - [Misc](#misc)
- [Shard block configs](#shard-block-configs)
- [Gwei values](#gwei-values)
- [Initial values](#initial-values)
- [Time parameters](#time-parameters)
- [Domain types](#domain-types)
- [Updated containers](#updated-containers) - [Updated containers](#updated-containers)
- [Extended `AttestationData`](#extended-attestationdata) - [Extended `AttestationData`](#extended-attestationdata)
- [Extended `Attestation`](#extended-attestation) - [Extended `Attestation`](#extended-attestation)
@ -103,11 +108,39 @@ Configuration is not namespaced. Instead it is strictly an extension;
### Misc ### Misc
| Name | Value | Unit | Duration | | Name | Value |
| - | - | - | - | | - | - |
| `MAX_SHARDS` | `2**10` (= 1024) | - | - | | `MAX_SHARDS` | `2**10` (= 1024) |
| `ONLINE_PERIOD` | `OnlineEpochs(2**3)` (= 8) | online epochs | ~51 min |
| `LIGHT_CLIENT_COMMITTEE_SIZE` | `2**7` (= 128) | | `LIGHT_CLIENT_COMMITTEE_SIZE` | `2**7` (= 128) |
| `GASPRICE_ADJUSTMENT_COEFFICIENT` | `2**3` (= 8) |
### Shard block configs
| Name | Value |
| - | - |
| `MAX_SHARD_BLOCK_SIZE` | `2**20` (= 1,048,576) |
| `TARGET_SHARD_BLOCK_SIZE` | `2**18` (= 262,144) |
| `SHARD_BLOCK_OFFSETS` | `[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233]` |
| `MAX_SHARD_BLOCKS_PER_ATTESTATION` | `len(SHARD_BLOCK_OFFSETS)` |
### Gwei values
| Name | Value |
| - | - |
| `MAX_GASPRICE` | `Gwei(2**14)` (= 16,384) | Gwei |
| `MIN_GASPRICE` | `Gwei(2**3)` (= 8) | Gwei |
### Initial values
| Name | Value |
| - | - |
| `NO_SIGNATURE` | `BLSSignature(b'\x00' * 96)` |
### Time parameters
| Name | Value | Unit | Duration |
| - | - | :-: | :-: |
| `ONLINE_PERIOD` | `OnlineEpochs(2**3)` (= 8) | online epochs | ~51 mins |
| `LIGHT_CLIENT_COMMITTEE_PERIOD` | `Epoch(2**8)` (= 256) | epochs | ~27 hours | | `LIGHT_CLIENT_COMMITTEE_PERIOD` | `Epoch(2**8)` (= 256) | epochs | ~27 hours |
| `MAX_SHARD_BLOCK_SIZE` | `2**20` (= 1,048,576) | bytes | - | | `MAX_SHARD_BLOCK_SIZE` | `2**20` (= 1,048,576) | bytes | - |
| `TARGET_SHARD_BLOCK_SIZE` | `2**18` (= 262,144) | bytes | - | | `TARGET_SHARD_BLOCK_SIZE` | `2**18` (= 262,144) | bytes | - |
@ -124,6 +157,14 @@ Configuration is not namespaced. Instead it is strictly an extension;
| `CUSTODY_RESPONSE_DEPTH` | `ceillog2(MAX_SHARD_BLOCK_SIZE // BYTES_PER_CUSTODY_CHUNK)` | - | - | | `CUSTODY_RESPONSE_DEPTH` | `ceillog2(MAX_SHARD_BLOCK_SIZE // BYTES_PER_CUSTODY_CHUNK)` | - | - |
| `NO_SIGNATURE` | `BLSSignature(b'\x00' * 96)` | | | | `NO_SIGNATURE` | `BLSSignature(b'\x00' * 96)` | | |
### Domain types
| Name | Value |
| - | - |
| `DOMAIN_SHARD_PROPOSAL` | `DomainType('0x80000000')` |
| `DOMAIN_SHARD_COMMITTEE` | `DomainType('0x81000000')` |
| `DOMAIN_LIGHT_CLIENT` | `DomainType('0x82000000')` |
## Updated containers ## Updated containers
The following containers have updated definitions in Phase 1. The following containers have updated definitions in Phase 1.