-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code updates to work with system contracts
- Loading branch information
1 parent
ca16464
commit 05d5b9c
Showing
10 changed files
with
204 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
ENDPOINT_ONE=$1 | ||
WALLET_DIR=$2 | ||
|
||
# create 21 producers error out if vars not set | ||
for producer_name in bpa bpb bpc | ||
do | ||
[ ! -s "$WALLET_DIR/${producer_name}.keys" ] && cleos create key --to-console > "$WALLET_DIR/${producer_name}.keys" | ||
# head because we want the first match; they may be multiple keys | ||
PRIVATE_KEY=$(grep Private "$WALLET_DIR/${producer_name}.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
PUBLIC_KEY=$(grep Public "$WALLET_DIR/${producer_name}.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
cleos wallet import --name finality-test-network-wallet --private-key $PRIVATE_KEY | ||
|
||
# register producer | ||
cleos --url $ENDPOINT_ONE system regproducer ${producer_name} ${PUBLIC_KEY} | ||
done | ||
|
||
# create user keys | ||
[ ! -s "$WALLET_DIR/user.keys" ] && cleos create key --to-console > "$WALLET_DIR/user.keys" | ||
# head because we want the first match; they may be multiple keys | ||
USER_PRIVATE_KEY=$(grep Private "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
cleos wallet import --name finality-test-network-wallet --private-key $USER_PRIVATE_KEY | ||
|
||
for user_name in usera userb userc userd usere userf userg userh useri userj | ||
do | ||
# vote | ||
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc | ||
done | ||
|
||
for user_name in userk userl userm usern usero userp userq userr users usert useru | ||
do | ||
# vote | ||
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc | ||
done | ||
|
||
for user_name in userv userw userx usery userz | ||
do | ||
# vote | ||
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
ENDPOINT_ONE=$1 | ||
WALLET_DIR=$2 | ||
|
||
# create 21 producers error out if vars not set | ||
for producer_name in bpa bpb bpc bpd bpe bpf bpg bph bpi bpj bpk bpl bpm bpn bpo bpp bpq bpr bps bpt bpu | ||
do | ||
[ ! -s "$WALLET_DIR/${producer_name}.keys" ] && cleos create key --to-console > "$WALLET_DIR/${producer_name}.keys" | ||
# head because we want the first match; they may be multiple keys | ||
PRIVATE_KEY=$(grep Private "$WALLET_DIR/${producer_name}.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
PUBLIC_KEY=$(grep Public "$WALLET_DIR/${producer_name}.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
cleos wallet import --name finality-test-network-wallet --private-key $PRIVATE_KEY | ||
|
||
# 400 staked per producer x21 = 8400 EOS staked total | ||
cleos --url $ENDPOINT_ONE system newaccount eosio ${producer_name:?} ${PUBLIC_KEY:?} --stake-net "500 EOS" --stake-cpu "500 EOS" --buy-ram "1000 EOS" | ||
# get some spending money | ||
cleos --url $ENDPOINT_ONE transfer eosio ${producer_name} "10000 EOS" "init funding" | ||
# self stake some net and cpu | ||
cleos --url $ENDPOINT_ONE system delegatebw ${producer_name} ${producer_name} "4000.0 EOS" "4000.0 EOS" | ||
done | ||
|
||
# create user keys | ||
[ ! -s "$WALLET_DIR/user.keys" ] && cleos create key --to-console > "$WALLET_DIR/user.keys" | ||
# head because we want the first match; they may be multiple keys | ||
USER_PRIVATE_KEY=$(grep Private "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
USER_PUBLIC_KEY=$(grep Public "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2 | sed 's/ //g') | ||
cleos wallet import --name finality-test-network-wallet --private-key $USER_PRIVATE_KEY | ||
|
||
for user_name in usera userb userc userd usere userf userg userh useri userj userk userl userm usern usero userp userq userr users usert useru userv userw userx usery userz | ||
do | ||
# create user account | ||
cleos --url $ENDPOINT_ONE system newaccount eosio ${user_name:?} ${USER_PUBLIC_KEY:?} --stake-net "50 EOS" --stake-cpu "50 EOS" --buy-ram "100 EOS" | ||
# get some spending money | ||
cleos --url $ENDPOINT_ONE transfer eosio ${user_name} "11540000 EOS" "init funding" | ||
# stake 1154K EOS x26 accounts = 300,004,000 EOS Total Staked | ||
cleos --url $ENDPOINT_ONE system delegatebw ${user_name} ${user_name} "5770000.000 EOS" "5770000.0000 EOS" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
ENDPOINT=${1:-http://127.0.0.1:8888} | ||
|
||
SNAPSHOT_DIR="/bigata1/savanna" | ||
curl -X POST "${ENDPOINT}/v1/producer/create_snapshot" > ${SNAPSHOT_DIR}/snapshot.json | ||
SNAP_PATH=$(cat "${SNAPSHOT_DIR}/snapshot.json" | \ | ||
python3 -c "import sys | ||
import json | ||
print (json.load(sys.stdin)['snapshot_name'])") | ||
SNAP_HEAD_BLOCK=$(cat "${SNAPSHOT_DIR}/snapshot.json" | \ | ||
python3 -c "import sys | ||
import json | ||
print (json.load(sys.stdin)['head_block_num'])") | ||
VERSION=$(cat "${SNAPSHOT_DIR}/snapshot.json" | \ | ||
python3 -c "import sys | ||
import json | ||
print (json.load(sys.stdin)['version'])") | ||
HEAD_BLOCK_TIME=$(cat "${SNAPSHOT_DIR}/snapshot.json" | \ | ||
python3 -c "import sys | ||
import json | ||
print (json.load(sys.stdin)['head_block_time'])") | ||
|
||
DATE=${HEAD_BLOCK_TIME%T*} | ||
TIME=${HEAD_BLOCK_TIME#*T} | ||
HOUR=${TIME%%:*} | ||
DATE="${DATE}-${HOUR}" | ||
if type zstd >/dev/null 2>&1; then | ||
# rename to our format snapshot-2019-08-11-16-eos-v6-0073487941.bin.zst | ||
NEW_PATH="${SNAP_PATH%/*}/snapshot-${DATE}-eos-v${VERSION}-${SNAP_HEAD_BLOCK}.bin.zst" | ||
zstd < "$SNAP_PATH" > "$NEW_PATH" | ||
if [ $? -eq 0 ]; then | ||
rm "$SNAP_PATH" | ||
fi | ||
else | ||
NEW_PATH="${SNAP_PATH%/*}/snapshot-${DATE}-eos-v${VERSION}-${SNAP_HEAD_BLOCK}.bin.gzip" | ||
gzip < "$SNAP_PATH" > "$NEW_PATH" | ||
if [ $? -eq 0 ]; then | ||
rm "$SNAP_PATH" | ||
fi | ||
fi | ||
rm ${SNAPSHOT_DIR}/snapshot.json |
Oops, something went wrong.