Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update simapp to nightly-2020-07-29 #323

Merged
merged 9 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/simapp/env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Choose from https://hub.docker.com/r/interchainio/cosmos-sdk/tags
REPOSITORY="interchainio/cosmos-sdk"
VERSION="july-2-2020"
# Choose from https://hub.docker.com/r/interchainio/simapp/tags
REPOSITORY="interchainio/simapp"
VERSION="nightly-2020-07-29"
CONTAINER_NAME="simapp"
4 changes: 2 additions & 2 deletions scripts/simapp/generate_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ source "$SCRIPT_DIR"/env

rm -rf "$SCRIPT_DIR/template"
mkdir "$SCRIPT_DIR/template"
cp setup.sh "$SCRIPT_DIR/template/"
cp run_simd.sh "$SCRIPT_DIR/template/"
cp setup.sh "$SCRIPT_DIR/template/" && chmod +x "$SCRIPT_DIR/template/setup.sh"
cp run_simd.sh "$SCRIPT_DIR/template/" && chmod +x "$SCRIPT_DIR/template/run_simd.sh"

# The usage of the accounts below is documented in README.md of this directory
docker run --rm \
Expand Down
2 changes: 1 addition & 1 deletion scripts/simapp/run_simd.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0"

cp -R "/template/.simapp" /root
mkdir -p /root/log

simd start --rpc.laddr tcp://0.0.0.0:26657 --trace
23 changes: 15 additions & 8 deletions scripts/simapp/setup.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@ command -v shellcheck > /dev/null && shellcheck "$0"
PASSWORD=${PASSWORD:-1234567890}
STAKE=${STAKE_TOKEN:-ustake}
FEE=${FEE_TOKEN:-ucosm}
CHAIN_ID=${CHAIN_ID:-testing}
CHAIN_ID=${CHAIN_ID:-simd-testing}
MONIKER=${MONIKER:-simd-moniker}

simd init --chain-id="$CHAIN_ID" "$CHAIN_ID"
# staking/governance token is hardcoded in config, change this
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json
if ! simcli keys show validator; then
(echo "$PASSWORD"; echo "$PASSWORD") | simcli keys add validator
echo "Creating genesis ..."
simd init --chain-id "$CHAIN_ID" "$MONIKER"
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this

echo "Setting up validator ..."
if ! simd keys show validator; then
echo "Validator does not yet exist. Creating it ..."
(echo "$PASSWORD"; echo "$PASSWORD") | simd keys add validator
fi
# hardcode the validator account for this instance
echo "$PASSWORD" | simd add-genesis-account validator "1000000000$STAKE,1000000000$FEE"

echo "Setting up accounts ..."
# (optionally) add a few more genesis accounts
for addr in "$@"; do
echo $addr
simd add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
done
# submit a genesis validator tx
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | simd gentx --name validator --amount "250000000$STAKE"

echo "Creating genesis tx ..."
(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | simd gentx validator --amount "250000000$STAKE" --chain-id "$CHAIN_ID"
simd collect-gentxs
18 changes: 11 additions & 7 deletions scripts/simapp/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0"

TENDERMINT_PORT_GUEST="26657"
TENDERMINT_PORT_HOST="26657"

SCRIPT_DIR="$(realpath "$(dirname "$0")")"
# shellcheck source=./env
# shellcheck disable=SC1091
source "$SCRIPT_DIR"/env

echo "$CONTAINER_NAME"

TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/simapp.XXXXXXXXX")
chmod 777 "$TMP_DIR"
echo "Using temporary dir $TMP_DIR"
SIMD_LOGFILE="$TMP_DIR/simd.log"
PORT=26657

# Use a fresh volume for every start
docker volume rm -f simapp_data

docker run --rm \
--name "$CONTAINER_NAME" \
-p "$PORT:$PORT" \
--mount type=bind,source="$SCRIPT_DIR/template",target=/root \
-p "$TENDERMINT_PORT_HOST":"$TENDERMINT_PORT_GUEST" \
--mount type=bind,source="$SCRIPT_DIR/template",target=/template \
--mount type=volume,source=simapp_data,target=/root \
"$REPOSITORY:$VERSION" \
./run_simd.sh \
/template/run_simd.sh \
> "$SIMD_LOGFILE" &

echo "simd running on http://localhost:$PORT and logging into $SIMD_LOGFILE"
echo "simd running on http://localhost:$TENDERMINT_PORT_HOST and logging into $SIMD_LOGFILE"

if [ -n "${CI:-}" ]; then
# Follow the logs in CI's background job
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wNy0yOSAxMjozMzo0My4yNzMwNzc0ICswMDAwIFVUQyBtPSswLjQyMDc1MDIwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Ik1QUEpoYXdfUE9CTk84ckcifQ.1qbmeelJhpCbCgKFx3RUYchhFtsZhl8HpVe2TIk_ioOt4LE9zJ1a5A.rYvjRK55ePe7O9JU.-RTRUDq1_79yOeZoXXUyyiVlanfHFjlmxQ8ZdtDCfLg8OcIgEvQYWpQG0NXFVQSaV3yYc8m1sWuXQqnMH5pm9kgxFWq7jahobz9a70d9WibfAUNBqdcvC7AyvM1L8eWIo1a_HJV_C1-CkZDjUuAK4MDj8KReC4NFbOKW_A1rNkJxCrVX7m1v2SQF9fEAEepnEZzYtH0LFDTZYNhpwt8o-ofk-47lPYr0KJB6CXaMv2CJ2clRTg12V_a0.Xv8QuXyJcO_9ZLK6LBhBkg
2 changes: 1 addition & 1 deletion scripts/simapp/template/.simapp/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
proxy_app = "tcp://127.0.0.1:26658"

# A custom human readable name for this node
moniker = "testing"
moniker = "simd-moniker"

# If this node is many blocks behind the tip of the chain, FastSync
# allows them to catchup quickly by downloading blocks in parallel
Expand Down
Loading