* [stream] added a length bytes to the start of p2p base stream
* [stream] added stream manager module
* [stream] added rate limiter
* [stream] added removeStream handling in ratelimiter and added test cases
Co-authored-by: Rongjian Lan <rongjian.lan@gmail.com>
1. Added some functionality to HostV2 for stream support.
2. Added new module discovery under p2p host to replace the networkInfo service.
3. Make dht datastore badger only active on bootstrap nodes. For normal nodes, badger is disabled by default. It can also be enabled by flags.
Co-authored-by: Rongjian Lan <rongjian.lan@gmail.com>
* [rosetta] Add /construct function framework
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add network ID check to all construct endpoints
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add UnsupportedCurveTypeError
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Implement ConstructionDerive & add ConstructAPI router
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Make recover middleware the outermost middleware
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Correct error for block not found
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Expose EstimateGas
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add InvalidTransactionConstructionError
* Add GetValidConstructionOperations
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Make TransactionMetadata optional ptr
* Add UnmarshalFromInterface for TransactionMetadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add InvalidTransactionConstructionError to network response
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add ConstructionPreprocess & ConstructionMetadata skeleton
* Add Helper methods for said functions
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add GasPrice to ConstructMetadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Make suggested gas fee & price its own fn
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Nit - fix comment
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add To & From Account ID in tx metadata
* remove getAmountFromUndelegateMessage
* make contract address a valid account identifier
* remove needless metadata in non-staking operations
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add error report for b32 error in newAccountIdentifier
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Simplify assertValidNetworkIdentifier
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Use sdk MapMarshall instead of rpc structured response
* remove unused GetValidConstructionOperations
* Add CurrencyHash
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement assertValidTransferOperationsAndGetTxAccounts
* refactor usages of rpc structured response for sdk map marshall
* add account identifier checks for transaction metadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Max related operation check more general for tx op check
* refactor names for readability
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add & Expose OperationComponents
* Remove txAccounts & add OperationComponents to metadata for quicker processing
* Remove From & To acc ID from TransactionMetadata as it's in OperationComponents
* Update tests for changes
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add tx type to OperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add logs to TransactionMetadata
* Enforce Operation type uniqueness invariant for each transaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add error for 3+ operations in getOperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Expose GetOperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add CrossShardTransactionOperationMetadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add staking operation medata type declaration
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix error messages & update comment
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Implement getCrossShardOperationComponents
* rename txAccs to components for clarity
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Implement getContractCreationOperationComponents
* Fix some edge case optional checks for operation validation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [go.mod] Bump rosetta version to 0.4.4 & dependent libs
* Update broken rosetta structs
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add ChainID to ConstructMetadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Rename PreStakingBlockRewardOperation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Init operation_components.go & move respective code
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Refactor formatTransaction for clarity
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Move maxNumOfConstructionOps to operation_components.go
* Clarify unsupported type err msg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Implement framework for ConstructionPayloads
* Remove currying OperationComponents in metadata as PublicKeys is now
part of the request in the necessary endpoints
* Add respective checks for added PublicKeys
* Make getAddressFromPublicKey more general & update tests
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add getAddress and update respective functions
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Create transaction_construction.go & impl ConstructTransaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add unmarshal check for ConstructMetadata & ConstructMetadataOptions
* Remove constructTransaction
* Wrap unsigned transaction with UnsignedTransaction to include intended signer
* Add framework for ConstructionParse
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add getSigningPayload method to construction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [internal/commonm] Add MustGeneratePrivateKey
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement parseUnsignedTransaction
* Add unpackWrappedTransactionFromHexString & refactor rlp encoding of transactions
* Make getSigningPayload return a list
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add TestUnpackWrappedTransactionFromHexString
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement parseSignedTransaction
* Move unpackWrappedTransactionFromHexString to ConstructionParse
before parsing transactions bases on if it's signed or not
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Nit - fix WrappedTransaction comments
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add extra negative tests for unpackWrappedTransactionFromHexString
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Finish initial Construct implementation
* Implement ConstructionCombine
* Implement ConstructionHash
* Implement ConstructionSubmit
* Ensure RLPbytes & From is present in WrappedTransaction
when unpackWrappedTransactionFromHexString is called
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Refactor construction into separate files
* Move tests into appropriate files
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement construction_check_test.go
* Update edge case for getSuggestedFeeAndPrice found during testing
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement construction_parse_test.go
* Clarify names for construction_create_test.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix ConstructionParse to not use crypto.PubkeyToAddress
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix UnmarshalFromInterface for CrossShardTransactionOperationMetadata
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add operation_components_test.go
* Implement TestGetContractCreationOperationComponents
* Implement TestGetCrossShardOperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Finish operation_components_test.go
* Implement TestGetTransferOperationComponents
* Implement TestGetOperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix big number checks for getTransferOperationComponents
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Implement transaction_construction_test.go
* Implement TestConstructPlainTransaction
* Implement TestConstructCrossShardTransaction
* Implement TestConstructContractCreationTransaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add shard ID checks for constructCrossShardTransaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add bad curve test for TestGetAddressFromPublicKey
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add nil error catches for Construction API
* Fix nits in messages as seen during pass
* Add DefaultGasLimit
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add trace message with version to all err msgs
* Add NewError unit test
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add TestGetAddressFromKnownPublicKey
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Fix possible nil ptr crash for GetBlockSigners
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Edge case bug fixes
* Create empty TransactionMetdata if no metadata is provided in operations.
Also update tests to correctly account for the behavior.
* In pre-staking era make current block one less than the absolute latest
to guarentee calculation of pres-taking eara block rewards.
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix unpackWrappedTransactionFromHexString
* Rename function to unpackWrappedTransactionFromString
* Update respective tests
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Make parsed transaction statuses empty
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Remove needles list initialization
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add SignatureType & SignedPayloadLength with checks
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix genesis network status crash
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Correct error message dumps for transaction_construction.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add OperationType to ConstructMetadataOptions
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Fix rosetta service rebase
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Fix estimate gas fail check
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add formatNegativeValue to ensure there's only 1 zero
* Correct regression found in constructCrossShardTransaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
[rosetta] Add contract creation estimate gas hack
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add DefaultSenderAddress for transaction formatter
* Update Construction API parser to reflect change
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix imports
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Address PR comments
* Add GetCallStackInfo to internal utils
* Add EstimateGas TODO in RPC package
* Remove DefaultGasLimit to use param gas limit
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add checks to tx formatter for nil to addr
* Remove needless block check for genesisBlock
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Remove EstimatedGasUsed from WrappedTransaction
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Rollup evm to geth v1.9.9 Muir Glacier
* fix go gen
* update intrinsic gas for istanbul
* Update statedb.Commit
* revert go gen result
* revert protobuf version
* update protobuf
* update go gen files
* set testnet epoch for evm upgrade
* [rosetta] Fix decimal precision on staking transactions
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add GenesisFundsOperation & PreStakingEraBlockRewardsOperation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add special case transaction ID & refactor to use
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Fix block signer mask creation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Update docs for block reward
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Rename PreStakingEraBlockRewardOperation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add pre-staking block reward txs & refactor special cases
* Add getBlockSigner info
* Rename vars named block to blk for pkg imports
* Add unit tests for block reward formatting
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix lint
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add new line to rosetta start msg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [go.mod] Correct go mod
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Make pre-staking block rewards calc same as AccumulateRewardsAndCountSigs
* Change committee to signers for blockSignerInfo
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add sanity check for pre-staking block reward amount
* Correct network chain for sync status
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Improve unpackSpecialCaseTransactionIdentifier unit test
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add server with example block & network services
* Update go.mod for rosetta SDK
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [internal/configs] Add RosettaServer to node config
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Add rosetta port flag
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [node] Add rosetta server start & rename api.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Change server start to use nodeconfig of rosetta
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Cleanup debugging prints
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix stdout print & document placeholders
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix lint & make StartSevers more consistent
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Disable rosetta by default
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [test] Make explorer deploy rosetta server
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Use direct http server for start
* Make go.mod changes minimal
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix fmt
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix fmt of go.mod
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Use port 9700 instead of 10000
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Bump config version
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Add v1.0.0 config backwards compatibility test
* Included update message if old config is loaded
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [test] Do not broadcast invalid tx on localnet
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Correct for invalid port when loading old config
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [cmd] Make rosetta variable names consistent
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
This is a big PR merged many small commits together.
We add the message validation function in libp2p layer.
In the validation function, we check the following conditions
1) the p2p message is a valid consensus message
2) the p2p message sender has a valid public key
3) the sender's public key is in the current committee
4) log the number of invalid/valid messages
After the validation, the valid messages will be forward to the network,
while the invalid messages will be filtered out.
The messages intended for the validator will be handled in the consensus layer.
Signed-off-by: Leo Chen <leo@harmony.one>
* [project] Use tracepointer
* [project] Remove dead dependencies
* [rpc] Add unix time at boot as value for node metadata rpc - need direct machine uptime
* [go] upgrade golang to 1.14
Signed-off-by: Leo Chen <leo@harmony.one>
* [go] fix goimports and update go.mod
Signed-off-by: Leo Chen <leo@harmony.one>
* [docker] update golang version
Signed-off-by: Leo Chen <leo@harmony.one>
* [internal] Remove dead RPC/wallet
* [rpc] Reduce API surface area for dead RPC
* [node] Remove dead flags, unused setters
* [project] Unused logger, too many loggers
* [core] staticcheck fixes, remove unused db keys
* [project] More dead code through, now in param and genesis
* [internal] Useless test
* [project] Update Dockerfile
* [main] Whitespace
* [p2p][go.mod] Update libp2p, pick pubsub from master as of commit now time. Limit max p2p message size
* [go.mod] Unused package
* [project] Remove p2pchat test app
* [project] Remove unused test/txgen
* [project] Remove two one off test programs, unused shell scripts
* [p2p] Temp log out sign of receive p2p message
* [p2p] Use 3 MB as max message size
support config variable's section name and refactor/move code to the internal package
set default config dir to .hmy/
change relative path ./.hmy
error string fmt
* [rpc][validator] Extend hmy blockchain validator information
* [availability] Optimize bump count
* [staking][validator][rpc] Remove validator stats rpc, fold into validator information, make existing pattern default behavior
* [slash] Reimplement SetDifference
* [reward][engine][network] Remove bad API from fall, begin setup for Per validator awards
* [header] Custom Marshal header for downstream, remove dev code
* [effective][committee] Factor out EPoS round of computation thereby unification in codebase of EPoS
* [unit-test] Fix semantically wrong validator unit tests, punt on maxBLS key wrt tx-pool test
* [reward] Use excellent singleflight package for caching lookup of subcommittees
* [apr][reward] Begin APR package itself, iterate on iterface signatures
* [reward] Handle possible error from singleflight
* [rpc][validator][reward] Adjust RPC committees, singleflight on votingPower, foldStats into Validator Information
* [apr] Stub out computation of APR
* [effective][committee] Upgrade SlotPurchase with named fields, provide marshal
* [effective] Update Tests
* [blockchain] TODO Remove the validators no longer in committee
* [validator][effective] More expressive string representation of eligibilty, ValidatorRPC explicit say if in committee now
* [rpc] Median-stake more semantic meaningful
* [validator] Iterate on semantic meaning of JSON representation
* [offchain] Make validator stats return explicit error
* [availability] Small typo
* [rpc] Quick visual hack until fix delete out kicked out validators
* [offchain] Delete validator from offchain that lost their slot
* [apr] Forgot to update interface signature
* [apr] Mul instead of Div
* [protocol][validator] Fold block reward accum per vaidator into validator-wrapper, off-chain => on-chain
* [votepower] Refactor votepower Roster, simplify aggregation of network wide rosters
* [votepower][shard] Adjust roster, optimize usage of BLSPublicKey as key, use MarshalText trick
* [shard] Granular errors
* [votepower][validator] Unify votepower data structure with off-chain usage
* [votepower][consensus][validator] Further simplify and unify votepower with off-chain, validator stats
* [votepower] Use RJs naming convention group,overall
* [votepower] Remove Println, do keep enforcing order
* [effective][reward] Expand semantics of eligibility as it was overloaded and confusing, evict old voting power computations
* [apr] Adjust json field name
* [votepower] Only aggregate on external validator
* [votepower] Mistake on aggregation, custom presentation network-wide
* [rpc][validator][availability] Remove parameter, take into account empty snapshot
* [apr] Use snapshots from two, one epochs ago. Still have question on header
* [apr] Use GetHeaderByNumber for the header needed for time stamp
* [chain] Evict > 3 epoch old voting power
* [blockchain] Leave Delete Validator snapshot as TODO
* [validator][rpc][effective] Undo changes to Protocol field, use virtual construct at RPC layer for meaning
* [project] Address PR comments
* [committee][rpc] Move +1 to computation of epos round rather than hack mutation
* [reward] Remove entire unnecessary loop, hook on AddReward. Remove unnecessary new big int
* [votepower][rpc][validator] Stick with numeric.Dec for token involved with computation, expose accumulate block-reward in RPC
* [effective][committee] Track the candidates for the EPoS auction, RPC median-stake benefits
* [node] Add hack way to get real error reason of why cannot load shardchain
* [consensus] Expand log on current issue on nil block
* [apr] Do the actual call to compute for validator's APR
* [committee] Wrap SlotOrder with validator address, manifests in median-stake RPC
* [apr] Incorrect error handle order
* [quorum] Remove incorrect compare on bls Key, (typo), remove redundant error check
* [shard] Add log if stakedSlots is 0
* [apr] More sanity check on div by zero, more lenient on error when dont have historical data yet
* [committee] Remove + 1 on seat count
* [apr] Use int64() directly
* [apr] Log when odd empty nil header
* [apr] Do not crash on empty header, figure out later
* [slash] Remove dead interface, associated piping
* [slash] Expand out structs
* [consensus] Write to a chan when find a case of double-signing, remove dead code
* [slash] Broadcast the noticing of a double signing
* [rawdb] CRUD for slashing candidates
* [slashing][node][proto] Broadcast the slash record after receive from consensus, handle received proto message, persist in off-chain db while pending
* [slash][node][propose-block] Add verified slashes proposed into the header in block proposal
* [slash][shard] Factor out external validator as method on shard state, add double-signature field
* [slash][engine] Apply slash, name boolean expression for sorts, use stable sort
* [slash] Abstract Ballot results so keep track of both pre and post double sign event
* [slash] Fix type errors on test code
* [slash] Read from correct rawdb
* [slash] Add epoch based guards in CRUD of slashing
* [slash] Write to correct cache for slashing candidates
* [shard] Use explicit named type of BLS Signature, use convention
* [slash] Fix mistake done in refactor, improper header used. Factor out fromSlice to set
* [slash][node] Restore newblock to master, try again minimial change
* [cx-receipts] Break up one-liner, use SliceStable, not Slice
* [network] Finish refactor that makes network message headers once
* [network] Simplify creation further of headers write
* [slash] Adjust data structure of slash after offline discussion with RJ, Chao
* [slash] Still did need signature of the double signature
* [consensus] Prepare message does not have block header
* [consensus] Soft reset three files to 968517d~1
* [consensus] Begin factor consensus network intended message out with prepare first
* [consensus] Factor out Prepared message
* [consensus] Factor out announce message creation
* [consensus] Committed Message, branch on verify sender key for clearer log
* [consensus] Committed Message Factor out
* [consensus] Do jenkins MVP of signatures adjustment
* [main][slash] Provide YAML config as webhook config for double sign event
* [consensus] Adjust signatures, whitespace, lessen GC pressure
* [consensus] Remove dead code
* [consensus] Factor out commit overloaded message, give commit payload override in construct
* [consensus] Fix travis tests
* [consensus] Provide block bytes in SubmitVote(quorum.Commit)
* [consensus] Factor out noisy sanity checks in BFT, move existing commit check earlier as was before
* [quorum] Adjust signatures in quorum
* [staking] Adjust after merge from master
* [consensus] Finish refactor of consensus
* [node] Fix import
* [consensus] Fix travis
* [consensus] Use origin/master copy of block, fix mistake of pointer to empty byte
* [consensus] Less verbose bools
* [consensus] Remove unused trailing mutation hook in message construct
* [consensus] Address some TODOs on err, comment out double sign