Remove wrongly refactored ShardIDs

pull/1413/head
Rongjian Lan 5 years ago
parent cbd0d802b0
commit 179e19972e
  1. 2
      api/client/client.go
  2. 6
      cmd/harmony/main.go
  3. 2
      consensus/consensus_service.go
  4. 2
      core/types/block.go
  5. 4
      internal/configs/node/config.go
  6. 2
      node/node.go
  7. 8
      node/node_handler.go

@ -7,7 +7,7 @@ import (
// Client represents a node (e.g. a wallet) which sends transactions and receives responses from the harmony network
type Client struct {
ShardID uint32 // ShardIDs
ShardID uint32 // ShardID
UpdateBlocks func([]*types.Block) // Closure function used to sync new block with the leader. Once the leader finishes the consensus on a new block, it will send it to the clients. Clients use this method to update their blockchain
// The p2p host used to send/receive p2p messages

@ -361,7 +361,7 @@ func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node {
// TODO: Disable drand. Currently drand isn't functioning but we want to compeletely turn it off for full protection.
// Enable it back after mainnet.
// dRand := drand.New(nodeConfig.Host, nodeConfig.ShardIDs, []p2p.Peer{}, nodeConfig.Leader, currentNode.ConfirmedBlockChannel, nodeConfig.ConsensusPriKey)
// dRand := drand.New(nodeConfig.Host, nodeConfig.ShardID, []p2p.Peer{}, nodeConfig.Leader, currentNode.ConfirmedBlockChannel, nodeConfig.ConsensusPriKey)
// currentNode.Consensus.RegisterPRndChannel(dRand.PRndChannel)
// currentNode.Consensus.RegisterRndChannel(dRand.RndChannel)
// currentNode.DRand = dRand
@ -438,7 +438,7 @@ func main() {
}
if *shardID >= 0 {
utils.GetLogInstance().Info("ShardIDs Override", "original", initialAccount.ShardID, "override", *shardID)
utils.GetLogInstance().Info("ShardID Override", "original", initialAccount.ShardID, "override", *shardID)
initialAccount.ShardID = uint32(*shardID)
}
@ -455,7 +455,7 @@ func main() {
}
utils.GetLogInstance().Info(startMsg,
"BlsPubKey", hex.EncodeToString(nodeConfig.ConsensusPubKey.Serialize()),
"ShardIDs", nodeConfig.ShardID,
"ShardID", nodeConfig.ShardID,
"ShardGroupID", nodeConfig.GetShardGroupID(),
"BeaconGroupID", nodeConfig.GetBeaconGroupID(),
"ClientGroupID", nodeConfig.GetClientGroupID(),

@ -263,7 +263,7 @@ func (consensus *Consensus) String() string {
} else {
duty = "VLD" // validator
}
return fmt.Sprintf("[duty:%s, PubKey:%s, ShardIDs:%v]",
return fmt.Sprintf("[duty:%s, PubKey:%s, ShardID:%v]",
duty, consensus.PubKey.SerializeToHexStr(), consensus.ShardID)
}

@ -389,7 +389,7 @@ func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() }
// MixDigest is the header mix digest.
func (b *Block) MixDigest() common.Hash { return b.header.MixDigest }
// ShardID is the header ShardIDs
// ShardID is the header ShardID
func (b *Block) ShardID() uint32 { return b.header.ShardID }
// Epoch is the header Epoch

@ -71,7 +71,7 @@ type ConfigType struct {
client p2p.GroupID // the client group ID of the shard
isClient bool // whether this node is a client node, such as wallet/txgen
isBeacon bool // whether this node is beacon node doing consensus or not
ShardID uint32 // ShardIDs of this node; TODO ek – reviisit when resharding
ShardID uint32 // ShardID of this node; TODO ek – reviisit when resharding
role Role // Role of the node
Port string // Port of the node.
IP string // IP of the node.
@ -157,7 +157,7 @@ func (conf *ConfigType) SetIsClient(b bool) {
conf.isClient = b
}
// SetShardID set the ShardIDs
// SetShardID set the ShardID
func (conf *ConfigType) SetShardID(s uint32) {
conf.ShardID = s
}

@ -379,7 +379,7 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, chainDBFactory shardc
node.AddContractKeyAndAddress(scFaucet)
}
//if node.Consensus.ShardIDs == 0 {
//if node.Consensus.ShardID == 0 {
// // Contracts only exist in beacon chain
// if node.isFirstTime {
// // Setup one time smart contracts

@ -621,7 +621,7 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block) {
// TODO: enable shard state update
//newBlockHeader := newBlock.Header()
//if newBlockHeader.ShardStateHash != (common.Hash{}) {
// if node.Consensus.ShardIDs == 0 {
// if node.Consensus.ShardID == 0 {
// // TODO ek – this is a temp hack until beacon chain sync is fixed
// // End-of-epoch block on beacon chain; block's EpochState is the
// // master resharding table. Broadcast it to the network.
@ -950,11 +950,11 @@ func (node *Node) epochShardStateMessageHandler(msgPayload []byte) error {
func (node *Node) transitionIntoNextEpoch(shardState types.ShardState) {
logger = logger.New(
"blsPubKey", hex.EncodeToString(node.Consensus.PubKey.Serialize()),
"curShard", node.Blockchain().ShardIDs(),
"curShard", node.Blockchain().ShardID(),
"curLeader", node.Consensus.IsLeader())
for _, c := range shardState {
utils.Logger().Debug().
Uint32("shardID", c.ShardIDs).
Uint32("shardID", c.ShardID).
Str("nodeList", c.NodeList).
Msg("new shard information")
}
@ -986,7 +986,7 @@ func (node *Node) transitionIntoNextEpoch(shardState types.ShardState) {
node.Consensus.UpdatePublicKeys(publicKeys)
// node.DRand.UpdatePublicKeys(publicKeys)
if node.Blockchain().ShardIDs() == myShardID {
if node.Blockchain().ShardID() == myShardID {
getLogger().Info("staying in the same shard")
} else {
getLogger().Info("moving to another shard")

Loading…
Cancel
Save