-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Network ReqResp modularization #1930
Conversation
Overwrite types until this issue is fixed alanshaw/it-pipe#4 Original types contain ``` export function pipe (first: any, ...rest: any[]): any ``` Which act as a @ts-ignore compromising type safety
Remove unused parameter Update test import Delete placeholder test Use expectRejectedWithLodestarError util Use expectIsEqualSszTypeArr in network tests Update handleRequest test Trigger TOO_MUCH_BYTES_READ error Update sync/reqResp tests
Code Climate has analyzed commit bc75d81 and detected 8 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
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.
Great PR! I think this is long-overdue refactor of the req/resp code.
I checked this out and saw a lot of positive things:
- significantly more comprehensive comments
- encoding/decoding logic pulled into pure functions (rather than embedded in fns that return async generators)
- more correct handling of req/resp timeout and response length limits
- fully defined request/resp error codes/types
- simplified/linearized req/resp flows
Things like the types can be pushed upstream (eg: it-pipe and libp2p) in the future.
Refactors network reqResp code with the general goals of modularization and better maintainability. The overall logic is not changed with a few exceptions outlined below.
ReqRespHandler
to network's ReqResp instanceLodestarError
style with rich documented errorsresponseTimeoutsHandler
This branch is currently syncing Pyrmont in
lodestar-cloud-02
with a stable peer count. I has also synced Pyrmont on my local machine without issues.Happy to jump on a call if more context is needed by a reviewer.