-
Notifications
You must be signed in to change notification settings - Fork 215
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
synchronous makeVstorageKit #10670
synchronous makeVstorageKit #10670
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
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 CI failure looks like it might be related to the changes, will TAL after that's passing
614397f
to
bb7daca
Compare
bb7daca
to
a9b385a
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.
LGTM mostly but please see my non-blocking request to add a comment
/** | ||
* Stop-gap using execFileSync until we have a pure JS signing client. | ||
* | ||
* @param {object} root0 |
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.
Question: this root0 seems a little out of place, yet familiar... is this codegen or something?
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.
it's what the eslint autofixer for missing jsdoc params does
@@ -1,4 +1,5 @@ | |||
// @ts-nocheck FIXME | |||
// XXX uses agoric.follow to read data through spawned processes; replace with VstorageKit |
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.
Question: is agoric.follow deprecated? Just not preferred? Is there a larger pattern of work to replace it with vstorage kit that we should 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.
Deprecated, yeah. The larger pattern is in the comment, "replace with VstorageKit". That gets the vstorage data without shelling out, making it more portable and less dependent on the process env (e.g. PATH)
@@ -0,0 +1,352 @@ | |||
# Snapshot report for `test/vstorage-kit.test.js` |
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.
Awesome
@@ -50,7 +55,7 @@ const parseUSDCAmount = (amountString, usdc) => { | |||
*/ | |||
export const addLPCommands = ( | |||
program, | |||
{ fetch, vstorageKit, stderr, stdout, env, now }, | |||
{ fetch, agoricNames, vstorageKit, stderr, stdout, env, now }, |
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.
It seems a little fickle to inject both agoricNames
and vstorageKit
because agoricNames
should always come from the vstorageKit
's queries. Being able to independently craft them allows them to have conflicting results. I.e. vstorageKit
could return something when querying published.agoricNames.brands
that doesn't match the agoricNames
arg. It would be helpful to at least document these options as test-only to avoid confusion. So request: please add a doc/comment saying these are for testing.
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.
It seems a little fickle to inject both agoricNames and vstorageKit because agoricNames should always come from the vstorageKit's queries
Not anymore, right? The PR is about removing agoricNames
from VstorageKit
.
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 thought this PR is about making vstorageKit synchronous. If there's a context where looking at a provided agoricNames
object contradicts what would result by calling the provided vstorageKit.readPublished("agoricNames...")
then I think that's a bad consequence. Perhaps make vstorageKit.agoricNames
a promise instead of removing it then?
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.
Perhaps make vstorageKit.agoricNames a promise instead of removing it then?
I don't think it's necessary to do this. My main concern is that we have a function with two arguments that can be two different sources of truth for the same data, it would just be nice to highlight this hazard somehow with a comment.
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.
My main concern is that we have a function with two arguments that can be two different sources of truth for the same data, it would just be nice to highlight this hazard somehow with a comment.
Oh, I see. Yes that is a hazard. I'll work on that.
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.
a9b385a
to
501be3a
Compare
incidental
refs: agoric-labs/vstorage-viewer#2
Description
In the course of working on agoric-labs/vstorage-viewer#3 it was hard to work with an async
makeVstorageKit
. It was async because construction of the kit required fetching a bunch of data from vstorage to populateagoricNames
.That concern is a higher level than vstorage so this pulls it out. That allows
makeVstorageKit
to be synchronous.I added a test of
makeAgoricNames
both before and after.Eventually I think something should make it easy to make an AgoricNamesKit that wraps
VstorageKit
the wayVstorageKit
wrapsVstorage
.makeWalletUtils
does that but needs more work. At least renaming toSmartWallet
but it would help to have a rethink of the layering and vstorage decoding in client-utils.Security Considerations
none
Scaling Considerations
none
Documentation Considerations
not documented but this will make it less complex
Testing Considerations
new test
While refactoring, tsc really let me down by not detecting destuctured properies that were no longer on the source object. I suppose our settings aren't strict enough. I enabled
noImplicitAny
to detect those (by then filtering for makeVstorageKit)Upgrade Considerations
n/a