From 8e41bd19c561da12072ec100c820671f20fa1826 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Tue, 22 Oct 2019 14:37:35 -0700 Subject: [PATCH] Revert "Fix Round Robin Test (#3775)" This reverts commit 00a5a253239869737b1aa262c92c6a4c617d89dd. --- beacon-chain/sync/initial-sync/round_robin.go | 11 +--- .../sync/initial-sync/round_robin_test.go | 61 ++++++++++--------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/beacon-chain/sync/initial-sync/round_robin.go b/beacon-chain/sync/initial-sync/round_robin.go index 9c9c44ed072b..369bdd6a89eb 100644 --- a/beacon-chain/sync/initial-sync/round_robin.go +++ b/beacon-chain/sync/initial-sync/round_robin.go @@ -70,18 +70,9 @@ func (s *InitialSync) roundRobinSync(genesis time.Time) error { if ctx.Err() != nil { return nil, ctx.Err() } - - originalStart := start - originalCount := count start := start + uint64(i)*step step := step * uint64(len(peers)) - count := mathutil.Min(count, (helpers.StartSlot(finalizedEpoch+1)-originalStart)/step) - // If there is only 1 peer left, rather than further minimising the count in the situation - // of a large step value. we remove the variable entirely. This also handles the case if - // there is only 1 peer overall(step = 1). - if len(peers) == 1 { - count = mathutil.Min(originalCount, helpers.StartSlot(finalizedEpoch+1)-originalStart) - } + count := mathutil.Min(count, (helpers.StartSlot(finalizedEpoch+1)-start)/step) // If the count was divided by an odd number of peers, there will be some blocks // missing from the first requests so we accommodate that scenario. if i < remainder { diff --git a/beacon-chain/sync/initial-sync/round_robin_test.go b/beacon-chain/sync/initial-sync/round_robin_test.go index f30e62c2cc5a..f8dd97a9d6d2 100644 --- a/beacon-chain/sync/initial-sync/round_robin_test.go +++ b/beacon-chain/sync/initial-sync/round_robin_test.go @@ -136,36 +136,37 @@ func TestRoundRobinSync(t *testing.T) { }, }, - { - name: "Multiple peers with multiple failures", - currentSlot: 320, // 5 epochs - expectedBlockSlots: makeSequence(1, 320), - peers: []*peerData{ - { - blocks: makeSequence(1, 320), - finalizedEpoch: 4, - headSlot: 320, - }, - { - blocks: makeSequence(1, 320), - finalizedEpoch: 4, - headSlot: 320, - failureSlots: makeSequence(1, 320), - }, - { - blocks: makeSequence(1, 320), - finalizedEpoch: 4, - headSlot: 320, - failureSlots: makeSequence(1, 320), - }, - { - blocks: makeSequence(1, 320), - finalizedEpoch: 4, - headSlot: 320, - failureSlots: makeSequence(1, 320), - }, - }, - }, + // TODO(3147): Handle multiple failures. + //{ + // name: "Multiple peers with multiple failures", + // currentSlot: 320, // 5 epochs + // expectedBlockSlots: makeSequence(1, 320), + // peers: []*peerData{ + // { + // blocks: makeSequence(1, 320), + // finalizedEpoch: 4, + // headSlot: 320, + // }, + // { + // blocks: makeSequence(1, 320), + // finalizedEpoch: 4, + // headSlot: 320, + // failureSlots: makeSequence(1, 320), + // }, + // { + // blocks: makeSequence(1, 320), + // finalizedEpoch: 4, + // headSlot: 320, + // failureSlots: makeSequence(1, 320), + // }, + // { + // blocks: makeSequence(1, 320), + // finalizedEpoch: 4, + // headSlot: 320, + // failureSlots: makeSequence(1, 320), + // }, + // }, + //}, { name: "Multiple peers with different finalized epoch", currentSlot: 320, // 5 epochs