Skip to content

Commit

Permalink
Fixed compilation in DKG tests
Browse files Browse the repository at this point in the history
  • Loading branch information
durkmurder committed Oct 4, 2023
1 parent a5ca17d commit 5acf227
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions integration/dkg/dkg_emulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ func (s *EmulatorSuite) runTest(goodNodes int, emulatorProblems bool) {
DKGPhase2FinalView: 200,
DKGPhase3FinalView: 250,
FinalView: 300,
Participants: s.netIDs,
Participants: s.netIDs.ToSkeleton(),
RandomSource: []byte("random bytes for seed"),
}

// create the EpochSetup that will trigger the next DKG run with all the
// desired parameters
nextEpochSetup := flow.EpochSetup{
Counter: currentCounter + 1,
Participants: s.netIDs,
Participants: s.netIDs.ToSkeleton(),
RandomSource: []byte("random bytes for seed"),
FirstView: 301,
FinalView: 600,
Expand Down
4 changes: 2 additions & 2 deletions integration/dkg/dkg_whiteboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ func TestWithWhiteboard(t *testing.T) {
DKGPhase2FinalView: 200,
DKGPhase3FinalView: 250,
FinalView: 300,
Participants: conIdentities,
Participants: conIdentities.ToSkeleton(),
RandomSource: []byte("random bytes for seed"),
}

// create the EpochSetup that will trigger the next DKG run with all the
// desired parameters
nextEpochSetup := flow.EpochSetup{
Counter: currentCounter + 1,
Participants: conIdentities,
Participants: conIdentities.ToSkeleton(),
RandomSource: []byte("random bytes for seed"),
}

Expand Down
6 changes: 3 additions & 3 deletions integration/epochs/cluster_epoch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ func (s *Suite) deployEpochQCContract() {
}

// CreateClusterList creates a clustering with the nodes split evenly and returns the resulting `ClusterList`
func (s *Suite) CreateClusterList(clusterCount, nodesPerCluster int) (flow.ClusterList, flow.IdentityList) {
func (s *Suite) CreateClusterList(clusterCount, nodesPerCluster int) (flow.ClusterList, flow.IdentitySkeletonList) {

// create list of nodes to be used for the clustering
nodes := unittest.IdentityListFixture(clusterCount*nodesPerCluster, unittest.WithRole(flow.RoleCollection))
nodes := unittest.IdentityListFixture(clusterCount*nodesPerCluster, unittest.WithRole(flow.RoleCollection)).ToSkeleton()
// create cluster assignment
clusterAssignment := unittest.ClusterAssignment(uint(clusterCount), nodes)

Expand Down Expand Up @@ -142,7 +142,7 @@ func (s *Suite) StartVoting(clustering flow.ClusterList, clusterCount, nodesPerC
cdcNodeID, err := cadence.NewString(node.NodeID.String())
require.NoError(s.T(), err)
nodeIDs = append(nodeIDs, cdcNodeID)
nodeWeights = append(nodeWeights, cadence.NewUInt64(node.Weight))
nodeWeights = append(nodeWeights, cadence.NewUInt64(node.InitialWeight))
}

clusterNodeIDs[index] = cadence.NewArray(nodeIDs)
Expand Down
8 changes: 4 additions & 4 deletions integration/testnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ func BootstrapNetwork(networkConf NetworkConfig, bootstrapDir string, chainID fl

// IMPORTANT: we must use this ordering when writing the DKG keys as
// this ordering defines the DKG participant's indices
stakedNodeInfos := bootstrap.Sort(toNodeInfos(stakedConfs), order.Canonical)
stakedNodeInfos := bootstrap.Sort(toNodeInfos(stakedConfs), order.Canonical[flow.Identity])

dkg, err := runBeaconKG(stakedConfs)
if err != nil {
Expand Down Expand Up @@ -1145,7 +1145,7 @@ func BootstrapNetwork(networkConf NetworkConfig, bootstrapDir string, chainID fl
DKGPhase2FinalView: dkgOffsetView + networkConf.ViewsInDKGPhase*2,
DKGPhase3FinalView: dkgOffsetView + networkConf.ViewsInDKGPhase*3,
FinalView: root.Header.View + networkConf.ViewsInEpoch - 1,
Participants: participants,
Participants: participants.ToSkeleton(),
Assignments: clusterAssignments,
RandomSource: randomSource,
}
Expand Down Expand Up @@ -1306,7 +1306,7 @@ func setupClusterGenesisBlockQCs(nClusters uint, epochCounter uint64, confs []Co

participantsUnsorted := toParticipants(confs)
participants := participantsUnsorted.Sort(order.Canonical[flow.Identity])
collectors := participants.Filter(filter.HasRole[flow.Identity](flow.RoleCollection))
collectors := participants.Filter(filter.HasRole[flow.Identity](flow.RoleCollection)).ToSkeleton()
assignments := unittest.ClusterAssignment(nClusters, collectors)
clusters, err := factory.NewClusterList(assignments, collectors)
if err != nil {
Expand Down Expand Up @@ -1338,7 +1338,7 @@ func setupClusterGenesisBlockQCs(nClusters uint, epochCounter uint64, confs []Co
}

// must order in canonical ordering otherwise decoding signer indices from cluster QC would fail
clusterCommittee := bootstrap.ToIdentityList(clusterNodeInfos).Sort(order.Canonical[flow.Identity])
clusterCommittee := bootstrap.ToIdentityList(clusterNodeInfos).Sort(order.Canonical[flow.Identity]).ToSkeleton()
qc, err := run.GenerateClusterRootQC(clusterNodeInfos, clusterCommittee, block)
if err != nil {
return nil, nil, nil, fmt.Errorf("fail to generate cluster root QC with clusterNodeInfos %v, %w",
Expand Down
6 changes: 3 additions & 3 deletions integration/tests/collection/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (suite *CollectorSuite) Clusters() flow.ClusterList {
setup, ok := result.ServiceEvents[0].Event.(*flow.EpochSetup)
suite.Require().True(ok)

collectors := suite.net.Identities().Filter(filter.HasRole[flow.Identity](flow.RoleCollection))
collectors := suite.net.Identities().Filter(filter.HasRole[flow.Identity](flow.RoleCollection)).ToSkeleton()
clusters, err := factory.NewClusterList(setup.Assignments, collectors)
suite.Require().Nil(err)
return clusters
Expand Down Expand Up @@ -170,7 +170,7 @@ func (suite *CollectorSuite) NextTransaction(opts ...func(*sdk.Transaction)) *sd
return tx
}

func (suite *CollectorSuite) TxForCluster(target flow.IdentityList) *sdk.Transaction {
func (suite *CollectorSuite) TxForCluster(target flow.IdentitySkeletonList) *sdk.Transaction {
acct := suite.acct

tx := suite.NextTransaction()
Expand Down Expand Up @@ -331,7 +331,7 @@ func (suite *CollectorSuite) Collector(clusterIdx, nodeIdx uint) *testnet.Contai
node, ok := cluster.ByIndex(nodeIdx)
require.True(suite.T(), ok, "invalid node index")

return suite.net.ContainerByID(node.ID())
return suite.net.ContainerByID(node.NodeID)
}

// ClusterStateFor returns a cluster state instance for the collector node with the given ID.
Expand Down

0 comments on commit 5acf227

Please sign in to comment.