From ca80dd24c285fb102e01a1d9fa673cad1d87dd2c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 5 Jul 2024 08:42:34 -0700 Subject: [PATCH 1/2] chore(deps): bump prettier to 3.3.2 --- multichain-testing/package.json | 2 +- package.json | 2 +- yarn.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/multichain-testing/package.json b/multichain-testing/package.json index 5f0230c2710..6b58d44319f 100644 --- a/multichain-testing/package.json +++ b/multichain-testing/package.json @@ -37,7 +37,7 @@ "execa": "^9.2.0", "fs-extra": "^11.2.0", "patch-package": "^8.0.0", - "prettier": "^3.2.4", + "prettier": "^3.3.2", "starshipjs": "2.0.0", "tsimp": "^2.0.10", "tsx": "^4.15.6", diff --git a/package.json b/package.json index d2a79653224..db01224f7b1 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "eslint-plugin-prettier": "^5.1.3", "lerna": "^5.6.2", "npm-run-all": "^4.1.5", - "prettier": "^3.2.5", + "prettier": "^3.3.2", "prettier-plugin-jsdoc": "^1.3.0", "prettier-plugin-sh": "^0.14.0", "type-coverage": "^2.27.1", diff --git a/yarn.lock b/yarn.lock index 62061b53ed2..90145538b0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9898,7 +9898,7 @@ prettier@^2.6.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -prettier@^3.0.0, prettier@^3.2.5, prettier@^3.3.2: +prettier@^3.0.0, prettier@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== From da0fa6c6539f4a328673cbe7f64940fb930c44fb Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 5 Jul 2024 08:40:41 -0700 Subject: [PATCH 2/2] style: a3p+multichain in repo format --- .../generate-kread-item-request.mjs | 3 +- multichain-testing/config.yaml | 16 +++--- multichain-testing/package.json | 12 +--- multichain-testing/scripts/dev-setup.sh | 56 +++++++++---------- multichain-testing/scripts/install.sh | 24 ++++---- multichain-testing/scripts/port-forward.sh | 38 ++++++------- multichain-testing/scripts/update-config.sh | 4 +- package.json | 4 +- 8 files changed, 70 insertions(+), 87 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/generate-kread-item-request.mjs b/a3p-integration/proposals/z:acceptance/generate-kread-item-request.mjs index be9e07d6dde..55feaf5f067 100644 --- a/a3p-integration/proposals/z:acceptance/generate-kread-item-request.mjs +++ b/a3p-integration/proposals/z:acceptance/generate-kread-item-request.mjs @@ -64,7 +64,8 @@ const body = { give: { Price: { brand: smallCaps.ref(brand.IST), - value: smallCaps.Nat(5n * ISTunit) } + value: smallCaps.Nat(5n * ISTunit), + }, }, }, }, diff --git a/multichain-testing/config.yaml b/multichain-testing/config.yaml index 3694d17321e..a82dbac5e8b 100644 --- a/multichain-testing/config.yaml +++ b/multichain-testing/config.yaml @@ -10,10 +10,10 @@ chains: app_state: staking: params: - unbonding_time: "2m" + unbonding_time: '2m' swingset: params: - bootstrap_vat_config: "@agoric/vm-config/decentral-itest-orchestration-config.json" + bootstrap_vat_config: '@agoric/vm-config/decentral-itest-orchestration-config.json' scripts: updateConfig: file: scripts/update-config.sh @@ -34,17 +34,17 @@ chains: app_state: staking: params: - unbonding_time: "2m" + unbonding_time: '2m' interchain_accounts: host_genesis_state: params: host_enabled: true - allow_messages: ["*"] + allow_messages: ['*'] interchainquery: - host_port: "icqhost" + host_port: 'icqhost' params: host_enabled: true - allow_queries: ["*"] + allow_queries: ['*'] faucet: enabled: true type: starship @@ -63,12 +63,12 @@ chains: app_state: staking: params: - unbonding_time: "2m" + unbonding_time: '2m' interchain_accounts: host_genesis_state: params: host_enabled: true - allow_messages: ["*"] + allow_messages: ['*'] faucet: enabled: true ports: diff --git a/multichain-testing/package.json b/multichain-testing/package.json index 6b58d44319f..94be045eb20 100644 --- a/multichain-testing/package.json +++ b/multichain-testing/package.json @@ -33,11 +33,9 @@ "ava": "^6.1.3", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.1.3", "execa": "^9.2.0", "fs-extra": "^11.2.0", "patch-package": "^8.0.0", - "prettier": "^3.3.2", "starshipjs": "2.0.0", "tsimp": "^2.0.10", "tsx": "^4.15.6", @@ -63,12 +61,6 @@ "serial": true, "timeout": "125s" }, - "prettier": { - "arrowParens": "avoid", - "semi": true, - "singleQuote": true, - "trailingComma": "all" - }, "eslintConfig": { "root": true, "env": { @@ -76,8 +68,7 @@ }, "parser": "@typescript-eslint/parser", "plugins": [ - "@typescript-eslint", - "prettier" + "@typescript-eslint" ], "extends": [ "eslint:recommended", @@ -85,7 +76,6 @@ "prettier" ], "rules": { - "prettier/prettier": "error", "@typescript-eslint/no-unused-vars": [ "error", { diff --git a/multichain-testing/scripts/dev-setup.sh b/multichain-testing/scripts/dev-setup.sh index a119db8eb09..63cdebfa7c9 100644 --- a/multichain-testing/scripts/dev-setup.sh +++ b/multichain-testing/scripts/dev-setup.sh @@ -14,48 +14,46 @@ function color() { # Define a function to install a binary on macOS install_macos() { - case $1 in - kubectl) brew install kubectl ;; - helm) brew install helm ;; - yq) brew install yq ;; - kind) brew install kind ;; - esac + case $1 in + kubectl) brew install kubectl ;; + helm) brew install helm ;; + yq) brew install yq ;; + kind) brew install kind ;; + esac } # Define a function to install a binary on Linux install_linux() { - color green "Installing $1 at ~/.local/bin, please add it to PATH" - mkdir -p ~/.local/bin - case $1 in - kubectl) curl -Lks "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > ~/.local/bin/kubectl && chmod +x ~/.local/bin/kubectl ;; - helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;; - yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;; - kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;; - esac + color green "Installing $1 at ~/.local/bin, please add it to PATH" + mkdir -p ~/.local/bin + case $1 in + kubectl) curl -Lks "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > ~/.local/bin/kubectl && chmod +x ~/.local/bin/kubectl ;; + helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;; + yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;; + kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;; + esac } # Define a function to install a binary install_binary() { - if [[ $(uname -s) == "Darwin" ]]; then - install_macos $1 - else - install_linux $1 - fi + if [[ $(uname -s) == "Darwin" ]]; then + install_macos $1 + else + install_linux $1 + fi } # Define a function to check for the presence of a binary check_binary() { - if ! command -v $1 &> /dev/null - then - echo "$1 is not installed" - install_binary $1 - if ! command -v $1 &> /dev/null - then - color red "Installation of $1 failed, exiting..." - color red "Please install $1 manually, then run me again to verify the installation" - exit 1 - fi + if ! command -v $1 &> /dev/null; then + echo "$1 is not installed" + install_binary $1 + if ! command -v $1 &> /dev/null; then + color red "Installation of $1 failed, exiting..." + color red "Please install $1 manually, then run me again to verify the installation" + exit 1 fi + fi } # Check the binaries diff --git a/multichain-testing/scripts/install.sh b/multichain-testing/scripts/install.sh index d38325dfe93..faa8bac917e 100644 --- a/multichain-testing/scripts/install.sh +++ b/multichain-testing/scripts/install.sh @@ -14,7 +14,7 @@ set -euo pipefail # read config file from args into variable CONFIGFILE="config.yaml" -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) echo "Script dir: ${SCRIPT_DIR}" # default values @@ -29,8 +29,7 @@ HELM_NAME="agoric-multichain-testing" # check_helm function verifies the helm binary is installed function check_helm() { - if ! command -v helm &> /dev/null - then + if ! command -v helm &> /dev/null; then echo "helm could not be found; please install it first!!!" exit fi @@ -68,7 +67,10 @@ function set_helm_args() { if [[ "$scripts" == "null" ]]; then return 0 fi - datadir="$(cd "$(dirname -- "${CONFIGFILE}")" >/dev/null; pwd -P)" + datadir="$( + cd "$(dirname -- "${CONFIGFILE}")" > /dev/null + pwd -P + )" for script in $(yq -r ".chains[$i].scripts | keys | .[]" ${CONFIGFILE}); do args="$args --set-file chains[$i].scripts.$script.data=$datadir/$(yq -r ".chains[$i].scripts.$script.file" ${CONFIGFILE})" done @@ -84,19 +86,19 @@ function install_chart() { while [ $# -gt 0 ]; do case "$1" in - -c|--config) + -c | --config) CONFIGFILE="$2" shift 2 # past argument=value ;; - -v|--version) + -v | --version) HELM_CHART_VERSION="$2" shift 2 # past argument ;; - -t|--timeout) + -t | --timeout) TIMEOUT="$2" shift 2 # past argument ;; - -n|--name) + -n | --name) HELM_NAME="$2" shift 2 # past argument ;; @@ -112,12 +114,12 @@ while [ $# -gt 0 ]; do DRY_RUN=1 shift # past argument ;; - -*|--*) + -* | --*) echo "Unknown option $1" exit 1 ;; - *) - ;; + *) ;; + esac done diff --git a/multichain-testing/scripts/port-forward.sh b/multichain-testing/scripts/port-forward.sh index fdfba3e6334..3ad80c8d29b 100644 --- a/multichain-testing/scripts/port-forward.sh +++ b/multichain-testing/scripts/port-forward.sh @@ -38,16 +38,16 @@ MONITORING_GRAFANA_PORT=8080 for i in "$@"; do case $i in - -c=*|--config=*) + -c=* | --config=*) CONFIGFILE="${i#*=}" shift # past argument=value ;; - -*|--*) + -* | --*) echo "Unknown option $i" exit 1 ;; - *) - ;; + *) ;; + esac done @@ -60,16 +60,15 @@ if [[ $num_chains -gt -1 ]]; then for i in $(seq 0 $num_chains); do # derive chain pod name from chain id # https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56 - chain=$(yq -r ".chains[$i].id" ${CONFIGFILE} ) + chain=$(yq -r ".chains[$i].id" ${CONFIGFILE}) chain=${chain/_/"-"} - localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE} ) - localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE} ) - locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE} ) + localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE}) + localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE}) + locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE}) localexp=$(yq -r ".chains[$i].ports.exposer" ${CONFIGFILE}) localfaucet=$(yq -r ".chains[$i].ports.faucet" ${CONFIGFILE}) color yellow "chains: forwarded $chain" - if [[ $(yq -r ".chains[$i].cometmock.enabled" $CONFIGFILE) == "true" ]]; - then + if [[ $(yq -r ".chains[$i].cometmock.enabled" $CONFIGFILE) == "true" ]]; then [[ "$localrpc" != "null" ]] && color yellow " cometmock rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-cometmock-0 $localrpc:$CHAIN_COMETMOCK_PORT > /dev/null 2>&1 & else [[ "$localrpc" != "null" ]] && color yellow " rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-genesis-0 $localrpc:$CHAIN_RPC_PORT > /dev/null 2>&1 & @@ -84,17 +83,16 @@ else echo "No chains to port-forward: num: $num_chains" fi - echo "Port forward relayers" num_relayers=$(yq -r ".relayers | length - 1" ${CONFIGFILE}) if [[ $num_relayers -gt -1 ]]; then for i in $(seq 0 $num_relayers); do # derive chain pod name from chain id # https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56 - relayer=$(yq -r ".relayers[$i].name" ${CONFIGFILE} ) - relayer=$(yq -r ".relayers[$i].type" ${CONFIGFILE} )-${relayer/_/"-"} - localrest=$(yq -r ".relayers[$i].ports.rest" ${CONFIGFILE} ) - localexposer=$(yq -r ".relayers[$i].ports.exposer" ${CONFIGFILE} ) + relayer=$(yq -r ".relayers[$i].name" ${CONFIGFILE}) + relayer=$(yq -r ".relayers[$i].type" ${CONFIGFILE})-${relayer/_/"-"} + localrest=$(yq -r ".relayers[$i].ports.rest" ${CONFIGFILE}) + localexposer=$(yq -r ".relayers[$i].ports.exposer" ${CONFIGFILE}) color yellow "relayers: forwarded $relayer" [[ "$localrest" != "null" ]] && color yellow " rpc to http://localhost:$localrest" && kubectl port-forward pods/$relayer-0 $localrest:$RELAYER_REST_PORT > /dev/null 2>&1 & [[ "$localexposer" != "null" ]] && color yellow " rpc to http://localhost:$localexposer" && kubectl port-forward pods/$relayer-0 $localexposer:$RELAYER_EXPOSER_PORT > /dev/null 2>&1 & @@ -104,26 +102,22 @@ else echo "No relayer to port-forward: num: $num_relayers" fi - echo "Port forward services" -if [[ $(yq -r ".registry.enabled" $CONFIGFILE) == "true" ]]; -then +if [[ $(yq -r ".registry.enabled" $CONFIGFILE) == "true" ]]; then kubectl port-forward service/registry 8081:$REGISTRY_LCD_PORT > /dev/null 2>&1 & kubectl port-forward service/registry 9091:$REGISTRY_GRPC_PORT > /dev/null 2>&1 & sleep 1 color yellow "registry: forwarded registry lcd to grpc http://localhost:8081, to http://localhost:9091" fi -if [[ $(yq -r ".explorer.enabled" $CONFIGFILE) == "true" ]]; -then +if [[ $(yq -r ".explorer.enabled" $CONFIGFILE) == "true" ]]; then kubectl port-forward service/explorer 8080:$EXPLORER_LCD_PORT > /dev/null 2>&1 & sleep 1 color green "Open the explorer to get started.... http://localhost:8080" fi -if [[ $(yq -r ".monitoring.enabled" $CONFIGFILE) == "true" ]]; -then +if [[ $(yq -r ".monitoring.enabled" $CONFIGFILE) == "true" ]]; then color yellow "monitoring port forward:" localgrafana=$(yq -r ".monitoring.ports.grafana" ${CONFIGFILE}) localprometheus=$(yq -r ".monitoring.ports.prometheus" ${CONFIGFILE}) diff --git a/multichain-testing/scripts/update-config.sh b/multichain-testing/scripts/update-config.sh index aae19a9144e..a350f60142c 100644 --- a/multichain-testing/scripts/update-config.sh +++ b/multichain-testing/scripts/update-config.sh @@ -10,14 +10,13 @@ set -eux ls $CHAIN_DIR - echo "Update config.toml file" sed -i -e 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' $CHAIN_DIR/config/config.toml sed -i -e 's/index_all_keys = false/index_all_keys = true/g' $CHAIN_DIR/config/config.toml sed -i -e 's/seeds = ".*"/seeds = ""/g' $CHAIN_DIR/config/config.toml sed -i -e 's#cors_allowed_origins = \[\]#cors_allowed_origins = \["*"\]#g' $CHAIN_DIR/config/config.toml -echo "Increase `*_bytes` parameters for MsgInstallBundle" +echo "Increase $(*_bytes) parameters for MsgInstallBundle" # See https://github.com/Agoric/agoric-sdk/blob/7b684a6268c999b082a326fdb22f63e4575bac4f/packages/agoric-cli/src/chain-config.js#L66 RPC_MAX_BODY_BYTES=15000000 MAX_HEADER_BYTES=$((RPC_MAX_BODY_BYTES / 10)) @@ -41,7 +40,6 @@ sed -i -e 's#swagger = false#swagger = true#g' $CHAIN_DIR/config/app.toml sed -i -e 's/enable-unsafe-cors = false/enable-unsafe-cors = true/g' $CHAIN_DIR/config/app.toml sed -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $CHAIN_DIR/config/app.toml - function get_next_line_number() { local txt=$1 local file=$2 diff --git a/package.json b/package.json index db01224f7b1..8f1f558f059 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "lerna": "lerna", "link-cli": "yarn run create-agoric-cli", "create-agoric-cli": "node ./scripts/create-agoric-cli.cjs", - "format": "yarn prettier --write .github golang packages scripts", - "lint:format": "yarn prettier --check .github golang packages scripts", + "format": "yarn prettier --write .github golang packages scripts a3p-integration multichain-testing", + "lint:format": "yarn prettier --check .github golang packages scripts a3p-integration multichain-testing", "lint-fix": "yarn lerna run --no-bail lint-fix", "lint": "run-s --continue-on-error lint:*", "lint:packages": "yarn lerna run --no-bail lint",