Skip to content

Commit

Permalink
Merge pull request EOSIO#1986 from EOSIO/bios-use-well-known-key
Browse files Browse the repository at this point in the history
restore the default producer key pair for the bios producer
  • Loading branch information
b1bart authored Mar 30, 2018
2 parents 38b43a9 + 841f1a0 commit 1c1e93d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 54 deletions.
37 changes: 20 additions & 17 deletions programs/eosio-launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,23 +744,26 @@ launcher_def::bind_nodes () {
}
int non_bios = prod_nodes - 1;
int per_node = producers / non_bios;
int extra = producers % non_bios;
producer_set.version = 1;
unsigned int i = 0;
for (auto &h : bindings) {
for (auto &inst : h.instances) {
bool is_bios = inst.name == "bios";
tn_node_def node;
node.name = inst.name;
node.instance = &inst;
auto kp = private_key_type::generate();
auto pubkey = kp.get_public_key();
node.keys.emplace_back (move(kp));
if (is_bios) {
string prodname = "eosio";
node.producers.push_back(prodname);
producer_set.producers.push_back({prodname,pubkey});
}
int extra = producers % non_bios;
producer_set.version = 1;
unsigned int i = 0;
for (auto &h : bindings) {
for (auto &inst : h.instances) {
bool is_bios = inst.name == "bios";
tn_node_def node;
node.name = inst.name;
node.instance = &inst;
auto kp = is_bios ?
private_key_type(string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3")) :
private_key_type::generate();
auto pubkey = kp.get_public_key();
node.keys.emplace_back (move(kp));
if (is_bios) {
string prodname = "eosio";
//pubkey = public_key_type(string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"));
node.producers.push_back(prodname);
producer_set.producers.push_back({prodname,pubkey});
}
else {
if (i < non_bios) {
int count = per_node;
Expand Down
35 changes: 7 additions & 28 deletions scripts/eosio-tn_bounce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,19 @@
# in most cases, simply running ./eosio-tn_bounce.sh is sufficient.
#

cd $EOSIO_HOME
pushd $EOSIO_HOME

prog=""
RD=""
for p in eosd eosiod nodeos; do
prog=$p
RD=bin
if [ -f $RD/$prog ]; then
break;
else
RD=programs/$prog
if [ -f $RD/$prog ]; then
break;
fi
fi
prog=""
RD=""
done

if [ \( -z "$prog" \) -o \( -z "$RD" \) ]; then
echo unable to locate binary for eosd or eosiod or nodeos
if [ ! -f programs/nodeos/nodeos ]; then
echo unable to locate binary for nodeos
exit 1
fi

config_base=etc/eosio/node_
if [ -z "$EOSIO_NODE" ]; then
DD=`ls -d var/lib/node_[012]?`
DD=`ls -d ${config_base}[012]?`
ddcount=`echo $DD | wc -w`
if [ $ddcount -ne 1 ]; then
echo $HOSTNAME has $ddcount data directories, bounce not possible. Set environment variable
echo $HOSTNAME has $ddcount config directories, bounce not possible. Set environment variable
echo EOSIO_NODE to the 2-digit node id number to specify which node to bounce. For example:
echo EOSIO_NODE=06 $0 \<options\>
cd -
Expand All @@ -48,18 +32,13 @@ if [ -z "$EOSIO_NODE" ]; then
OFS=$((${#DD}-2))
export EOSIO_NODE=${DD:$OFS}
else
DD=var/lib/node_$EOSIO_NODE
DD=${config_base}$EOSIO_NODE
if [ ! \( -d $DD \) ]; then
echo no directory named $PWD/$DD
cd -
exit 1
fi
fi

echo DD = $DD

bash $EOSIO_HOME/scripts/eosio-tn_down.sh
bash $EOSIO_HOME/scripts/eosio-tn_up.sh $*
unset EOSIO_RESTART_DATA_DIR

cd -
10 changes: 7 additions & 3 deletions scripts/eosio-tn_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ relaunch() {

datadir=var/lib/node_$EOSIO_NODE
now=`date +'%Y_%m_%d_%H_%M_%S'`
log=$datadir/stderr.$now.txt
touch $log
log=stderr.$now.txt
touch $datadir/$log
rm $datadir/stderr.txt
ln -s $log $datadir/stderr.txt

Expand All @@ -58,14 +58,18 @@ if [ -z "$EOSIO_LEVEL" ]; then
relaunch $prog $rundir $*
if [ \( -z "$running" \) -o \( "$connected" -eq 0 \) ]; then
EOSIO_LEVEL=replay
else
exit 0
fi
fi

if [ $EOSIO_LEVEL == replay ]; then
if [ "$EOSIO_LEVEL" == replay ]; then
echo starting with replay
relaunch $prog $rundir $* --replay
if [ \( -z "$running" \) -o \( "$connected" -eq 0 \) ]; then
EOSIO_LEVEL=resync
else
exit 0
fi
fi
if [ "$EOSIO_LEVEL" == resync ]; then
Expand Down
7 changes: 1 addition & 6 deletions testnet.template
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ programs/cleos/cleos --wallet-port $wdport --wallet-host $wdhost -p $biosport -H
echo ==== End: $step ============== >> $logfile
step=$(($step + 1))

for a in a b c d e f g h i j k l m n o p q r s t u; do ecmd transfer eosio init$a 1000000.0000 "fund producer init$a"; done
for a in {a..u}; do ecmd transfer eosio init$a 1000000.0000 "\"fund producer init$a\""; done


echo waiting for producers to settle
sleep 15
echo shutting down ignition wallet and bios node
pkill -15 keosd
kill -15 $(cat var/lib/node_bios/nodeos.pid) && rm var/lib/node_bios/nodeos.pid

0 comments on commit 1c1e93d

Please sign in to comment.