This is a temporary measure until we can:
- Fix shard state mutation bug, and
- Implement key passphrase recycle across process restart (exec) for
shard migration.
* 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.
For now, validators simply wait until the leader proposes something.
Going forward though, validators would have to deal with a leader
intentionally delaying resharding:
- A beacon leader should send resharding proposal as soon as DRand is
finished.
- A regular leader should send a local resharding proposal as soon as it
sees a master proposal from the beacon chain (received via syncing).
In both cases, there should be some sort of grace period to allow for a
short delay inserted by the leader's discretion (so that it can wait for
most nodes to catch up with DRand or beacon chain syncing).
1. Remove eth rpc code and unnecessary changes from
7a0f18f92b. Import the package instead.
2. Move HmyAPIBackend into core package so it has more access to core.
3. Add API interface for services.
4. Start RPC for all roles, for both HTTP (baseport+10) and WS (baseport+20).
3. Keep implemented APIs but move to internal/hmyapi package.
* add resharding for epoch switch:
1) add randseed and shardStateHash in block header;
2) Read and Write shardState from/to blockchain;
3) perform resharding after every N (epoch length) blocks