Skip to content

Commit

Permalink
Removed outdated tests. Fixed compilation for other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
durkmurder committed Oct 4, 2023
1 parent 38ffeee commit 6e65018
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 27 deletions.
12 changes: 0 additions & 12 deletions consensus/hotstuff/committees/cluster_committee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ func (suite *ClusterSuite) TestInvalidSigner() {
})

suite.Run("should return ErrInvalidSigner for existent but ejected cluster member", func() {
// at the root block, the cluster member is not ejected yet
suite.Run("root block", func() {
actual, err := suite.com.IdentityByBlock(rootBlockID, realEjectedClusterMember.NodeID)
suite.Require().NoError(err)
suite.Assert().Equal(realEjectedClusterMember, actual)
})
suite.Run("non-root block", func() {
_, err := suite.com.IdentityByBlock(nonRootBlockID, realEjectedClusterMember.NodeID)
suite.Assert().True(model.IsInvalidSignerError(err))
Expand All @@ -164,12 +158,6 @@ func (suite *ClusterSuite) TestInvalidSigner() {
})

suite.Run("should return ErrInvalidSigner for existent but zero-weight cluster member", func() {
// at the root block, the cluster member has its initial weight
suite.Run("root block", func() {
actual, err := suite.com.IdentityByBlock(rootBlockID, realNoWeightClusterMember.NodeID)
suite.Require().NoError(err)
suite.Assert().Equal(realNoWeightClusterMember, actual)
})
suite.Run("non-root block", func() {
_, err := suite.com.IdentityByBlock(nonRootBlockID, realNoWeightClusterMember.NodeID)
suite.Assert().True(model.IsInvalidSignerError(err))
Expand Down
8 changes: 2 additions & 6 deletions consensus/hotstuff/committees/consensus_committee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ func (suite *ConsensusSuite) TestIdentitiesByEpoch() {
// epoch 1 identities with varying conditions which would disqualify them
// from committee participation
realIdentity := unittest.IdentityFixture(unittest.WithRole(flow.RoleConsensus))
zeroWeightConsensusIdentity := unittest.IdentityFixture(unittest.WithRole(flow.RoleConsensus), unittest.WithWeight(0))
zeroWeightConsensusIdentity := unittest.IdentityFixture(unittest.WithRole(flow.RoleConsensus),
unittest.WithInitialWeight(0))
ejectedConsensusIdentity := unittest.IdentityFixture(unittest.WithRole(flow.RoleConsensus), unittest.WithEjected(true))
validNonConsensusIdentity := unittest.IdentityFixture(unittest.WithRole(flow.RoleVerification))
epoch1Identities := flow.IdentityList{realIdentity, zeroWeightConsensusIdentity, ejectedConsensusIdentity, validNonConsensusIdentity}
Expand Down Expand Up @@ -356,11 +357,6 @@ func (suite *ConsensusSuite) TestIdentitiesByEpoch() {
require.True(t, model.IsInvalidSignerError(err))
})

t.Run("ejected consensus node", func(t *testing.T) {
_, err := suite.committee.IdentityByEpoch(unittest.Uint64InRange(1, 100), ejectedConsensusIdentity.NodeID)
require.True(t, model.IsInvalidSignerError(err))
})

t.Run("otherwise valid non-consensus node", func(t *testing.T) {
_, err := suite.committee.IdentityByEpoch(unittest.Uint64InRange(1, 100), validNonConsensusIdentity.NodeID)
require.True(t, model.IsInvalidSignerError(err))
Expand Down
2 changes: 1 addition & 1 deletion consensus/integration/epoch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func withNextEpoch(
encodableSnapshot := snapshot.Encodable()

currEpoch := &encodableSnapshot.Epochs.Current // take pointer so assignments apply
currentEpochIdentities := currEpoch.InitialIdentities
currentEpochIdentities, _ := snapshot.Identities(filter.Any)
nextEpochIdentities = nextEpochIdentities.Sort(order.Canonical[flow.Identity])

currEpoch.FinalView = currEpoch.FirstView + curEpochViews - 1 // first epoch lasts curEpochViews
Expand Down
2 changes: 1 addition & 1 deletion consensus/integration/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func createRootBlockData(participantData *run.ParticipantData) (*flow.Block, *fl

counter := uint64(1)
setup := unittest.EpochSetupFixture(
unittest.WithParticipants(participants),
unittest.WithParticipants(participants.ToSkeleton()),
unittest.SetupWithCounter(counter),
unittest.WithFirstView(root.Header.View),
unittest.WithFinalView(root.Header.View+1000),
Expand Down
13 changes: 8 additions & 5 deletions engine/access/rpc/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1891,12 +1891,15 @@ func (suite *Suite) TestExecutionNodesForBlockID() {
actualList = append(actualList, actual)
}

if len(expectedENs) > maxNodesCnt {
for _, actual := range actualList {
require.Contains(suite.T(), expectedENs, actual)
{
expectedENs := expectedENs.ToSkeleton()
if len(expectedENs) > maxNodesCnt {
for _, actual := range actualList {
require.Contains(suite.T(), expectedENs, actual)
}
} else {
require.ElementsMatch(suite.T(), actualList, expectedENs)
}
} else {
require.ElementsMatch(suite.T(), actualList, expectedENs)
}
}
// if we don't find sufficient receipts, executionNodesForBlockID should return a list of random ENs
Expand Down
4 changes: 2 additions & 2 deletions engine/consensus/dkg/reactor_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (suite *ReactorEngineSuite_SetupPhase) SetupTest() {
suite.currentEpoch.On("DKGPhase3FinalView").Return(suite.dkgPhase3FinalView, nil)
suite.nextEpoch = new(protocol.Epoch)
suite.nextEpoch.On("Counter").Return(suite.NextEpochCounter(), nil)
suite.nextEpoch.On("InitialIdentities").Return(suite.committee, nil)
suite.nextEpoch.On("InitialIdentities").Return(suite.committee.ToSkeleton(), nil)

suite.epochQuery = mocks.NewEpochQuery(suite.T(), suite.epochCounter)
suite.epochQuery.Add(suite.currentEpoch)
Expand Down Expand Up @@ -162,7 +162,7 @@ func (suite *ReactorEngineSuite_SetupPhase) SetupTest() {
suite.factory = new(module.DKGControllerFactory)
suite.factory.On("Create",
dkgmodule.CanonicalInstanceID(suite.firstBlock.ChainID, suite.NextEpochCounter()),
suite.committee,
suite.committee.ToSkeleton(),
mock.Anything,
).Return(suite.controller, nil)

Expand Down

0 comments on commit 6e65018

Please sign in to comment.