This repository has been archived by the owner on Jan 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Improve type definitions for decode #78
Comments
An additional wrinkle, the readme says : It looks like the skipRemainderCheck logic is gone. EDIT: |
ryanio
added a commit
that referenced
this issue
Jan 9, 2022
ryanio
added a commit
that referenced
this issue
Jan 10, 2022
* update karma-typescript to use fix on master not yet released: monounity/karma-typescript#502 * update readme * bin/rlp: use capital RLP, destructure bytesToHex * destructure ternary operator for easier readability * tidy, touch ups, flatten return statements when possible, move utils to own file * destructure utils usage, move numberToBytes to test utils * eslint updates * rename baToJSON to arrToJSON * add new test coverage from @jochem-brouwer, add es2020 property to eslint, renamings * update package.json version to 3.0.0, add changelog entries * remove separate browser build since tsconfigs are the same. tested with browserify and was able to RLP encode in the browser from dist/index.js * fix karma-typescript * ci: - use npm 7 for github url integrity support (for karma-typescript unreleased workaround) - run coverage inside node v16 workflow so a duplicative job is not needed * ci: more clarity on reason for added npm v7 and when it can be removed * combine to one file to improve esm, deno support * update changelog * Add NestedUint8Array type (fixes issue #78) * tidy readme * changelog: add cli PR * nit: keys by alphabetical order * replace node 13 with 17
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Thinking abstractly about
decode
I'd expect a function signature such as:where
NestedBufferList
could be any nested composition of buffers and arrays such asBuffer
, orBuffer[]
, or[Buffer, Buffer[]]
, etc. (haven't tried expressing this in TS).Currently the
decode
method has the following definitions:rlp/src/index.ts
Lines 60 to 63 in f06a96f
Buffer
and returns aBuffer
. Not sure why, it could very well be that the decoding is aNestedBufferList
. This was also the problem stated in Encoding and Decoding RLP lists when part of a buffer #77Buffer[]
. Is this to support decoding multiple serialized items simultaneously? the code doesn't seem to do that. I suggest we remove thisInput
as argument. I imagine this is for backwards-compatibility. I suggest we tighten the API and only accept aBuffer
On the
stream
flag: we could keep it, or add a new functiondecodeStreaming
.The text was updated successfully, but these errors were encountered: