-
Notifications
You must be signed in to change notification settings - Fork 95
Add ability to produce a request ID from a request #74
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
Conversation
Hydra is now somehow failing with an evaluation error:
|
But only on darwin... |
I'm now able to reproduce this locally:
We're using napalm (by @nmattia), and it looks like it's having trouble naming or producing a derivation from the I have no idea what triggered this. |
Is this possibly related to any upstream changes @paulyoung ? |
Shouldn't be – everything is pinned 😕 |
Perhaps |
I seem to have fixed the issue by regenerating the lock file 😑 |
return new Uint8Array(Buffer.from(hex, "hex").buffer); | ||
// Named `BinaryBlob` as opposed to `Blob` so not to conflict with | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Blob | ||
export type BinaryBlob = Uint8Array & { __blob__: void }; |
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.
Interesting -- thanks Paul!
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 is where I first read about this approach: microsoft/TypeScript#25709 (comment)
@@ -19,7 +19,7 @@ | |||
"mkdirp": "^0.5.1", | |||
"output-file-sync": "^2.0.0", | |||
"slash": "^2.0.0", | |||
"source-map": "^0.6.1" | |||
"source-map": "^0.5.0" |
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.
Downgrading?
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.
Not sure why but this is a generated file anyway.
// NOTE: `nonce` is optional in the spec, but we provide it so that requests | ||
// are unique and we avoid a bug in the client when the same request is | ||
// submitted more than once: https://dfinity.atlassian.net/browse/DFN-895 | ||
nonce?: BinaryBlob; |
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.
👍
sender_sig: new Uint8Array(64) as BinaryBlob, | ||
}; | ||
|
||
const requestId = await requestIdOf(request); |
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 to self (and anyone interested): I was hoping we have a way to call the client inside the tests and extend this test to incorporate the handler. However, after talking with @paulyoung it seems there is no easy and not time-consuming way to do this: deferred. 😢
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.
To clarify, I was specifically talking about browser-based end-to-end tests. A Node.js version should be easier to get to sooner.
js-user-library/src/requestId.ts
Outdated
}; | ||
|
||
export const requestIdOf = async (request: Request): Promise<RequestId> => { | ||
const { sender_pubkey, sender_sig, ...rest } = request; |
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.
nit: I would rename the rest -- usually with rest you get the impression that it is left out dropped. It is the other way around here though.
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 remaining properties are called rest properties and I couldn't think of a better name at the time 😄
I'll rename it to fields
.
|
||
const traversed: Array<[BinaryBlob, BinaryBlob]> = await Promise.all(hashed); | ||
|
||
const sorted: Array<[BinaryBlob, BinaryBlob]> = traversed |
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.
Do we need the sorting here? (I am missing the reason here.)
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.
determinism.
Edit: Apparently it is in the spec -- tt @paulyoung
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 -- I have 1 question, 1 comment, and a really nit one (feel free to ignore it).
Extracted from #56, with some changes.
This adds some minimal type information for requests for now.