Remove Record suffix (#434)

This commit is contained in:
JinHwan 2019-01-17 20:01:13 +09:00 committed by Justin
parent 812b385f64
commit 87fb35d244
1 changed files with 16 additions and 16 deletions

View File

@ -43,10 +43,10 @@
- [`ProposalSignedData`](#proposalsigneddata) - [`ProposalSignedData`](#proposalsigneddata)
- [Beacon chain state](#beacon-chain-state) - [Beacon chain state](#beacon-chain-state)
- [`BeaconState`](#beaconstate) - [`BeaconState`](#beaconstate)
- [`ValidatorRecord`](#validatorrecord) - [`Validator`](#validator)
- [`CrosslinkRecord`](#crosslinkrecord) - [`Crosslink`](#crosslink)
- [`DepositRootVote`](#depositrootvote) - [`DepositRootVote`](#depositrootvote)
- [`PendingAttestationRecord`](#pendingattestationrecord) - [`PendingAttestation`](#pendingattestation)
- [`ForkData`](#forkdata) - [`ForkData`](#forkdata)
- [`ValidatorRegistryDeltaBlock`](#validatorregistrydeltablock) - [`ValidatorRegistryDeltaBlock`](#validatorregistrydeltablock)
- [Ethereum 1.0 deposit contract](#ethereum-10-deposit-contract) - [Ethereum 1.0 deposit contract](#ethereum-10-deposit-contract)
@ -473,7 +473,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'fork_data': ForkData, # For versioning hard forks 'fork_data': ForkData, # For versioning hard forks
# Validator registry # Validator registry
'validator_registry': [ValidatorRecord], 'validator_registry': [Validator],
'validator_balances': ['uint64'], 'validator_balances': ['uint64'],
'validator_registry_latest_change_slot': 'uint64', 'validator_registry_latest_change_slot': 'uint64',
'validator_registry_exit_count': 'uint64', 'validator_registry_exit_count': 'uint64',
@ -499,10 +499,10 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'finalized_slot': 'uint64', 'finalized_slot': 'uint64',
# Recent state # Recent state
'latest_crosslinks': [CrosslinkRecord], 'latest_crosslinks': [Crosslink],
'latest_block_roots': ['hash32'], # Needed to process attestations, older to newer 'latest_block_roots': ['hash32'], # Needed to process attestations, older to newer
'latest_penalized_exit_balances': ['uint64'], # Balances penalized at every withdrawal period 'latest_penalized_exit_balances': ['uint64'], # Balances penalized at every withdrawal period
'latest_attestations': [PendingAttestationRecord], 'latest_attestations': [PendingAttestation],
'batched_block_roots': ['hash32'], 'batched_block_roots': ['hash32'],
# Ethereum 1.0 deposit root # Ethereum 1.0 deposit root
@ -511,7 +511,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
} }
``` ```
#### `ValidatorRecord` #### `Validator`
```python ```python
{ {
@ -544,7 +544,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
} }
``` ```
#### `CrosslinkRecord` #### `Crosslink`
```python ```python
{ {
@ -566,7 +566,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
} }
``` ```
#### `PendingAttestationRecord` #### `PendingAttestation`
```python ```python
{ {
@ -776,7 +776,7 @@ Note: We aim to migrate to a S[T/N]ARK-friendly hash function in a future Ethere
#### `is_active_validator` #### `is_active_validator`
```python ```python
def is_active_validator(validator: ValidatorRecord, slot: int) -> bool: def is_active_validator(validator: Validator, slot: int) -> bool:
""" """
Checks if ``validator`` is active. Checks if ``validator`` is active.
""" """
@ -786,7 +786,7 @@ def is_active_validator(validator: ValidatorRecord, slot: int) -> bool:
#### `get_active_validator_indices` #### `get_active_validator_indices`
```python ```python
def get_active_validator_indices(validators: [ValidatorRecord], slot: int) -> List[int]: def get_active_validator_indices(validators: [Validator], slot: int) -> List[int]:
""" """
Gets indices of active validators from ``validators``. Gets indices of active validators from ``validators``.
""" """
@ -877,7 +877,7 @@ def get_committee_count_per_slot(active_validator_count: int) -> int:
```python ```python
def get_shuffling(seed: Hash32, def get_shuffling(seed: Hash32,
validators: List[ValidatorRecord], validators: List[Validator],
slot: int) -> List[List[int]] slot: int) -> List[List[int]]
""" """
Shuffles ``validators`` into crosslink committees seeded by ``seed`` and ``slot``. Shuffles ``validators`` into crosslink committees seeded by ``seed`` and ``slot``.
@ -1241,7 +1241,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
finalized_slot=GENESIS_SLOT, finalized_slot=GENESIS_SLOT,
# Recent state # Recent state
latest_crosslinks=[CrosslinkRecord(slot=GENESIS_SLOT, shard_block_root=ZERO_HASH) for _ in range(SHARD_COUNT)], latest_crosslinks=[Crosslink(slot=GENESIS_SLOT, shard_block_root=ZERO_HASH) for _ in range(SHARD_COUNT)],
latest_block_roots=[ZERO_HASH for _ in range(LATEST_BLOCK_ROOTS_LENGTH)], latest_block_roots=[ZERO_HASH for _ in range(LATEST_BLOCK_ROOTS_LENGTH)],
latest_penalized_exit_balances=[0 for _ in range(LATEST_PENALIZED_EXIT_LENGTH)], latest_penalized_exit_balances=[0 for _ in range(LATEST_PENALIZED_EXIT_LENGTH)],
latest_attestations=[], latest_attestations=[],
@ -1331,7 +1331,7 @@ def process_deposit(state: BeaconState,
if pubkey not in validator_pubkeys: if pubkey not in validator_pubkeys:
# Add new validator # Add new validator
validator = ValidatorRecord( validator = Validator(
pubkey=pubkey, pubkey=pubkey,
withdrawal_credentials=withdrawal_credentials, withdrawal_credentials=withdrawal_credentials,
randao_commitment=randao_commitment, randao_commitment=randao_commitment,
@ -1521,7 +1521,7 @@ For each `attestation` in `block.body.attestations`:
* Let `group_public_key = bls_aggregate_pubkeys([state.validator_registry[v].pubkey for v in participants])`. * Let `group_public_key = bls_aggregate_pubkeys([state.validator_registry[v].pubkey for v in participants])`.
* Verify that `bls_verify(pubkey=group_public_key, message=hash_tree_root(AttestationDataAndCustodyBit(attestation.data, False)), signature=attestation.aggregate_signature, domain=get_domain(state.fork_data, attestation.data.slot, DOMAIN_ATTESTATION))`. * Verify that `bls_verify(pubkey=group_public_key, message=hash_tree_root(AttestationDataAndCustodyBit(attestation.data, False)), signature=attestation.aggregate_signature, domain=get_domain(state.fork_data, attestation.data.slot, DOMAIN_ATTESTATION))`.
* [TO BE REMOVED IN PHASE 1] Verify that `attestation.data.shard_block_root == ZERO_HASH`. * [TO BE REMOVED IN PHASE 1] Verify that `attestation.data.shard_block_root == ZERO_HASH`.
* Append `PendingAttestationRecord(data=attestation.data, participation_bitfield=attestation.participation_bitfield, custody_bitfield=attestation.custody_bitfield, slot_included=state.slot)` to `state.latest_attestations`. * Append `PendingAttestation(data=attestation.data, participation_bitfield=attestation.participation_bitfield, custody_bitfield=attestation.custody_bitfield, slot_included=state.slot)` to `state.latest_attestations`.
#### Deposits #### Deposits
@ -1653,7 +1653,7 @@ Set `state.finalized_slot = state.previous_justified_slot` if any of the followi
For every `slot in range(state.slot - 2 * EPOCH_LENGTH, state.slot)`, let `crosslink_committee_at_slot = get_crosslink_committees_at_slot(slot)`. For every `(crosslink_committee, shard)` in `crosslink_committee_at_slot`, compute: For every `slot in range(state.slot - 2 * EPOCH_LENGTH, state.slot)`, let `crosslink_committee_at_slot = get_crosslink_committees_at_slot(slot)`. For every `(crosslink_committee, shard)` in `crosslink_committee_at_slot`, compute:
* Set `state.latest_crosslinks[shard] = CrosslinkRecord(slot=state.slot, shard_block_root=winning_root(crosslink_committee))` if `3 * total_attesting_balance(crosslink_committee) >= 2 * total_balance(crosslink_committee)`. * Set `state.latest_crosslinks[shard] = Crosslink(slot=state.slot, shard_block_root=winning_root(crosslink_committee))` if `3 * total_attesting_balance(crosslink_committee) >= 2 * total_balance(crosslink_committee)`.
### Rewards and penalties ### Rewards and penalties