|
|
@ -6,6 +6,8 @@ import ( |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/dedis/kyber" |
|
|
|
|
|
|
|
"github.com/simple-rules/harmony-benchmark/crypto/pki" |
|
|
|
"github.com/simple-rules/harmony-benchmark/log" |
|
|
|
"github.com/simple-rules/harmony-benchmark/log" |
|
|
|
"github.com/simple-rules/harmony-benchmark/node" |
|
|
|
"github.com/simple-rules/harmony-benchmark/node" |
|
|
|
) |
|
|
|
) |
|
|
@ -20,7 +22,7 @@ type IdentityChain struct { |
|
|
|
log log.Logger |
|
|
|
log log.Logger |
|
|
|
PeerToShardMap map[*node.Node]int |
|
|
|
PeerToShardMap map[*node.Node]int |
|
|
|
ShardLeaderMap map[int]*node.Node |
|
|
|
ShardLeaderMap map[int]*node.Node |
|
|
|
PubKey string |
|
|
|
PubKey kyber.Point |
|
|
|
NumberOfShards int |
|
|
|
NumberOfShards int |
|
|
|
NumberOfLeadersAdded int |
|
|
|
NumberOfLeadersAdded int |
|
|
|
} |
|
|
|
} |
|
|
@ -31,18 +33,22 @@ func (IDC *IdentityChain) CreateShardAssignment() { |
|
|
|
func (IDC *IdentityChain) generateRandomPermutations(num int) { |
|
|
|
func (IDC *IdentityChain) generateRandomPermutations(num int) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SelectIds as
|
|
|
|
//Init
|
|
|
|
func (IDC *IdentityChain) SelectIds() { |
|
|
|
func New(filename string) { |
|
|
|
// selectNumber := IDC.NumberOfNodesInShard - len(IDC.Identities)
|
|
|
|
idc := IdentityChain{} |
|
|
|
// Insert the lines below once you have a identity block
|
|
|
|
idc.NumberOfShards = readConfigFile(filename) |
|
|
|
// IB := IDC.GetLatestBlock()
|
|
|
|
idc.PubKey = generateIDCKeys() |
|
|
|
// currentIDS := IB.GetIdentities()
|
|
|
|
idc.StartServer() |
|
|
|
// currentIDS := IDC.Identities
|
|
|
|
} |
|
|
|
// selectNumber = int(math.Min(float64(len(IDC.PendingIdentities)), float64(selectNumber)))
|
|
|
|
|
|
|
|
// pending := IDC.PendingIdentities[:selectNumber]
|
|
|
|
func readConfigFile(filename string) int { |
|
|
|
// IDC.SelectedIdentitites = append(currentIDS, pending...)
|
|
|
|
return 2 |
|
|
|
// IDC.PendingIdentities = []*node.Node{}
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func generateIDCKeys() kyber.Point { |
|
|
|
|
|
|
|
priKey := pki.GetPrivateKeyFromInt(10) |
|
|
|
|
|
|
|
pubkey := pki.GetPublicKeyFromPrivateKey(priKey) |
|
|
|
|
|
|
|
return pubkey |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//AcceptConnections welcomes new connections
|
|
|
|
//AcceptConnections welcomes new connections
|
|
|
|