diff --git a/golang/cosmos/app/app.go b/golang/cosmos/app/app.go index b9aff7586f4..e276b988d85 100644 --- a/golang/cosmos/app/app.go +++ b/golang/cosmos/app/app.go @@ -103,7 +103,6 @@ import ( "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" gaiaappparams "github.com/Agoric/agoric-sdk/golang/cosmos/app/params" @@ -792,17 +791,17 @@ func NewAgoricApp( app.SetEndBlocker(app.EndBlocker) const ( - upgradeName = "agoric-upgrade-12" - upgradeNameTest = "agorictest-upgrade-12" + upgradeName = "agoric-upgrade-13" + upgradeNameTest = "agorictest-upgrade-13" ) app.UpgradeKeeper.SetUpgradeHandler( upgradeName, - upgrade12Handler(app, upgradeName), + upgrade13Handler(app, upgradeName), ) app.UpgradeKeeper.SetUpgradeHandler( upgradeNameTest, - upgrade12Handler(app, upgradeNameTest), + upgrade13Handler(app, upgradeNameTest), ) if loadLatest { @@ -825,18 +824,13 @@ func NewAgoricApp( return app } -// upgrade12Handler performs standard upgrade actions plus custom actions for upgrade-12. -func upgrade12Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) { +// upgrade13Handler performs standard upgrade actions plus custom actions for upgrade-13. +func upgrade13Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) { return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) { app.CheckControllerInited(false) // Record the plan to send to SwingSet app.upgradePlan = &plan - // Reflect default BlockParams.MaxBytes change to current params - cp := app.BaseApp.GetConsensusParams(ctx) - cp.Block.MaxBytes = tmtypes.DefaultBlockParams().MaxBytes - app.BaseApp.StoreConsensusParams(ctx, cp) - // Always run module migrations mvm, err := app.mm.RunMigrations(ctx, app.configurator, fromVm) if err != nil { diff --git a/packages/deployment/upgrade-test/Dockerfile b/packages/deployment/upgrade-test/Dockerfile index bc21bfd45f3..d39fa17a4a8 100644 --- a/packages/deployment/upgrade-test/Dockerfile +++ b/packages/deployment/upgrade-test/Dockerfile @@ -1,14 +1,14 @@ # Defaults -ARG BASE_IMAGE=ghcr.io/agoric/agoric-3-proposals@sha256:ac10c09b5927d759d37b1525b5a0bc4aeb3034df8d0f0fbb15b51203555ffb1b +ARG BASE_IMAGE=ghcr.io/agoric/agoric-3-proposals:pr-33 ARG DEST_IMAGE=ghcr.io/agoric/agoric-sdk:dev ARG BOOTSTRAP_MODE=main # TODO different naming scheme for upgrade handler (in app.go) and the image name # UPGRADE -FROM ${BASE_IMAGE} as propose-agoric-upgrade-12 -ARG BOOTSTRAP_MODE UPGRADE_INFO_12 -ENV THIS_NAME= UPGRADE_TO=agoric-upgrade-12 UPGRADE_INFO=${UPGRADE_INFO_12} BOOTSTRAP_MODE=${BOOTSTRAP_MODE} +FROM ${BASE_IMAGE} as propose-agoric-upgrade-13 +ARG BOOTSTRAP_MODE UPGRADE_INFO +ENV THIS_NAME= UPGRADE_TO="agoric-upgrade-13" UPGRADE_INFO=${UPGRADE_INFO} BOOTSTRAP_MODE=${BOOTSTRAP_MODE} WORKDIR /usr/src/agoric-sdk/ COPY --chmod=755 ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/ @@ -16,12 +16,12 @@ SHELL ["/bin/bash", "-c"] RUN . ./upgrade-test-scripts/start_to_to.sh # DEST (TEST) -#this is agoric-upgrade-12 / multi-collateral, etc. +#this is agoric-upgrade-13 ARG DEST_IMAGE -FROM ${DEST_IMAGE} as agoric-upgrade-12 +FROM ${DEST_IMAGE} as agoric-upgrade-13 ARG BOOTSTRAP_MODE -ENV THIS_NAME=agoric-upgrade-12 BOOTSTRAP_MODE=${BOOTSTRAP_MODE} USE_JS=1 -COPY --from=propose-agoric-upgrade-12 /root/.agoric /root/.agoric +ENV THIS_NAME=agoric-upgrade-13 BOOTSTRAP_MODE=${BOOTSTRAP_MODE} USE_JS=1 +COPY --from=propose-agoric-upgrade-13 /root/.agoric /root/.agoric # start-chain boilerplate WORKDIR /usr/src/agoric-sdk/ COPY ./env_setup.sh ./start_to_to.sh ./package.json ./*.js ./upgrade-test-scripts/ diff --git a/packages/deployment/upgrade-test/Makefile b/packages/deployment/upgrade-test/Makefile index 5ab47afa0f4..ce3e13f8fa9 100644 --- a/packages/deployment/upgrade-test/Makefile +++ b/packages/deployment/upgrade-test/Makefile @@ -2,7 +2,7 @@ REPOSITORY = agoric/upgrade-test # use :dev (latest prerelease image) unless we build local sdk DEST_IMAGE ?= $(if $(findstring local_sdk,$(MAKECMDGOALS)),ghcr.io/agoric/agoric-sdk:latest,ghcr.io/agoric/agoric-sdk:dev) BOOTSTRAP_MODE?=main -TARGET?=agoric-upgrade-12 +TARGET?=agoric-upgrade-13 dockerLabel?=$(TARGET) @echo target: $(TARGET) @@ -13,11 +13,11 @@ BUILD = docker build --progress=plain $(BUILD_OPTS) \ --build-arg BOOTSTRAP_MODE=$(BOOTSTRAP_MODE) --build-arg DEST_IMAGE=$(DEST_IMAGE) \ -f Dockerfile upgrade-test-scripts -propose-agoric-upgrade-12: - $(BUILD) --target propose-agoric-upgrade-12 -t $(REPOSITORY):propose-agoric-upgrade-12$(TAG_SUFFIX) +propose-agoric-upgrade-13: + $(BUILD) --target propose-agoric-upgrade-13 -t $(REPOSITORY):propose-agoric-upgrade-13$(TAG_SUFFIX) -agoric-upgrade-12: propose-agoric-upgrade-12 - $(BUILD) --target agoric-upgrade-12 -t $(REPOSITORY):agoric-upgrade-12$(TAG_SUFFIX) +agoric-upgrade-13: propose-agoric-upgrade-13 + $(BUILD) --target agoric-upgrade-13 -t $(REPOSITORY):agoric-upgrade-13$(TAG_SUFFIX) # build main bootstrap build: $(TARGET) @@ -43,4 +43,4 @@ run_test: shell: docker exec -it `docker ps --latest --format json | jq -r .Names` bash -.PHONY: local_sdk agoric-upgrade-7-2 agoric-upgrade-8 agoric-upgrade-8-1 agoric-upgrade-9 agoric-upgrade-10 agoric-upgrade-11 agoric-upgrade-12 build build_test run +.PHONY: local_sdk agoric-upgrade-13 build build_test run diff --git a/packages/deployment/upgrade-test/Readme.md b/packages/deployment/upgrade-test/Readme.md index cd6eacb6b2f..731e0f710c1 100644 --- a/packages/deployment/upgrade-test/Readme.md +++ b/packages/deployment/upgrade-test/Readme.md @@ -1,20 +1,10 @@ # Dockerized Chain Upgrade Tester -This will build all previous upgrades and upgrade each one. - -## Upgrades - -| number | description | notes | -| ------ | -------------- | -------------------------------------------------------------------------- | -| 8 | PismoA | Runs with Pismo release agoric-sdk (including CLI) | -| 8.1 | PismoB | -| 9 | PismoC | -| 10 | --> Vaults | Runs with latest SDK. Tests backwards compatibility with Pismo vstorage. | -| 11 | Vaults --> V+1 | Anticipated upgrade. Tests that Vaults release _can be_ upgraded in place. | +This will build an image upgrade of [agoric-3-proposals](https://github.com/Agoric/agoric-3-proposals), a Docker based environment simulating the agoric-3 mainnet chain, using the latest agoric-sdk. ## Testing -**To build the images to latest** +**To build the upgrade image** ```shell make build @@ -24,7 +14,7 @@ By default pre-releases use the lastest image tagged `dev` in our [container rep a specific build: ```shell -DEST_IMAGE=docker pull ghcr.io/agoric/agoric-sdk:20230515033839-e56ae7 +DEST_IMAGE=ghcr.io/agoric/agoric-sdk:20230515033839-e56ae7 ``` To use a build based on local changes: ```shell @@ -33,7 +23,7 @@ make local_sdk build # or DEST_IMAGE=ghcr.io/agoric/agoric-sdk:latest make build ``` -**To run the latest upgrade interactively** +**To run the upgrade interactively** ```shell make run @@ -54,15 +44,6 @@ If you run into other problems, you might have a local `agoric-sdk:latest` that is stale. Either `make local_sdk` or delete your local image so Docker pulls from the repository instead. -**To build and run a specific upgrade** - -```shell -TARGET=agoric-upgrade-10 make build run -``` - -This will put you in `/usr/src/agoric-sdk`. You'll run commands from here. `upgrade-test-scripts` is copied here with only the test scripts for the current image. - - If you lose the connection and want to get back, ```sh # find the container id @@ -75,7 +56,7 @@ docker attach sweet_edison ```shell json='{"some":"json","here":123}' -make build BUILD_OPTS="--build-arg UPGRADE_INFO_11='$json'" +make build BUILD_OPTS="--build-arg UPGRADE_INFO='$json'" ``` Search this directory for `UPGRADE_INFO` if you want to see how it is plumbed @@ -101,24 +82,9 @@ make shell To make the wallet ui talk to your local chain, set the network config to `https://local.agoric.net/network-config` -## To add an upgrade - -1. Update the upgrade handler in app.go -2. Duplicate the last pair of UPGRADE and TEST blocks -3. Update their number from the UPGRADE / DEST block at the end -4. Make directory for tests (e.g. `agoric-upgrade-12`) -4. Make directory for ugprade (e.g. `propose-agoric-upgrade-12` with a `.keep`) -5. Update the UPGRADE/DEST pair to be your new upgrade (THIS_NAME matching the upgrade handler string in app.go) -6. Update the `Makefile` - - the two targets to `Makefile` (e.g. `propose-agoric-upgrade-12` and `agoric-upgrade-12`) - - set the default TARGET (e.g. `agoric-upgrade-12`) - - add the DEST target to the `.phony` in `Makefile` -7. Test with `make local_sdk build run` - - ## Development -You can iterate on a particular upgrade by targeting. When you exit and run again, it will be a fresh state. +When you exit and run again, the container will be a fresh state. By default targets that use "agoric-sdk:latest" will source from CI builds. To use your local checkout of agoric-sdk inside Docker run, @@ -127,9 +93,9 @@ make local_sdk ``` Builds an image: ghcr.io/agoric/agoric-sdk:latest that will be used by all your builds. -That will produce the an image tagged agoric-sdk:latest in your local resolution. (Then run `make build run` again.) +That will produce an image tagged agoric-sdk:latest in your local resolution. (Then run `make build run` again.) -You can send information from one run to the next using `/envs`. A release N can append ENV variable setting shell commands to `"$HOME/.agoric/envs"`. The N+1 release will then have them in its environment. (Because `env_setup.sh` starts with `source "$HOME/.agoric/envs"`) +For more details about the docker upgrade test framework, refer to the [agoric-3-proposals](https://github.com/Agoric/agoric-3-proposals) repository. ### IDE diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/.gitignore b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/.gitignore deleted file mode 100644 index 781644c0395..00000000000 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -upgrade-walletFactory-permit.json -upgrade-walletFactory.js diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/actions.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/actions.test.js deleted file mode 100644 index 00e49a04dc9..00000000000 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/actions.test.js +++ /dev/null @@ -1,68 +0,0 @@ -import test from 'ava'; - -import { agd, agoric, agops } from '../cliHelper.js'; -import { GOV1ADDR, SDK_ROOT } from '../constants.js'; -import { installBundles, runZcfUpgrade, runProber } from './actions.js'; -import { adjustVault, closeVault, mintIST, openVault } from '../econHelpers.js'; - -test.before(async t => { - await mintIST(GOV1ADDR, 12340000000, 10000, 2000); - - const bundlesData = [ - { - name: 'Zcf-upgrade', - filePath: `${SDK_ROOT}/packages/zoe/src/contractFacet/vatRoot.js`, - }, - { - name: 'Zoe-upgrade', - filePath: `${SDK_ROOT}/packages/vats/src/vat-zoe.js`, - }, - { - name: 'prober-contract', - filePath: `${SDK_ROOT}/packages/boot/test/bootstrapTests/zcfProbe.js`, - }, - ]; - - // @ts-expect-error - t.context.bundleIds = await installBundles(bundlesData); -}); - -test.skip('Open Vaults', async t => { - const currentVaults = await agops.vaults('list', '--from', GOV1ADDR); - t.is(currentVaults.length, 5); - - // TODO get as return value from openVault - const vaultId = 'vault6'; - await openVault(GOV1ADDR, 7, 11); - await adjustVault(GOV1ADDR, vaultId, { giveMinted: 1.5 }); - await adjustVault(GOV1ADDR, vaultId, { giveCollateral: 2.0 }); - await closeVault(GOV1ADDR, vaultId, 5.75); -}); - -test.skip('Run Prober (first time)', async t => { - // @ts-expect-error - await runProber(t.context.bundleIds['prober-contract']); - const data = await agd.query('vstorage', 'data', 'published.prober-asid9a'); - const value = JSON.parse(data.value); - t.is(value.values[0], 'false'); -}); - -test.skip('Upgrade Zoe and ZCF', async t => { - await runZcfUpgrade( - // @ts-expect-error - t.context.bundleIds['Zcf-upgrade'], - // @ts-expect-error - t.context.bundleIds['Zoe-upgrade'], - ); - - t.pass(); -}); - -test.skip('Run Prober (second time)', async t => { - // @ts-expect-error - await runProber(t.context.bundleIds['prober-contract']); - - const data = await agd.query('vstorage', 'data', 'published.prober-asid9a'); - const value = JSON.parse(data.value); - t.is(value.values[0], 'true'); -}); diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/post.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/post.test.js deleted file mode 100644 index 8483e97e403..00000000000 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/post.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import test from 'ava'; -import { getIncarnation } from './tools/vat-status.js'; - -test.skip(`verify Zoe vat incarnation`, async t => { - const incarantion = await getIncarnation('zoe'); - t.is(incarantion, 1); -}); diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/pre.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/pre.test.js deleted file mode 100644 index 09113d99805..00000000000 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/pre.test.js +++ /dev/null @@ -1,27 +0,0 @@ -import test from 'ava'; - -import { waitForBlock } from '../commonUpgradeHelpers.js'; -import { agd } from '../cliHelper.js'; -import { getIncarnation } from './tools/vat-status.js'; - -test.before(async () => { - console.log('Wait for upgrade to settle'); - - await waitForBlock(5); -}); - -test(`Ensure Zoe Vat is at 0`, async t => { - const incarnation = await getIncarnation('zoe'); - t.is(incarnation, 0); -}); - -test('Ensure MaxBytes param was updated', async t => { - const { value: rawParams } = await agd.query( - 'params', - 'subspace', - 'baseapp', - 'BlockParams', - ); - const blockParams = JSON.parse(rawParams); - t.is(blockParams.max_bytes, '5242880'); -}); diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/.gitignore b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/actions.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.js similarity index 100% rename from packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/actions.js rename to packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.js diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.test.js new file mode 100644 index 00000000000..823296571d0 --- /dev/null +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/actions.test.js @@ -0,0 +1,21 @@ +import test from 'ava'; + +import { agops } from '../cliHelper.js'; +import { GOV1ADDR } from '../constants.js'; +import { adjustVault, closeVault, mintIST, openVault } from '../econHelpers.js'; + +test.before(async t => { + await mintIST(GOV1ADDR, 12340000000, 10000, 2000); +}); + +test.skip('Open Vaults', async t => { + const currentVaults = await agops.vaults('list', '--from', GOV1ADDR); + t.is(currentVaults.length, 5); + + // TODO get as return value from openVault + const vaultId = 'vault6'; + await openVault(GOV1ADDR, 7, 11); + await adjustVault(GOV1ADDR, vaultId, { giveMinted: 1.5 }); + await adjustVault(GOV1ADDR, vaultId, { giveCollateral: 2.0 }); + await closeVault(GOV1ADDR, vaultId, 5.75); +}); diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/post.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/post.test.js new file mode 100644 index 00000000000..8c8d4b3bbde --- /dev/null +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/post.test.js @@ -0,0 +1 @@ +import test from 'ava'; diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/pre.test.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/pre.test.js new file mode 100644 index 00000000000..567fb1ec863 --- /dev/null +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/pre.test.js @@ -0,0 +1,9 @@ +import test from 'ava'; + +import { waitForBlock } from '../commonUpgradeHelpers.js'; + +test.before(async () => { + console.log('Wait for upgrade to settle'); + + await waitForBlock(5); +}); diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/tools/vat-status.js b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/tools/vat-status.js similarity index 100% rename from packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-12/tools/vat-status.js rename to packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-13/tools/vat-status.js