Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions patches/@libp2p__tcp@11.0.13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/dist/src/socket-to-conn.js b/dist/src/socket-to-conn.js
index 2ef149718745e5901cdce459d73dcb3d4b7e596e..a8a2ba0830c4f1cb42bd555112ee01dead908c2f 100644
--- a/dist/src/socket-to-conn.js
+++ b/dist/src/socket-to-conn.js
@@ -88,6 +88,10 @@ class TCPSocketMultiaddrConnection extends AbstractMultiaddrConnection {
await pEvent(this.socket, 'close', options);
}
sendReset() {
+ if (this.socket.writableEnded) {
+ this.socket.destroy();
+ return;
+ }
this.socket.resetAndDestroy();
}
sendPause() {
diff --git a/src/socket-to-conn.ts b/src/socket-to-conn.ts
index c4a085b17b6326c96b305741af6b1717cd8a2714..4fba3375008e899bb60eef0382cb4d9c6245525f 100644
--- a/src/socket-to-conn.ts
+++ b/src/socket-to-conn.ts
@@ -123,6 +123,11 @@ class TCPSocketMultiaddrConnection extends AbstractMultiaddrConnection {
}

sendReset (): void {
+ if (this.socket.writableEnded) {
+ this.socket.destroy()
+ return
+ }
Comment on lines +23 to +27

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not sure it's required to patch src but why not 🤷

+
this.socket.resetAndDestroy()
}

10 changes: 6 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ allowBuilds:
ssh2: true

overrides:
# Pin exactly while patches/@libp2p__tcp@11.0.13.patch is in place, the patch
# only applies to this version. Remove together with the patch once
# js-libp2p#3597 is released.
"@libp2p/tcp": "11.0.13"
dns-over-http-resolver: "^2.1.1"
elliptic: ">=6.6.1"
loupe: "^2.3.6"
Expand All @@ -43,4 +47,5 @@ overrides:
sigstore: "4.0.0"

patchedDependencies:
"@libp2p/tcp@11.0.13": patches/@libp2p__tcp@11.0.13.patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ship the TCP fix with published packages

When Lodestar is installed from npm, this workspace-level patchedDependencies entry is not included in the published tarball, so consumers still receive an unpatched @libp2p/tcp. The release workflow publishes with Lerna, while packages/beacon-node/package.json:128 retains "@libp2p/tcp": "^11.0.13" and excludes both this workspace configuration and the patch file. Consequently, npm installations of @chainsafe/lodestar or @lodestar/beacon-node remain vulnerable to the shutdown hang this commit is intended to fix; ensure the published dependency path also carries the fix.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

pretty sure this comment is wrong @matthewkeil ?

sigstore@4.0.0: patches/sigstore@4.0.0.patch
Loading