diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 24251e1e2..56a9299d7 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -30,6 +30,7 @@ - [Attestations](#attestations) - [`Attestation`](#attestation) - [`AttestationData`](#attestationdata) + - [`AttestationDataAndCustodyBit`](#attestationdataandcustodybit) - [Deposits](#deposits) - [`Deposit`](#deposit) - [`DepositData`](#depositdata) @@ -105,7 +106,6 @@ - [Helpers](#helpers) - [Receipt roots](#receipt-roots) - [Justification](#justification) - - [Finalization](#finalization) - [Crosslinks](#crosslinks) - [Rewards and penalties](#rewards-and-penalties) - [Justification and finalization](#justification-and-finalization) @@ -340,6 +340,17 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted } ``` +##### `AttestationDataAndCustodyBit` + +```python +{ + # Attestation data + data: AttestationData, + # Proof of custody bit + poc_bit: bool, +} +``` + #### Deposits ##### `Deposit` @@ -1038,18 +1049,15 @@ def verify_slashable_vote_data(state: BeaconState, vote_data: SlashableVoteData) if len(vote_data.aggregate_signature_poc_0_indices) + len(vote_data.aggregate_signature_poc_1_indices) > MAX_CASPER_VOTES: return False - pubs = [ - 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]) - ] - vote_data_root = hash_tree_root(vote_data) - messages = [ - vote_data_root + bytes1(0), - vote_data_root + bytes1(1) - ] return bls_verify_multiple( - pubkeys=pubs, - messages=messages, + 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]), + ], + messages=[ + hash_tree_root(AttestationDataAndCustodyBit(vote_data, False)), + hash_tree_root(AttestationDataAndCustodyBit(vote_data, True)), + ], signature=vote_data.aggregate_signature, domain=get_domain( state.fork_data, @@ -1138,7 +1146,7 @@ A valid block with slot `INITIAL_SLOT_NUMBER` (a "genesis block") has the follow poc_challenges=[], poc_responses=[], deposits=[], - exits=[] + exits=[], ), } ``` @@ -1202,7 +1210,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit], deposit=deposit.deposit_data.value, 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 + randao_commitment=deposit.deposit_data.deposit_input.randao_commitment, ) if get_effective_balance(state, validator_index) == MAX_DEPOSIT * GWEI_PER_ETH: update_validator_status(state, validator_index, ACTIVE) @@ -1407,7 +1415,7 @@ def exit_validator(state: BeaconState, current_validator_registry_delta_chain_tip=state.validator_registry_delta_chain_tip, validator_index=index, pubkey=validator.pubkey, - flag=EXIT + flag=EXIT, ) # Remove validator from persistent committees @@ -1510,7 +1518,7 @@ For each `attestation` in `block.body.attestations`: * `aggregate_signature` verification: * Let `participants = get_attestation_participants(state, attestation.data, attestation.participation_bitfield)`. * 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(attestation.data) + bytes1(0), 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`. * Append `PendingAttestationRecord(data=attestation.data, participation_bitfield=attestation.participation_bitfield, custody_bitfield=attestation.custody_bitfield, slot_included=state.slot)` to `state.latest_attestations`. @@ -1548,7 +1556,6 @@ process_deposit( withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials, poc_commitment=deposit.deposit_data.deposit_input.poc_commitment, randao_commitment=deposit.deposit_data.deposit_input.randao_commitment, - ) ```