-
Notifications
You must be signed in to change notification settings - Fork 214
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
cleanup agoricNames publishing #9480
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,12 +7,11 @@ import { | |||||||||||||||||||||
makeSubscriptionKit, | ||||||||||||||||||||||
observeIteration, | ||||||||||||||||||||||
} from '@agoric/notifier'; | ||||||||||||||||||||||
import { makeScalarBigMapStore } from '@agoric/vat-data'; | ||||||||||||||||||||||
import { prepareRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js'; | ||||||||||||||||||||||
import * as farExports from '@endo/far'; | ||||||||||||||||||||||
import { E, Far } from '@endo/far'; | ||||||||||||||||||||||
import { importBundle } from '@endo/import-bundle'; | ||||||||||||||||||||||
import { makePromiseKit } from '@endo/promise-kit'; | ||||||||||||||||||||||
import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; | ||||||||||||||||||||||
import { PowerFlags } from '../walletFlags.js'; | ||||||||||||||||||||||
import { BASIC_BOOTSTRAP_PERMITS } from './basic-behaviors.js'; | ||||||||||||||||||||||
import { agoricNamesReserved, callProperties, extractPowers } from './utils.js'; | ||||||||||||||||||||||
|
@@ -357,8 +356,8 @@ export const makeChainStorage = async ({ | |||||||||||||||||||||
}) => { | ||||||||||||||||||||||
const bridgeManager = await bridgeManagerP; | ||||||||||||||||||||||
if (!bridgeManager) { | ||||||||||||||||||||||
console.warn('Cannot support chainStorage without an actual chain.'); | ||||||||||||||||||||||
chainStorageP.resolve(null); | ||||||||||||||||||||||
console.warn('no bridge so chainStorage will not write.'); | ||||||||||||||||||||||
chainStorageP.resolve(makeMockChainStorageRoot()); | ||||||||||||||||||||||
Comment on lines
+359
to
+360
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. Yay! The
A big part of me would like to tell the type system that this thing is always there so we don't have to keep supporting the sim chain in new code. That might be more involved, though. 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. What would it take to remove sim-chain concerns from chain-behaviors entirely? I figure we could provide a fake agoric-sdk/packages/vats/src/core/chain-behaviors.js Lines 319 to 328 in af9e1c1
But I don't know what fidelity it needs or if anything downstream relies on detecting its absence. 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.
I can't think of any technical obstacles. @michaelfig , maybe you know? Seems like product (@mitdralla, @sufyaankhan ) should be involved. @sufyaankhan led the charge to hide the sim chain from docs.agoric.com . 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.
No technical obstacles. Earlier in our history, it was considered onerous to force dapp-developers to install Docker or compile agd themselves. Nowadays, we rely on Docker without batting an eye. The times have changed, and sim-chain is a relic we can safely jettison. |
||||||||||||||||||||||
// @ts-expect-error expects value or undefined | ||||||||||||||||||||||
storageBridgeManagerP.resolve(null); | ||||||||||||||||||||||
return; | ||||||||||||||||||||||
|
@@ -428,10 +427,8 @@ export const publishAgoricNamesToChainStorage = async ({ | |||||||||||||||||||||
}, | ||||||||||||||||||||||
}) => { | ||||||||||||||||||||||
const root = await rootP; | ||||||||||||||||||||||
if (!root) { | ||||||||||||||||||||||
console.warn('no chainStorage: not publishing agoricNames'); | ||||||||||||||||||||||
return; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
assert(root, 'publishAgoricNamesToChainStorage requires chainStorage'); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const nameStorage = E(root).makeChildNode('agoricNames'); | ||||||||||||||||||||||
await E(agoricNames).publishNameHubs( | ||||||||||||||||||||||
nameStorage, | ||||||||||||||||||||||
|
@@ -440,51 +437,6 @@ export const publishAgoricNamesToChainStorage = async ({ | |||||||||||||||||||||
); | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* @deprecated use publishAgoricNamesToChainStorage | ||||||||||||||||||||||
* @param {BootstrapPowers} powers | ||||||||||||||||||||||
* @param {{ | ||||||||||||||||||||||
* options?: { | ||||||||||||||||||||||
* agoricNamesOptions?: { | ||||||||||||||||||||||
* topLevel?: string[]; | ||||||||||||||||||||||
* }; | ||||||||||||||||||||||
* }; | ||||||||||||||||||||||
* }} config | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
export const publishAgoricNames = async ( | ||||||||||||||||||||||
{ consume: { agoricNamesAdmin, board, chainStorage: rootP } }, | ||||||||||||||||||||||
{ options: { agoricNamesOptions } = {} } = {}, | ||||||||||||||||||||||
) => { | ||||||||||||||||||||||
const root = await rootP; | ||||||||||||||||||||||
if (!root) { | ||||||||||||||||||||||
console.warn('cannot publish agoricNames without chainStorage'); | ||||||||||||||||||||||
return; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
const nameStorage = E(root).makeChildNode('agoricNames'); | ||||||||||||||||||||||
const marshaller = E(board).getPublishingMarshaller(); | ||||||||||||||||||||||
|
||||||||||||||||||||||
// XXX will fail upon restart, but so would the makeStoredPublishKit this is replacing | ||||||||||||||||||||||
// Since we expect the bootstrap vat to be replaced instead of upgraded this should be | ||||||||||||||||||||||
// fine. See {@link ./README.md bootstrap documentation} for details. | ||||||||||||||||||||||
const fakeBaggage = makeScalarBigMapStore( | ||||||||||||||||||||||
'fake baggage for AgoricNames kinds', | ||||||||||||||||||||||
); | ||||||||||||||||||||||
const makeRecorderKit = prepareRecorderKit(fakeBaggage, marshaller); | ||||||||||||||||||||||
|
||||||||||||||||||||||
// brand, issuer, ... | ||||||||||||||||||||||
const { topLevel = keys(agoricNamesReserved) } = agoricNamesOptions || {}; | ||||||||||||||||||||||
await Promise.all( | ||||||||||||||||||||||
topLevel.map(async kind => { | ||||||||||||||||||||||
const kindAdmin = await E(agoricNamesAdmin).lookupAdmin(kind); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const kindNode = await E(nameStorage).makeChildNode(kind); | ||||||||||||||||||||||
const { recorder } = makeRecorderKit(kindNode); | ||||||||||||||||||||||
kindAdmin.onUpdate(recorder); | ||||||||||||||||||||||
return recorder.write([]); | ||||||||||||||||||||||
}), | ||||||||||||||||||||||
); | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* no free lunch on chain | ||||||||||||||||||||||
* | ||||||||||||||||||||||
|
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.
Where is that link supposed to go? I don't see a README in this dir.
Possible alternative link: