-
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
create new @agoric/time package, move timeMath.js and types #6867
Conversation
@erights I deleted |
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.
NEWS.md and CHANGELOG.md were copied in toto, and should be cut down.
I'm iterating on types, there will be some CI back and forth as I figure out what I'm doing (thanks @turadg !) |
5e7f150
to
1e8e4c6
Compare
Deletion is fine. Since this is the PR deleting it, I'll note here that it is a great example of how to do a cold notifier --- by simply doing a cold async iterable. Attn @michaelfig |
1e8e4c6
to
a09b47a
Compare
@@ -22,8 +22,8 @@ const makeVoterVat = async (log, vats, zoe) => { | |||
/** | |||
* | |||
* @param {Pick<QuestionDetails, 'issue' | 'positions' | 'electionType'>} qDetails | |||
* @param {TimestampValue} closingTime | |||
* @param {{ electorateFacet: import('../../../src/committee.js').CommitteeElectorateCreatorFacet, installations: Record<string, Installation>, timer: TimerService }} tools | |||
* @param {import('@agoric/time/src/types').Timestamp} closingTime |
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.
note: this replaces TimestampValue
(which is just an integer) with the preferred TimeStamp
(which is currently either an integer or a branded record, but the next step of #6003 is to require them all to be branded)
Ok, ready for review. My use of types is probably pretty bad, please recommend fixes. I'll do some squashing/rewriting of this after review, before I land it, to make the last few "fighting with CI" commits more sensible. @erights please see if this matches your vision for time management (knowing that I'm working on the next step, to require brands on all @turadg please be critical about types. @Chris-Hibbert please see if this matches what you need/expect on the client side. |
|
||
// This consumes O(N) RAM only for outstanding promises, via wakeAt(), | ||
// delay(), and Notifiers/Iterators (for each actively-waiting | ||
// client). Everything else should remain in the DB. | ||
|
||
/** | ||
* @typedef {import('@agoric/time/src/types').Timestamp} Timestamp |
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.
as discussed, this faux import copies the structure but not the documentation.
I think that's acceptable for the scope of this change.
@@ -32,7 +32,7 @@ const makeApiInvocationPositions = (apiMethodName, methodArgs) => { | |||
* @param {Instance} governedInstance | |||
* @param {ERef<{ [methodName: string]: (...args: any) => unknown }>} governedApis | |||
* @param {Array<string | symbol>} governedNames names of the governed API methods | |||
* @param {ERef<TimerService>} timer | |||
* @param {ERef<import('@agoric/time/src/types').TimerService>} timer |
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 think it would be worth the investment to get these on the package export:
* @param {ERef<import('@agoric/time/src/types').TimerService>} timer | |
* @param {ERef<import('@agoric/time').TimerService>} timer |
But I don't think that need be a blocker. It stands out like a sore thumb so it'll get addressed.
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.
b7987bf should do it
// These aren't in the global runtime environment. They are just types that are | ||
// meant to be globally accessible as a side-effect of importing this module. |
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 was for the declare global
so no longer applicable.
@@ -7,9 +7,6 @@ import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; | |||
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; | |||
import { Stable } from '../tokens.js'; | |||
|
|||
// Ambient types (globals) |
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.
🎉
Noted. As per our discussions around the future of |
5cb6fff
to
f897df4
Compare
This will house timerMath.js, and types for TimerBrand, Timestamp, and RelativeTime. It also holds types for a TimerService, although the service implementation is in SwingSet (inside `vat-timer`). refs #6003
This is a straight move, with no code changes, for the sake of review. Of course this means that both old and new packages won't work until the next few commits, which will fix up the necessary imports.
* zoe * governamce * inter-protocol * swingset This also removes the old type "<reference>" clause from swingset's `exported.js`, since the timer types are no longer found there.
This updates a lot of downstream packages to get their Time-related types from the right place, and adds package.json dependencies so they can import those types.
f897df4
to
418545a
Compare
This creates a new package named
@agoric/time
, to house timerMath.js, and types for TimerBrand, Timestamp, and RelativeTime.It also holds types for a TimerService, although the service implementation remains in SwingSet (inside
vat-timer
).Clients who use time must now get their types and math functions with e.g.
import { TimeMath } from '@agoric/time'
.refs #6003
But does not close it yet, because the Timestamps are not yet universally branded.