diff --git a/specs/phase1/shard-fork-choice.md b/specs/phase1/shard-fork-choice.md index b6d5c5ad4..8d64eb842 100644 --- a/specs/phase1/shard-fork-choice.md +++ b/specs/phase1/shard-fork-choice.md @@ -170,7 +170,9 @@ def on_shard_block(store: Store, shard_store: ShardStore, signed_shard_block: Si # Check the block is valid and compute the post-state shard_state = shard_parent_state.copy() - shard_state_transition(shard_state, shard_block, validate_message=True, beacon_parent_state=beacon_parent_state) + shard_state_transition( + shard_state, signed_shard_block, + validate=True, beacon_parent_state=beacon_parent_state) # Add new block to the store shard_store.blocks[hash_tree_root(shard_block)] = shard_block diff --git a/specs/phase1/shard-transition.md b/specs/phase1/shard-transition.md index e9982b370..05f986000 100644 --- a/specs/phase1/shard-transition.md +++ b/specs/phase1/shard-transition.md @@ -50,10 +50,10 @@ def verify_shard_block_message(beacon_parent_state: BeaconState, ``` ```python -def verify_shard_block_signature(beacon_state: BeaconState, +def verify_shard_block_signature(beacon_parent_state: BeaconState, signed_block: SignedShardBlock) -> bool: - proposer = beacon_state.validators[signed_block.message.proposer_index] - domain = get_domain(beacon_state, DOMAIN_SHARD_PROPOSAL, compute_epoch_at_slot(signed_block.message.slot)) + proposer = beacon_parent_state.validators[signed_block.message.proposer_index] + domain = get_domain(beacon_parent_state, DOMAIN_SHARD_PROPOSAL, compute_epoch_at_slot(signed_block.message.slot)) signing_root = compute_signing_root(signed_block.message, domain) return bls.Verify(proposer.pubkey, signing_root, signed_block.signature) ``` @@ -62,14 +62,15 @@ def verify_shard_block_signature(beacon_state: BeaconState, ```python def shard_state_transition(shard_state: ShardState, - block: ShardBlock, - validate_message: bool = True, + signed_block: SignedShardBlock, + validate: bool = True, beacon_parent_state: Optional[BeaconState] = None) -> ShardState: - if validate_message: + if validate: assert beacon_parent_state is not None - assert verify_shard_block_message(beacon_parent_state, shard_state, block) + assert verify_shard_block_message(beacon_parent_state, shard_state, signed_block.message) + assert verify_shard_block_signature(beacon_parent_state, signed_block) - process_shard_block(shard_state, block) + process_shard_block(shard_state, signed_block.message) return shard_state ``` @@ -127,7 +128,7 @@ def is_valid_fraud_proof(beacon_state: BeaconState, else: shard_state = transition.shard_states[offset_index - 1] # Not doing the actual state updates here. - shard_state_transition(shard_state, block, validate_message=False) + shard_state_transition(shard_state, block, validate=False) if shard_state != transition.shard_states[offset_index]: return True diff --git a/specs/phase1/validator.md b/specs/phase1/validator.md index d78726bc2..c0d6ecbf9 100644 --- a/specs/phase1/validator.md +++ b/specs/phase1/validator.md @@ -299,7 +299,7 @@ def get_shard_transition_fields( shard_block = SignedShardBlock(message=ShardBlock(slot=slot, shard=shard)) shard_data_roots.append(Root()) shard_state = shard_state.copy() - shard_state_transition(shard_state, shard_block.message, validate_message=False) + shard_state_transition(shard_state, shard_block, validate=False) shard_states.append(shard_state) shard_block_lengths.append(len(shard_block.message.body))