From 729e21cbcf66f0275d3bf196f4f9a314056e4956 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Sat, 8 Aug 2020 09:29:04 -0700 Subject: [PATCH 1/3] apply_shard_transition: copy shard state --- specs/phase1/beacon-chain.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index b64c31a57..73aa9b7da 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -868,8 +868,9 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr assert optional_aggregate_verify(pubkeys, signing_roots, transition.proposer_signature_aggregate) # Save updated state - state.shard_states[shard] = transition.shard_states[len(transition.shard_states) - 1] - state.shard_states[shard].slot = compute_previous_slot(state.slot) + shard_state = transition.shard_states[len(transition.shard_states) - 1].copy() + shard_state.slot = compute_previous_slot(state.slot) + state.shard_states[shard] = shard_state ``` ###### `process_crosslink_for_shard` From d22e02f20af74dd3c7ba7adb9114d79b4c13050f Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 10 Aug 2020 06:26:52 -0700 Subject: [PATCH 2/3] Update specs/phase1/beacon-chain.md Co-authored-by: Hsiao-Wei Wang --- specs/phase1/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index 73aa9b7da..f14fc96f5 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -868,7 +868,7 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr assert optional_aggregate_verify(pubkeys, signing_roots, transition.proposer_signature_aggregate) # Save updated state - shard_state = transition.shard_states[len(transition.shard_states) - 1].copy() + shard_state = copy(transition.shard_states[len(transition.shard_states) - 1]) shard_state.slot = compute_previous_slot(state.slot) state.shard_states[shard] = shard_state ``` From 77b933035c5483077496da9ea7a4fa9c818b03d6 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 10 Aug 2020 07:15:54 -0700 Subject: [PATCH 3/3] Update apply_shard_transition comments --- specs/phase1/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index f14fc96f5..6f40e5081 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -867,7 +867,7 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr # Verify combined proposer signature assert optional_aggregate_verify(pubkeys, signing_roots, transition.proposer_signature_aggregate) - # Save updated state + # Copy and save updated shard state shard_state = copy(transition.shard_states[len(transition.shard_states) - 1]) shard_state.slot = compute_previous_slot(state.slot) state.shard_states[shard] = shard_state