Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Update rlp-encoding lib to rlp #94

Merged
merged 2 commits into from
Nov 3, 2020
Merged

Update rlp-encoding lib to rlp #94

merged 2 commits into from
Nov 3, 2020

Conversation

ryanio
Copy link
Contributor

@ryanio ryanio commented Oct 30, 2020

Closes #49.

@ryanio ryanio added PR state: needs review dependencies Pull requests that update a dependency file labels Oct 30, 2020
@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #94 into master will increase coverage by 0.05%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage   83.33%   83.39%   +0.05%     
==========================================
  Files          15       15              
  Lines        1158     1162       +4     
  Branches      191      191              
==========================================
+ Hits          965      969       +4     
  Misses         73       73              
  Partials      120      120              
Impacted Files Coverage Δ
src/rlpx/peer.ts 74.80% <50.00%> (ø)
src/dpt/message.ts 82.43% <100.00%> (ø)
src/eth/index.ts 85.00% <100.00%> (ø)
src/rlpx/ecies.ts 90.27% <100.00%> (+0.04%) ⬆️
src/util.ts 83.33% <100.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe414c0...250367d. Read the comment docs.

@@ -106,3 +107,9 @@ export class Deferred<T> {
export function createDeferred<T>(): Deferred<T> {
return new Deferred()
}

export function unstrictDecode(value: Buffer) {
// rlp library throws on remainder.length !== 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this an issue of some kind? If so can you open on rlp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure, I think checking for 0 remainder is just a cautious check. Could we solicit feedback from some other team members?

This little bypass is just a trick in the rlp src that if stream is passed as true, it'll return the decoded data before it does the remainder check 😆 but it is fragile workaround: https://github.com/ethereumjs/rlp/blob/75f398193fef0c2416fd0f68b4e2794273105620/src/index.ts#L71-L76

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, maybe we'll find this out along the way when we have more to do with the devp2p library and questions like this can benefit from the daily practical experience and some grown intuition. Will leave for now with this comment.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this looks good, thanks Ryan, nice issue to tackle since open for ages! 😄 I linked this locally within the client, client is still syncing (my biggest fear these days on every day work, "is the client still syncing?" 😂 ). Will merge once the tests pass.

I fixed the build command along the way which was pointing to a non-exising script.

Also something I stumbled upon, just dropping here if someone has a better understanding what was going on and how to (permanently) fix:

I got these kind of errors when building the client, related to some @types/node version conflict:

../ethereumjs-devp2p/dist/rlpx/rlpx.d.ts:1:23 - error TS4090: Conflicting definitions for 'node' found at '/ethereumjs-devp2p/node_modules/@types/node/index.d.ts' and '/ethereumjs-client/node_modules/@types/node/index.d.ts'. Consider installing a specific version of this library to resolve the conflict.

1 /// <reference types="node" />

Not sure if this only happened due to the local linking, I tried reinstalling node_modules (with a deleted package-lock.json 😋 ) but this didn't make any difference. At the end I "solved" this by doing a npm i @types/node@14.11.5 --no-save (the package version from the client) within the ethereumjs-devp2p folder.

@holgerd77 holgerd77 merged commit 2ecc7df into master Nov 3, 2020
@holgerd77 holgerd77 deleted the upgrade-rlp-dep branch November 3, 2020 10:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Pull requests that update a dependency file PR state: needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace unmaintained rlp-encoding with rlp library
2 participants