-
Notifications
You must be signed in to change notification settings - Fork 208
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
use contract "start" consistently #8045
Conversation
37aa6be
to
5fe5330
Compare
buildRootObject === undefined || | ||
Fail`Did you provide a vat bundle instead of a contract bundle?`; | ||
Fail`contract exports missing start/prepare`; | ||
Fail`contract exports missing start`; |
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.
Will this break current users of agoric using prepare? Should we communicate this change to our partners?
|
||
const areDurable = objectMap( | ||
{ creatorFacet, publicFacet, creatorInvitation }, | ||
canBeDurable, | ||
); | ||
const allDurable = Object.values(areDurable).every(Boolean); | ||
if (prepare) { | ||
if (takesBaggage) { | ||
allDurable || | ||
Fail`values from prepare() must be durable ${areDurable}`; |
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.
Replace prepare
with start
in the error message.
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.
done
@@ -147,7 +147,7 @@ harden(validateQuestionFromCounter); | |||
* }>} | |||
* @param {import('@agoric/vat-data').Baggage} baggage | |||
*/ | |||
export const prepare = async (zcf, privateArgs, baggage) => { | |||
export const start = async (zcf, privateArgs, baggage) => { | |||
trace('prepare'); |
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.
replace prepare
with start
in trace statements here and bellow in this file.
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.
done
Closing as we need to support the case of a contract that will eventually be upgradable but isn't already. That is, it takes |
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.
This works for me.
3bd57b9
to
f846088
Compare
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.
@toliaqat's comments merit a response.
LGTM.
export const meta = { | ||
upgradability: 'canUpgrade', | ||
}; | ||
|
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.
harden(meta);
export const meta = { | ||
privateArgsShape: M.splitRecord( | ||
harden({ | ||
marshaller: M.remotable('Marshaller'), | ||
storageNode: StorageNodeShape, | ||
}), | ||
harden({ | ||
// only necessary on first invocation, not subsequent | ||
feeMintAccess: FeeMintAccessShape, | ||
initialPoserInvitation: InvitationShape, | ||
initialShortfallInvitation: InvitationShape, | ||
}), | ||
), | ||
upgradability: 'canUpgrade', | ||
}; |
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.
export const meta = { | |
privateArgsShape: M.splitRecord( | |
harden({ | |
marshaller: M.remotable('Marshaller'), | |
storageNode: StorageNodeShape, | |
}), | |
harden({ | |
// only necessary on first invocation, not subsequent | |
feeMintAccess: FeeMintAccessShape, | |
initialPoserInvitation: InvitationShape, | |
initialShortfallInvitation: InvitationShape, | |
}), | |
), | |
upgradability: 'canUpgrade', | |
}; | |
export const meta = { | |
privateArgsShape: M.splitRecord( | |
{ | |
marshaller: M.remotable('Marshaller'), | |
storageNode: StorageNodeShape, | |
}, | |
{ | |
// only necessary on first invocation, not subsequent | |
feeMintAccess: FeeMintAccessShape, | |
initialPoserInvitation: InvitationShape, | |
initialShortfallInvitation: InvitationShape, | |
}, | |
), | |
upgradability: 'canUpgrade', | |
}; |
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.
thanks. I thought splitRecord
required hardened args
privateArgsShape: M.splitRecord( | ||
harden({ | ||
marshaller: M.remotable('Marshaller'), | ||
storageNode: StorageNodeShape, | ||
}), | ||
harden({ | ||
// only necessary on first invocation, not subsequent | ||
feeMintAccess: FeeMintAccessShape, | ||
initialPoserInvitation: InvitationShape, | ||
}), | ||
), |
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.
privateArgsShape: M.splitRecord( | |
harden({ | |
marshaller: M.remotable('Marshaller'), | |
storageNode: StorageNodeShape, | |
}), | |
harden({ | |
// only necessary on first invocation, not subsequent | |
feeMintAccess: FeeMintAccessShape, | |
initialPoserInvitation: InvitationShape, | |
}), | |
), | |
privateArgsShape: M.splitRecord( | |
{ | |
marshaller: M.remotable('Marshaller'), | |
storageNode: StorageNodeShape, | |
}, | |
{ | |
// only necessary on first invocation, not subsequent | |
feeMintAccess: FeeMintAccessShape, | |
initialPoserInvitation: InvitationShape, | |
}, | |
), |
/** @typedef {Awaited<ReturnType<typeof start>>['publicFacet']} PsmPublicFacet */ | ||
harden(start); |
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.
/** @typedef {Awaited<ReturnType<typeof start>>['publicFacet']} PsmPublicFacet */ | |
harden(start); | |
harden(start); | |
/** @typedef {Awaited<ReturnType<typeof start>>['publicFacet']} PsmPublicFacet */ |
packages/vats/src/provisionPool.js
Outdated
export const meta = { | ||
privateArgsShape: M.splitRecord( | ||
harden({ | ||
poolBank: M.eref(M.remotable('bank')), | ||
storageNode: M.eref(M.remotable('storageNode')), | ||
marshaller: M.eref(M.remotable('marshaller')), | ||
}), | ||
harden({ | ||
// only necessary on first invocation, not subsequent | ||
initialPoserInvitation: InvitationShape, | ||
metricsOverride: M.recordOf(M.string()), | ||
}), | ||
), | ||
upgradability: 'canUpgrade', | ||
}; |
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.
export const meta = { | |
privateArgsShape: M.splitRecord( | |
harden({ | |
poolBank: M.eref(M.remotable('bank')), | |
storageNode: M.eref(M.remotable('storageNode')), | |
marshaller: M.eref(M.remotable('marshaller')), | |
}), | |
harden({ | |
// only necessary on first invocation, not subsequent | |
initialPoserInvitation: InvitationShape, | |
metricsOverride: M.recordOf(M.string()), | |
}), | |
), | |
upgradability: 'canUpgrade', | |
}; | |
export const meta = { | |
privateArgsShape: M.splitRecord( | |
{ | |
poolBank: M.eref(M.remotable('bank')), | |
storageNode: M.eref(M.remotable('storageNode')), | |
marshaller: M.eref(M.remotable('marshaller')), | |
}, | |
{ | |
// only necessary on first invocation, not subsequent | |
initialPoserInvitation: InvitationShape, | |
metricsOverride: M.recordOf(M.string()), | |
}, | |
), | |
upgradability: 'canUpgrade', | |
}; |
f846088
to
e7c9a9c
Compare
e7c9a9c
to
5ae46e4
Compare
* buildRootObject: undefined, | ||
* start: ContractStartFn, | ||
* meta?: ContractMeta, | ||
}>} */ |
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.
The formatting looks broken here. Is github confused?
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.
That is janky. I must have messed it up.
prettier-plugin-jsdoc would format it as,
/**
* @type {() => Promise<
* | {
* buildRootObject: any;
* start: undefined;
* meta: undefined;
* }
* | {
* buildRootObject: undefined;
* start: ContractStartFn;
* meta?: ContractMeta;
* }
* >}
*/
Since that automated our whitespace, I'll address this when we opt packages/zoe into pretty jsdoc
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 started noticing that VS code is not auto formatting for some packages (i.e. cosmic-swingset). It does for SwingSet. Maybe I started noticing this in cosmic-swingset because I just now made some changes in it.
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.
Please ignore my comment. I was missing settings file for cosmic-swingset in my project.
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.
The formatting of one comment in zcfZygote looks broken. otherwise, looks great.
use contract "start" consistently
Description
While describing contract upgrade to @carlos-kryha I couldn't come up with a good explanation for why upgradable contracts name the start function
prepare
.This keeps the
start
name and makes an explicit declaration undermeta
of the upgradability the contract claims.Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Any other docs about "prepare" will need to be updated.
This is a breaking change to downstream consumers, but will appear in the changelogs and is trivial to comply with.
Testing Considerations
CI