diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index a353d5cb0..373d43134 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -11,9 +11,6 @@ import ( "runtime" "time" - common2 "github.com/ethereum/go-ethereum/common" - "github.com/harmony-one/harmony/internal/common" - "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/harmony-one/bls/ffi/go/bls" @@ -21,6 +18,7 @@ import ( "github.com/harmony-one/harmony/consensus" "github.com/harmony-one/harmony/core" "github.com/harmony-one/harmony/internal/blsgen" + "github.com/harmony-one/harmony/internal/common" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding" "github.com/harmony-one/harmony/internal/ctxerror" @@ -125,11 +123,6 @@ var ( metricsFlag = flag.Bool("metrics", false, "Collect and upload node metrics") pushgatewayIP = flag.String("pushgateway_ip", "grafana.harmony.one", "Metrics view ip") pushgatewayPort = flag.String("pushgateway_port", "9091", "Metrics view port") - - // Bad block revert - doRevertBefore = flag.Int("do_revert_before", 410000, "If the current block is less than do_revert_before, revert all blocks until (including) revert_to block") - revertTo = flag.Int("revert_to", 407735, "The revert will rollback all blocks until and including block number revert_to") - revertShardID = flag.Int("revert_shard_id", 3, "The shard id where the revert will happen") ) func initSetup() { @@ -274,6 +267,16 @@ func createGlobalConfig() *nodeconfig.ConfigType { return nodeConfig } +func _HarmonyNotice(shardID uint32) { + tick := time.NewTicker(20 * time.Second) + for { + select { + case <-tick.C: + utils.GetLogger().Info("Please wait for the blockain bootstrapping process", "Shard", shardID) + } + } +} + func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node { // Consensus object. // TODO: consensus object shouldn't start here @@ -301,22 +304,11 @@ func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node { chainDBFactory := &shardchain.LDBFactory{RootDir: nodeConfig.DBDir} currentNode := node.New(nodeConfig.Host, currentConsensus, chainDBFactory, *isArchival) - ////// Temporary fix for 8-6 incident ///////// + // Temporary Pangaea fix to stop shard0/shard1 nodes, so that the shard can be rebooted chain := currentNode.Blockchain() - curNum := chain.CurrentBlock().NumberU64() - if chain.ShardID() == uint32(*revertShardID) && curNum < uint64(*doRevertBefore) && curNum >= uint64(*revertTo) { - utils.GetLogInstance().Warn("[WARNING] Reverting blocks", - "to", *revertTo, "curBlock", curNum) - // Remove invalid blocks - for chain.CurrentBlock().NumberU64() >= uint64(*revertTo) { - curBlock := chain.CurrentBlock() - rollbacks := []common2.Hash{curBlock.Hash()} - chain.Rollback(rollbacks) - sigAndBitMap := append(curBlock.Header().LastCommitSignature[:], curBlock.Header().LastCommitBitmap...) - chain.WriteLastCommits(sigAndBitMap) - } + if (chain.ShardID() == uint32(0) || chain.ShardID() == uint32(1)) && core.ShardingSchedule == shardingconfig.PangaeaSchedule { + _HarmonyNotice(chain.ShardID()) } - /////////////////////////////////////////////// if *dnsZone != "" { currentNode.SetDNSZone(*dnsZone) diff --git a/consensus/config.go b/consensus/config.go index 41c79a8aa..6cca5b9bc 100644 --- a/consensus/config.go +++ b/consensus/config.go @@ -11,7 +11,7 @@ const ( // timeout duration for announce/prepare/commit phaseDuration time.Duration = 60 * time.Second - bootstrapDuration time.Duration = 300 * time.Second + bootstrapDuration time.Duration = 600 * time.Second maxLogSize uint32 = 1000 // threshold between received consensus message blockNum and my blockNum consensusBlockNumBuffer uint64 = 2 diff --git a/test/configs/pangaea.txt b/test/configs/pangaea.txt new file mode 100644 index 000000000..083000dc9 --- /dev/null +++ b/test/configs/pangaea.txt @@ -0,0 +1,10 @@ +127.0.0.1 9000 validator one104raxhv2gfk7syf42jqs7t3gwpewylh28z5rgv 88a10274dc63dbd0731b2b8d436656edc999f1e60b4510e032f004189d43e076ac7ed2a1a4b7f9ebe1e5391ff51a3601 +127.0.0.1 9001 validator one1tc8525rnajj2ldn52z75y0w9rvdlat7uem7atr 6fcccf6105c23d45f7c1e5becb7bab33ae329cf0a3b18f80e8c4194effa29b2a26fe5c7fa8f461e82bf0d6f6dfbba018 +127.0.0.1 9002 validator one1g2dlhygsf0yckcvehdvvkk57melwempqjk44el 8ddbb90bacf203c54d260deda3f1a7d7a03a90c316d8eaff353fb9c02ee13c6fd181112e2b9cb0c84d2ffc61a0fccc8f +127.0.0.1 9003 validator one1q769x04mmlfcj5fqup2n7tst92egca4uj2dujp 1c0d5e8b81407e4928be5188dfa66bea6841111675ea1e3de07a0ab941432930b91ddd38f4946d651c8096750ad14082 +127.0.0.1 9004 validator one1hrqzk47rcuuhg88al5xspry8d4652r03j5fej6 68997549f99566819a5104036ad8b2e6674639cae4aae79125a4209ba6bbf3608678d239e2c76cbb286081aae210e302 +127.0.0.1 9005 validator one1wrau8zpzq4g034pl9kkrupmhrf0e2sknkjldwq 28449f23cdae7bad685e694252878aa068274b4f68341b3b82097d01620f456f6ada8cd8f64f63445a28c5018eeb5903 +127.0.0.1 9006 validator one1ml4kpquwxvgh358xsnafzxhlessnxft07agn3n 79b3cdd972a276e740c794a20657b4881f47fc657cac075e90a5317b427d2f86d62fc61870f399a17aaaeb9fa597f510 +127.0.0.1 9007 validator one1hcmsm0djlve4wmec9lu3szxr2p7fkl28y6xaml ddb18d7acbd97e655584fc1ea368d3b0b748e3e8881cdc7546d13f8953846a7dfa67f8cbd8471a7c13565e4ef167dd8b +127.0.0.1 9008 validator one1v9a6esgxzw6fz3rdluem02esq6thdg9yxamqxy ea3d6267f5cce1187a12a4f0698a035a41a0f8c03cba12173d7cb16462c1491bd6506c70effa897290f81d6d814b8e0d +127.0.0.1 9009 validator one1nr0cts9w4ct74934uq6t59zh66fxk3u4927dxj 4e3865d0eda7d87bd18d3b203567b5e4f55b176561a3bfbf4de81e20055d69183c8cada33b46a5c7861504f87629ff89 diff --git a/test/deploy.sh b/test/deploy.sh index da27224d9..3957b734c 100755 --- a/test/deploy.sh +++ b/test/deploy.sh @@ -64,6 +64,7 @@ USAGE: $ME [OPTIONS] config_file_name [extra args to node] -m min_peers minimal number of peers to start consensus (default: $MIN) -s shards number of shards (default: $SHARDS) -n dryrun mode (default: $DRYRUN) + -N network network type (default: $NETWORK) -B don't build the binary This script will build all the binaries and start harmony and txgen based on the configuration file. @@ -80,14 +81,15 @@ EOU DEFAULT_DURATION_NOSYNC=60 DEFAULT_DURATION_SYNC=200 -TXGEN=true +TXGEN=false DURATION= MIN=3 SHARDS=2 DRYRUN= SYNC=true +NETWORK=localnet -while getopts "htD:m:s:nB" option; do +while getopts "htD:m:s:nBN:" option; do case $option in h) usage ;; t) TXGEN=false ;; @@ -96,6 +98,7 @@ while getopts "htD:m:s:nB" option; do s) SHARDS=$OPTARG ;; n) DRYRUN=echo ;; B) NOBUILD=true ;; + N) NETWORK=$OPTARG ;; esac done @@ -148,7 +151,7 @@ echo "bootnode launched." + " $BN_MA" unset -v base_args declare -a base_args args -base_args=(-log_folder "${log_folder}" -min_peers "${MIN}" -bootnodes "${BN_MA}" -network_type="localnet" -blspass file:.hmy/blspass.txt -dns=false) +base_args=(-log_folder "${log_folder}" -min_peers "${MIN}" -bootnodes "${BN_MA}" -network_type="$NETWORK" -blspass file:.hmy/blspass.txt -dns=false) NUM_NN=0 sleep 2