-
Notifications
You must be signed in to change notification settings - Fork 212
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
7918 upgrade15 update zoe zcf #8793
Changes from all commits
f47702b
1d6111a
3db072a
85eb25a
b33d568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import '../internal-types.js'; | |
import { E } from '@endo/eventual-send'; | ||
import { Far } from '@endo/marshal'; | ||
import { makeScalarBigMapStore, prepareExo } from '@agoric/vat-data'; | ||
import { M } from '@agoric/store'; | ||
|
||
import { makeZoeStorageManager } from './zoeStorageManager.js'; | ||
import { makeStartInstance } from './startInstance.js'; | ||
|
@@ -32,7 +33,7 @@ import { ZoeServiceI } from '../typeGuards.js'; | |
const { Fail } = assert; | ||
|
||
/** | ||
* Create an durable instance of Zoe. | ||
* Create a durable instance of Zoe. | ||
* | ||
* @param {object} options | ||
* @param {Baggage} options.zoeBaggage - the baggage for Zoe durability. Must be provided by caller | ||
|
@@ -52,6 +53,7 @@ const makeDurableZoeKit = ({ | |
feeIssuerConfig = defaultFeeIssuerConfig, | ||
zcfSpec = { name: 'zcf' }, | ||
}) => { | ||
/** @type {BundleCap} */ | ||
let zcfBundleCap; | ||
|
||
const saveBundleCap = () => { | ||
|
@@ -168,6 +170,25 @@ const makeDurableZoeKit = ({ | |
}); | ||
}; | ||
|
||
const ZoeConfigI = M.interface('ZoeConfigFacet', { | ||
updateZcfBundleId: M.call(M.string()).returns(), | ||
}); | ||
|
||
const zoeConfigFacet = prepareExo(zoeBaggage, 'ZoeConfigFacet', ZoeConfigI, { | ||
updateZcfBundleId(bundleId) { | ||
E.when( | ||
getZcfBundleCap({ id: bundleId }, vatAdminSvc), | ||
bundleCap => { | ||
zcfBundleCap = bundleCap; | ||
}, | ||
e => { | ||
console.error(`'🚨 unable to update ZCF Bundle: `, e); | ||
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. 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. That's (unnecessarily) a backquoted string. The singlequote within (between the backquote and flashing light) is unintentional. Since it's withing a backquoted string, it doesn't need a close quote. I don't want to fix it only here. If you think it's worth the trouble, I will fix it first on master and then here. |
||
throw e; | ||
}, | ||
); | ||
}, | ||
}); | ||
|
||
/** @type {ZoeService} */ | ||
const zoeService = prepareExo(zoeBaggage, 'ZoeService', ZoeServiceI, { | ||
install(bundleId, bundleLabel) { | ||
|
@@ -223,6 +244,7 @@ const makeDurableZoeKit = ({ | |
|
||
return harden({ | ||
zoeService, | ||
zoeConfigFacet, | ||
/** @type {FeeMintAccess} */ | ||
// @ts-expect-error cast | ||
feeMintAccess: feeMintKit.feeMintAccess, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { E } from '@endo/far'; | ||
import { AssetKind, makeDurableIssuerKit, AmountMath } from '@agoric/ertp'; | ||
import { | ||
AssetKind, | ||
makeDurableIssuerKit, | ||
AmountMath, | ||
prepareIssuerKit, | ||
} from '@agoric/ertp'; | ||
import { | ||
makeScalarBigMapStore, | ||
provideDurableWeakMapStore, | ||
|
@@ -117,7 +122,7 @@ export const makeZoeStorageManager = ( | |
'zoeMintBaggageSet', | ||
); | ||
for (const issuerBaggage of zoeMintBaggageSet.values()) { | ||
zoeMintBaggageSet(issuerBaggage); | ||
prepareIssuerKit(issuerBaggage); | ||
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. Surprised to see 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.
As @warner noticed earlier today, it only didn't fail because |
||
} | ||
|
||
const makeZoeMint = prepareExoClass( | ||
|
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.
When might
settledBundleCap
beundefined
? What I'm wondering is if "broken" is the right diagnosis to report.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.
When a fresh ZcfBundleCap is gotten, what if anything updates
state.zcfBundleCap
? DoesgetZcfBundleCapP
do that? Where isgetZcfBundleCapP
defined anyway?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.
zcfBundleCap
is defined in zoe.js. It starts out undefined, and is set whensetVatAdminSvc()
is called. Zoe ensures that it's set early, but I think the type system can't tell, and is happier when we check and throw. "unset" might be more apt, but if it happens, I want whoever sees it to realize it's a big deal.Ooh! good catch! There's no
state.zcfBundleCap
, it's held in baggage. (We can't change what's in state in a new incarnation.) A fresh one would be set in a call toupdateZcfBundleId
, which does not update zoeBaggage. Created an issue: #8805.In the call to
makeStartInstance
it's set to() => zcfBundleCap
. (i.e. just dynamically access the local version held by Zoe.)