Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: a docker test for the zoe/zcf upgrade #8018

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

Chris-Hibbert
Copy link
Contributor

refs: #6678

Description

This is a Docker test to validate that the upgrade will work correctly on chain, and to build the necessary scripts.

Security Considerations

This is about deployment.

Scaling Considerations

N/A

Documentation Considerations

N/A

Testing Considerations

This is a test.

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't finish my review today, but I'll share my thoughts so far

yarn.lock Outdated
@@ -2831,6 +2831,14 @@ better-sqlite3@^8.2.0:
bindings "^1.5.0"
prebuild-install "^7.1.0"

better-sqlite3@^8.4.0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't better-sqlite3 already in our yarn.lock? Are we introducing another version of it or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverting.



echo XXXX install bundles XXXXXX
for f in $here/zoe-full-upgrade/*bundle.json; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this PR adds the bundles generated from the current git version. I can see why we might need to check in bundles from some older git version, but for the current version, I think we can do:

yarn bundle-source --cache-json /tmp packages/vats/src/vat-zoe.js Zoe-upgrade
ZOE_HASH=`jq -r .endoZipBase64Sha512 /tmp/bundle-Zoe-upgrade.json`
yarn bundle-source --cache-json /tmp packages/zoe/src/contractFacet/vatRoot.js Zcf-upgrade
ZCF_HASH=`jq -r .endoZipBase64Sha512 /tmp/bundle-Zcf-upgrade.json`

and then assert that $ZOE_HASH matches the one from zcf-upgrade-script.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bundles were actually (and crucially) generated in #7966 (effectively, a newer version), which has the changes to Zoe and ZCF. This PR sits on top of a branch without those changes, so we can't build them here.

I guess you're right that I could rebase this branch on top of #7966, and build the way you describe. deployment/upgrade-test provides an immutable environment that isn't affected by the checked-out code under agoric-sdk.

What #7969 wants to do can only be done in a branch that doesn't contain the Zoe/ZCF changes, but this branch's goals don't require that isolation.

// import { E } from "@endo/far";

const ZCF_BUNDLE_ID =
'b1-8674abc9a8de561c4a33fb475b87be75708cd901c37931fd5ac1f40d3ee99937a459a6ca7b4a8b7907512626caf98c125f22c15384826e37dfc899dc0bf2a63a';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get c4b3d8bf11cfbcc90ced7e1a8a936d368098360bb01aa4c70a750a39f56dc9d87c10547e825585ce11ceeca5b24d7093bdef04843ac8ac6e90e661b1235bf69b

when I do:

yarn bundle-source --cache-json /tmp packages/zoe/src/contractFacet/vatRoot.js Zcf-upgrade
export ZCF_HASH=`jq -r .endoZipBase64Sha512 /tmp/bundle-Zcf-upgrade.json`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a surprise that they don't match what you get when you build here, since this branch doesn't have the Zoe/ZCF changes. But I'll rebase to a place that does as you suggested above, and we can make that work.

I was also presuming there might be changes to libraries, etc. that would effect the hash, and expected to do a final re-build before submitting the merge request.

packages/deployment/package.json Outdated Show resolved Hide resolved
@Chris-Hibbert Chris-Hibbert changed the base branch from 6678-upgradeZoeZcf-transplant to 6678-test-upgradeZoeZcf July 20, 2023 23:55
Copy link
Contributor Author

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are instructions in agoric-upgrade-11/actions.sh for building the bundles.

packages/deployment/package.json Outdated Show resolved Hide resolved


echo XXXX install bundles XXXXXX
for f in $here/zoe-full-upgrade/*bundle.json; do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bundles were actually (and crucially) generated in #7966 (effectively, a newer version), which has the changes to Zoe and ZCF. This PR sits on top of a branch without those changes, so we can't build them here.

I guess you're right that I could rebase this branch on top of #7966, and build the way you describe. deployment/upgrade-test provides an immutable environment that isn't affected by the checked-out code under agoric-sdk.

What #7969 wants to do can only be done in a branch that doesn't contain the Zoe/ZCF changes, but this branch's goals don't require that isolation.

// import { E } from "@endo/far";

const ZCF_BUNDLE_ID =
'b1-8674abc9a8de561c4a33fb475b87be75708cd901c37931fd5ac1f40d3ee99937a459a6ca7b4a8b7907512626caf98c125f22c15384826e37dfc899dc0bf2a63a';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a surprise that they don't match what you get when you build here, since this branch doesn't have the Zoe/ZCF changes. But I'll rebase to a place that does as you suggested above, and we can make that work.

I was also presuming there might be changes to libraries, etc. that would effect the hash, and expected to do a final re-build before submitting the merge request.

yarn.lock Outdated
@@ -2831,6 +2831,14 @@ better-sqlite3@^8.2.0:
bindings "^1.5.0"
prebuild-install "^7.1.0"

better-sqlite3@^8.4.0:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverting.

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. Thanks for the thorough comments

@@ -5,5 +5,55 @@
# CWD is agoric-sdk
here=./upgrade-test-scripts/agoric-upgrade-11

# run zoe thru "null upgrade"
$here/zoe-upgrade/zoe-upgrade-driver.sh
# Pre-steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helpful docs

# Finish
# * create instance of prober contract and run expecting to see atomicRearrange

echo XXXX fill wallet XXXXXX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XXX elsewhere means tech debt. please user a different character. Or just upcase.

Suggested change
echo XXXX fill wallet XXXXXX
echo FILL WALLET

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -5,5 +5,55 @@
# CWD is agoric-sdk
here=./upgrade-test-scripts/agoric-upgrade-11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this precedes this PR, but I want to say I think we can have a better name for this. eg. thisupgrade. or find a way to evaluate the scripts letting them use file path relative references. maybe if we adopt zx or execa.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,95 @@
// to turn on ts-check:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??? did you mean to use @ts-check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


console.info('running zcf prober');

const sub = (a, v) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if you import AmountMath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUI, imports aren't supported in core-eval proposals.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a mechanism to support imports. You used it in #7969: packages/vats/src/proposals/zcf-proposal.js starts with import { E } from '@endo/far';.

But it's a complex mechanism, and E is in the environment of a core-eval script even without that import. I tend to do a certain amount of copy-and-paste before I go for the whole writeCoreProposal thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to do a certain amount of copy-and-paste before I go for the whole writeCoreProposal thing.

@dckc I'm not positive how to interpret this. Should I change something here?

};

/*
* Test a full upgrade of Zzoe and ZCF.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💤

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a couple of passes to see it. Thx.

set -euo pipefail

# This shows how to upgrade Zoe and ZCF on a running chain. It presumes that
# The bundles for Zoe and ZCF have been installed, and their hashes updated in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The bundles for Zoe and ZCF have been installed, and their hashes updated in
# the bundles for Zoe and ZCF have been installed, and their hashes updated in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

# zcf-upgrade-script.js. The bundles can be generated by running the test in
# vats/test/bootstrapTests/test-zcf-upgrade.js, noting the logged ZOE BUNDLE ID
# and ZCF BUNDLE ID, and finding the corresponding bundles in ~/.agoric/cache.
# !! THERE HAS TO BE A BETTER WAY !!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be! we just have to design and implement it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are slightly clearer instructions now in actions.sh.

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to reproduce the bundles.

I'd like to avoid checking them in at all.

/* global E */

// import { E } from "@endo/far";
// to turn on ts-check:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. Why disable ts-check if this is all it takes to enable it? Oh, does the import fail at runtime? if that's it then please enable ts-check and do a type-only import.

/** @typedef {import('@endo/far').E} E */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dckc I'm just cargo-culting here. What's your advice on best practices?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type-only import

TIL. Nifty.

But at runtime, the string import( cannot occur anywhere in the script, even in comments. See rejectImportExpressions

Conservatively reject the source text if it may contain a dynamic
import expression. To reject without parsing, rejectImportExpressions will
also reject some other text as well.

Copy link
Member

@dckc dckc Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh... this import( limitation is another thing that's addressed by the "cadillac method", using writeCoreProposal from @agoric/deploy-script-support:

export const defangEvaluableCode = code =>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chris-Hibbert
Copy link
Contributor Author

I haven't been able to reproduce the bundles. I'd like to avoid checking them in at all.

Let's pair to come up with a working alternative.

@dckc dckc force-pushed the 6678-upgradeZoeZcf-docker branch from 1ce7f19 to bd043a9 Compare July 24, 2023 23:44
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-upgradeZoeZcf-docker branch 2 times, most recently from 63009af to a5a339e Compare July 25, 2023 18:07
@Chris-Hibbert Chris-Hibbert requested a review from dckc July 25, 2023 18:07
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank check in zcf-upgrade-permit.json is worth filling in.

@@ -0,0 +1 @@
true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a blank check for zcf-upgrade-permit.json to use all powers in the bootstrap space. We neglected to go back and fill in the actual amount. Based on what upgradeZoeAndZcf uses from its argument, that seems to be:

Suggested change
true
{
"consume": { "vatStore": true, "vatAdminSvc": true }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Base automatically changed from 6678-test-upgradeZoeZcf to master July 28, 2023 01:11
@Chris-Hibbert Chris-Hibbert added this pull request to the merge queue Jul 28, 2023
@Chris-Hibbert Chris-Hibbert removed this pull request from the merge queue due to a manual request Jul 28, 2023
chore: generate upgrade bundles and check hashes
@Chris-Hibbert Chris-Hibbert added this pull request to the merge queue Jul 28, 2023
Merged via the queue into master with commit 29ef60f Jul 28, 2023
62 of 64 checks passed
@Chris-Hibbert Chris-Hibbert deleted the 6678-upgradeZoeZcf-docker branch July 28, 2023 18:20
mhofman pushed a commit that referenced this pull request Aug 7, 2023
test: a docker test for the zoe/zcf upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants