Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snow/consensus/snowman/poll: remove "unused" no early term poller #2095

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading