Skip to content

Commit

Permalink
add testnet fullnode command (#243)
Browse files Browse the repository at this point in the history
* add testnet fullnode command

* linting

* update scripts

* linting

* update scripts

---------

Co-authored-by: Son of Odin <[email protected]>
  • Loading branch information
cbarraford and Son of Odin authored Aug 18, 2023
1 parent 1f297c9 commit dc5c640
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2


# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
Expand All @@ -57,7 +56,7 @@ jobs:

- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(cat chain.version)"
run: echo "version=$(cat chain.version)" >> $GITHUB_OUTPUT

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ build:
install:
go install ${BUILD_FLAGS} ${BINARIES}


# ------------------------------ Docker Build ------------------------------

docker-build: proto-gen
@docker build . --file Dockerfile -t ${IMAGE}:${TAG}

docker-run:
localnet: docker-build
@docker run --rm -it -p 1317:1317 -p 26656:26656 -p 26657:26657 ${IMAGE}:${TAG}

# ------------------------------ Testnet ------------------------------

testnet-fullnode:
@docker run --rm -it -p 1317:1317 -p 26656:26656 -p 26657:26657 -v ./scripts:/scripts --entrypoint /scripts/fullnode.sh ${IMAGE}:${TAG}

# ------------------------------ Housekeeping ------------------------------

format:
Expand Down
2 changes: 1 addition & 1 deletion scripts/bond-provider.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ BOND="$3"
PUBKEY_RAW=$($BIN keys show "$USER" -p --keyring-backend test | jq -r .key)
PUBKEY=$($BIN debug pubkey-raw "$PUBKEY_RAW" | grep "Bech32 Acc" | awk '{ print $NF }')

$BIN tx $BIN_TX bond-provider -y --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "$BOND"
$BIN tx $BIN_TX bond-provider -y -b block --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "$BOND"
2 changes: 1 addition & 1 deletion scripts/claim-contract.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ CLIENT_PUBKEY=$($BIN debug pubkey-raw "$CLIENT_PUBKEY_RAW" | grep "Bech32 Acc" |

SIGNATURE=$(signhere -u "$USER" -m "$CONTRACT_ID:$CLIENT_PUBKEY:$NONCE")

$BIN tx $BIN_TX claim-contract-income -y --from "$USER" --keyring-backend test -- "$CONTRACT_ID" "$CLIENT_PUBKEY" "$NONCE" "$SIGNATURE"
$BIN tx $BIN_TX claim-contract-income -y -b block --from "$USER" --keyring-backend test -- "$CONTRACT_ID" "$CLIENT_PUBKEY" "$NONCE" "$SIGNATURE"
2 changes: 1 addition & 1 deletion scripts/claim-rewards.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ for raw_claim in $raw_claims; do
nonce=$(echo "$raw_claims" | jq -r '.nonce')
signature=$(echo "$raw_claims" | jq -r '.signature')

$BIN tx $BIN_TX claim-contract-income -y --from "$USER" --keyring-backend test -- "$id" "$nonce" "$signature"
$BIN tx $BIN_TX claim-contract-income -y -b block --from "$USER" --keyring-backend test -- "$id" "$nonce" "$signature"
done
2 changes: 1 addition & 1 deletion scripts/close-contract.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ BIN_TX="arkeo"
USER="$1"
ID="$2"

$BIN tx $BIN_TX close-contract -y --from "$USER" --keyring-backend test -- "$ID"
$BIN tx $BIN_TX close-contract -y -b block --from "$USER" --keyring-backend test -- "$ID"
12 changes: 5 additions & 7 deletions scripts/create-provider.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ if [ -z "$1" ]; then
fi

if [ -z "$2" ]; then
echo "No service supplied"
echo "No bond supplied"
exit 1
fi

if [ -z "$3" ]; then
echo "No bond supplied"
echo "No service supplied"
exit 1
fi

PWD=$(dirname -- "${BASH_SOURCE[0]}")
BIN="arkeod"
BIN_TX="arkeo"
USER="$1"
SERVICE="$2"
BOND="$3"
BOND="$2"
SERVICE="$3"

PUBKEY_RAW=$($BIN keys show "$USER" -p --keyring-backend test | jq -r .key)
PUBKEY=$($BIN debug pubkey-raw "$PUBKEY_RAW" | grep "Bech32 Acc" | awk '{ print $NF }')

./"$PWD"/bond-provider.bash "$USER" "$SERVICE" "$BOND"

sleep 5

$BIN tx $BIN_TX mod-provider -y --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "http://localhost:3636/metadata.json" 1 1 10 100 10uarkeo 10uarkeo 10
$BIN tx $BIN_TX mod-provider -y -b block --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "http://localhost:3636/metadata.json" 1 1 10 5256000 10uarkeo 10uarkeo 10
18 changes: 18 additions & 0 deletions scripts/fullnode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -o pipefail

export RPC="${RPC:=seed.arkeo.network:26657}"
export SEED="${SEED:=seed.arkeo.network:26656}"

if [ ! -f ~/.arkeo/config/genesis.json ]; then
CHAIN_ID=$(curl -s http://$RPC/status | jq -r '.result.node_info.network')
arkeod init local --chain-id "$CHAIN_ID"

curl -s http://$RPC/genesis | jq -r '.result.genesis' >~/.arkeo/config/genesis.json
fi

PEER_ID=$(curl -s http://$RPC/status | jq -r '.result.node_info.id')
sed -i "s/seeds = \"\"/seeds = \"$PEER_ID@$SEED\"/g" ~/.arkeo/config/config.toml

exec arkeod start
2 changes: 1 addition & 1 deletion scripts/open-contract.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ CLIENT_PUBKEY=$($BIN debug pubkey-raw "$CLIENT_PUBKEY_RAW" | grep "Bech32 Acc" |
# nolint
DEPOSIT=$((RATE * DURATION))

$BIN tx $BIN_TX open-contract -y --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "$CLIENT_PUBKEY" "$CTYPE" "$DEPOSIT" "$DURATION" "$RATE""uarkeo" $QUERY_PER_MINUTE $SETTLEMENT_DURATION
$BIN tx $BIN_TX open-contract -y -b block --from "$USER" --keyring-backend test -- "$PUBKEY" "$SERVICE" "$CLIENT_PUBKEY" "$CTYPE" "$DEPOSIT" "$DURATION" "$RATE""uarkeo" $QUERY_PER_MINUTE $SETTLEMENT_DURATION

0 comments on commit dc5c640

Please sign in to comment.