Bump up genesis beaconchain size to 50

pull/605/head
Rongjian Lan 6 years ago
parent e49fc84ba5
commit 8077352426
  1. 9
      cmd/harmony/main.go
  2. 2
      core/resharding.go
  3. 3650
      internal/utils/contract/constants.go
  4. 51
      test/configs/beaconchain50.txt
  5. 6
      test/crypto/bls/main.go
  6. 10
      test/deploy.sh

@ -7,7 +7,6 @@ import (
"os"
"path"
"runtime"
"strconv"
"time"
"github.com/ethereum/go-ethereum/ethdb"
@ -130,15 +129,13 @@ func createGlobalConfig() *nodeconfig.ConfigType {
stakingPriKey := ""
consensusPriKey := &bls.SecretKey{}
if *isBeacon {
// TODO: use a better way to get the index for accounts.
portNum, _ := strconv.Atoi(*port)
index := portNum % 10
stakingPriKey = contract.InitialBeaconChainAccounts[index].Private
err := consensusPriKey.SetHexString(contract.InitialBeaconChainBLSAccounts[index].Private)
stakingPriKey = contract.InitialBeaconChainAccounts[*accountIndex].Private
err := consensusPriKey.SetHexString(contract.InitialBeaconChainBLSAccounts[*accountIndex].Private)
if err != nil {
panic(fmt.Errorf("generate key error"))
}
} else {
// TODO: let user specify the ECDSA key
stakingPriKey = contract.NewNodeAccounts[*accountIndex].Private
// TODO: use user supplied key
consensusPriKey.SetByCSPRNG()

@ -24,7 +24,7 @@ const (
// GenesisShardNum is the number of shard at genesis
GenesisShardNum = 4
// GenesisShardSize is the size of each shard at genesis
GenesisShardSize = 10
GenesisShardSize = 50
// CuckooRate is the percentage of nodes getting reshuffled in the second step of cuckoo resharding.
CuckooRate = 0.1
)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,51 @@
127.0.0.1 9000 leader 0
127.0.0.1 9001 validator 0
127.0.0.1 9002 validator 0
127.0.0.1 9003 validator 0
127.0.0.1 9004 validator 0
127.0.0.1 9005 validator 0
127.0.0.1 9006 validator 0
127.0.0.1 9007 validator 0
127.0.0.1 9008 validator 0
127.0.0.1 9009 validator 0
127.0.0.1 9010 validator 0
127.0.0.1 9011 validator 0
127.0.0.1 9012 validator 0
127.0.0.1 9013 validator 0
127.0.0.1 9014 validator 0
127.0.0.1 9015 validator 0
127.0.0.1 9016 validator 0
127.0.0.1 9017 validator 0
127.0.0.1 9018 validator 0
127.0.0.1 9019 validator 0
127.0.0.1 9020 validator 0
127.0.0.1 9021 validator 0
127.0.0.1 9022 validator 0
127.0.0.1 9023 validator 0
127.0.0.1 9024 validator 0
127.0.0.1 9025 validator 0
127.0.0.1 9026 validator 0
127.0.0.1 9027 validator 0
127.0.0.1 9028 validator 0
127.0.0.1 9029 validator 0
127.0.0.1 9030 validator 0
127.0.0.1 9031 validator 0
127.0.0.1 9032 validator 0
127.0.0.1 9033 validator 0
127.0.0.1 9034 validator 0
127.0.0.1 9035 validator 0
127.0.0.1 9036 validator 0
127.0.0.1 9037 validator 0
127.0.0.1 9038 validator 0
127.0.0.1 9039 validator 0
127.0.0.1 9040 validator 0
127.0.0.1 9041 validator 0
127.0.0.1 9042 validator 0
127.0.0.1 9043 validator 0
127.0.0.1 9044 validator 0
127.0.0.1 9045 validator 0
127.0.0.1 9046 validator 0
127.0.0.1 9047 validator 0
127.0.0.1 9048 validator 0
127.0.0.1 9049 validator 0
127.0.0.1 19999 client 0

@ -1,6 +1,7 @@
package main
import (
"fmt"
"log"
"time"
@ -17,11 +18,10 @@ func main() {
var aggPub *bls.PublicKey
startTime := time.Now()
for i := 0; i < 10; i++ {
for i := 0; i < 400; i++ {
var sec bls.SecretKey
sec.SetByCSPRNG()
log.Printf("Secret Key: %s", sec.GetHexString())
fmt.Printf("{Address: \"\", Private: \"%s\", Public: \"\"},\n", sec.GetHexString())
if i == 0 {
aggSig = sec.Sign(m)
aggPub = sec.GetPublicKey()

@ -136,26 +136,28 @@ NUM_NN=0
sleep 2
# Start nodes
i=0
while IFS='' read -r line || [[ -n "$line" ]]; do
IFS=' ' read ip port mode shardID <<< $line
if [ "$mode" == "leader" ]; then
echo "launching leader ..."
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key -is_leader 2>&1 | tee -a $LOG_FILE &
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -account_index $i -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key -is_leader 2>&1 | tee -a $LOG_FILE &
fi
if [ "$mode" == "validator" ]; then
echo "launching validator ..."
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE &
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -account_index $i -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE &
fi
if [ "$mode" == "archival" ]; then
echo "launching archival node ... wait"
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB $HMY_OPT2 -key /tmp/$ip-$port.key -is_archival 2>&1 | tee -a $LOG_FILE &
$DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -account_index $i $HMY_OPT2 -key /tmp/$ip-$port.key -is_archival 2>&1 | tee -a $LOG_FILE &
fi
sleep 0.5
if [[ "$mode" == "newnode" && "$SYNC" == "true" ]]; then
(( NUM_NN += 10 ))
echo "launching new node ..."
(sleep $NUM_NN; $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE ) &
(sleep $NUM_NN; $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -account_index $i -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE ) &
fi
(( i++ ))
done < $config
# Emulate node offline

Loading…
Cancel
Save