This repository was archived by the owner on Oct 6, 2021. It is now read-only.
Conversation
nhynes
suggested changes
Dec 3, 2019
| * @param littleEndian is true if the keystring should be interpreted as | ||
| * little endian. Otherwise, defaults to big endian. | ||
| * @returns the byte incoding of the value | ||
| * @returns the byte encoding of the value |
|
|
||
| public async decodeSubscriptionEvent(e: any, _idl: Idl): Promise<any> { | ||
| const event = cbor.decode(bytes.parseHex(e.data)); | ||
| const eventBytes = bytes.parseHex(e.data).slice(4); // remove size of event |
Contributor
There was a problem hiding this comment.
Suggested change
| const eventBytes = bytes.parseHex(e.data).slice(4); // remove size of event | |
| const eventBytes = bytes.parseHex(e.data); | |
| const payloadSize = new Uint32Array(new Uint8Array(eventBytes.splice(0, 4)))[0]; | |
| const payloadBytes = eventBytes).slice(payloadSize); |
probably best not to ignore it. at the very least it's a sanity check
Contributor
Author
There was a problem hiding this comment.
was this meant to be const payloadBytes = eventBytes.slice(-payloadSize);?
Contributor
There was a problem hiding this comment.
yeah. (0, payloadSize) thanks for catching
| public async decodeSubscriptionEvent(e: any, _idl: Idl): Promise<any> { | ||
| const event = cbor.decode(bytes.parseHex(e.data)); | ||
| const eventBytes = bytes.parseHex(e.data).slice(4); // remove size of event | ||
| const event = cbor.decode(eventBytes); |
Contributor
There was a problem hiding this comment.
Suggested change
| const event = cbor.decode(eventBytes); | |
| const event = cbor.decode(payloadBytes); |
Contributor
|
to get CI to pass, you'll want to update the toolchain installed in |
added 2 commits
December 3, 2019 09:31
1f1aee7 to
1cedcb3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
packages/service/src/coder/oasis.tswhen decoding a subscription event.