-
Notifications
You must be signed in to change notification settings - Fork 206
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
Fix upgrade behaviors #9526
Merged
Merged
Fix upgrade behaviors #9526
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ef1e0a2
feat: Upgrade Zoe
mhofman e4cc97c
Revert "fix(a3p-integration): workaround zoe issues"
mhofman 84dd229
feat: repair KREAd contract on zoe upgrade
Chris-Hibbert cb77160
test: validate KREAd character purchase
Chris-Hibbert e1d961e
test: move vault upgrade from test to use phase (#9536)
Chris-Hibbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
|
||
import assert from 'node:assert/strict'; | ||
import { | ||
generateOracleMap, | ||
getPriceQuote, | ||
pushPrices, | ||
registerOraclesForBrand, | ||
} from './agd-tools.js'; | ||
|
||
const BRANDNAMES = ['ATOM', 'stATOM', 'stTIA', 'stOSMO', 'stkATOM']; | ||
const oraclesByBrand = generateOracleMap('u16', BRANDNAMES); | ||
|
||
// There are no old prices for the other currencies. | ||
const atomOutPre = await getPriceQuote('ATOM'); | ||
assert.equal(atomOutPre, '+12010000'); | ||
|
||
console.log('adding oracle for each brand'); | ||
await registerOraclesForBrand('ATOM', oraclesByBrand); | ||
await registerOraclesForBrand('stATOM', oraclesByBrand); | ||
await registerOraclesForBrand('stTIA', oraclesByBrand); | ||
await registerOraclesForBrand('stOSMO', oraclesByBrand); | ||
await registerOraclesForBrand('stkATOM', oraclesByBrand); | ||
|
||
console.log('pushing new prices'); | ||
await pushPrices(11.2, 'ATOM', oraclesByBrand); | ||
await pushPrices(11.3, 'stTIA', oraclesByBrand); | ||
await pushPrices(11.4, 'stATOM', oraclesByBrand); | ||
await pushPrices(11.5, 'stOSMO', oraclesByBrand); | ||
await pushPrices(11.6, 'stkATOM', oraclesByBrand); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
a3p-integration/proposals/z:acceptance/create-kread-item-test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
source /usr/src/upgrade-test-scripts/env_setup.sh | ||
|
||
OFFER=$(mktemp -t agops.XXX) | ||
agops vaults open --wantMinted 6.00 --giveCollateral 9.0 >| "$OFFER" | ||
agoric wallet send --offer "$OFFER" --from $GOV1ADDR --keyring-backend="test" | ||
|
||
govamount="200000000ubld" | ||
provisionSmartWallet $GOV1ADDR $govamount | ||
|
||
KREAD_ITEM_OFFER=$(mktemp -t kreadItem.XXX) | ||
node ./generate-kread-item-request.mjs > $KREAD_ITEM_OFFER | ||
agops perf satisfaction --from $GOV1ADDR --executeOffer $KREAD_ITEM_OFFER --keyring-backend=test | ||
|
||
agd query vstorage data published.wallet.$GOV1ADDR.current -o json >&gov1.out | ||
name=$(jq '.value | fromjson | .values[2] | fromjson | .body[1:] | fromjson | .purses[1].balance.value.payload[0][0].name ' gov1.out) | ||
test_val $name \"ephemeral_Ace\" "found KREAd character" |
76 changes: 76 additions & 0 deletions
76
a3p-integration/proposals/z:acceptance/generate-kread-item-request.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* global process */ | ||
import assert from 'assert'; | ||
import { execFile } from 'child_process'; | ||
|
||
const ISTunit = 1_000_000n; // aka displayInfo: { decimalPlaces: 6 } | ||
|
||
const id = `KREAd-test-${Date.now()}`; | ||
|
||
// poor-man's zx | ||
const $ = cmd => { | ||
const [file, ...args] = cmd.split(' '); | ||
|
||
return new Promise((resolve, reject) => { | ||
execFile(file, args, { encoding: 'utf8' }, (err, out) => { | ||
if (err) return reject(err); | ||
resolve(out); | ||
}); | ||
}); | ||
}; | ||
|
||
const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]); | ||
|
||
const fromSmallCapsEntries = txt => { | ||
const { body, slots } = JSON.parse(txt); | ||
const theEntries = zip(JSON.parse(body.slice(1)), slots).map( | ||
([[name, ref], boardID]) => { | ||
const iface = ref.replace(/^\$\d+\./, ''); | ||
return [name, { iface, boardID }]; | ||
}, | ||
); | ||
return Object.fromEntries(theEntries); | ||
}; | ||
|
||
const brand = fromSmallCapsEntries( | ||
await $('agoric follow -lF :published.agoricNames.brand -o text'), | ||
); | ||
assert(brand.IST); | ||
|
||
const slots = []; // XXX global mutable state | ||
|
||
const smallCaps = { | ||
Nat: n => `+${n}`, | ||
// XXX mutates obj | ||
ref: obj => { | ||
if (obj.ix) return obj.ix; | ||
const ix = slots.length; | ||
slots.push(obj.boardID); | ||
obj.ix = `$${ix}.Alleged: ${obj.iface}`; | ||
return obj.ix; | ||
}, | ||
}; | ||
|
||
const body = { | ||
method: 'executeOffer', | ||
offer: { | ||
id, | ||
invitationSpec: { | ||
source: 'agoricContract', | ||
instancePath: ['kread'], | ||
callPipe: [['makeMintCharacterInvitation', []]], | ||
}, | ||
offerArgs: { name: 'ephemeral_Ace' }, | ||
proposal: { | ||
give: { | ||
Price: { | ||
brand: smallCaps.ref(brand.IST), | ||
value: smallCaps.Nat(5n * ISTunit) } | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const capData = { body: `#${JSON.stringify(body)}`, slots }; | ||
const action = JSON.stringify(capData); | ||
|
||
console.log(action); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async () => | ||
harden({ | ||
sourceSpec: '@agoric/vats/src/proposals/kread-proposal.js', | ||
getManifestCall: ['getManifestForKread'], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('revive-kread', defaultProposalBuilder); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @param {BootstrapPowers & { | ||
* consume: { kreadKit: any }; | ||
* }} powers | ||
*/ | ||
export const repairKread = async ({ consume: { kreadKit: kreadKitP } }) => { | ||
console.log('repairSubscribers'); | ||
|
||
const kreadKit = await kreadKitP; | ||
const creatorFacet = kreadKit.creatorFacet; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider destrucuring. Could be directly from the promise as 'kreadKit' is unused There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a direct checkout of the |
||
console.log(`KREAd creatorFacet`, creatorFacet); | ||
await E(creatorFacet).reviveMarketExitSubscribers(); | ||
console.log('KREAd subscribers were revived!'); | ||
}; | ||
|
||
export const getManifestForKread = _powers => ({ | ||
manifest: { | ||
[repairKread.name]: { | ||
consume: { kreadKit: true }, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not privy to the plan so I'm just assuming this is supposed to be done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Zoe needs to be updated, and that forces us to repair KREAd