use consensus.IsLeader to replace the static nodeConfig
by checking the public key of the leader with the consensus public key
Signed-off-by: Leo Chen <leo@harmony.one>
This is done by introducing two concepts: sharding configuration
instance and sharding configuration schedule.
A sharding configuration instance is a particular set of sharding
parameters in effect, namely:
- Number of shards;
- Number of nodes/shard; and
- Number of Harmony-operated nodes per shard.
A sharding configuration schedule is a mapping from an epoch to the
corresponding sharding configuration for that epoch.
Two schedules are provided and to be maintained in the long term:
Mainnet sharding schedule (4 shards, 150 nodes/shard, 112
Harmony-operated nodes/shard) and public testnet sharding schedule (2
shards, 150 nodes/shard, 150 Harmony-operated nodes/shard).
Harmony node binary uses one of these for each -network_type=mainnet and
-network_type=testnet respectively.
In addition, for -network_type=devnet, a fixed sharding schedule can be
specified with direct control over all three parameters (-dn_num_shards,
-dn_shard_size, and -dn_hmy_size).
The mainnet schedule code includes a commented-out example schedule.
If a non-empty zone name is given, obtain syncing peers from the given
zone; otherwise, use libp2p peer discovery.
-dns=true is equivalent to -dns_zone=t.hmny.io; -dns=false is equivalent
to -dns-zone="". If -dns=true and -dns_zone are both given, -dns_zone
takes precedence, i.e. the given zone is used instead of t.hmny.io.
* Log the right shard number for wallet/getFreeToken
* Don't try to use empty commit bitmap from genesis block
* Fail hard if block reward or finalization fails
* Log the public key if message sig verification fails
* Extract and save chain state from received blocks in order to
eliminate deep tail recursion
* Properly deep copy chain config (previously ChainID was being shared
among chains)
* Eliminate chain use-before-init window in node.New()
* Save genesis epoch shard state in new blockchain database
* Do not check epoch of the received shard state message (temp
workaround – we should introduce the check elsewhere)
* Propose an empty block if no transactions have been received for 10
seconds
* Manage shard chains as first class citizen
* Bring core.BlockChain's read/write semantics cleaner
* Reimplement the block reward in terms of on-chain committee info, not
hardcoded genesis committee.