Skip to content

Commit

Permalink
chore: split game1 proposal from walletFactory upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Aug 24, 2023
1 parent 4901659 commit d1eecdd
Show file tree
Hide file tree
Showing 12 changed files with 226 additions and 245 deletions.
5 changes: 3 additions & 2 deletions packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
"@agoric/internal": "^0.3.2",
"@agoric/network": "^0.1.0",
"@agoric/notifier": "^0.6.2",
"@agoric/smart-wallet": "^0.5.3",
"@agoric/swingset-vat": "^0.32.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/vats": "^0.15.1",
"@agoric/zoe": "^0.26.2",
"@endo/marshal": "^0.8.6",
"@endo/bundle-source": "^2.5.2",
"@endo/captp": "^3.1.2",
"@endo/eventual-send": "^0.17.3",
"@endo/init": "^0.5.57",
"@endo/far": "^0.2.19",
"@endo/init": "^0.5.57",
"@endo/marshal": "^0.8.6",
"@endo/promise-kit": "^0.2.57",
"@endo/stream": "^0.3.26",
"import-meta-resolve": "^2.2.1"
Expand Down
34 changes: 34 additions & 0 deletions packages/builders/scripts/smart-wallet/build-game1-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @file Proposal Builder: Upgrade walletFactory
*
* Usage:
* agoric run build-game1-start.js
*/

import { makeHelpers } from '@agoric/deploy-script-support';
import { getManifestForGame1 } from '@agoric/smart-wallet/test/start-game1-proposal.js';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const game1ProposalBuilder = async ({ publishRef, install }) => {
return harden({
sourceSpec: '@agoric/smart-wallet/test/start-game1-proposal.js',
getManifestCall: [
getManifestForGame1.name,
{
game1Ref: publishRef(
install(
'@agoric/smart-wallet/test/gameAssetContract.js',
'../bundles/bundle-game1.js',
{ persist: true },
),
),
},
],
});
};

/** @type {DeployScriptFunction} */
export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('start-game1', game1ProposalBuilder);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @file Proposal Builder: Upgrade walletFactory
*
* Usage:
* agoric run build-walletFactory-upgrade.js
*/

import { makeHelpers } from '@agoric/deploy-script-support';
import { getManifestForUpgrade } from '@agoric/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const defaultProposalBuilder = async ({ publishRef, install }) => {
return harden({
sourceSpec:
'@agoric/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js',
getManifestCall: [
getManifestForUpgrade.name,
{
walletFactoryRef: publishRef(
install(
'@agoric/smart-wallet/src/walletFactory.js',
'../bundles/bundle-walletFactory.js',
{ persist: true },
),
),
},
],
});
};

/** @type {DeployScriptFunction} */
export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('upgrade-walletFactory', defaultProposalBuilder);
};
40 changes: 20 additions & 20 deletions packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/actions.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ SDK=${SDK:-/usr/src/agoric-sdk}
# Enable debugging
set -x

upgrade11=$SDK/upgrade-test-scripts/agoric-upgrade-11
cd $upgrade11

## build proposal and install bundles
waitForBlock 2
./tools/mint-ist.sh
./wallet-all-ertp/wf-install-bundles.sh

## upgrade wallet factory
./wallet-all-ertp/wf-propose.sh

## start game1
./wallet-all-ertp/wf-game-propose.sh

# Pay 0.25IST join the game and get some places
node ./wallet-all-ertp/gen-game-offer.mjs Shire Mordor >/tmp/,join.json
agops perf satisfaction --from $GOV1ADDR --executeOffer /tmp/,join.json --keyring-backend=test

cd $SDK

# hacky restore of pruned artifacts
killAgd
EXPORT_DIR=$(mktemp -t -d swing-store-export-upgrade-11-XXX)
Expand Down Expand Up @@ -64,6 +44,26 @@ test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.
test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault3 -o jsonlines | jq -r '.locked.value') "0" "vault3 contains no collateral"
test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault3 -o jsonlines | jq -r '.debtSnapshot.debt.value') "0" "vault3 has no debt"
upgrade11=$SDK/upgrade-test-scripts/agoric-upgrade-11
cd $upgrade11
## build proposal and install bundles
waitForBlock 2
./tools/mint-ist.sh
./wallet-all-ertp/wf-install-bundles.sh
## upgrade wallet factory
./wallet-all-ertp/wf-propose.sh
## start game1
./wallet-all-ertp/wf-game-propose.sh
# Pay 0.25IST join the game and get some places
node ./wallet-all-ertp/gen-game-offer.mjs Shire Mordor >/tmp/,join.json
agops perf satisfaction --from $GOV1ADDR --executeOffer /tmp/,join.json --keyring-backend=test
cd $SDK
######################################################################
# FIXME: remove this line when these tests don't hardcode bundle hashes.
echo 1>&2 "FIXME: skipping zoe-full-upgrade tests"; return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ testDisplayInfo() {

line="$(agoric follow -lF :published.boardAux.$id -o jsonlines)"
displayInfo="$(echo $line | jq -c .displayInfo)"
echo test_val "$displayInfo" "$expected" "$name displayInfo from boardAux"
test_val "$displayInfo" "$expected" "$name displayInfo from boardAux"
}

testDisplayInfo IST '{"assetKind":"nat","decimalPlaces":6}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Propose and carry out Wallet Factory upgrade
# Propose and carry out starting game contract

SDK=${SDK:-/usr/src/agoric-sdk}
UP11=${UP11:-$SDK/upgrade-test-scripts/agoric-upgrade-11}
Expand All @@ -15,6 +15,7 @@ TITLE="Start Game1 Contract"

DESC="Start Game1 and register well-known Place issuer"

# TODO: fix error recovery (or don't bother with it at all)
[ -f ./start-game1-permit.json ] || (echo run wf-install-bundle.sh first ; exit 1)

agd tx gov submit-proposal \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ UP11=${UP11:-$SDK/upgrade-test-scripts/agoric-upgrade-11}

cd $UP11/wallet-all-ertp

echo +++ run walletFactory upgrade proposal builder +++
agoric run $SDK/packages/smart-wallet/scripts/wfup.js >/tmp/,run.log
echo +++ run walletFactory, game upgrade proposal builders +++
(agoric run $SDK/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js; \
agoric run $SDK/packages/builders/scripts/smart-wallet/build-game1-start.js
)>/tmp/,run.log
bundles=$($UP11/tools/parseProposals.mjs </tmp/,run.log | jq -r '.bundles[]' | sort -u )

echo +++ proposal evals for later +++
Expand All @@ -19,6 +21,7 @@ ls ./upgrade-walletFactory* ./start-game1*

echo +++++ install bundles +++++

# TODO: try `agoric publish` to better track outcome
install_bundle() {
agd tx swingset install-bundle "@$1" \
--from gov1 --keyring-backend=test --gas=auto \
Expand Down
1 change: 0 additions & 1 deletion packages/smart-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"dependencies": {
"@agoric/assert": "^0.6.0",
"@agoric/casting": "^0.4.2",
"@agoric/deploy-script-support": "^0.10.3",
"@agoric/ertp": "^0.16.2",
"@agoric/internal": "^0.3.2",
"@agoric/notifier": "^0.6.2",
Expand Down
34 changes: 0 additions & 34 deletions packages/smart-wallet/scripts/types.js

This file was deleted.

57 changes: 0 additions & 57 deletions packages/smart-wallet/scripts/wfup.js

This file was deleted.

Loading

0 comments on commit d1eecdd

Please sign in to comment.