From 5e0ac5fc0ac56cb2a438c7a9038244f414cef233 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 26 Dec 2024 22:10:55 +0500 Subject: [PATCH 01/46] pre test hook for acceptance proposal --- .../proposals/z:acceptance/pre_test.sh | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 a3p-integration/proposals/z:acceptance/pre_test.sh diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh new file mode 100755 index 00000000000..a21b8bf7663 --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -0,0 +1,56 @@ +#! /bin/bash + +set -o errexit -o errtrace -o pipefail + +AGORIC_HOME="\$HOME/.agoric" +DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +LOADGEN_REPOSITORY_NAME="testnet-load-generator" +ORGANIZATION_NAME="agoric" +TRUSTED_BLOCK_HASH="" +TRUSTED_BLOCK_HEIGHT="" + +LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" +PROPOSAL_NAME="$(echo "$DIRECTORY_PATH" | cut --delimiter ':' --fields '2')" +CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" + +run_command_inside_container() { + local entrypoint="$1" + docker run \ + --entrypoint "/bin/bash" \ + --quiet \ + --rm \ + --user "root" \ + "$CONTAINER_IMAGE_NAME:use-$PROPOSAL_NAME" \ + -c "$entrypoint" +} + +set_trusted_block_data() { + local last_block_info + + last_block_info="$(run_command_inside_container "cat $AGORIC_HOME/last_observed_status")" + TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" + TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" + echo "TRUSTED_BLOCK_HASH: $TRUSTED_BLOCK_HASH" + echo "TRUSTED_BLOCK_HEIGHT: $TRUSTED_BLOCK_HEIGHT" +} + +start_follower() { + local entrypoint=" + #! /bin/bash + set -o errexit -o errtrace -o pipefail + + cd \$HOME + git clone $LOADGEN_REPOSITORY_LINK --branch usman/testing-loadgen-follower + cd $LOADGEN_REPOSITORY_NAME + TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH \ + TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT \ + ./start.sh + " + echo "entrypoint: $entrypoint" + run_command_inside_container "$entrypoint" & +} + +echo "DIRECTORY_PATH: $DIRECTORY_PATH" +echo "PROPOSAL_NAME: $PROPOSAL_NAME" +set_trusted_block_data +start_follower From d78e4c6ca9e168391b8cc88a523feb4820de03c3 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 1 Jan 2025 20:07:42 +0500 Subject: [PATCH 02/46] changes --- .../proposals/z:acceptance/pre_test.sh | 161 ++++++++++++++---- .../proposals/z:acceptance/test.sh | 7 +- .../z:acceptance/wait-for-follower.mjs | 27 +++ 3 files changed, 164 insertions(+), 31 deletions(-) create mode 100644 a3p-integration/proposals/z:acceptance/wait-for-follower.mjs diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index a21b8bf7663..891ed4d918f 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -2,55 +2,156 @@ set -o errexit -o errtrace -o pipefail -AGORIC_HOME="\$HOME/.agoric" DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BRANCH_NAME="usman/testing-loadgen-follower" +CHAIN_ID="agoriclocal" +FOLLOWER_API_PORT="2317" +FOLLOWER_GRPC_PORT="10090" +FOLLOWER_P2P_PORT="36656" +FOLLOWER_PPROF_PORT="7060" +FOLLOWER_RPC_PORT="36657" LOADGEN_REPOSITORY_NAME="testnet-load-generator" +MESSAGE_FILE_PATH="/tmp/message-file-path.tmp" ORGANIZATION_NAME="agoric" -TRUSTED_BLOCK_HASH="" -TRUSTED_BLOCK_HEIGHT="" +TIMESTAMP="$(date '+%s')" +VALIDATOR_NODE_ID="" +VALIDATOR_P2P_PORT="26656" +VALIDATOR_RPC_PORT="26657" +CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" +NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" +OUTPUT_DIRECTORY="/tmp/loadgen-output-$TIMESTAMP" PROPOSAL_NAME="$(echo "$DIRECTORY_PATH" | cut --delimiter ':' --fields '2')" -CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" + +FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" + +create_volume_assets() { + mkdir --parents "$OUTPUT_DIRECTORY" +} run_command_inside_container() { local entrypoint="$1" - docker run \ - --entrypoint "/bin/bash" \ - --quiet \ - --rm \ - --user "root" \ - "$CONTAINER_IMAGE_NAME:use-$PROPOSAL_NAME" \ - -c "$entrypoint" + shift + local name="$1" + shift + + if test -z "$(docker container ls --all --filter "name=$name" --format "json")"; then + docker container run \ + --entrypoint "/bin/bash" \ + --name "$name" \ + --network "host" \ + --quiet \ + --user "root" \ + "$@" \ + "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ + -c "$entrypoint" + else + docker container start "$name" + fi +} + +set_node_id() { + VALIDATOR_NODE_ID="$( + run_command_inside_container \ + "agd tendermint show-node-id" \ + "$FOLLOWER_CONTAINER_NAME" + )" } set_trusted_block_data() { + local entrypoint local last_block_info - last_block_info="$(run_command_inside_container "cat $AGORIC_HOME/last_observed_status")" - TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" - TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" - echo "TRUSTED_BLOCK_HASH: $TRUSTED_BLOCK_HASH" - echo "TRUSTED_BLOCK_HEIGHT: $TRUSTED_BLOCK_HEIGHT" + entrypoint=" + #! /bin/bash + source /usr/src/upgrade-test-scripts/env_setup.sh + cat \$STATUS_FILE + " + last_block_info="$( + run_command_inside_container \ + "$entrypoint" \ + "$FOLLOWER_CONTAINER_NAME" \ + --rm + )" + + TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" + TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" } start_follower() { local entrypoint=" - #! /bin/bash - set -o errexit -o errtrace -o pipefail - - cd \$HOME - git clone $LOADGEN_REPOSITORY_LINK --branch usman/testing-loadgen-follower - cd $LOADGEN_REPOSITORY_NAME - TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH \ - TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT \ - ./start.sh - " - echo "entrypoint: $entrypoint" - run_command_inside_container "$entrypoint" & + #! /bin/bash + + clone_repository() { + cd \$HOME + git clone $LOADGEN_REPOSITORY_LINK --branch $BRANCH_NAME + } + + install_dependencies() { + apt-get update + apt-get install curl --yes + } + + ################################################################################## + # Hacky way to get go lang in the container # + ################################################################################## + install_go() { + curl --location --output /tmp/go.tar.gz \ + https://go.dev/dl/go1.20.6.linux-amd64.tar.gz + + tar --directory /usr/local --extract --file /tmp/go.tar.gz --gzip + rm --force /tmp/go.tar.gz + + export PATH=/usr/local/go/bin:\$PATH + + echo 'export PATH=\"/usr/local/go/bin:\$PATH\"' >> /etc/profile + } + ################################################################################## + + start_loadgen() { + cd \$HOME/$LOADGEN_REPOSITORY_NAME + ./start.sh \ + --testnet-origin file://$NETWORK_CONFIG_FILE_PATH --use-state-sync + } + + install_dependencies + install_go + clone_repository + start_loadgen + " + run_command_inside_container \ + "$entrypoint" \ + "$FOLLOWER_CONTAINER_NAME" \ + --detach \ + --env "API_PORT=$FOLLOWER_API_PORT" \ + --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ + --env "MESSAGE_FILE_PATH=$MESSAGE_FILE_PATH" \ + --env "OUTPUT_DIR=$OUTPUT_DIRECTORY" \ + --env "P2P_PORT=$FOLLOWER_P2P_PORT" \ + --env "PPROF_PORT=$FOLLOWER_PPROF_PORT" \ + --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ + --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ + --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ + --mount "source=$MESSAGE_FILE_PATH,target=$MESSAGE_FILE_PATH,type=bind" \ + --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ + --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" +} + +write_network_config() { + echo " + { + \"chainName\": \"$CHAIN_ID\", + \"rpcAddrs\": [\"http://localhost:$VALIDATOR_RPC_PORT\"], + \"gci\": \"http://localhost:$VALIDATOR_RPC_PORT/genesis\", + \"peers\":[\"$VALIDATOR_NODE_ID@localhost:$VALIDATOR_P2P_PORT\"], + \"seeds\":[] + } + " >"$NETWORK_CONFIG_FILE_PATH" } -echo "DIRECTORY_PATH: $DIRECTORY_PATH" -echo "PROPOSAL_NAME: $PROPOSAL_NAME" +create_volume_assets +set_node_id set_trusted_block_data +write_network_config start_follower diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 78e9c2d09fa..28d649e88f2 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ueo pipefail +set -o errexit -o nounset -o pipefail # Place here any test that should be executed using the executed proposal. # The effects of this step are not persisted in further proposal layers. @@ -33,6 +33,11 @@ yarn ava vaults.test.js echo ACCEPTANCE TESTING governance yarn ava governance.test.js +if ! test -z "$MESSAGE_FILE_PATH"; then + echo -n "stop at $(agd status | jq --raw-output '.SyncInfo.latest_block_height')" >>"$MESSAGE_FILE_PATH" + node ./wait-for-follower.mjs +fi + echo ACCEPTANCE TESTING state sync ./state-sync-snapshots-test.sh ./genesis-test.sh diff --git a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs new file mode 100644 index 00000000000..4f4faa78ec2 --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs @@ -0,0 +1,27 @@ +/* eslint-env node */ + +import { readFile, watch } from 'fs/promises'; + +const FILE_ENCODING = 'utf-8'; +const FILE_PATH = process.env.MESSAGE_FILE_PATH; + +/** + * @param {string} filePath + */ +const watchSharedFile = async filePath => { + for await (const { eventType } of watch(filePath)) { + if (eventType === 'change') { + const fileContent = (await readFile(filePath, FILE_ENCODING)).trim(); + const parsed = /^stopped at ([0-9]+)$/.exec(fileContent); + if (!parsed) + console.warn('Ignoring unsupported file content: ', fileContent); + else return Number(parsed[1]); + } + } + return 0; +}; + +FILE_PATH && + watchSharedFile(FILE_PATH).then(height => + console.log(`Follower stopped at height ${height}`), + ); From 400c64f57ada8d9b5f5ffcd31d8b462f5887f0b7 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 1 Jan 2025 15:29:23 +0000 Subject: [PATCH 03/46] Merge branch "usman/a3p-prepare-test-script" into branch "usman/acceptance-pre-test" --- .aiderignore | 7 ++ .eslintrc.cjs | 5 + .github/workflows/integration.yml | 19 ++- .gitignore | 2 + .../n:upgrade-next/priceFeedUpdate.test.js | 12 +- .../n:upgrade-next/test-lib/price-feed.js | 29 +++++ .../proposals/p:upgrade-19/.gitignore | 1 + .../proposals/p:upgrade-19/package.json | 1 + .../proposals/p:upgrade-19/psm.test.js | 81 ++++++++++++ .../swap-anchor-for-minted-seat-permit.json | 8 ++ .../swap-anchor-for-minted-seat.js | 59 +++++++++ .../test-lib/mintHolder-helpers.js | 22 +++- .../proposals/p:upgrade-19/test.sh | 1 + .../proposals/z:acceptance/prepare-test.sh | 11 ++ .../proposals/z:acceptance/psm.test.js | 3 +- .../z:acceptance/test-lib/psm-lib.js | 5 +- .../proposals/z:acceptance/wallet.test.js | 25 ++-- golang/cosmos/app/upgrade.go | 3 + package.json | 4 +- packages/async-flow/src/types.ts | 4 +- .../bootstrapTests/net-ibc-upgrade.test.ts | 2 +- packages/boot/tools/drivers.ts | 2 +- packages/builders/scripts/vats/upgrade-psm.js | 19 +++ packages/casting/package.json | 1 + packages/casting/test/types.test-d.ts | 31 +++++ packages/casting/tsconfig.json | 4 +- packages/deploy-script-support/README.md | 10 +- packages/orchestration/src/cosmos-api.ts | 4 +- .../orchestration/src/orchestration-api.ts | 4 +- packages/orchestration/test/facade.test.ts | 1 - .../swingset-liveslots/src/vatDataTypes.ts | 2 +- packages/time/src/types.ts | 2 +- packages/vats/src/core/types-ambient.d.ts | 4 +- .../src/proposals/upgrade-psm-proposal.js | 74 +++++++++++ packages/vats/src/types.ts | 13 +- packages/vats/test/types-ambient.test-d.ts | 1 - packages/vow/src/types.ts | 2 +- .../zoe/src/contractFacet/types-ambient.d.ts | 13 +- packages/zoe/src/zoeService/utils.d.ts | 10 +- packages/zoe/test/types.test-d.ts | 2 +- scripts/npm-dist-tag.sh | 2 +- yarn.lock | 116 +++++++++--------- 42 files changed, 500 insertions(+), 121 deletions(-) create mode 100644 .aiderignore create mode 100644 a3p-integration/proposals/p:upgrade-19/psm.test.js create mode 100644 a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat-permit.json create mode 100644 a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat.js create mode 100644 a3p-integration/proposals/z:acceptance/prepare-test.sh create mode 100644 packages/builders/scripts/vats/upgrade-psm.js create mode 100644 packages/casting/test/types.test-d.ts create mode 100644 packages/vats/src/proposals/upgrade-psm-proposal.js diff --git a/.aiderignore b/.aiderignore new file mode 100644 index 00000000000..4b2920ee190 --- /dev/null +++ b/.aiderignore @@ -0,0 +1,7 @@ +# circular symlink +a3p-integration/agoric-sdk + +# git subrepos +moddable +xsnap-native + diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 43f34a9aaa4..3400a08b855 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -81,6 +81,11 @@ module.exports = { reportUnusedDisableDirectives: true, rules: { + '@typescript-eslint/no-unused-expressions': 'off', // we use `cond || Fail` + '@typescript-eslint/no-empty-object-type': 'warn', + '@typescript-eslint/no-unnecessary-type-constraint': 'warn', + '@typescript-eslint/no-unsafe-function-type': 'warn', + '@typescript-eslint/no-wrapper-object-types': 'warn', '@typescript-eslint/ban-ts-comment': [ 'error', { diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4d396afe867..f0f26d21c31 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,6 +10,7 @@ on: - 'release-*' - 'dev-*' - beta + - 'usman/*' tags: - '@agoric/sdk@*' pull_request: @@ -282,7 +283,23 @@ jobs: fi working-directory: a3p-integration - name: build proposals tests - run: yarn build + run: | + BRANCH_NAME="usman/prepare-test-hook" + FILES=("env_setup.sh" "run_eval.sh" "run_test.sh" "run_use.sh") + FOLDER_NAME="upgrade-test-scripts" + ORG="Agoric" + REPO="agoric-3-proposals" + + for file in "${FILES[@]}" + do + curl \ + "https://github.com/$ORG/$REPO/raw/refs/heads/$BRANCH_NAME/packages/synthetic-chain/public/$FOLDER_NAME/$file" \ + --location \ + --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ + --silent + done + + yarn build working-directory: a3p-integration - name: run proposals tests run: yarn test diff --git a/.gitignore b/.gitignore index ec596f3ce77..8a71bc41357 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,5 @@ _testoutput.txt junit.xml endo-sha.txt .aider* +!.aiderignore + diff --git a/a3p-integration/proposals/n:upgrade-next/priceFeedUpdate.test.js b/a3p-integration/proposals/n:upgrade-next/priceFeedUpdate.test.js index 557a837be9e..edde68b74b2 100644 --- a/a3p-integration/proposals/n:upgrade-next/priceFeedUpdate.test.js +++ b/a3p-integration/proposals/n:upgrade-next/priceFeedUpdate.test.js @@ -19,6 +19,7 @@ import { } from '@agoric/synthetic-chain'; import { getPriceFeedRoundId, + tryISTBalances, verifyPushedPrice, } from './test-lib/price-feed.js'; @@ -79,16 +80,19 @@ const createNewBid = async t => { }; const openMarginalVault = async t => { - let user1IST = await getISTBalance(USER1ADDR); + const istBalanceBeforeVaultOpen = await getISTBalance(USER1ADDR, 'uist', 1); await bankSend(USER1ADDR, `20000000${ATOM_DENOM}`); const currentVaults = await agops.vaults('list', '--from', USER1ADDR); t.log('opening a vault'); // @ts-expect-error bad typedef await openVault(USER1ADDR, 5, 10); - user1IST += 5; - const istBalanceAfterVaultOpen = await getISTBalance(USER1ADDR); - t.is(istBalanceAfterVaultOpen, user1IST); + const istBalanceAfterVaultOpen = await getISTBalance(USER1ADDR, 'uist', 1); + await tryISTBalances( + t, + istBalanceAfterVaultOpen, + istBalanceBeforeVaultOpen + 5_000_000, // in uist + ); const activeVaultsAfter = await agops.vaults('list', '--from', USER1ADDR); t.log(currentVaults, activeVaultsAfter); diff --git a/a3p-integration/proposals/n:upgrade-next/test-lib/price-feed.js b/a3p-integration/proposals/n:upgrade-next/test-lib/price-feed.js index 0fefd5ca52e..69cd3150f3f 100644 --- a/a3p-integration/proposals/n:upgrade-next/test-lib/price-feed.js +++ b/a3p-integration/proposals/n:upgrade-next/test-lib/price-feed.js @@ -60,3 +60,32 @@ export const getPriceFeedRoundId = async brand => { console.log(latestRoundPath, latestRound); return Number(latestRound.roundId); }; + +/** + * Copy from https://github.com/Agoric/agoric-sdk/blob/745f2a82cc94e246f98dd1bd69cb679b608a7170/a3p-integration/proposals/p%3Aupgrade-19/test-lib/psm-lib.js#L277 + * + * Checking IST balances can be tricky because of the execution fee mentioned in + * https://github.com/Agoric/agoric-sdk/issues/6525. So we first check for + * equality, but if that fails we recheck against an assumption that a fee of + * the default "minFeeDebit" has been charged. + * + * @param {import('ava').ExecutionContext} t + * @param {number} actualBalance + * @param {number} expectedBalance + */ +export const tryISTBalances = async (t, actualBalance, expectedBalance) => { + const firstTry = await t.try(tt => { + tt.is(actualBalance, expectedBalance); + }); + if (firstTry.passed) { + firstTry.commit(); + return; + } + + firstTry.discard(); + t.log('tryISTBalances assuming no batched IST fee', ...firstTry.errors); + // See golang/cosmos/x/swingset/types/default-params.go + // and `ChargeBeans` in golang/cosmos/x/swingset/keeper/keeper.go. + const minFeeDebit = 200_000; + t.is(actualBalance + minFeeDebit, expectedBalance); +}; diff --git a/a3p-integration/proposals/p:upgrade-19/.gitignore b/a3p-integration/proposals/p:upgrade-19/.gitignore index ffa9f22d144..e02eb30fb97 100644 --- a/a3p-integration/proposals/p:upgrade-19/.gitignore +++ b/a3p-integration/proposals/p:upgrade-19/.gitignore @@ -7,3 +7,4 @@ publishTestInfo/ upgrade-mintHolder/ upgradeAssetReserve/ terminate-governor/ +upgradePSM/ diff --git a/a3p-integration/proposals/p:upgrade-19/package.json b/a3p-integration/proposals/p:upgrade-19/package.json index 638d622ecf4..d70003a54e0 100644 --- a/a3p-integration/proposals/p:upgrade-19/package.json +++ b/a3p-integration/proposals/p:upgrade-19/package.json @@ -6,6 +6,7 @@ "testing/add-USD-LEMONS.js addUsdLemons", "vats/upgrade-provisionPool.js upgradeProvisionPool", "vats/upgrade-asset-reserve.js upgradeAssetReserve", + "vats/upgrade-psm.js upgradePSM", "vats/upgrade-paRegistry.js", "vats/upgrade-agoricNames.js agoricNamesCoreEvals/upgradeAgoricNames", "testing/add-USD-OLIVES.js agoricNamesCoreEvals/addUsdOlives", diff --git a/a3p-integration/proposals/p:upgrade-19/psm.test.js b/a3p-integration/proposals/p:upgrade-19/psm.test.js new file mode 100644 index 00000000000..90ff2060d98 --- /dev/null +++ b/a3p-integration/proposals/p:upgrade-19/psm.test.js @@ -0,0 +1,81 @@ +/* eslint-env node */ +/** + * @file The goal of this file is to make sure all the PSM contacts are upgrade. Each set of vats are different + * per chain, but for mainnet, we expect this to be: V37-V42, V73, V76 + * + * The test scenario is as follows; + * 1. Simulate trade of IST and USDC + * 2. Upgrade all PSMs + * 3. Verify metrics are the same after the upgrade + * 4. Verify trading is still possible after the upgrade + */ + +import '@endo/init'; +import test from 'ava'; +import { evalBundles } from '@agoric/synthetic-chain'; +import { makeVstorageKit } from '@agoric/client-utils'; + +const UPGRADE_PSM_DIR = 'upgradePSM'; +const SWAP_ANCHOR = 'swapAnchorForMintedSeat'; + +test.before(async t => { + const vstorageKit = await makeVstorageKit( + { fetch }, + { rpcAddrs: ['http://localhost:26657'], chainName: 'agoriclocal' }, + ); + + t.context = { + vstorageKit, + }; +}); + +test.serial('simulate trade of IST and USDC', async t => { + // @ts-expect-error casting + const { vstorageKit } = t.context; + + await evalBundles(SWAP_ANCHOR); + + const metrics = await vstorageKit.readLatestHead( + 'published.psm.IST.USDC.metrics', + ); + + t.is(metrics.anchorPoolBalance.value, 500000n); + t.is(metrics.feePoolBalance.value, 0n); + t.is(metrics.mintedPoolBalance.value, 500000n); + t.is(metrics.totalAnchorProvided.value, 0n); + t.is(metrics.totalMintedProvided.value, 500000n); +}); + +test.serial('upgrade PSMs', async t => { + // @ts-expect-error casting + const { vstorageKit } = t.context; + + await evalBundles(UPGRADE_PSM_DIR); + + const metrics = await vstorageKit.readLatestHead( + 'published.psm.IST.USDC.metrics', + ); + + t.is(metrics.anchorPoolBalance.value, 500000n); + t.is(metrics.feePoolBalance.value, 0n); + t.is(metrics.mintedPoolBalance.value, 500000n); + t.is(metrics.totalAnchorProvided.value, 0n); + t.is(metrics.totalMintedProvided.value, 500000n); +}); + +test.serial('verify trading after upgrade', async t => { + // @ts-expect-error casting + const { vstorageKit } = t.context; + + await evalBundles(SWAP_ANCHOR); + + const metrics = await vstorageKit.readLatestHead( + 'published.psm.IST.USDC.metrics', + ); + + t.is(metrics.anchorPoolBalance.value, 1000000n); + t.is(metrics.feePoolBalance.value, 0n); + t.is(metrics.mintedPoolBalance.value, 1000000n); + t.is(metrics.totalAnchorProvided.value, 0n); + t.is(metrics.totalMintedProvided.value, 1000000n); +}); diff --git a/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat-permit.json b/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat-permit.json new file mode 100644 index 00000000000..067c22846cd --- /dev/null +++ b/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat-permit.json @@ -0,0 +1,8 @@ +{ + "consume": { + "contractKits": true, + "zoe": true, + "agoricNames": true, + "psmKit": true + } +} diff --git a/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat.js b/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat.js new file mode 100644 index 00000000000..1f26f84cce2 --- /dev/null +++ b/a3p-integration/proposals/p:upgrade-19/swapAnchorForMintedSeat/swap-anchor-for-minted-seat.js @@ -0,0 +1,59 @@ +// @ts-nocheck +/* eslint-disable no-undef */ + +const swapAnchorForMintedSeat = async powers => { + const { + consume: { zoe, contractKits: contractKitsP, psmKit: psmKitP, agoricNames }, + } = powers; + + const [contractKits, psmKit, usdcIssuer, usdcBrand] = await Promise.all([ + contractKitsP, + psmKitP, + E(agoricNames).lookup('issuer', 'USDC'), + E(agoricNames).lookup('brand', 'USDC'), + ]); + + console.log('CONTRACT_KITS', contractKits); + console.log('ISSUER', usdcIssuer); + + let govCreatorFacet; + for (const { psmGovernorCreatorFacet, label } of psmKit.values()) { + if (label === 'psm-IST-USDC') { + govCreatorFacet = psmGovernorCreatorFacet; + console.log('psm-IST-USDC found', label); + } + } + + const psmPublicFacet = await E(govCreatorFacet).getPublicFacet(); + + let usdcMint; + for (const { publicFacet, creatorFacet: mint } of contractKits.values()) { + if (publicFacet === usdcIssuer) { + usdcMint = mint; + console.log('USDC found', mint); + break; + } + } + + console.log('Minting USDC'); + assert(usdcMint, 'USDC mint not found'); + + const amt = harden({ brand: usdcBrand, value: 500000n }); + const payment = await E(usdcMint).mintPayment(amt); + + const seat = E(zoe).offer( + E(psmPublicFacet).makeWantMintedInvitation(), + harden({ + give: { In: amt }, + }), + harden({ In: payment }), + ); + + console.log(await E(seat).getPayouts()); + + // We'll check for success in the tests that run this proposal by validating the metric values in + // vstorage + console.log('Done.'); +}; + +swapAnchorForMintedSeat; diff --git a/a3p-integration/proposals/p:upgrade-19/test-lib/mintHolder-helpers.js b/a3p-integration/proposals/p:upgrade-19/test-lib/mintHolder-helpers.js index 9639fd98662..0b4a5ef38ad 100644 --- a/a3p-integration/proposals/p:upgrade-19/test-lib/mintHolder-helpers.js +++ b/a3p-integration/proposals/p:upgrade-19/test-lib/mintHolder-helpers.js @@ -8,7 +8,10 @@ import { } from '@agoric/synthetic-chain'; import { makeVstorageKit, retryUntilCondition } from '@agoric/client-utils'; import { readFile, writeFile } from 'node:fs/promises'; -import { psmSwap, snapshotAgoricNames } from './psm-lib.js'; +import { psmSwap, snapshotAgoricNames, tryISTBalances } from './psm-lib.js'; + +/** @type {(x: number) => number} */ +const scale6 = x => x * 1_000_000; /** * @param {string} fileName base file name without .tjs extension @@ -89,6 +92,13 @@ export const mintPayment = async (t, address, assetList, value) => { } }; +/** + * + * @param {import('ava').ExecutionContext} t + * @param {string} address + * @param {Array<{ label: string, denom: string, mintHolderVat: string}>} assetList + * @param {number} want in IST + */ export const swap = async (t, address, assetList, want) => { for (const asset of assetList) { const { label, denom } = asset; @@ -100,7 +110,7 @@ export const swap = async (t, address, assetList, want) => { const pair = `IST.${label}`; - const istBalanceBefore = await getISTBalance(address, 'uist'); + const istBalanceBefore = await getISTBalance(address, 'uist', 1); // we want uist not IST const anchorBalanceBefore = await getISTBalance(address, denom); const psmSwapIo = { @@ -116,10 +126,14 @@ export const swap = async (t, address, assetList, want) => { psmSwapIo, ); - const istBalanceAfter = await getISTBalance(address, 'uist'); + const istBalanceAfter = await getISTBalance(address, 'uist', 1); // we want uist not IST const anchorBalanceAfter = await getISTBalance(address, denom); - t.is(istBalanceAfter, istBalanceBefore + want); + await tryISTBalances( + t, + istBalanceAfter, + istBalanceBefore + scale6(want), // scale "want" to uist + ); t.is(anchorBalanceAfter, anchorBalanceBefore - want); } }; diff --git a/a3p-integration/proposals/p:upgrade-19/test.sh b/a3p-integration/proposals/p:upgrade-19/test.sh index 9b175d8e6e0..97b3e694e04 100644 --- a/a3p-integration/proposals/p:upgrade-19/test.sh +++ b/a3p-integration/proposals/p:upgrade-19/test.sh @@ -8,5 +8,6 @@ yarn ava provisionPool.test.js yarn ava agoricNames.test.js yarn ava assetReserve.test.js +yarn ava psm.test.js yarn ava registry.test.js diff --git a/a3p-integration/proposals/z:acceptance/prepare-test.sh b/a3p-integration/proposals/z:acceptance/prepare-test.sh new file mode 100644 index 00000000000..3654b1d2407 --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/prepare-test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -o errexit -o pipefail -o xtrace + +# shellcheck disable=SC1091 +source /usr/src/upgrade-test-scripts/env_setup.sh + +SNAPSHOT_INTERVAL="$(($(jq --raw-output '.SyncInfo.latest_block_height' < "$STATUS_FILE") + 2))" +sed "s/^snapshot-interval\s*=.*/snapshot-interval = $SNAPSHOT_INTERVAL/" \ + "$HOME/.agoric/config/app.toml" \ + --in-place diff --git a/a3p-integration/proposals/z:acceptance/psm.test.js b/a3p-integration/proposals/z:acceptance/psm.test.js index ae176ec51c8..36da819c04a 100644 --- a/a3p-integration/proposals/z:acceptance/psm.test.js +++ b/a3p-integration/proposals/z:acceptance/psm.test.js @@ -34,7 +34,6 @@ import { logRecord, maxMintBelowLimit, psmSwap, - sendOfferAgd, } from './test-lib/psm-lib.js'; import { getBalances } from './test-lib/utils.js'; @@ -163,7 +162,7 @@ test.serial('swap into IST using agd with default gas', async t => { '--feePct', wantMintedFeeVal, ], - { ...psmSwapIo, sendOffer: sendOfferAgd }, + psmSwapIo, ); await checkSwapSucceeded(t, metricsBefore, balancesBefore, { diff --git a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js index 24c6a89ff88..14a6169024e 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/psm-lib.js @@ -434,6 +434,8 @@ export const initializeNewUser = async (name, fund, io) => { }; /** + * UNTIL https://github.com/Agoric/agoric-sdk/issues/10746 better to use {@link sendOfferAgd} + * * Similar to * https://github.com/Agoric/agoric-3-proposals/blob/422b163fecfcf025d53431caebf6d476778b5db3/packages/synthetic-chain/src/lib/commonUpgradeHelpers.ts#L123-L139 * However, for an address that is not provisioned, `agoric wallet send` is @@ -478,7 +480,6 @@ export const sendOfferAgd = async (address, offerPromise) => { [`--keyring-backend=test`, `--from=${address}`], ['tx', 'swingset', 'wallet-action', '--allow-spend', offer], '--yes', - '-bblock', '-ojson', ) ); @@ -522,7 +523,7 @@ export const sendOfferAgd = async (address, offerPromise) => { * }} io */ export const psmSwap = async (address, params, io) => { - const { now, sendOffer = sendOfferAgoric, ...waitIO } = io; + const { now, sendOffer = sendOfferAgd, ...waitIO } = io; const offerId = `${address}-psm-swap-${now()}`; const newParams = ['psm', ...params, '--offerId', offerId]; const offerPromise = executeCommand(agopsLocation, newParams); diff --git a/a3p-integration/proposals/z:acceptance/wallet.test.js b/a3p-integration/proposals/z:acceptance/wallet.test.js index 9a2e18d1395..d9f845a5ee7 100644 --- a/a3p-integration/proposals/z:acceptance/wallet.test.js +++ b/a3p-integration/proposals/z:acceptance/wallet.test.js @@ -14,6 +14,7 @@ import { import { execFileSync } from 'node:child_process'; import { agdWalletUtils } from './test-lib/index.js'; import { getBalances, replaceTemplateValuesInFile } from './test-lib/utils.js'; +import { tryISTBalances } from './test-lib/psm-lib.js'; /** * @param {string} file @@ -57,10 +58,12 @@ test.serial(`send invitation via namesByAddress`, async t => { ); }); -// FIXME https://github.com/Agoric/agoric-sdk/issues/10565 -test.skip('exitOffer tool reclaims stuck payment', async t => { +test.serial('exitOffer tool reclaims stuck payment', async t => { const istBalanceBefore = await getBalances([GOV1ADDR], 'uist'); - t.log('istBalanceBefore', istBalanceBefore); + + // Using console.log here because t.log is inconsistent + // when a test fails in CI. See https://github.com/Agoric/agoric-sdk/issues/10565#issuecomment-2561923537 + console.log('istBalanceBefore', istBalanceBefore); const offerId = 'bad-invitation-15'; // offer submitted on proposal upgrade-15 with an incorrect method name await agdWalletUtils.broadcastBridgeAction(GOV1ADDR, { @@ -70,16 +73,20 @@ test.skip('exitOffer tool reclaims stuck payment', async t => { const istBalanceAfter = await retryUntilCondition( async () => getBalances([GOV1ADDR], 'uist'), - istBalance => istBalance > istBalanceBefore, - 'tryExitOffer failed to reclaim stuck payment ', + // We only check gov1's IST balance is changed. + // Because the reclaimed amount (0,015 IST) is less than execution fee (0,2 IST) + // we might end up with less IST than the one before reclaiming the stuck payment. + istBalance => istBalance !== istBalanceBefore, + 'tryExitOffer did not end up changing the IST balance', { log: t.log, setTimeout, retryIntervalMs: 5000, maxRetries: 15 }, ); - t.log('istBalanceAfter', istBalanceAfter); + console.log('istBalanceAfter', istBalanceAfter); - t.true( - istBalanceAfter > istBalanceBefore, - 'The IST balance should increase after reclaiming the stuck payment', + await tryISTBalances( + t, + Number(istBalanceAfter), + Number(istBalanceBefore + 15_000n), ); }); diff --git a/golang/cosmos/app/upgrade.go b/golang/cosmos/app/upgrade.go index 7f682710986..ba513a24888 100644 --- a/golang/cosmos/app/upgrade.go +++ b/golang/cosmos/app/upgrade.go @@ -304,6 +304,9 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte // vm.CoreProposalStepForModules( // "@agoric/builders/scripts/vats/upgrade-asset-reserve.js", // ), + // vm.CoreProposalStepForModules( + // "@agoric/builders/scripts/vats/upgrade-psm.js", + // ), // ) terminateOldGovernor, err := terminateGovernorCoreProposal(targetUpgrade) diff --git a/package.json b/package.json index bf32fcc3094..f289a011b19 100644 --- a/package.json +++ b/package.json @@ -37,12 +37,12 @@ "typedoc": "^0.26.7", "typedoc-plugin-markdown": "^4.2.1", "typescript": "~5.7.1", - "typescript-eslint": "^8.17.0" + "typescript-eslint": "^8.18.2" }, "resolutions": { "**/protobufjs": "^7.2.6", "**/@types/estree": "^1.0.0", - "@endo/eslint-plugin/typescript-eslint": "^8.17.0" + "@endo/eslint-plugin/typescript-eslint": "^8.18.2" }, "engines": { "node": "^18.12 || ^20.9" diff --git a/packages/async-flow/src/types.ts b/packages/async-flow/src/types.ts index 29359000d39..cf2fd873846 100644 --- a/packages/async-flow/src/types.ts +++ b/packages/async-flow/src/types.ts @@ -18,7 +18,7 @@ export type FlowState = * but since they still could not be made durable, in this context * it'd be pointless.) */ -export type Guest = T; +export type Guest = T; export type Host = T; /** @@ -109,7 +109,7 @@ export type Outcome = problem: any; }; -export type Ephemera = { +export type Ephemera = { for: (self: S) => V; resetFor: (self: S) => void; }; diff --git a/packages/boot/test/bootstrapTests/net-ibc-upgrade.test.ts b/packages/boot/test/bootstrapTests/net-ibc-upgrade.test.ts index 53a1a1ebc98..904f24394ae 100644 --- a/packages/boot/test/bootstrapTests/net-ibc-upgrade.test.ts +++ b/packages/boot/test/bootstrapTests/net-ibc-upgrade.test.ts @@ -185,7 +185,7 @@ test.serial('upgrade at many points in network API flow', async t => { // continuation after upgrade. const pausedFlows = [] as Array<{ result: any; - remainingSteps: [string, Function][]; + remainingSteps: [string, (lastResult: any) => unknown][]; }>; for (let i = 0; i < flow.length; i += 1) { const [beforeStepName] = flow[i]; diff --git a/packages/boot/tools/drivers.ts b/packages/boot/tools/drivers.ts index 850cf668d04..0c1efd03f53 100644 --- a/packages/boot/tools/drivers.ts +++ b/packages/boot/tools/drivers.ts @@ -399,7 +399,7 @@ export const makeGovernanceDriver = async ( proposeApiCall, enactLatestProposal, getLatestOutcome, - async changeParams(instance: Instance, params: Object, path?: object) { + async changeParams(instance: Instance, params: object, path?: object) { instance || Fail`missing instance`; await ensureInvitationsAccepted(); await proposeParams(instance, params, path); diff --git a/packages/builders/scripts/vats/upgrade-psm.js b/packages/builders/scripts/vats/upgrade-psm.js new file mode 100644 index 00000000000..678f4a5449b --- /dev/null +++ b/packages/builders/scripts/vats/upgrade-psm.js @@ -0,0 +1,19 @@ +import { makeHelpers } from '@agoric/deploy-script-support'; + +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ +export const defaultProposalBuilder = async ({ publishRef, install }) => + harden({ + sourceSpec: '@agoric/vats/src/proposals/upgrade-psm-proposal.js', + getManifestCall: [ + 'getManifestForUpgradingPSM', + { + psmRef: publishRef(install('@agoric/inter-protocol/src/psm/psm.js')), + }, + ], + }); + +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ +export default async (homeP, endowments) => { + const { writeCoreProposal } = await makeHelpers(homeP, endowments); + await writeCoreProposal('upgrade-psm', defaultProposalBuilder); +}; diff --git a/packages/casting/package.json b/packages/casting/package.json index 3f0432049d8..1cc342bd405 100644 --- a/packages/casting/package.json +++ b/packages/casting/package.json @@ -42,6 +42,7 @@ "ava": "^5.3.0", "c8": "^10.1.2", "express": "^5.0.1", + "tsd": "^0.31.2", "ws": "^7.2.0" }, "publishConfig": { diff --git a/packages/casting/test/types.test-d.ts b/packages/casting/test/types.test-d.ts new file mode 100644 index 00000000000..4c9635592b8 --- /dev/null +++ b/packages/casting/test/types.test-d.ts @@ -0,0 +1,31 @@ +import { E } from '@endo/far'; +import { expectType } from 'tsd'; +import type { ValueFollower } from '../src/follower-cosmjs.js'; +import { makeFollower } from '../src/follower.js'; +import { iterateLatest } from '../src/iterable.js'; +import { makeLeader } from '../src/leader-netconfig.js'; +import type { ValueFollowerElement } from '../src/types.js'; + +type ThePublishedDatum = { a: 1; b: 'two' }; +type TheFollowerElement = ValueFollowerElement; + +const leader = makeLeader(); + +{ + const f = makeFollower('', leader, {}); + expectType>(await f); + + expectType>(await E(f).getLatestIterable()); + + expectType>(await E(f).getLatestIterable()); + + expectType>( + await E(f).getReverseIterable(), + ); + + const iter = iterateLatest(f); + for await (const { value } of iter) { + assert(value, 'value undefined'); + expectType(value); + } +} diff --git a/packages/casting/tsconfig.json b/packages/casting/tsconfig.json index b24e1c5d9f3..71b002f8f4f 100644 --- a/packages/casting/tsconfig.json +++ b/packages/casting/tsconfig.json @@ -5,7 +5,7 @@ "include": [ "*.js", "public/**/*.js", - "src/**/*.js", - "test/**/*.js", + "src", + "test", ], } diff --git a/packages/deploy-script-support/README.md b/packages/deploy-script-support/README.md index f541fc01a7f..742cf5901f3 100644 --- a/packages/deploy-script-support/README.md +++ b/packages/deploy-script-support/README.md @@ -70,9 +70,10 @@ or an object whose keys identify child properties and whose corresponding values are theirselves (recursive) permits. See `BootstrapManifiest` in [lib-boot.js](../vats/src/core/lib-boot.js). -The object returned from a "getManifestCall" invocation may also include -"installations" to register in `agoricNames`, as is done here with name "game1" -using the reference passed in via the invocation argument: +The manifest object returned from a "getManifestCall" invocation may also +include "installations" to register in `agoricNames` and/or "options" to be +provided as the "options" property of the second argument for each call of the +manifest's functions: ```js /** @type {import('@agoric/vats/src/core/lib-boot').BootstrapManifest} */ const gameManifest = harden({ @@ -87,9 +88,12 @@ const gameManifest = harden({ export const getManifestForGame1 = ({ restoreRef }, { game1Ref }) => { return harden({ manifest: gameManifest, + // a reference to the game1 bundle will be published in agoricNames as "game1" installations: { game1: restoreRef(game1Ref), }, + // the second argument of `startGameContract` will be `{ options: ["foo"] }` + options: ["foo"], }); }; ``` diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index a4934c2006c..8fa9ef07e1f 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -353,10 +353,10 @@ export interface IBCMsgTransferOptions { export type CosmosChainAccountMethods = IcaAccountMethods & (CCI extends { - stakingTokens: {}; + stakingTokens: object; } ? StakingAccountActions & StakingAccountQueries - : {}); + : object); export type ICQQueryFunction = ( msgs: JsonSafe[], diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 4bd51994d26..500fcf46f51 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -75,7 +75,7 @@ export type OrchestrationAccount = ? CI['chainId'] extends `agoric${string}` ? LocalAccountMethods : CosmosChainAccountMethods - : {}); + : object); /** * An object for access the core functions of a remote chain. @@ -133,7 +133,7 @@ export interface Orchestrator { chainName: C, ) => Promise< Chain & - (C extends 'agoric' ? AgoricChainMethods : {}) + (C extends 'agoric' ? AgoricChainMethods : object) >; /** diff --git a/packages/orchestration/test/facade.test.ts b/packages/orchestration/test/facade.test.ts index 728e38016d5..db0512e0d2a 100644 --- a/packages/orchestration/test/facade.test.ts +++ b/packages/orchestration/test/facade.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @jessie.js/safe-await-separator */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import type { VowTools } from '@agoric/vow'; diff --git a/packages/swingset-liveslots/src/vatDataTypes.ts b/packages/swingset-liveslots/src/vatDataTypes.ts index 2b0638b9ba5..c19a6e2f8c8 100644 --- a/packages/swingset-liveslots/src/vatDataTypes.ts +++ b/packages/swingset-liveslots/src/vatDataTypes.ts @@ -37,7 +37,7 @@ type OmitFirstArg = F extends (x: any, ...args: infer P) => infer R // The type of a passable local object with methods. // An internal helper to avoid having to repeat `O`. -type PrimaryRemotable = O & RemotableObject & RemotableBrand<{}, O>; +type PrimaryRemotable = O & RemotableObject & RemotableBrand; export type KindFacet = PrimaryRemotable<{ [K in keyof O]: OmitFirstArg; // omit the 'context' parameter diff --git a/packages/time/src/types.ts b/packages/time/src/types.ts index 06eaf1c3dca..d85af117e24 100644 --- a/packages/time/src/types.ts +++ b/packages/time/src/types.ts @@ -182,7 +182,7 @@ export interface TimerServiceCommon { // XXX copied from Remotable helper return type export type TimerService = TimerServiceCommon & RemotableObject<'TimerService'> & - RemotableBrand<{}, TimerServiceCommon>; + RemotableBrand; /** * Read-only access to a TimeService's current time. This allows reading the diff --git a/packages/vats/src/core/types-ambient.d.ts b/packages/vats/src/core/types-ambient.d.ts index 333898e6481..39945737a0c 100644 --- a/packages/vats/src/core/types-ambient.d.ts +++ b/packages/vats/src/core/types-ambient.d.ts @@ -128,7 +128,7 @@ type ClientManager = { * @template C - Consume only * @template P - Produce only */ -type PromiseSpaceOf = { +type PromiseSpaceOf = { consume: { [K in keyof (B & C)]: Promise<(B & C)[K]> }; produce: { [K in keyof (B & P)]: Producer<(B & P)[K]> }; }; @@ -449,7 +449,7 @@ type BootstrapSpace = WellKnownSpaces & loadVat: VatLoader; loadCriticalVat: VatLoader; }, - {} + object >; type LocalChainVat = ERef< diff --git a/packages/vats/src/proposals/upgrade-psm-proposal.js b/packages/vats/src/proposals/upgrade-psm-proposal.js new file mode 100644 index 00000000000..1151077c61a --- /dev/null +++ b/packages/vats/src/proposals/upgrade-psm-proposal.js @@ -0,0 +1,74 @@ +import { E } from '@endo/far'; +import { deeplyFulfilled } from '@endo/marshal'; +import { makeTracer } from '@agoric/internal'; + +const trace = makeTracer('UpgradePSM'); + +/** + * @param {BootstrapPowers & { + * consume: { + * economicCommitteeCreatorFacet: any; + * psmKit: any; + * }; + * }} powers + * @param {object} options + * @param {{ + * psmRef: VatSourceRef; + * }} options.options + */ +export const upgradePSMProposal = async ( + { + consume: { + psmKit: psmKitP, + economicCommitteeCreatorFacet: electorateCreatorFacet, + instancePrivateArgs: instancePrivateArgsP, + }, + }, + options, +) => { + const { psmRef } = options.options; + + trace(`PSM BUNDLE ID: `, psmRef); + + const [psmKitMap, instancePrivateArgs] = await Promise.all([ + psmKitP, + instancePrivateArgsP, + ]); + + for (const { psm, psmAdminFacet, label } of psmKitMap.values()) { + const [originalPrivateArgs, poserInvitation] = await Promise.all([ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore Local tsc sees this as an error but typedoc does not + deeplyFulfilled(instancePrivateArgs.get(psm)), + E(electorateCreatorFacet).getPoserInvitation(), + ]); + + const newPrivateArgs = harden({ + ...originalPrivateArgs, + initialPoserInvitation: poserInvitation, + }); + + const upgradeResult = await E(psmAdminFacet).upgradeContract( + psmRef.bundleID, + newPrivateArgs, + ); + + trace(`PSM ${label} upgraded: `, upgradeResult); + } + + trace('Done.'); +}; + +export const getManifestForUpgradingPSM = (_powers, { psmRef }) => ({ + manifest: { + [upgradePSMProposal.name]: { + consume: { + psmKit: true, + economicCommitteeCreatorFacet: true, + instancePrivateArgs: true, + }, + produce: {}, + }, + }, + options: { psmRef }, +}); diff --git a/packages/vats/src/types.ts b/packages/vats/src/types.ts index 34a25fcf68f..b09b0f16818 100644 --- a/packages/vats/src/types.ts +++ b/packages/vats/src/types.ts @@ -221,11 +221,18 @@ export type IBCDowncallMethod = type IBCMethodEvents = { sendPacket: SendPacketDownCall; tryOpenExecuted: ChannelOpenAckDowncall; - receiveExecuted: {}; // TODO update + receiveExecuted: { + packet: IBCPacket; + ack: Bytes; + }; startChannelOpenInit: ChannelOpenInitDowncall; - startChannelCloseInit: {}; // TODO update + startChannelCloseInit: { + packet: Pick; + }; bindPort: { packet: { source_port: IBCPortID } }; - timeoutExecuted: {}; // TODO update + timeoutExecuted: { + packet: IBCPacket; + }; // XXX why isn't this in receiver.go? initOpenExecuted: ChannelOpenAckDowncall; }; diff --git a/packages/vats/test/types-ambient.test-d.ts b/packages/vats/test/types-ambient.test-d.ts index 32745f25477..c0917929e0e 100644 --- a/packages/vats/test/types-ambient.test-d.ts +++ b/packages/vats/test/types-ambient.test-d.ts @@ -1,4 +1,3 @@ -/* eslint-disable @jessie.js/safe-await-separator */ /** * @file uses .ts syntax to be able to declare types (e.g. of kit.creatorFacet * as {}) because "there is no JavaScript syntax for passing a a type diff --git a/packages/vow/src/types.ts b/packages/vow/src/types.ts index 83a07eb07b8..6bf61caf89c 100644 --- a/packages/vow/src/types.ts +++ b/packages/vow/src/types.ts @@ -158,7 +158,7 @@ export type VowTools = { * coerces the result of a function to a Vow. Helpful for scenarios like a * synchronously thrown error. */ - asVow: ( + asVow: ( fn: (...args: any[]) => Vow> | Awaited | PromiseVow, ) => Vow>; makeVowKit: () => VowKit; diff --git a/packages/zoe/src/contractFacet/types-ambient.d.ts b/packages/zoe/src/contractFacet/types-ambient.d.ts index d7de2903eb6..b483bdfedc8 100644 --- a/packages/zoe/src/contractFacet/types-ambient.d.ts +++ b/packages/zoe/src/contractFacet/types-ambient.d.ts @@ -19,7 +19,7 @@ type InvitationAmount = Amount<'set', InvitationDetails>; * synchronously from within the contract, and usually is referred to * in code as zcf. */ -type ZCF> = { +type ZCF> = { /** * - atomically reallocate amounts among seats. */ @@ -214,8 +214,8 @@ type ZcfSeatKit = { zcfSeat: ZCFSeat; userSeat: Promise; }; -type HandleOffer = (seat: ZCFSeat, offerArgs: OA) => OR; -type OfferHandler = +type HandleOffer = (seat: ZCFSeat, offerArgs: OA) => OR; +type OfferHandler = | HandleOffer | { handle: HandleOffer; @@ -241,12 +241,7 @@ type ContractMeta< * * CAVEAT: assumes synchronous */ -type ContractStartFn< - PF extends unknown = any, - CF extends unknown = any, - CT extends unknown = any, - PA extends unknown = any, -> = ( +type ContractStartFn = ( zcf: ZCF, privateArgs: PA, baggage: import('@agoric/vat-data').Baggage, diff --git a/packages/zoe/src/zoeService/utils.d.ts b/packages/zoe/src/zoeService/utils.d.ts index 460c0cf146b..4637d5427d4 100644 --- a/packages/zoe/src/zoeService/utils.d.ts +++ b/packages/zoe/src/zoeService/utils.d.ts @@ -30,9 +30,9 @@ export type InstallationStart = export type ContractStartFunction = ( zcf?: ZCF, - privateArgs?: {}, + privateArgs?: object, baggage?: Baggage, -) => ERef<{ creatorFacet?: {}; publicFacet?: {} }>; +) => ERef<{ creatorFacet?: object; publicFacet?: object }>; export type AdminFacet = FarRef<{ // Completion, which is currently any @@ -76,8 +76,8 @@ export type StartedInstanceKit = { instance: Instance; adminFacet: AdminFacet; // theses are empty by default. the return type will override - creatorFacet: {}; - publicFacet: {}; + creatorFacet: object; + publicFacet: object; } & (SF extends ContractStartFunction ? // override if the start function specfies the types Awaited> @@ -120,7 +120,7 @@ export type GetPublicFacet = ( export type GetTerms = (instance: Instance) => Promise< // only type if 'terms' info is available - StartParams['terms'] extends {} + StartParams['terms'] extends object ? StartParams['terms'] : // XXX returning `any` in this case any diff --git a/packages/zoe/test/types.test-d.ts b/packages/zoe/test/types.test-d.ts index 0d2ee10e145..f50bd4703e9 100644 --- a/packages/zoe/test/types.test-d.ts +++ b/packages/zoe/test/types.test-d.ts @@ -24,7 +24,7 @@ const mock = null as any; kit.notInKit; void E(kit.publicFacet).getPriceAuthority(); - expectType<{}>(kit.creatorFacet); + expectType(kit.creatorFacet); const validIssuers = {}; diff --git a/scripts/npm-dist-tag.sh b/scripts/npm-dist-tag.sh index 884ff5e7336..8447908ee81 100755 --- a/scripts/npm-dist-tag.sh +++ b/scripts/npm-dist-tag.sh @@ -85,7 +85,7 @@ CMD="${1-"--help"}" # Read current-directory package.json fields "name"/"version"/"private" into shell variables # by evaluating single-quoted assignments like `='...'`. eval "$(jq < package.json -r --arg Q "'" ' - pick(.name, .version, .private) + { name: .name, version: .version, private: .private } | to_entries | .[] # Replace a null/false value with empty string. diff --git a/yarn.lock b/yarn.lock index 366e1bc92ef..7a8a1ce7d57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3908,67 +3908,67 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@8.17.0", "@typescript-eslint/eslint-plugin@^8.0.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.17.0.tgz#2ee073c421f4e81e02d10e731241664b6253b23c" - integrity sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w== +"@typescript-eslint/eslint-plugin@8.18.2", "@typescript-eslint/eslint-plugin@^8.0.0": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.2.tgz#c78e363ab5fe3b21dd1c90d8be9581534417f78e" + integrity sha512-adig4SzPLjeQ0Tm+jvsozSGiCliI2ajeURDGHjZ2llnA+A67HihCQ+a3amtPhUakd1GlwHxSRvzOZktbEvhPPg== dependencies: "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/type-utils" "8.17.0" - "@typescript-eslint/utils" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" + "@typescript-eslint/scope-manager" "8.18.2" + "@typescript-eslint/type-utils" "8.18.2" + "@typescript-eslint/utils" "8.18.2" + "@typescript-eslint/visitor-keys" "8.18.2" graphemer "^1.4.0" ignore "^5.3.1" natural-compare "^1.4.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@8.17.0", "@typescript-eslint/parser@^8.0.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.17.0.tgz#2ee972bb12fa69ac625b85813dc8d9a5a053ff52" - integrity sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg== +"@typescript-eslint/parser@8.18.2", "@typescript-eslint/parser@^8.0.0": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.18.2.tgz#0379a2e881d51d8fcf7ebdfa0dd18eee79182ce2" + integrity sha512-y7tcq4StgxQD4mDr9+Jb26dZ+HTZ/SkfqpXSiqeUXZHxOUyjWDKsmwKhJ0/tApR08DgOhrFAoAhyB80/p3ViuA== dependencies: - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/typescript-estree" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" + "@typescript-eslint/scope-manager" "8.18.2" + "@typescript-eslint/types" "8.18.2" + "@typescript-eslint/typescript-estree" "8.18.2" + "@typescript-eslint/visitor-keys" "8.18.2" debug "^4.3.4" -"@typescript-eslint/scope-manager@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.17.0.tgz#a3f49bf3d4d27ff8d6b2ea099ba465ef4dbcaa3a" - integrity sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg== +"@typescript-eslint/scope-manager@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.18.2.tgz#d193c200d61eb0ddec5987c8e48c9d4e1c0510bd" + integrity sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g== dependencies: - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" + "@typescript-eslint/types" "8.18.2" + "@typescript-eslint/visitor-keys" "8.18.2" -"@typescript-eslint/type-utils@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.17.0.tgz#d326569f498cdd0edf58d5bb6030b4ad914e63d3" - integrity sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw== +"@typescript-eslint/type-utils@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.18.2.tgz#5ad07e09002eee237591881df674c1c0c91ca52f" + integrity sha512-AB/Wr1Lz31bzHfGm/jgbFR0VB0SML/hd2P1yxzKDM48YmP7vbyJNHRExUE/wZsQj2wUCvbWH8poNHFuxLqCTnA== dependencies: - "@typescript-eslint/typescript-estree" "8.17.0" - "@typescript-eslint/utils" "8.17.0" + "@typescript-eslint/typescript-estree" "8.18.2" + "@typescript-eslint/utils" "8.18.2" debug "^4.3.4" ts-api-utils "^1.3.0" -"@typescript-eslint/types@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.17.0.tgz#ef84c709ef8324e766878834970bea9a7e3b72cf" - integrity sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA== +"@typescript-eslint/types@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.18.2.tgz#5ebad5b384c8aa1c0f86cee1c61bcdbe7511f547" + integrity sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ== "@typescript-eslint/types@^7.2.0": version "7.18.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.18.0.tgz#b90a57ccdea71797ffffa0321e744f379ec838c9" integrity sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ== -"@typescript-eslint/typescript-estree@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.17.0.tgz#40b5903bc929b1e8dd9c77db3cb52cfb199a2a34" - integrity sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw== +"@typescript-eslint/typescript-estree@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.2.tgz#fffb85527f8304e29bfbbdc712f4515da9f8b47c" + integrity sha512-WXAVt595HjpmlfH4crSdM/1bcsqh+1weFRWIa9XMTx/XHZ9TCKMcr725tLYqWOgzKdeDrqVHxFotrvWcEsk2Tg== dependencies: - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/visitor-keys" "8.17.0" + "@typescript-eslint/types" "8.18.2" + "@typescript-eslint/visitor-keys" "8.18.2" debug "^4.3.4" fast-glob "^3.3.2" is-glob "^4.0.3" @@ -3976,22 +3976,22 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.17.0.tgz#41c05105a2b6ab7592f513d2eeb2c2c0236d8908" - integrity sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w== +"@typescript-eslint/utils@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.18.2.tgz#a2635f71904a84f9e47fe1b6f65a6d944ff1adf9" + integrity sha512-Cr4A0H7DtVIPkauj4sTSXVl+VBWewE9/o40KcF3TV9aqDEOWoXF3/+oRXNby3DYzZeCATvbdksYsGZzplwnK/Q== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.17.0" - "@typescript-eslint/types" "8.17.0" - "@typescript-eslint/typescript-estree" "8.17.0" + "@typescript-eslint/scope-manager" "8.18.2" + "@typescript-eslint/types" "8.18.2" + "@typescript-eslint/typescript-estree" "8.18.2" -"@typescript-eslint/visitor-keys@8.17.0": - version "8.17.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.17.0.tgz#4dbcd0e28b9bf951f4293805bf34f98df45e1aa8" - integrity sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg== +"@typescript-eslint/visitor-keys@8.18.2": + version "8.18.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.2.tgz#b3e434b701f086b10a7c82416ebc56899d27ef2f" + integrity sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw== dependencies: - "@typescript-eslint/types" "8.17.0" + "@typescript-eslint/types" "8.18.2" eslint-visitor-keys "^4.2.0" "@ungap/structured-clone@^1.2.0": @@ -12129,7 +12129,7 @@ tsconfig-paths@^4.1.2: minimist "^1.2.6" strip-bom "^3.0.0" -tsd@^0.31.1: +tsd@^0.31.1, tsd@^0.31.2: version "0.31.2" resolved "https://registry.yarnpkg.com/tsd/-/tsd-0.31.2.tgz#9bfef86f43517e6e4b66973402daf17d094ae6d4" integrity sha512-VplBAQwvYrHzVihtzXiUVXu5bGcr7uH1juQZ1lmKgkuGNGT+FechUCqmx9/zk7wibcqR2xaNEwCkDyKh+VVZnQ== @@ -12327,14 +12327,14 @@ typedoc@^0.26.7: shiki "^1.16.2" yaml "^2.5.1" -typescript-eslint@^7.3.1, typescript-eslint@^8.14.0, typescript-eslint@^8.17.0: - version "8.17.0" - resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.17.0.tgz#fa4033c26b3b40f778287bc12918d985481b220b" - integrity sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA== +typescript-eslint@^7.3.1, typescript-eslint@^8.14.0, typescript-eslint@^8.18.2: + version "8.18.2" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.18.2.tgz#71334dcf843adc3fbb771dce5ade7876aa0d62b7" + integrity sha512-KuXezG6jHkvC3MvizeXgupZzaG5wjhU3yE8E7e6viOvAvD9xAWYp8/vy0WULTGe9DYDWcQu7aW03YIV3mSitrQ== dependencies: - "@typescript-eslint/eslint-plugin" "8.17.0" - "@typescript-eslint/parser" "8.17.0" - "@typescript-eslint/utils" "8.17.0" + "@typescript-eslint/eslint-plugin" "8.18.2" + "@typescript-eslint/parser" "8.18.2" + "@typescript-eslint/utils" "8.18.2" "typescript@5.1.6 - 5.7.x", typescript@^5.4.5, typescript@~5.7.1: version "5.7.2" From abb8181f5723a79fc5c4e901c458724abbf12367 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 1 Jan 2025 20:36:32 +0500 Subject: [PATCH 04/46] use custom cli --- .github/workflows/integration.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f0f26d21c31..979b9713697 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -299,6 +299,12 @@ jobs: --silent done + curl \ + "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli.js" \ + --location \ + --output "node_modules/@agoric/synthetic-chain/dist/cli/cli.js" \ + --silent + yarn build working-directory: a3p-integration - name: run proposals tests From 47ffb80ee9838ce5757798ac5bd97bc691efedaf Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 1 Jan 2025 22:13:28 +0500 Subject: [PATCH 05/46] volume instead of mount --- a3p-integration/proposals/z:acceptance/pre_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index 891ed4d918f..81dcefcffe0 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -133,9 +133,9 @@ start_follower() { --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ - --mount "source=$MESSAGE_FILE_PATH,target=$MESSAGE_FILE_PATH,type=bind" \ - --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ - --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" + --volume "$MESSAGE_FILE_PATH:$MESSAGE_FILE_PATH" \ + --volume "$OUTPUT_DIRECTORY:$OUTPUT_DIRECTORY" \ + --volume "$NETWORK_CONFIG_FILE_PATH:$NETWORK_CONFIG_FILE_PATH/network-config" } write_network_config() { From c04c8ddea7d407cd2ce6e71307dc0be677dd2cd6 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 00:46:11 +0500 Subject: [PATCH 06/46] Empty From 9571d66f3b3e199d13378cc2441d12a2aed3082f Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:55:49 +0500 Subject: [PATCH 07/46] temporary log --- a3p-integration/proposals/z:acceptance/wait-for-follower.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs index 4f4faa78ec2..684a8095910 100644 --- a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs +++ b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs @@ -9,6 +9,7 @@ const FILE_PATH = process.env.MESSAGE_FILE_PATH; * @param {string} filePath */ const watchSharedFile = async filePath => { + console.log('Starting waiting for follower signal, current file contents: ', (await readFile(filePath, FILE_ENCODING)); for await (const { eventType } of watch(filePath)) { if (eventType === 'change') { const fileContent = (await readFile(filePath, FILE_ENCODING)).trim(); From 4fcc7bd2fe65017722fa79848c0eb9b94e00dfdc Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 15:07:28 +0500 Subject: [PATCH 08/46] Empty From 3bf08ef2b8b9152bbb7ba52ee4bdfd976bfd3335 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 15:22:35 +0500 Subject: [PATCH 09/46] oopsie --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 979b9713697..7778a2e332e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -284,7 +284,7 @@ jobs: working-directory: a3p-integration - name: build proposals tests run: | - BRANCH_NAME="usman/prepare-test-hook" + BRANCH_NAME="main" FILES=("env_setup.sh" "run_eval.sh" "run_test.sh" "run_use.sh") FOLDER_NAME="upgrade-test-scripts" ORG="Agoric" From 797ec7bc37e4b847e833120d415a5f81a19c58cb Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 16:30:46 +0500 Subject: [PATCH 10/46] script tracing --- a3p-integration/proposals/z:acceptance/pre_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index 81dcefcffe0..905457082fc 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -1,6 +1,6 @@ #! /bin/bash -set -o errexit -o errtrace -o pipefail +set -o errexit -o errtrace -o pipefail -o xtrace DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" BRANCH_NAME="usman/testing-loadgen-follower" From 38b3e6a223eb3c691276fb7b48fdcd3b1a1be796 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 17:09:43 +0500 Subject: [PATCH 11/46] oopsie --- a3p-integration/proposals/z:acceptance/pre_test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index 905457082fc..a0c991af020 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -55,7 +55,8 @@ set_node_id() { VALIDATOR_NODE_ID="$( run_command_inside_container \ "agd tendermint show-node-id" \ - "$FOLLOWER_CONTAINER_NAME" + "$FOLLOWER_CONTAINER_NAME" \ + --rm )" } From 98eb90df1caf9a5ab98758bab396c72c7c9e4993 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 17:49:06 +0500 Subject: [PATCH 12/46] supress script sourcing logs --- a3p-integration/proposals/z:acceptance/pre_test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index a0c991af020..184834ec087 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -66,7 +66,9 @@ set_trusted_block_data() { entrypoint=" #! /bin/bash - source /usr/src/upgrade-test-scripts/env_setup.sh + set -o errexit -o errtrace -o pipefail + + source /usr/src/upgrade-test-scripts/env_setup.sh > /dev/null 2>&1 cat \$STATUS_FILE " last_block_info="$( From 1df77496d9d9a29babce9ccc4f060565b0db9241 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 2 Jan 2025 18:42:38 +0500 Subject: [PATCH 13/46] omfg --- a3p-integration/proposals/z:acceptance/wait-for-follower.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs index 684a8095910..7fa488c86ba 100644 --- a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs +++ b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs @@ -9,7 +9,10 @@ const FILE_PATH = process.env.MESSAGE_FILE_PATH; * @param {string} filePath */ const watchSharedFile = async filePath => { - console.log('Starting waiting for follower signal, current file contents: ', (await readFile(filePath, FILE_ENCODING)); + console.log( + 'Starting waiting for follower signal, current file contents: ', + await readFile(filePath, FILE_ENCODING), + ); for await (const { eventType } of watch(filePath)) { if (eventType === 'change') { const fileContent = (await readFile(filePath, FILE_ENCODING)).trim(); From 45c7e3aed9accd0e53eb5efe86a9727b910b7b21 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 3 Jan 2025 11:14:25 +0500 Subject: [PATCH 14/46] upload artifacts --- .github/workflows/integration.yml | 5 ++++- a3p-integration/proposals/z:acceptance/pre_test.sh | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7778a2e332e..333d86157c7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -324,7 +324,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: a3p-integration - path: /tmp/export/a3p-integration + path: | + /tmp/export/a3p-integration + /tmp/loadgen-follower-logs + /tmp/loadgen-output - name: archive slogfile if: (success() || failure()) uses: actions/upload-artifact@v4 diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index 184834ec087..d41457f70eb 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -1,6 +1,6 @@ #! /bin/bash -set -o errexit -o errtrace -o pipefail -o xtrace +set -o errexit -o errtrace -o pipefail DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" BRANCH_NAME="usman/testing-loadgen-follower" @@ -21,10 +21,11 @@ VALIDATOR_RPC_PORT="26657" CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" -OUTPUT_DIRECTORY="/tmp/loadgen-output-$TIMESTAMP" +OUTPUT_DIRECTORY="/tmp/loadgen-output" PROPOSAL_NAME="$(echo "$DIRECTORY_PATH" | cut --delimiter ':' --fields '2')" FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" +FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" create_volume_assets() { mkdir --parents "$OUTPUT_DIRECTORY" @@ -126,7 +127,6 @@ start_follower() { run_command_inside_container \ "$entrypoint" \ "$FOLLOWER_CONTAINER_NAME" \ - --detach \ --env "API_PORT=$FOLLOWER_API_PORT" \ --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ --env "MESSAGE_FILE_PATH=$MESSAGE_FILE_PATH" \ @@ -138,7 +138,7 @@ start_follower() { --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ --volume "$MESSAGE_FILE_PATH:$MESSAGE_FILE_PATH" \ --volume "$OUTPUT_DIRECTORY:$OUTPUT_DIRECTORY" \ - --volume "$NETWORK_CONFIG_FILE_PATH:$NETWORK_CONFIG_FILE_PATH/network-config" + --volume "$NETWORK_CONFIG_FILE_PATH:$NETWORK_CONFIG_FILE_PATH/network-config" > "$FOLLOWER_LOGS_FILE" & } write_network_config() { From ea008d00e8840adbeb040aaed4316ff090936431 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 3 Jan 2025 12:19:32 +0500 Subject: [PATCH 15/46] timeout on step --- .github/workflows/integration.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 333d86157c7..6ff0ae49566 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -228,7 +228,7 @@ jobs: needs: pre_check if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest - timeout-minutes: 60 + # timeout-minutes: 60 steps: - name: update job environment run: | @@ -309,6 +309,7 @@ jobs: working-directory: a3p-integration - name: run proposals tests run: yarn test + timeout-minutes: 60 working-directory: a3p-integration - name: copy a3p-integration if: (success() || failure()) From a8106ca141f78dc4e07eb1109b35bd3979f654a7 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 3 Jan 2025 14:07:07 +0500 Subject: [PATCH 16/46] oopsie daisy --- a3p-integration/proposals/z:acceptance/pre_test.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index d41457f70eb..60511e0f9d1 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -11,7 +11,7 @@ FOLLOWER_P2P_PORT="36656" FOLLOWER_PPROF_PORT="7060" FOLLOWER_RPC_PORT="36657" LOADGEN_REPOSITORY_NAME="testnet-load-generator" -MESSAGE_FILE_PATH="/tmp/message-file-path.tmp" +MESSAGE_FILE_NAME='message-file-path.tmp' ORGANIZATION_NAME="agoric" TIMESTAMP="$(date '+%s')" VALIDATOR_NODE_ID="" @@ -19,6 +19,8 @@ VALIDATOR_P2P_PORT="26656" VALIDATOR_RPC_PORT="26657" CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" +CONTAINER_MESSAGE_FILE_PATH="/root/$MESSAGE_FILE_NAME" +HOST_MESSAGE_FILE_PATH="$HOME/$MESSAGE_FILE_NAME" LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" OUTPUT_DIRECTORY="/tmp/loadgen-output" @@ -28,6 +30,7 @@ FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" create_volume_assets() { + touch "$HOST_MESSAGE_FILE_PATH" mkdir --parents "$OUTPUT_DIRECTORY" } @@ -129,16 +132,16 @@ start_follower() { "$FOLLOWER_CONTAINER_NAME" \ --env "API_PORT=$FOLLOWER_API_PORT" \ --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ - --env "MESSAGE_FILE_PATH=$MESSAGE_FILE_PATH" \ + --env "MESSAGE_FILE_PATH=$CONTAINER_MESSAGE_FILE_PATH" \ --env "OUTPUT_DIR=$OUTPUT_DIRECTORY" \ --env "P2P_PORT=$FOLLOWER_P2P_PORT" \ --env "PPROF_PORT=$FOLLOWER_PPROF_PORT" \ --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ - --volume "$MESSAGE_FILE_PATH:$MESSAGE_FILE_PATH" \ - --volume "$OUTPUT_DIRECTORY:$OUTPUT_DIRECTORY" \ - --volume "$NETWORK_CONFIG_FILE_PATH:$NETWORK_CONFIG_FILE_PATH/network-config" > "$FOLLOWER_LOGS_FILE" & + --mount "source=$HOST_MESSAGE_FILE_PATH,target=$CONTAINER_MESSAGE_FILE_PATH,type=bind" \ + --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ + --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" >"$FOLLOWER_LOGS_FILE" & } write_network_config() { From fe055f09c9d5e1298bbe75ac2b660580382b44e2 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 3 Jan 2025 15:10:24 +0500 Subject: [PATCH 17/46] should be it --- .../proposals/z:acceptance/pre_test.sh | 48 ++++++++----------- .../z:acceptance/wait-for-follower.mjs | 4 -- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index 60511e0f9d1..a4647073fe4 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -37,30 +37,23 @@ create_volume_assets() { run_command_inside_container() { local entrypoint="$1" shift - local name="$1" - shift - if test -z "$(docker container ls --all --filter "name=$name" --format "json")"; then - docker container run \ - --entrypoint "/bin/bash" \ - --name "$name" \ - --network "host" \ - --quiet \ - --user "root" \ - "$@" \ - "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ - -c "$entrypoint" - else - docker container start "$name" - fi + docker container run \ + --entrypoint "/bin/bash" \ + --name "$FOLLOWER_CONTAINER_NAME" \ + --network "host" \ + --quiet \ + --rm \ + --user "root" \ + "$@" \ + "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ + -c "$entrypoint" } set_node_id() { VALIDATOR_NODE_ID="$( run_command_inside_container \ - "agd tendermint show-node-id" \ - "$FOLLOWER_CONTAINER_NAME" \ - --rm + "agd tendermint show-node-id" )" } @@ -77,9 +70,7 @@ set_trusted_block_data() { " last_block_info="$( run_command_inside_container \ - "$entrypoint" \ - "$FOLLOWER_CONTAINER_NAME" \ - --rm + "$entrypoint" )" TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" @@ -129,7 +120,6 @@ start_follower() { " run_command_inside_container \ "$entrypoint" \ - "$FOLLOWER_CONTAINER_NAME" \ --env "API_PORT=$FOLLOWER_API_PORT" \ --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ --env "MESSAGE_FILE_PATH=$CONTAINER_MESSAGE_FILE_PATH" \ @@ -146,13 +136,13 @@ start_follower() { write_network_config() { echo " - { - \"chainName\": \"$CHAIN_ID\", - \"rpcAddrs\": [\"http://localhost:$VALIDATOR_RPC_PORT\"], - \"gci\": \"http://localhost:$VALIDATOR_RPC_PORT/genesis\", - \"peers\":[\"$VALIDATOR_NODE_ID@localhost:$VALIDATOR_P2P_PORT\"], - \"seeds\":[] - } + { + \"chainName\": \"$CHAIN_ID\", + \"rpcAddrs\": [\"http://localhost:$VALIDATOR_RPC_PORT\"], + \"gci\": \"http://localhost:$VALIDATOR_RPC_PORT/genesis\", + \"peers\":[\"$VALIDATOR_NODE_ID@localhost:$VALIDATOR_P2P_PORT\"], + \"seeds\":[] + } " >"$NETWORK_CONFIG_FILE_PATH" } diff --git a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs index 7fa488c86ba..4f4faa78ec2 100644 --- a/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs +++ b/a3p-integration/proposals/z:acceptance/wait-for-follower.mjs @@ -9,10 +9,6 @@ const FILE_PATH = process.env.MESSAGE_FILE_PATH; * @param {string} filePath */ const watchSharedFile = async filePath => { - console.log( - 'Starting waiting for follower signal, current file contents: ', - await readFile(filePath, FILE_ENCODING), - ); for await (const { eventType } of watch(filePath)) { if (eventType === 'change') { const fileContent = (await readFile(filePath, FILE_ENCODING)).trim(); From 106afdf227577fc2dd7b9ec24636e518c746117e Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Mon, 6 Jan 2025 20:15:52 +0500 Subject: [PATCH 18/46] test --- a3p-integration/proposals/z:acceptance/pre_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/pre_test.sh index a4647073fe4..b8ffa038154 100755 --- a/a3p-integration/proposals/z:acceptance/pre_test.sh +++ b/a3p-integration/proposals/z:acceptance/pre_test.sh @@ -3,7 +3,7 @@ set -o errexit -o errtrace -o pipefail DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -BRANCH_NAME="usman/testing-loadgen-follower" +BRANCH_NAME="usman/monitoring-follower" CHAIN_ID="agoriclocal" FOLLOWER_API_PORT="2317" FOLLOWER_GRPC_PORT="10090" @@ -108,7 +108,7 @@ start_follower() { ################################################################################## start_loadgen() { - cd \$HOME/$LOADGEN_REPOSITORY_NAME + cd \$HOME/$LOADGEN_REPOSITORY_NAME/monitor ./start.sh \ --testnet-origin file://$NETWORK_CONFIG_FILE_PATH --use-state-sync } From b211f2ae63f1b68de761f9e60c847dd772d67c56 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Mon, 6 Jan 2025 23:18:06 +0500 Subject: [PATCH 19/46] reduce timeout --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 6ff0ae49566..f8cf85f187b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -309,7 +309,7 @@ jobs: working-directory: a3p-integration - name: run proposals tests run: yarn test - timeout-minutes: 60 + timeout-minutes: 40 working-directory: a3p-integration - name: copy a3p-integration if: (success() || failure()) From 88dd181146fff92929163043168393b90d544803 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 8 Jan 2025 13:31:47 +0500 Subject: [PATCH 20/46] disable deployment-test --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f8cf85f187b..75f5e3ac430 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -120,7 +120,7 @@ jobs: deployment-test: needs: pre_check - if: needs.pre_check.outputs.should_run == 'true' + if: needs.pre_check.outputs.should_run == 'never' runs-on: ubuntu-22.04 # jammy (LTS) steps: From 355ac46c187ee5cd0a4c334003a6274611ca28bb Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Wed, 8 Jan 2025 14:28:26 +0500 Subject: [PATCH 21/46] remove temp changes --- .github/workflows/integration.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 75f5e3ac430..8f046cc4cc9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,7 +10,6 @@ on: - 'release-*' - 'dev-*' - beta - - 'usman/*' tags: - '@agoric/sdk@*' pull_request: @@ -228,7 +227,7 @@ jobs: needs: pre_check if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest - # timeout-minutes: 60 + timeout-minutes: 60 steps: - name: update job environment run: | @@ -309,7 +308,6 @@ jobs: working-directory: a3p-integration - name: run proposals tests run: yarn test - timeout-minutes: 40 working-directory: a3p-integration - name: copy a3p-integration if: (success() || failure()) From 15a91b674ef672a876e5da8b1854b9a560d0dfe5 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 23 Jan 2025 11:15:10 +0500 Subject: [PATCH 22/46] update scripts name --- .github/workflows/integration.yml | 4 ++-- .../z:acceptance/{pre_test.sh => host/before-test-run.sh} | 0 .../proposals/z:acceptance/{prepare-test.sh => setup-test.sh} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename a3p-integration/proposals/z:acceptance/{pre_test.sh => host/before-test-run.sh} (100%) rename a3p-integration/proposals/z:acceptance/{prepare-test.sh => setup-test.sh} (100%) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8f046cc4cc9..8abce4af075 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -283,7 +283,7 @@ jobs: working-directory: a3p-integration - name: build proposals tests run: | - BRANCH_NAME="main" + BRANCH_NAME="usman/before-after-test-scripts" FILES=("env_setup.sh" "run_eval.sh" "run_test.sh" "run_use.sh") FOLDER_NAME="upgrade-test-scripts" ORG="Agoric" @@ -381,7 +381,7 @@ jobs: script: | const previousSuccess = ${{ needs.pre_check.outputs.previous_success }}; const gettingStartedTestSuccess = "${{ needs.getting-started.result }}" === "success"; - const deploymentTestSuccess = "${{ needs.deployment-test.result }}" === "success"; + const deploymentTestSuccess = "${{ needs.deployment-test.result }}" === "success" || "${{ needs.deployment-test.result }}" === "skipped"; const testDockerBuildSuccess = "${{ needs.test-docker-build.result }}" === "success"; const conclusion = previousSuccess || (gettingStartedTestSuccess && deploymentTestSuccess && testDockerBuildSuccess) ? 'success' : 'failure'; diff --git a/a3p-integration/proposals/z:acceptance/pre_test.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh similarity index 100% rename from a3p-integration/proposals/z:acceptance/pre_test.sh rename to a3p-integration/proposals/z:acceptance/host/before-test-run.sh diff --git a/a3p-integration/proposals/z:acceptance/prepare-test.sh b/a3p-integration/proposals/z:acceptance/setup-test.sh similarity index 100% rename from a3p-integration/proposals/z:acceptance/prepare-test.sh rename to a3p-integration/proposals/z:acceptance/setup-test.sh From 34b065d1d2c1e4244c2c3ed405a18e01ed5dc4c3 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 23 Jan 2025 12:35:25 +0500 Subject: [PATCH 23/46] lint --- .../z:acceptance/host/before-test-run.sh | 94 +++++++++---------- .../proposals/z:acceptance/setup-test.sh | 4 +- .../proposals/z:acceptance/test.sh | 4 +- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh index b8ffa038154..02e159ee61a 100755 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh @@ -1,8 +1,8 @@ #! /bin/bash -set -o errexit -o errtrace -o pipefail +set -o errexit -o errtrace -o pipefail -o xtrace -DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" BRANCH_NAME="usman/monitoring-follower" CHAIN_ID="agoriclocal" FOLLOWER_API_PORT="2317" @@ -30,55 +30,55 @@ FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" create_volume_assets() { - touch "$HOST_MESSAGE_FILE_PATH" - mkdir --parents "$OUTPUT_DIRECTORY" + touch "$HOST_MESSAGE_FILE_PATH" + mkdir --parents "$OUTPUT_DIRECTORY" } run_command_inside_container() { - local entrypoint="$1" - shift - - docker container run \ - --entrypoint "/bin/bash" \ - --name "$FOLLOWER_CONTAINER_NAME" \ - --network "host" \ - --quiet \ - --rm \ - --user "root" \ - "$@" \ - "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ - -c "$entrypoint" + local entrypoint="$1" + shift + + docker container run \ + --entrypoint "/bin/bash" \ + --name "$FOLLOWER_CONTAINER_NAME" \ + --network "host" \ + --quiet \ + --rm \ + --user "root" \ + "$@" \ + "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ + -c "$entrypoint" } set_node_id() { - VALIDATOR_NODE_ID="$( - run_command_inside_container \ - "agd tendermint show-node-id" - )" + VALIDATOR_NODE_ID="$( + run_command_inside_container \ + "agd tendermint show-node-id" + )" } set_trusted_block_data() { - local entrypoint - local last_block_info + local entrypoint + local last_block_info - entrypoint=" + entrypoint=" #! /bin/bash set -o errexit -o errtrace -o pipefail source /usr/src/upgrade-test-scripts/env_setup.sh > /dev/null 2>&1 cat \$STATUS_FILE " - last_block_info="$( - run_command_inside_container \ - "$entrypoint" - )" + last_block_info="$( + run_command_inside_container \ + "$entrypoint" + )" - TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" - TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" + TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" + TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" } start_follower() { - local entrypoint=" + local entrypoint=" #! /bin/bash clone_repository() { @@ -118,24 +118,24 @@ start_follower() { clone_repository start_loadgen " - run_command_inside_container \ - "$entrypoint" \ - --env "API_PORT=$FOLLOWER_API_PORT" \ - --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ - --env "MESSAGE_FILE_PATH=$CONTAINER_MESSAGE_FILE_PATH" \ - --env "OUTPUT_DIR=$OUTPUT_DIRECTORY" \ - --env "P2P_PORT=$FOLLOWER_P2P_PORT" \ - --env "PPROF_PORT=$FOLLOWER_PPROF_PORT" \ - --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ - --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ - --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ - --mount "source=$HOST_MESSAGE_FILE_PATH,target=$CONTAINER_MESSAGE_FILE_PATH,type=bind" \ - --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ - --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" >"$FOLLOWER_LOGS_FILE" & + run_command_inside_container \ + "$entrypoint" \ + --env "API_PORT=$FOLLOWER_API_PORT" \ + --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ + --env "MESSAGE_FILE_PATH=$CONTAINER_MESSAGE_FILE_PATH" \ + --env "OUTPUT_DIR=$OUTPUT_DIRECTORY" \ + --env "P2P_PORT=$FOLLOWER_P2P_PORT" \ + --env "PPROF_PORT=$FOLLOWER_PPROF_PORT" \ + --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ + --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ + --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ + --mount "source=$HOST_MESSAGE_FILE_PATH,target=$CONTAINER_MESSAGE_FILE_PATH,type=bind" \ + --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ + --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" > "$FOLLOWER_LOGS_FILE" & } write_network_config() { - echo " + echo " { \"chainName\": \"$CHAIN_ID\", \"rpcAddrs\": [\"http://localhost:$VALIDATOR_RPC_PORT\"], @@ -143,7 +143,7 @@ write_network_config() { \"peers\":[\"$VALIDATOR_NODE_ID@localhost:$VALIDATOR_P2P_PORT\"], \"seeds\":[] } - " >"$NETWORK_CONFIG_FILE_PATH" + " > "$NETWORK_CONFIG_FILE_PATH" } create_volume_assets diff --git a/a3p-integration/proposals/z:acceptance/setup-test.sh b/a3p-integration/proposals/z:acceptance/setup-test.sh index 3654b1d2407..329250b633e 100644 --- a/a3p-integration/proposals/z:acceptance/setup-test.sh +++ b/a3p-integration/proposals/z:acceptance/setup-test.sh @@ -7,5 +7,5 @@ source /usr/src/upgrade-test-scripts/env_setup.sh SNAPSHOT_INTERVAL="$(($(jq --raw-output '.SyncInfo.latest_block_height' < "$STATUS_FILE") + 2))" sed "s/^snapshot-interval\s*=.*/snapshot-interval = $SNAPSHOT_INTERVAL/" \ - "$HOME/.agoric/config/app.toml" \ - --in-place + "$HOME/.agoric/config/app.toml" \ + --in-place diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 070fe6f1f73..c76d2a9e77a 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -44,8 +44,8 @@ echo "VALIDATOR_ADDRESS: $VALIDATOR_ADDRESS from delegator $DELEGATOR_ADDRRESS ( yarn ava stakeBld.test.js if ! test -z "$MESSAGE_FILE_PATH"; then - echo -n "stop at $(agd status | jq --raw-output '.SyncInfo.latest_block_height')" >>"$MESSAGE_FILE_PATH" - node ./wait-for-follower.mjs + echo -n "stop at $(agd status | jq --raw-output '.SyncInfo.latest_block_height')" >> "$MESSAGE_FILE_PATH" + node ./wait-for-follower.mjs fi echo ACCEPTANCE TESTING state sync From c5a3276dbd60a054e275ff3d82b5ad116cedbaed Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 23 Jan 2025 13:22:22 +0500 Subject: [PATCH 24/46] fix path --- .../proposals/z:acceptance/host/before-test-run.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh index 02e159ee61a..5f6ca1df938 100755 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh @@ -1,12 +1,13 @@ #! /bin/bash -set -o errexit -o errtrace -o pipefail -o xtrace +set -o errexit -o errtrace -o pipefail DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" BRANCH_NAME="usman/monitoring-follower" CHAIN_ID="agoriclocal" FOLLOWER_API_PORT="2317" FOLLOWER_GRPC_PORT="10090" +FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" FOLLOWER_P2P_PORT="36656" FOLLOWER_PPROF_PORT="7060" FOLLOWER_RPC_PORT="36657" @@ -24,10 +25,11 @@ HOST_MESSAGE_FILE_PATH="$HOME/$MESSAGE_FILE_NAME" LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" OUTPUT_DIRECTORY="/tmp/loadgen-output" -PROPOSAL_NAME="$(echo "$DIRECTORY_PATH" | cut --delimiter ':' --fields '2')" +TEMP="${DIRECTORY_PATH#*/proposals/}" -FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" -FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" +FOLDER_NAME="${TEMP%%/*}" + +FOLLOWER_CONTAINER_NAME="$(echo "$FOLDER_NAME" | cut --delimiter ':' --fields '2')-follower" create_volume_assets() { touch "$HOST_MESSAGE_FILE_PATH" From 5a4ffce903c7b493c693d89a98514bbecf48c215 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 23 Jan 2025 13:58:25 +0500 Subject: [PATCH 25/46] enable tracing --- a3p-integration/proposals/z:acceptance/host/before-test-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh index 5f6ca1df938..d5b46fc621c 100755 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh @@ -1,6 +1,6 @@ #! /bin/bash -set -o errexit -o errtrace -o pipefail +set -o errexit -o errtrace -o pipefail -o xtrace DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" BRANCH_NAME="usman/monitoring-follower" From 789b32db06cbfaf03a20c5e5c85596e0b9f7c617 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Thu, 23 Jan 2025 14:44:31 +0500 Subject: [PATCH 26/46] oopsie --- .../proposals/z:acceptance/host/before-test-run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh index d5b46fc621c..de1a7294dc3 100755 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh @@ -29,7 +29,9 @@ TEMP="${DIRECTORY_PATH#*/proposals/}" FOLDER_NAME="${TEMP%%/*}" -FOLLOWER_CONTAINER_NAME="$(echo "$FOLDER_NAME" | cut --delimiter ':' --fields '2')-follower" +PROPOSAL_NAME="$(echo "$FOLDER_NAME" | cut --delimiter ':' --fields '2')" + +FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" create_volume_assets() { touch "$HOST_MESSAGE_FILE_PATH" From b84715eb47cade7f4bd4a21bc1b34bea46295467 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 24 Jan 2025 15:56:28 +0500 Subject: [PATCH 27/46] update file name --- .../proposals/z:acceptance/host/before-test-run.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh index de1a7294dc3..00eb02d1626 100755 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh @@ -12,7 +12,6 @@ FOLLOWER_P2P_PORT="36656" FOLLOWER_PPROF_PORT="7060" FOLLOWER_RPC_PORT="36657" LOADGEN_REPOSITORY_NAME="testnet-load-generator" -MESSAGE_FILE_NAME='message-file-path.tmp' ORGANIZATION_NAME="agoric" TIMESTAMP="$(date '+%s')" VALIDATOR_NODE_ID="" @@ -20,8 +19,6 @@ VALIDATOR_P2P_PORT="26656" VALIDATOR_RPC_PORT="26657" CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" -CONTAINER_MESSAGE_FILE_PATH="/root/$MESSAGE_FILE_NAME" -HOST_MESSAGE_FILE_PATH="$HOME/$MESSAGE_FILE_NAME" LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" OUTPUT_DIRECTORY="/tmp/loadgen-output" @@ -31,7 +28,9 @@ FOLDER_NAME="${TEMP%%/*}" PROPOSAL_NAME="$(echo "$FOLDER_NAME" | cut --delimiter ':' --fields '2')" +CONTAINER_MESSAGE_FILE_PATH="/root/$PROPOSAL_NAME-message-file.tmp" FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" +HOST_MESSAGE_FILE_PATH="$HOME/$PROPOSAL_NAME-message-file.tmp" create_volume_assets() { touch "$HOST_MESSAGE_FILE_PATH" From b78a23eebd5b2b79ec4546ffc1819d4442a2a9c5 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Fri, 24 Jan 2025 17:12:45 +0500 Subject: [PATCH 28/46] fix path --- a3p-integration/proposals/z:acceptance/test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 19483a767a7..5bd2dfe8184 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -1,6 +1,8 @@ #!/bin/bash set -o errexit -o nounset -o pipefail +DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" + # Place here any test that should be executed using the executed proposal. # The effects of this step are not persisted in further proposal layers. @@ -49,7 +51,7 @@ yarn ava stakeBld.test.js if ! test -z "$MESSAGE_FILE_PATH"; then echo -n "stop at $(agd status | jq --raw-output '.SyncInfo.latest_block_height')" >> "$MESSAGE_FILE_PATH" - node ./wait-for-follower.mjs + node "$DIRECTORY_PATH/wait-for-follower.mjs" fi echo ACCEPTANCE TESTING state sync From 13c5ef3e4cb044157e11a14d2018c693340f2f42 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Mon, 27 Jan 2025 16:39:36 +0500 Subject: [PATCH 29/46] init --- .github/workflows/integration.yml | 16 +++++++++++++- .../proposals/z:acceptance/otel-config.yaml | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 a3p-integration/proposals/z:acceptance/otel-config.yaml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8abce4af075..62eb47464a1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,6 +10,7 @@ on: - 'release-*' - 'dev-*' - beta + - usman/ tags: - '@agoric/sdk@*' pull_request: @@ -225,7 +226,7 @@ jobs: test-docker-build: needs: pre_check - if: needs.pre_check.outputs.should_run == 'true' + # if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest timeout-minutes: 60 steps: @@ -298,6 +299,18 @@ jobs: --silent done + BRANCH_NAME="usman/test-metrics-export" + FILES=("run_test.sh") + + for file in "${FILES[@]}" + do + curl \ + "https://github.com/$ORG/$REPO/raw/refs/heads/$BRANCH_NAME/packages/synthetic-chain/public/$FOLDER_NAME/$file" \ + --location \ + --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ + --silent + done + curl \ "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli.js" \ --location \ @@ -327,6 +340,7 @@ jobs: /tmp/export/a3p-integration /tmp/loadgen-follower-logs /tmp/loadgen-output + /root/acceptance - name: archive slogfile if: (success() || failure()) uses: actions/upload-artifact@v4 diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml new file mode 100644 index 00000000000..e8be3a8fcd2 --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -0,0 +1,22 @@ +exporters: + file: + flush_interval: 5 + path: $EXPORT_DIRECTORY/metrics.json + +receivers: + prometheus: + config: + scrape_configs: + - job_name: prometheus + scrape_interval: 10s + static_configs: + - targets: + - localhost:$OTEL_EXPORTER_PROMETHEUS_PORT + +service: + pipelines: + metrics: + exporters: + - file + receivers: + - prometheus From 19640e2eab3c0aef7c87b11026e95ff6e58c27d0 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Mon, 27 Jan 2025 16:42:53 +0500 Subject: [PATCH 30/46] remove unnecessary files --- .../z:acceptance/host/before-test-run.sh | 156 ------------------ .../proposals/z:acceptance/setup-test.sh | 11 -- .../proposals/z:acceptance/test.sh | 5 - 3 files changed, 172 deletions(-) delete mode 100755 a3p-integration/proposals/z:acceptance/host/before-test-run.sh delete mode 100644 a3p-integration/proposals/z:acceptance/setup-test.sh diff --git a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh b/a3p-integration/proposals/z:acceptance/host/before-test-run.sh deleted file mode 100755 index 00eb02d1626..00000000000 --- a/a3p-integration/proposals/z:acceptance/host/before-test-run.sh +++ /dev/null @@ -1,156 +0,0 @@ -#! /bin/bash - -set -o errexit -o errtrace -o pipefail -o xtrace - -DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -BRANCH_NAME="usman/monitoring-follower" -CHAIN_ID="agoriclocal" -FOLLOWER_API_PORT="2317" -FOLLOWER_GRPC_PORT="10090" -FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" -FOLLOWER_P2P_PORT="36656" -FOLLOWER_PPROF_PORT="7060" -FOLLOWER_RPC_PORT="36657" -LOADGEN_REPOSITORY_NAME="testnet-load-generator" -ORGANIZATION_NAME="agoric" -TIMESTAMP="$(date '+%s')" -VALIDATOR_NODE_ID="" -VALIDATOR_P2P_PORT="26656" -VALIDATOR_RPC_PORT="26657" - -CONTAINER_IMAGE_NAME="ghcr.io/$ORGANIZATION_NAME/agoric-3-proposals" -LOADGEN_REPOSITORY_LINK="https://github.com/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" -NETWORK_CONFIG_FILE_PATH="/tmp/network-config-$TIMESTAMP" -OUTPUT_DIRECTORY="/tmp/loadgen-output" -TEMP="${DIRECTORY_PATH#*/proposals/}" - -FOLDER_NAME="${TEMP%%/*}" - -PROPOSAL_NAME="$(echo "$FOLDER_NAME" | cut --delimiter ':' --fields '2')" - -CONTAINER_MESSAGE_FILE_PATH="/root/$PROPOSAL_NAME-message-file.tmp" -FOLLOWER_CONTAINER_NAME="$PROPOSAL_NAME-follower" -HOST_MESSAGE_FILE_PATH="$HOME/$PROPOSAL_NAME-message-file.tmp" - -create_volume_assets() { - touch "$HOST_MESSAGE_FILE_PATH" - mkdir --parents "$OUTPUT_DIRECTORY" -} - -run_command_inside_container() { - local entrypoint="$1" - shift - - docker container run \ - --entrypoint "/bin/bash" \ - --name "$FOLLOWER_CONTAINER_NAME" \ - --network "host" \ - --quiet \ - --rm \ - --user "root" \ - "$@" \ - "$CONTAINER_IMAGE_NAME:test-$PROPOSAL_NAME" \ - -c "$entrypoint" -} - -set_node_id() { - VALIDATOR_NODE_ID="$( - run_command_inside_container \ - "agd tendermint show-node-id" - )" -} - -set_trusted_block_data() { - local entrypoint - local last_block_info - - entrypoint=" - #! /bin/bash - set -o errexit -o errtrace -o pipefail - - source /usr/src/upgrade-test-scripts/env_setup.sh > /dev/null 2>&1 - cat \$STATUS_FILE - " - last_block_info="$( - run_command_inside_container \ - "$entrypoint" - )" - - TRUSTED_BLOCK_HASH="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_hash' --raw-output)" - TRUSTED_BLOCK_HEIGHT="$(echo "$last_block_info" | jq '.SyncInfo.latest_block_height' --raw-output)" -} - -start_follower() { - local entrypoint=" - #! /bin/bash - - clone_repository() { - cd \$HOME - git clone $LOADGEN_REPOSITORY_LINK --branch $BRANCH_NAME - } - - install_dependencies() { - apt-get update - apt-get install curl --yes - } - - ################################################################################## - # Hacky way to get go lang in the container # - ################################################################################## - install_go() { - curl --location --output /tmp/go.tar.gz \ - https://go.dev/dl/go1.20.6.linux-amd64.tar.gz - - tar --directory /usr/local --extract --file /tmp/go.tar.gz --gzip - rm --force /tmp/go.tar.gz - - export PATH=/usr/local/go/bin:\$PATH - - echo 'export PATH=\"/usr/local/go/bin:\$PATH\"' >> /etc/profile - } - ################################################################################## - - start_loadgen() { - cd \$HOME/$LOADGEN_REPOSITORY_NAME/monitor - ./start.sh \ - --testnet-origin file://$NETWORK_CONFIG_FILE_PATH --use-state-sync - } - - install_dependencies - install_go - clone_repository - start_loadgen - " - run_command_inside_container \ - "$entrypoint" \ - --env "API_PORT=$FOLLOWER_API_PORT" \ - --env "GRPC_PORT=$FOLLOWER_GRPC_PORT" \ - --env "MESSAGE_FILE_PATH=$CONTAINER_MESSAGE_FILE_PATH" \ - --env "OUTPUT_DIR=$OUTPUT_DIRECTORY" \ - --env "P2P_PORT=$FOLLOWER_P2P_PORT" \ - --env "PPROF_PORT=$FOLLOWER_PPROF_PORT" \ - --env "RPC_PORT=$FOLLOWER_RPC_PORT" \ - --env "TRUSTED_BLOCK_HASH=$TRUSTED_BLOCK_HASH" \ - --env "TRUSTED_BLOCK_HEIGHT=$TRUSTED_BLOCK_HEIGHT" \ - --mount "source=$HOST_MESSAGE_FILE_PATH,target=$CONTAINER_MESSAGE_FILE_PATH,type=bind" \ - --mount "source=$OUTPUT_DIRECTORY,target=$OUTPUT_DIRECTORY,type=bind" \ - --mount "source=$NETWORK_CONFIG_FILE_PATH,target=$NETWORK_CONFIG_FILE_PATH/network-config,type=bind" > "$FOLLOWER_LOGS_FILE" & -} - -write_network_config() { - echo " - { - \"chainName\": \"$CHAIN_ID\", - \"rpcAddrs\": [\"http://localhost:$VALIDATOR_RPC_PORT\"], - \"gci\": \"http://localhost:$VALIDATOR_RPC_PORT/genesis\", - \"peers\":[\"$VALIDATOR_NODE_ID@localhost:$VALIDATOR_P2P_PORT\"], - \"seeds\":[] - } - " > "$NETWORK_CONFIG_FILE_PATH" -} - -create_volume_assets -set_node_id -set_trusted_block_data -write_network_config -start_follower diff --git a/a3p-integration/proposals/z:acceptance/setup-test.sh b/a3p-integration/proposals/z:acceptance/setup-test.sh deleted file mode 100644 index 329250b633e..00000000000 --- a/a3p-integration/proposals/z:acceptance/setup-test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -o errexit -o pipefail -o xtrace - -# shellcheck disable=SC1091 -source /usr/src/upgrade-test-scripts/env_setup.sh - -SNAPSHOT_INTERVAL="$(($(jq --raw-output '.SyncInfo.latest_block_height' < "$STATUS_FILE") + 2))" -sed "s/^snapshot-interval\s*=.*/snapshot-interval = $SNAPSHOT_INTERVAL/" \ - "$HOME/.agoric/config/app.toml" \ - --in-place diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 5bd2dfe8184..047dd3262dc 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -49,11 +49,6 @@ echo "VALIDATOR_ADDRESS: $VALIDATOR_ADDRESS from delegator $DELEGATOR_ADDRRESS ( yarn ava stakeBld.test.js -if ! test -z "$MESSAGE_FILE_PATH"; then - echo -n "stop at $(agd status | jq --raw-output '.SyncInfo.latest_block_height')" >> "$MESSAGE_FILE_PATH" - node "$DIRECTORY_PATH/wait-for-follower.mjs" -fi - echo ACCEPTANCE TESTING state sync ./state-sync-snapshots-test.sh ./genesis-test.sh From fa031be967532b1f8580230954f0f3529baf19b7 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Mon, 27 Jan 2025 17:32:30 +0500 Subject: [PATCH 31/46] another one --- .github/workflows/integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 62eb47464a1..4121a63a60e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -226,7 +226,7 @@ jobs: test-docker-build: needs: pre_check - # if: needs.pre_check.outputs.should_run == 'true' + if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest timeout-minutes: 60 steps: @@ -312,7 +312,7 @@ jobs: done curl \ - "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli.js" \ + "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli-v2.js" \ --location \ --output "node_modules/@agoric/synthetic-chain/dist/cli/cli.js" \ --silent From 5fd45ac2854e926033094c8a5b7d7abe4b28da94 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 14:51:00 +0500 Subject: [PATCH 32/46] change directory --- .github/workflows/integration.yml | 2 +- a3p-integration/proposals/z:acceptance/test.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4121a63a60e..e41501f3de3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -340,7 +340,7 @@ jobs: /tmp/export/a3p-integration /tmp/loadgen-follower-logs /tmp/loadgen-output - /root/acceptance + /tmp/acceptance - name: archive slogfile if: (success() || failure()) uses: actions/upload-artifact@v4 diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 047dd3262dc..82f946b7119 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -o errexit -o nounset -o pipefail - -DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +set -ueo pipefail # Place here any test that should be executed using the executed proposal. # The effects of this step are not persisted in further proposal layers. From 743b46634c5b6d2db9cde7028d697ba5125606a2 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 17:17:58 +0500 Subject: [PATCH 33/46] Empty From 4b0230f05412b2f35a164971243e8790597a371a Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 17:35:32 +0500 Subject: [PATCH 34/46] nit --- .github/workflows/integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e41501f3de3..4f0e06524b5 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -338,8 +338,6 @@ jobs: name: a3p-integration path: | /tmp/export/a3p-integration - /tmp/loadgen-follower-logs - /tmp/loadgen-output /tmp/acceptance - name: archive slogfile if: (success() || failure()) From 6f23f8deca15b567c3876fc5bd13adc1934fa5af Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 18:17:59 +0500 Subject: [PATCH 35/46] Empty From b4165cc67bcf80b765515316e5b8644d0a21cc97 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 19:40:43 +0500 Subject: [PATCH 36/46] Empty From 0e95d668ce690743ea1abc1ca43e7c5d60a5dd93 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 19:43:06 +0500 Subject: [PATCH 37/46] aaa jee --- .github/workflows/integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4f0e06524b5..1f3e6d1a4f1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -310,6 +310,7 @@ jobs: --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ --silent done + cat "node_modules/@agoric/synthetic-chain/dist/upgrade-test-scripts/run_test.sh" curl \ "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli-v2.js" \ From bb04965504f8014f256eaa6be5c7abdbf4a73dc6 Mon Sep 17 00:00:00 2001 From: usmanmani1122 Date: Tue, 28 Jan 2025 23:17:57 +0500 Subject: [PATCH 38/46] revert --- .github/workflows/integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1f3e6d1a4f1..4f0e06524b5 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -310,7 +310,6 @@ jobs: --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ --silent done - cat "node_modules/@agoric/synthetic-chain/dist/upgrade-test-scripts/run_test.sh" curl \ "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli-v2.js" \ From 70306a8ee4041a0ac34cc6b267d895e2efe379fa Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:27:01 +0500 Subject: [PATCH 39/46] revert --- .github/workflows/integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4f0e06524b5..1f3e6d1a4f1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -310,6 +310,7 @@ jobs: --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ --silent done + cat "node_modules/@agoric/synthetic-chain/dist/upgrade-test-scripts/run_test.sh" curl \ "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli-v2.js" \ From df8197a9eee489017ca009ed76203ca111e91775 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:29:45 +0500 Subject: [PATCH 40/46] sudo --- .github/workflows/integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1f3e6d1a4f1..136c60e9130 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -225,8 +225,6 @@ jobs: password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} test-docker-build: - needs: pre_check - if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest timeout-minutes: 60 steps: From 72004892642998dd0213b6de6204e0711a580a95 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 00:29:56 +0500 Subject: [PATCH 41/46] disable not supported config --- a3p-integration/proposals/z:acceptance/otel-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml index e8be3a8fcd2..1023a3b710b 100644 --- a/a3p-integration/proposals/z:acceptance/otel-config.yaml +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -1,6 +1,6 @@ exporters: file: - flush_interval: 5 + # flush_interval: 5 path: $EXPORT_DIRECTORY/metrics.json receivers: From e895c0608656e4f6afbb6ac0d618a855c308b7fd Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 10:51:32 +0500 Subject: [PATCH 42/46] change prometheus target --- a3p-integration/proposals/z:acceptance/otel-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml index 1023a3b710b..9c97919486f 100644 --- a/a3p-integration/proposals/z:acceptance/otel-config.yaml +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -1,6 +1,5 @@ exporters: file: - # flush_interval: 5 path: $EXPORT_DIRECTORY/metrics.json receivers: @@ -11,7 +10,7 @@ receivers: scrape_interval: 10s static_configs: - targets: - - localhost:$OTEL_EXPORTER_PROMETHEUS_PORT + - 0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT service: pipelines: From 16b29c6293beaf8cf83573165d450ce46cc26888 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:41:55 +0500 Subject: [PATCH 43/46] nit --- a3p-integration/proposals/z:acceptance/otel-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml index 9c97919486f..0458db39130 100644 --- a/a3p-integration/proposals/z:acceptance/otel-config.yaml +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -1,6 +1,6 @@ exporters: file: - path: $EXPORT_DIRECTORY/metrics.json + path: $EXPORT_FILE receivers: prometheus: @@ -10,7 +10,7 @@ receivers: scrape_interval: 10s static_configs: - targets: - - 0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT + - http://0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT service: pipelines: From d688a743631f1d65b47e2dfc62e4449b7f058e02 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:15:19 +0500 Subject: [PATCH 44/46] fix target host --- a3p-integration/proposals/z:acceptance/otel-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml index 0458db39130..e4568a4cbf2 100644 --- a/a3p-integration/proposals/z:acceptance/otel-config.yaml +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -10,7 +10,7 @@ receivers: scrape_interval: 10s static_configs: - targets: - - http://0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT + - 0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT service: pipelines: From a157f5abd324878efe583982059709ebf44fbab0 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:17:40 +0500 Subject: [PATCH 45/46] remove cat --- .github/workflows/integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 136c60e9130..b34e59c5af6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -308,7 +308,6 @@ jobs: --output "node_modules/@agoric/synthetic-chain/dist/$FOLDER_NAME/$file" \ --silent done - cat "node_modules/@agoric/synthetic-chain/dist/upgrade-test-scripts/run_test.sh" curl \ "https://storage.googleapis.com/agoric-snapshots-public/share/temp-a3p-cli-v2.js" \ From d5a50db64023e8b3deb2e9135b988b171d042b53 Mon Sep 17 00:00:00 2001 From: Usman Saleem <57341641+usmanmani1122@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:13:07 +0500 Subject: [PATCH 46/46] ISTG --- a3p-integration/proposals/z:acceptance/otel-config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/a3p-integration/proposals/z:acceptance/otel-config.yaml b/a3p-integration/proposals/z:acceptance/otel-config.yaml index e4568a4cbf2..88d7605877f 100644 --- a/a3p-integration/proposals/z:acceptance/otel-config.yaml +++ b/a3p-integration/proposals/z:acceptance/otel-config.yaml @@ -10,7 +10,7 @@ receivers: scrape_interval: 10s static_configs: - targets: - - 0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT + - 0.0.0.0:$OTEL_EXPORTER_PROMETHEUS_PORT service: pipelines: @@ -19,3 +19,6 @@ service: - file receivers: - prometheus + telemetry: + logs: + level: debug