From df6a9158c26704d7b242c127d2d6f32b4fa64f07 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Tue, 10 Sep 2024 11:54:32 +0500 Subject: [PATCH 1/2] chore: remove bg voting loop --- .devcontainer.json | 22 +++++++++++++ .devcontainer/devcontainer.json | 14 ++++++++ .github/dependabot.yml | 12 ------- .setup/setup.sh | 2 ++ contract/scripts/run-chain.sh | 57 --------------------------------- 5 files changed, 38 insertions(+), 69 deletions(-) create mode 100644 .devcontainer.json delete mode 100644 .github/dependabot.yml create mode 100755 .setup/setup.sh diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 00000000..a900611c --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,22 @@ +{ + "forwardPorts": [5173, 1317, 26657, 26656], + "portsAttributes": { + "5173": { + "label": "UI", + "onAutoForward": "openBrowser" + }, + "1317": { + "label": "API", + "onAutoForward": "silent" + }, + "26657": { + "label": "RPC", + "onAutoForward": "silent" + }, + "26656": { + "label": "P2P", + "onAutoForward": "silent" + } + } + // "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 18e4d42e..6a8eaa08 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -27,9 +27,23 @@ }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", +<<<<<<< HEAD "postStartCommand": "yarn install", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/github-cli:1": {} } +======= +"postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", +"features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} +} + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +>>>>>>> 593eec0 (fix: add gh CLI to features) } diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index f33a02cd..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,12 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for more information: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# https://containers.dev/guide/dependabot - -version: 2 -updates: - - package-ecosystem: "devcontainers" - directory: "/" - schedule: - interval: weekly diff --git a/.setup/setup.sh b/.setup/setup.sh new file mode 100755 index 00000000..96def143 --- /dev/null +++ b/.setup/setup.sh @@ -0,0 +1,2 @@ +../make_ports_public.sh 5173 1317 26657 + diff --git a/contract/scripts/run-chain.sh b/contract/scripts/run-chain.sh index e6435bd4..689fc181 100755 --- a/contract/scripts/run-chain.sh +++ b/contract/scripts/run-chain.sh @@ -1,68 +1,11 @@ #!/bin/bash -wait_for_bootstrap() { - endpoint="localhost" - while true; do - if json=$(curl -s --fail -m 15 "$endpoint:26657/status"); then - if [[ "$(echo "$json" | jq -r .jsonrpc)" == "2.0" ]]; then - if last_height=$(echo "$json" | jq -r .result.sync_info.latest_block_height); then - if [[ "$last_height" != "1" ]]; then - echo "$last_height" - return - else - echo "$last_height" - fi - fi - fi - fi - echo "waiting for next block..." - sleep 5 - done - echo "done" -} - -waitForBlock() ( - echo "waiting for block..." - times=${1:-1} - echo "$times" - for ((i = 1; i <= times; i++)); do - b1=$(wait_for_bootstrap) - while true; do - b2=$(wait_for_bootstrap) - if [[ "$b1" != "$b2" ]]; then - echo "block produced" - break - fi - sleep 5 - done - done - echo "done" -) - -approveProposals() { - while true; do - proposals=$(make -s -C /workspace/contract gov-voting-q 2>/dev/null) - exit_status=$? - if [ $exit_status -eq 0 ]; then - echo "Approving proposals: $proposals" - printf $proposals | xargs -I {} make -s -C /workspace/contract vote PROPOSAL={} - else - echo "No proposals to approve, continuing..." - fi - - sleep 10 - done -} - # Start the chain in the background /usr/src/upgrade-test-scripts/start_agd.sh & # wait for blocks to start being produced waitForBlock 2 -# Approve any proposals forever in the background. -approveProposals & - make -C /workspace/contract mint100 # bring back chain process to foreground From 2639959ae04378348bdff84250aa7b3b979a47d8 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Thu, 5 Sep 2024 15:02:58 +0500 Subject: [PATCH 2/2] chore: run-chain.sh is identical in example dapps --- .devcontainer.json | 22 ---------------------- .devcontainer/devcontainer.json | 14 -------------- .github/dependabot.yml | 12 ++++++++++++ .setup/setup.sh | 2 -- contract/scripts/run-chain.sh | 4 +++- 5 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 .devcontainer.json create mode 100644 .github/dependabot.yml delete mode 100755 .setup/setup.sh diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index a900611c..00000000 --- a/.devcontainer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "forwardPorts": [5173, 1317, 26657, 26656], - "portsAttributes": { - "5173": { - "label": "UI", - "onAutoForward": "openBrowser" - }, - "1317": { - "label": "API", - "onAutoForward": "silent" - }, - "26657": { - "label": "RPC", - "onAutoForward": "silent" - }, - "26656": { - "label": "P2P", - "onAutoForward": "silent" - } - } - // "postStartCommand": "bash -i -c 'nvm install 18.20 && nvm alias default 18.20' && bash ./make_ports_public.sh 5173 1317 26657" -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6a8eaa08..18e4d42e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -27,23 +27,9 @@ }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "bash /workspaces/dapp-agoric-basics/make_ports_public.sh 26657 5173 1317", -<<<<<<< HEAD "postStartCommand": "yarn install", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/github-cli:1": {} } -======= -"postStartCommand": "/workspaces/dapp-agoric-basics/make_ports_public.sh 26656 5173 1317 26657 && yarn install", -"features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/github-cli:1": {} -} - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" ->>>>>>> 593eec0 (fix: add gh CLI to features) } diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.setup/setup.sh b/.setup/setup.sh deleted file mode 100755 index 96def143..00000000 --- a/.setup/setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -../make_ports_public.sh 5173 1317 26657 - diff --git a/contract/scripts/run-chain.sh b/contract/scripts/run-chain.sh index 689fc181..019cfa9f 100755 --- a/contract/scripts/run-chain.sh +++ b/contract/scripts/run-chain.sh @@ -1,10 +1,12 @@ #!/bin/bash +. /usr/src/upgrade-test-scripts/env_setup.sh + # Start the chain in the background /usr/src/upgrade-test-scripts/start_agd.sh & # wait for blocks to start being produced -waitForBlock 2 +waitForBlock 1 make -C /workspace/contract mint100