Merge pull request #209 from vulcanize/feature/update-foundry
Basic updates, add prints and variables
This commit is contained in:
commit
53c1322cb4
@ -89,9 +89,10 @@ for i in $(seq 0 "$ACCOUNTS"); do
|
|||||||
balance+=(' "'"${address[i]}"'": { "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"}')
|
balance+=(' "'"${address[i]}"'": { "balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"}')
|
||||||
done
|
done
|
||||||
|
|
||||||
#ALLOC_CLEAN=$(echo ${ALLOC} | jq .)
|
if [[ ! -f "./genesis.json" ]]
|
||||||
EXTRA_DATA="0x3132333400000000000000000000000000000000000000000000000000000000${address[0]#0x}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
then
|
||||||
JSON_VAL='{
|
EXTRA_DATA="0x3132333400000000000000000000000000000000000000000000000000000000${address[0]#0x}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
JSON_VAL='{
|
||||||
"config": {
|
"config": {
|
||||||
"chainId": '"$CHAINID"',
|
"chainId": '"$CHAINID"',
|
||||||
"homesteadBlock": 0,
|
"homesteadBlock": 0,
|
||||||
@ -111,21 +112,26 @@ JSON_VAL='{
|
|||||||
"gaslimit": "0xffffffffffff",
|
"gaslimit": "0xffffffffffff",
|
||||||
"extraData": "'"$EXTRA_DATA"'",
|
"extraData": "'"$EXTRA_DATA"'",
|
||||||
"alloc": {'"$balance"'}
|
"alloc": {'"$balance"'}
|
||||||
}'
|
}'
|
||||||
echo $JSON_VAL | jq . > $chaindir/config/genesis.json
|
echo $JSON_VAL | jq . > $chaindir/config/genesis.json
|
||||||
|
|
||||||
geth 2>/dev/null --datadir "$chaindir" init "$chaindir/config/genesis.json"
|
geth 2>/dev/null --datadir "$chaindir" init "$chaindir/config/genesis.json"
|
||||||
|
else
|
||||||
|
echo "Using local genesis file"
|
||||||
|
geth 2>/dev/null --datadir "$chaindir" init "./genesis.json"
|
||||||
|
fi
|
||||||
|
|
||||||
export ETH_RPC_URL=http://$RPC_ADDRESS:$RPC_PORT
|
export ETH_RPC_URL=http://$RPC_ADDRESS:$RPC_PORT
|
||||||
|
|
||||||
port=$((RPC_PORT + 30000))
|
port=$((RPC_PORT + 30000))
|
||||||
|
|
||||||
geth version
|
geth version
|
||||||
echo >&2 "dapp-testnet: RPC URL: $ETH_RPC_URL"
|
echo >&2 "testnet: RPC URL: $ETH_RPC_URL"
|
||||||
echo >&2 "dapp-testnet: TCP port: $port"
|
echo >&2 "testnet: DB ADDRESS: $DB_HOST"
|
||||||
echo >&2 "dapp-testnet: Chain ID: $CHAINID"
|
echo >&2 "testnet: TCP port: $port"
|
||||||
echo >&2 "dapp-testnet: Database: $chaindir"
|
echo >&2 "testnet: Chain ID: $CHAINID"
|
||||||
echo >&2 "dapp-testnet: Geth log: $chaindir/geth.log"
|
echo >&2 "testnet: Database: $chaindir"
|
||||||
|
echo >&2 "testnet: Geth log: $chaindir/geth.log"
|
||||||
|
|
||||||
printf "%s\n" "${address[@]}" > "$chaindir/config/account"
|
printf "%s\n" "${address[@]}" > "$chaindir/config/account"
|
||||||
echo "$ETH_RPC_URL" > "$chaindir/config/rpc-url"
|
echo "$ETH_RPC_URL" > "$chaindir/config/rpc-url"
|
||||||
@ -145,24 +151,29 @@ set +m
|
|||||||
# --statediff.db.type="$DB_TYPE" --statediff.db.driver="$DB_DRIVER" --statediff.waitforsync="$DB_WAIT_FOR_SYNC" \
|
# --statediff.db.type="$DB_TYPE" --statediff.db.driver="$DB_DRIVER" --statediff.waitforsync="$DB_WAIT_FOR_SYNC" \
|
||||||
# --ws --ws.addr="0.0.0.0" --unlock="$(IFS=,; echo "${address[*]}")" --password=<(exit) &
|
# --ws --ws.addr="0.0.0.0" --unlock="$(IFS=,; echo "${address[*]}")" --password=<(exit) &
|
||||||
|
|
||||||
|
echo "Starting Geth with following flags"
|
||||||
geth \
|
geth \
|
||||||
2> >(tee "$chaindir/geth.log" | grep --line-buffered Success | sed 's/^/geth: /' >&2) \
|
2> >(tee "$chaindir/geth.log" | grep --line-buffered Success | sed 's/^/geth: /' >&2) \
|
||||||
--datadir "$chaindir" --networkid "$CHAINID" --port="$port" \
|
--datadir "$chaindir" --networkid "$CHAINID" --port="$port" \
|
||||||
--mine --miner.threads=1 --allow-insecure-unlock \
|
--mine --miner.threads=1 --allow-insecure-unlock \
|
||||||
--http --http.api "web3,eth,net,debug,personal,statediff" --http.corsdomain '*' --http.vhosts '*' --nodiscover \
|
--http --http.api "admin,debug,eth,miner,net,personal,txpool,web3,statediff" --http.corsdomain '*' --http.vhosts '*' --nodiscover \
|
||||||
--http.addr="$RPC_ADDRESS" --http.port="$RPC_PORT" --syncmode=full --gcmode=archive \
|
--http.addr="$RPC_ADDRESS" --http.port="$RPC_PORT" --syncmode=full --gcmode=archive \
|
||||||
--statediff --statediff.db.host="$DB_HOST" --statediff.db.port="$DB_PORT" --statediff.db.user="$DB_USER" \
|
--statediff --statediff.db.host="$DB_HOST" --statediff.db.port="$DB_PORT" --statediff.db.user="$DB_USER" \
|
||||||
--statediff.db.password="$DB_PASSWORD" --statediff.db.name="$DB_NAME" \
|
--statediff.db.password="$DB_PASSWORD" --statediff.db.name="$DB_NAME" \
|
||||||
--statediff.db.nodeid 1 --statediff.db.clientname test1 --statediff.writing="$DB_WRITE" \
|
--statediff.db.nodeid 1 --statediff.db.clientname test1 --statediff.writing="$DB_WRITE" \
|
||||||
--statediff.db.type="$DB_TYPE" --statediff.db.driver="$DB_DRIVER" \
|
--statediff.db.type="$DB_TYPE" --statediff.db.driver="$DB_DRIVER" \
|
||||||
--ws --ws.addr="0.0.0.0" --unlock="$(IFS=,; echo "${address[*]}")" --password=<(exit) &
|
--ws --ws.addr="0.0.0.0" --ws.origins '*' --ws.api=admin,debug,eth,miner,net,personal,txpool,web3 \
|
||||||
|
--nat=none --miner.gasprice 16000000000 --nat=none \
|
||||||
|
--unlock="$(IFS=,; echo "${address[*]}")" --password=<(exit) &
|
||||||
|
|
||||||
gethpid=$!
|
gethpid=$!
|
||||||
|
echo "Geth started"
|
||||||
|
echo "Geth PID: $gethpid"
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
( set -x; kill -INT $gethpid; wait )
|
( set -x; kill -INT $gethpid; wait )
|
||||||
if [[ $SAVE ]]; then
|
if [[ $SAVE ]]; then
|
||||||
echo >&2 "dapp-testnet: saving $gethdir/snapshots/$SAVE"
|
echo >&2 "testnet: saving $gethdir/snapshots/$SAVE"
|
||||||
mkdir -p "$gethdir/snapshots/$SAVE"
|
mkdir -p "$gethdir/snapshots/$SAVE"
|
||||||
cp -r "$chaindir/keystore" "$gethdir/snapshots/$SAVE"
|
cp -r "$chaindir/keystore" "$gethdir/snapshots/$SAVE"
|
||||||
cp -r "$chaindir/config" "$gethdir/snapshots/$SAVE"
|
cp -r "$chaindir/config" "$gethdir/snapshots/$SAVE"
|
||||||
@ -173,15 +184,18 @@ clean() {
|
|||||||
}
|
}
|
||||||
trap clean EXIT
|
trap clean EXIT
|
||||||
|
|
||||||
|
echo "Curling: $ETH_RPC_URL"
|
||||||
until curl -s "$ETH_RPC_URL"; do sleep 1; done
|
until curl -s "$ETH_RPC_URL"; do sleep 1; done
|
||||||
|
|
||||||
|
echo "Curling: $ETH_RPC_URL complete"
|
||||||
# UPDATE
|
# UPDATE
|
||||||
#ETH_FROM=$(seth --rpc-url="$ETH_RPC_URL" rpc eth_coinbase)
|
#ETH_FROM=$(seth --rpc-url="$ETH_RPC_URL" rpc eth_coinbase)
|
||||||
#export ETH_FROM
|
#export ETH_FROM
|
||||||
export ETH_KEYSTORE=$chaindir/keystore
|
export ETH_KEYSTORE=$chaindir/keystore
|
||||||
export ETH_PASSWORD=/dev/null
|
export ETH_PASSWORD=/dev/null
|
||||||
printf 'dapp-testnet: Account: %s (default)\n' "${address[0]}" >&2
|
printf 'testnet: Account: %s (default)\n' "${address[0]}" >&2
|
||||||
|
|
||||||
[[ "${#address[@]}" -gt 1 ]] && printf 'dapp-testnet: Account: %s\n' "${address[@]:1}" >&2
|
[[ "${#address[@]}" -gt 1 ]] && printf 'testnet: Account: %s\n' "${address[@]:1}" >&2
|
||||||
|
|
||||||
|
echo "Geth Start up completed!"
|
||||||
while true; do sleep 3600; done
|
while true; do sleep 3600; done
|
||||||
|
@ -9,7 +9,7 @@ trap "exit 1" SIGINT SIGTERM
|
|||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
/bin/bash deploy-local-network.sh --rpc-addr 0.0.0.0 --chain-id 4 --db-user $DB_USER --db-password $DB_PASSWORD --db-name $DB_NAME \
|
/bin/bash deploy-local-network.sh --rpc-addr 0.0.0.0 --chain-id 4 --db-user $DB_USER --db-password $DB_PASSWORD --db-name $DB_NAME \
|
||||||
--db-host $DB_HOST --db-port $DB_PORT --db-write $DB_WRITE --dir "$TMPDIR" --address $ADDRESS \
|
--db-host $DB_HOST --db-port $DB_PORT --db-write $DB_WRITE --dir "$TMPDIR" --address $ADDRESS \
|
||||||
--db-type $DB_TYPE --db-driver $DB_DRIVER --db-waitforsync $DB_WAIT_FOR_SYNC &
|
--db-type $DB_TYPE --db-driver $DB_DRIVER --db-waitforsync $DB_WAIT_FOR_SYNC --chain-id $CHAIN_ID &
|
||||||
echo "sleeping 90 sec"
|
echo "sleeping 90 sec"
|
||||||
# give it a few secs to start up
|
# give it a few secs to start up
|
||||||
sleep 90
|
sleep 90
|
||||||
|
Loading…
Reference in New Issue
Block a user