From 4431e399b1c42f6dbe17aa35dddc87e600988a52 Mon Sep 17 00:00:00 2001 From: ericsson Date: Wed, 13 May 2020 16:13:33 +0300 Subject: [PATCH 1/2] Fix bugs: - `range(len(col))`` instead of `range(col)` - `beacon_parent_block.body.shard_transitions` instead of `beacon_parent_block.shard_transitions` - `shard_states[len(shard_states)-1]` instead of `shard_states[-1]` --- specs/phase1/shard-transition.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/phase1/shard-transition.md b/specs/phase1/shard-transition.md index a8de508fb..227ea9343 100644 --- a/specs/phase1/shard-transition.md +++ b/specs/phase1/shard-transition.md @@ -127,7 +127,7 @@ def is_valid_fraud_proof(beacon_state: BeaconState, beacon_parent_block: BeaconBlock) -> bool: # 1. Check if `custody_bits[offset_index][j] != generate_custody_bit(subkey, block_contents)` for any `j`. custody_bits = attestation.custody_bits_blocks - for j in range(custody_bits[offset_index]): + for j in range(len(custody_bits[offset_index])): if custody_bits[offset_index][j] != generate_custody_bit(subkey, block): return True @@ -135,7 +135,8 @@ def is_valid_fraud_proof(beacon_state: BeaconState, # `transition.shard_states[offset_index - 1]` to `transition.shard_states[offset_index]`. if offset_index == 0: shard = get_shard(beacon_state, attestation) - shard_state = beacon_parent_block.shard_transitions[shard].shard_states[-1] + shard_states = beacon_parent_block.body.shard_transitions[shard].shard_states + shard_state = shard_states[len(shard_states)-1] else: shard_state = transition.shard_states[offset_index - 1] # Not doing the actual state updates here. From b41410eade5c4ddb7333949ee928ee93a5240493 Mon Sep 17 00:00:00 2001 From: ericsson Date: Wed, 13 May 2020 16:25:16 +0300 Subject: [PATCH 2/2] lint problem fixed --- specs/phase1/shard-transition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/phase1/shard-transition.md b/specs/phase1/shard-transition.md index 227ea9343..68bfb3507 100644 --- a/specs/phase1/shard-transition.md +++ b/specs/phase1/shard-transition.md @@ -136,7 +136,7 @@ def is_valid_fraud_proof(beacon_state: BeaconState, if offset_index == 0: shard = get_shard(beacon_state, attestation) shard_states = beacon_parent_block.body.shard_transitions[shard].shard_states - shard_state = shard_states[len(shard_states)-1] + shard_state = shard_states[len(shard_states) - 1] else: shard_state = transition.shard_states[offset_index - 1] # Not doing the actual state updates here.