diff --git a/.github/workflows/cheqd-sdk-tests.yml b/.github/workflows/cheqd-sdk-tests.yml index f9395c876..a1e771082 100644 --- a/.github/workflows/cheqd-sdk-tests.yml +++ b/.github/workflows/cheqd-sdk-tests.yml @@ -6,6 +6,7 @@ jobs: runs-on: ubuntu-latest env: CHEQD_MNEMONIC: "steak come surprise obvious remain black trouble measure design volume retreat float coach amused match album moment radio stuff crack orphan ranch dose endorse" + IMAGE_TAG: 3.0.2 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 diff --git a/scripts/cheqd_entrypoint b/scripts/cheqd_entrypoint index 9dfd14b5d..c02b2e763 100755 --- a/scripts/cheqd_entrypoint +++ b/scripts/cheqd_entrypoint @@ -5,10 +5,9 @@ CHAIN_ID="cheqd-dev" NODE_NAME="cheqd-dev" KEY_NAME="my-key" MONIKER="local-node" -STAKE_DENOM="stake" CHAIN_DIR="$HOME/.testnode" -GENESIS_AMOUNT="100000000000000000000000000000ncheq,8246428745600000$STAKE_DENOM" # Very large amount -STAKE_AMOUNT="8246428745600000$STAKE_DENOM" # Ensure this is >= DefaultPowerReduction +GENESIS_AMOUNT="100000000000000000000000000000ncheq" # Very large amount +STAKE_AMOUNT="8246428745600000ncheq" # Ensure this is >= DefaultPowerReduction COMMAND="cheqd-noded" # Install Cosmos SDK if not installed (replace this with your specific chain's SDK) @@ -22,7 +21,17 @@ rm -rf $CHAIN_DIR # Step 1: Initialize the chain echo "Initializing chain..." -$COMMAND init $NODE_NAME --chain-id $CHAIN_ID --home $CHAIN_DIR +$COMMAND init $NODE_NAME --chain-id $CHAIN_ID --home $CHAIN_DIR --default-denom ncheq + +# Step 1.a: Replace the default "stake" with "ncheq" in the genesis file +echo "Replacing default 'stake' with 'ncheq' in genesis file..." +sed -i 's/"stake"/"ncheq"/' $CHAIN_DIR/config/genesis.json + +# Step 1.b: Configure feemarket +echo "Configuring feemarket..." +sed -i 's/"fee_denom": "stake"/"fee_denom": "ncheq"/' $CHAIN_DIR/config/genesis.json +sed -i 's/"min_base_gas_price": "1.000000000000000000"/"min_base_gas_price": "0.005000000000000000"/' $CHAIN_DIR/config/genesis.json +sed -i 's/"base_gas_price": "1.000000000000000000"/"base_gas_price": "0.005000000000000000"/' $CHAIN_DIR/config/genesis.json # Step 2: Generate a keypair (if it doesn't exist already) if [ -z "$CHEQD_MNEMONIC" ]; then @@ -35,7 +44,7 @@ fi # Step 3: Add the generated key as a genesis account echo "Adding genesis account..." -$COMMAND genesis add-genesis-account $($COMMAND keys show $KEY_NAME -a --keyring-backend test --home $CHAIN_DIR) $GENESIS_AMOUNT --home $CHAIN_DIR +$COMMAND genesis add-genesis-account $($COMMAND keys show $KEY_NAME -a --keyring-backend test --home $CHAIN_DIR) $GENESIS_AMOUNT --keyring-backend test --home $CHAIN_DIR # Step 4: Generate a genesis transaction echo "Generating genesis transaction..." @@ -49,9 +58,13 @@ $COMMAND genesis collect-gentxs --home $CHAIN_DIR echo "Validating genesis file..." $COMMAND genesis validate-genesis --home $CHAIN_DIR +# Step 6.a: Cat genesis file +echo "Modified genesis file..." +cat $CHAIN_DIR/config/genesis.json + # Step 7: Copy custom configuration cp /tmp/cheqd_config.toml $CHAIN_DIR/config/config.toml # Step 8: Starting the node -echo "Starting Cosmos node..." -$COMMAND start --home $CHAIN_DIR --moniker $MONIKER --log_level info +echo "Starting cheqd node..." +$COMMAND start --home $CHAIN_DIR --moniker $MONIKER --log_level info \ No newline at end of file diff --git a/scripts/with_cheqd_docker_test_node b/scripts/with_cheqd_docker_test_node index ab7da8dd5..8a9862238 100755 --- a/scripts/with_cheqd_docker_test_node +++ b/scripts/with_cheqd_docker_test_node @@ -6,10 +6,16 @@ entrypoint="$(realpath $(dirname $0)/cheqd_entrypoint)" config="$(realpath $(dirname $0)/cheqd_config.toml)" # pre-pull -docker pull --platform linux/amd64 ghcr.io/cheqd/cheqd-node:2.0.2 +docker pull --platform linux/amd64 ghcr.io/cheqd/cheqd-node:$IMAGE_TAG # start a pos alice node -alice_container_id=$(docker run --platform linux/amd64 -d --rm --name cheqd-dev -p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 -e CHEQD_MNEMONIC="$CHEQD_MNEMONIC" -v $entrypoint:/usr/local/bin/entrypoint.sh -v $config:/tmp/cheqd_config.toml --entrypoint /usr/local/bin/entrypoint.sh ghcr.io/cheqd/cheqd-node:2.0.2 start) +alice_container_id=$(docker run --platform linux/amd64 -d --rm --name cheqd-dev -p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 -e CHEQD_MNEMONIC="$CHEQD_MNEMONIC" -v $entrypoint:/usr/local/bin/entrypoint.sh -v $config:/tmp/cheqd_config.toml --entrypoint /usr/local/bin/entrypoint.sh ghcr.io/cheqd/cheqd-node:$IMAGE_TAG start) + +# locate the node's home directory +alice_home=$(docker exec $alice_container_id sh -c 'echo $HOME') + +# tail logs, if necessary +# docker logs -f $alice_container_id cleanup() { docker kill $alice_container_id 2> /dev/null @@ -17,8 +23,8 @@ cleanup() { try_with_node() { sleep 10; - # Execute the commands, potentially against the nodes - $@ + # Execute the commands, potentially against the nodes + $@ } trap cleanup EXIT SIGINT SIGTERM @@ -29,4 +35,4 @@ else exit_code=$? fi -exit $exit_code +exit $exit_code \ No newline at end of file