Rename poc_ to custody

This commit is contained in:
Hsiao-Wei Wang 2019-01-02 15:16:55 +08:00
parent d49b6e5087
commit 0d9ecce344
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4

View File

@ -113,7 +113,6 @@
- [Crosslinks](#crosslinks-1)
- [Ejections](#ejections)
- [Validator registry](#validator-registry)
- [Proposer reshuffling](#proposer-reshuffling)
- [Final updates](#final-updates)
- [State root processing](#state-root-processing)
- [References](#references)
@ -289,13 +288,13 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
```python
{
# Proof-of-custody indices (0 bits)
'aggregate_signature_poc_0_indices': '[uint24]',
'custody_bit_0_indices': ['uint24'],
# Proof-of-custody indices (1 bits)
'aggregate_signature_poc_1_indices': '[uint24]',
'custody_bit_1_indices': ['uint24'],
# Attestation data
'data': AttestationData,
# Aggregate signature
'aggregate_signature': '[uint384]',
'aggregate_signature': ['uint384'],
}
```
@ -346,7 +345,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
# Attestation data
data: AttestationData,
# Proof of custody bit
poc_bit: bool,
custody_bit: bool,
}
```
@ -389,7 +388,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
# Initial RANDAO commitment
'randao_commitment': 'hash32',
# Initial proof of custody commitment
'poc_commitment': 'hash32',
'custody_commitment': 'hash32',
# a BLS signature of this ``DepositInput``
'proof_of_possession': ['uint384'],
}
@ -436,15 +435,15 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'proposer_slashings': [ProposerSlashing],
'casper_slashings': [CasperSlashing],
'attestations': [Attestation],
'poc_seed_changes': [ProofOfCustodySeedChange],
'poc_challenges': [ProofOfCustodyChallenge],
'poc_responses': [ProofOfCustodyResponse],
'custody_reseeds': [CustodyReseed],
'custody_challenges': [CustodyChallenge],
'custody_responses': [CustodyResponse],
'deposits': [Deposit],
'exits': [Exit],
}
```
`ProofOfCustodySeedChange`, `ProofOfCustodyChallenge`, and `ProofOfCustodyResponse` will be defined in phase 1; for now, put dummy classes as these lists will remain empty throughout phase 0.
`CustodyReseed`, `CustodyChallenge`, and `CustodyResponse` will be defined in phase 1; for now, put dummy classes as these lists will remain empty throughout phase 0.
#### `ProposalSignedData`
@ -483,9 +482,9 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'shard_committees_at_slots': [[ShardCommittee]],
# Proof of custody
# Placeholders for now; ProofOfCustodyChallenge is defined in phase 1, implementers can
# Placeholders for now; CustodyChallenge is defined in phase 1, implementers can
# put a dummy class in for now, as the list will remain empty throughout phase 0
'poc_challenges': [ProofOfCustodyChallenge],
'custody_challenges': [CustodyChallenge],
# Finality
'previous_justified_slot': 'uint64',
@ -525,10 +524,10 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
# Exit counter when validator exited (or 0)
'exit_count': 'uint64',
# Proof of custody commitment
'poc_commitment': 'hash32',
'custody_commitment': 'hash32',
# Slot the proof of custody seed was last changed
'last_poc_change_slot': 'uint64',
'second_last_poc_change_slot': 'uint64',
'latest_custody_reseed_slot': 'uint64',
'penultimate_custody_reseed_slot': 'uint64',
}
```
@ -1046,13 +1045,13 @@ def get_domain(fork_data: ForkData,
```python
def verify_slashable_vote_data(state: BeaconState, vote_data: SlashableVoteData) -> bool:
if len(vote_data.aggregate_signature_poc_0_indices) + len(vote_data.aggregate_signature_poc_1_indices) > MAX_CASPER_VOTES:
if len(vote_data.custody_bit_0_indices) + len(vote_data.custody_bit_1_indices) > MAX_CASPER_VOTES:
return False
return bls_verify_multiple(
pubkeys=[
aggregate_pubkey([state.validators[i].pubkey for i in vote_data.aggregate_signature_poc_0_indices]),
aggregate_pubkey([state.validators[i].pubkey for i in vote_data.aggregate_signature_poc_1_indices]),
aggregate_pubkey([state.validators[i].pubkey for i in vote_data.custody_bit_0_indices]),
aggregate_pubkey([state.validators[i].pubkey for i in vote_data.custody_bit_1_indices]),
],
messages=[
hash_tree_root(AttestationDataAndCustodyBit(vote_data, False)),
@ -1148,9 +1147,9 @@ A valid block with slot `INITIAL_SLOT_NUMBER` (a "genesis block") has the follow
proposer_slashings=[],
casper_slashings=[],
attestations=[],
poc_seed_changes=[],
poc_challenges=[],
poc_responses=[],
custody_reseeds=[],
custody_challenges=[],
custody_responses=[],
deposits=[],
exits=[],
),
@ -1186,7 +1185,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
shard_committees_at_slots=[],
# Proof of custody
poc_challenges=[],
custody_challenges=[],
# Finality
previous_justified_slot=INITIAL_SLOT_NUMBER,
@ -1215,7 +1214,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession,
withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials,
randao_commitment=deposit.deposit_data.deposit_input.randao_commitment,
poc_commitment=deposit.deposit_data.deposit_input.poc_commitment,
custody_commitment=deposit.deposit_data.deposit_input.custody_commitment,
)
if get_effective_balance(state, validator_index) == MAX_DEPOSIT * GWEI_PER_ETH:
update_validator_status(state, validator_index, ACTIVE)
@ -1247,12 +1246,12 @@ def validate_proof_of_possession(state: BeaconState,
proof_of_possession: bytes,
withdrawal_credentials: Hash32,
randao_commitment: Hash32,
poc_commitment: Hash32) -> bool:
custody_commitment: Hash32) -> bool:
proof_of_possession_data = DepositInput(
pubkey=pubkey,
withdrawal_credentials=withdrawal_credentials,
randao_commitment=randao_commitment,
poc_commitment=poc_commitment,
custody_commitment=custody_commitment,
proof_of_possession=EMPTY_SIGNATURE,
)
@ -1277,7 +1276,7 @@ def process_deposit(state: BeaconState,
proof_of_possession: bytes,
withdrawal_credentials: Hash32,
randao_commitment: Hash32,
poc_commitment: Hash32) -> int:
custody_commitment: Hash32) -> int:
"""
Process a deposit from Ethereum 1.0.
Note that this function mutates ``state``.
@ -1289,7 +1288,7 @@ def process_deposit(state: BeaconState,
proof_of_possession,
withdrawal_credentials,
randao_commitment,
poc_commitment,
custody_commitment,
)
validator_pubkeys = [v.pubkey for v in state.validator_registry]
@ -1304,9 +1303,9 @@ def process_deposit(state: BeaconState,
status=PENDING_ACTIVATION,
latest_status_change_slot=state.slot,
exit_count=0,
poc_commitment=poc_commitment,
last_poc_change_slot=0,
second_last_poc_change_slot=0,
custody_commitment=custody_commitment,
latest_custody_reseed_slot=0,
second_latest_custody_reseed_slot=0,
)
index = min_empty_validator_index(state.validator_registry, state.validator_balances, state.slot)
@ -1492,7 +1491,7 @@ For each `casper_slashing` in `block.body.casper_slashings`:
* Let `slashable_vote_data_1 = casper_slashing.slashable_vote_data_1`.
* Let `slashable_vote_data_2 = casper_slashing.slashable_vote_data_2`.
* Let `indices(slashable_vote_data) = slashable_vote_data.aggregate_signature_poc_0_indices + slashable_vote_data.aggregate_signature_poc_1_indices`.
* Let `indices(slashable_vote_data) = slashable_vote_data.custody_bit_0_indices + slashable_vote_data.custody_bit_1_indices`.
* Let `intersection = [x for x in indices(slashable_vote_data_1) if x in indices(slashable_vote_data_2)]`.
* Verify that `len(intersection) >= 1`.
* Verify that `slashable_vote_data_1.data != slashable_vote_data_2.data`.
@ -1552,7 +1551,7 @@ process_deposit(
proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession,
withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials,
randao_commitment=deposit.deposit_data.deposit_input.randao_commitment,
poc_commitment=deposit.deposit_data.deposit_input.poc_commitment,
custody_commitment=deposit.deposit_data.deposit_input.custody_commitment,
)
```
@ -1570,7 +1569,7 @@ For each `exit` in `block.body.exits`:
#### Miscellaneous
[TO BE REMOVED IN PHASE 1] Verify that `len(block.body.poc_seed_changes) == len(block.body.poc_challenges) == len(block.body.poc_responses) == 0`.
[TO BE REMOVED IN PHASE 1] Verify that `len(block.body.custody_reseeds) == len(block.body.custody_challenges) == len(block.body.custody_responses) == 0`.
## Per-epoch processing