From c5d6c045e6fc6675d4f78fba80a8c31181e98e16 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Tue, 30 Apr 2019 11:07:58 -0700 Subject: [PATCH 1/3] Update 0_beacon-chain.md --- specs/core/0_beacon-chain.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 55791e25f..0498bd3d5 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -929,10 +929,11 @@ def get_beacon_proposer_index(state: BeaconState) -> ValidatorIndex: current_epoch = get_current_epoch(state) first_committee, _ = get_crosslink_committees_at_slot(state, state.slot)[0] MAX_RANDOM_BYTE = 2**8 - 1 + seed = hash(generate_seed(state, current_epoch) i = 0 while True: candidate_index = first_committee[(current_epoch + i) % len(first_committee)] - random_byte = hash(generate_seed(state, current_epoch) + int_to_bytes8(i // 32))[i % 32] + random_byte = seed + int_to_bytes8(i // 32))[i % 32] effective_balance = state.validator_registry[candidate_index].effective_balance if effective_balance * MAX_RANDOM_BYTE >= MAX_EFFECTIVE_BALANCE * random_byte: return candidate_index From 407902763ceb3ec467a7eda1b2fd849eec24e9e9 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 1 May 2019 09:33:22 +0100 Subject: [PATCH 2/3] Update 0_beacon-chain.md --- specs/core/0_beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 0498bd3d5..f89f1460a 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -929,11 +929,11 @@ def get_beacon_proposer_index(state: BeaconState) -> ValidatorIndex: current_epoch = get_current_epoch(state) first_committee, _ = get_crosslink_committees_at_slot(state, state.slot)[0] MAX_RANDOM_BYTE = 2**8 - 1 - seed = hash(generate_seed(state, current_epoch) + seed = generate_seed(state, current_epoch) i = 0 while True: candidate_index = first_committee[(current_epoch + i) % len(first_committee)] - random_byte = seed + int_to_bytes8(i // 32))[i % 32] + random_byte = hash(seed + int_to_bytes8(i // 32))[i % 32]) effective_balance = state.validator_registry[candidate_index].effective_balance if effective_balance * MAX_RANDOM_BYTE >= MAX_EFFECTIVE_BALANCE * random_byte: return candidate_index From f62126d5ee11d2d2703f4f536772f79bba0e6483 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 1 May 2019 09:34:09 +0100 Subject: [PATCH 3/3] Update 0_beacon-chain.md --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index f89f1460a..b7942d9db 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -933,7 +933,7 @@ def get_beacon_proposer_index(state: BeaconState) -> ValidatorIndex: i = 0 while True: candidate_index = first_committee[(current_epoch + i) % len(first_committee)] - random_byte = hash(seed + int_to_bytes8(i // 32))[i % 32]) + random_byte = hash(seed + int_to_bytes8(i // 32))[i % 32] effective_balance = state.validator_registry[candidate_index].effective_balance if effective_balance * MAX_RANDOM_BYTE >= MAX_EFFECTIVE_BALANCE * random_byte: return candidate_index