Skip to content

Commit

Permalink
snow/consensus/snowman/poll: remove "unused" no early term poller (#2095
Browse files Browse the repository at this point in the history
)

Signed-off-by: Gyuho Lee <[email protected]>
Co-authored-by: Stephen Buttolph <[email protected]>
  • Loading branch information
gyuho and StephenButtolph authored Sep 26, 2023
1 parent b2b0841 commit 1876f6b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 155 deletions.
68 changes: 0 additions & 68 deletions snow/consensus/snowman/poll/no_early_term.go

This file was deleted.

66 changes: 0 additions & 66 deletions snow/consensus/snowman/poll/no_early_term_test.go

This file was deleted.

48 changes: 27 additions & 21 deletions snow/consensus/snowman/poll/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package poll
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/prometheus/client_golang/prometheus"

"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/bag"
"github.com/ava-labs/avalanchego/utils/logging"
Expand All @@ -31,7 +31,7 @@ var (
func TestNewSetErrorOnMetrics(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
factory := NewEarlyTermNoTraversalFactory(1)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
Expand All @@ -49,14 +49,15 @@ func TestNewSetErrorOnMetrics(t *testing.T) {
func TestCreateAndFinishPollOutOfOrder_NewerFinishesFirst(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3
alpha := 3

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3

// create two polls for the two blocks
vdrBag := bag.Of(vdrs...)
require.True(s.Add(1, vdrBag))
Expand Down Expand Up @@ -84,14 +85,15 @@ func TestCreateAndFinishPollOutOfOrder_NewerFinishesFirst(t *testing.T) {
func TestCreateAndFinishPollOutOfOrder_OlderFinishesFirst(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3
alpha := 3

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3

// create two polls for the two blocks
vdrBag := bag.Of(vdrs...)
require.True(s.Add(1, vdrBag))
Expand Down Expand Up @@ -119,14 +121,15 @@ func TestCreateAndFinishPollOutOfOrder_OlderFinishesFirst(t *testing.T) {
func TestCreateAndFinishPollOutOfOrder_UnfinishedPollsGaps(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3
alpha := 3

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := []ids.NodeID{vdr1, vdr2, vdr3} // k = 3

// create three polls for the two blocks
vdrBag := bag.Of(vdrs...)
require.True(s.Add(1, vdrBag))
Expand Down Expand Up @@ -162,14 +165,15 @@ func TestCreateAndFinishPollOutOfOrder_UnfinishedPollsGaps(t *testing.T) {
func TestCreateAndFinishSuccessfulPoll(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := bag.Of(vdr1, vdr2) // k = 2
alpha := 2

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := bag.Of(vdr1, vdr2) // k = 2

require.Zero(s.Len())

require.True(s.Add(0, vdrs))
Expand All @@ -193,14 +197,15 @@ func TestCreateAndFinishSuccessfulPoll(t *testing.T) {
func TestCreateAndFinishFailedPoll(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := bag.Of(vdr1, vdr2) // k = 2
alpha := 1

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := bag.Of(vdr1, vdr2) // k = 2

require.Zero(s.Len())

require.True(s.Add(0, vdrs))
Expand All @@ -221,14 +226,15 @@ func TestCreateAndFinishFailedPoll(t *testing.T) {
func TestSetString(t *testing.T) {
require := require.New(t)

factory := NewNoEarlyTermFactory()
vdrs := bag.Of(vdr1) // k = 1
alpha := 1

factory := NewEarlyTermNoTraversalFactory(alpha)
log := logging.NoLog{}
namespace := ""
registerer := prometheus.NewRegistry()
s := NewSet(factory, log, namespace, registerer)

vdrs := bag.Of(vdr1) // k = 1

expected := `current polls: (Size = 1)
RequestID 0:
waiting on Bag[ids.NodeID]: (Size = 1)
Expand Down

0 comments on commit 1876f6b

Please sign in to comment.