Skip to content
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

Client Network Improvements #1031

Merged
merged 3 commits into from
Jan 6, 2021
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
32 changes: 23 additions & 9 deletions packages/common/src/chains/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,39 @@
"comment": "Upstream bootnode 3"
},
{
"ip": "52.64.155.147",
"port": 30303,
"id": "c1f8b7c2ac4453271fa07d8e9ecf9a2e8285aa0bd0c07df0131f47153306b0736fd3db8924e7a9bf0bed6b1d8d4f87362a71b033dc7c64547728d953e43e59b2",
"ip": "18.218.250.66",
"port": 30313,
"id": "b5948a2d3e9d486c4d75bf32713221c2bd6cf86463302339299bd227dc2e276cd5a1c7ca4f43a0e9122fe9af884efed563bd2a1fd28661f3b5f5ad7bf1de5949",
"location": "",
"comment": "Upstream bootnode 4"
},
{
"ip": "213.186.16.82",
"ip": "3.11.147.67",
"port": 30303,
"id": "f4a9c6ee28586009fb5a96c8af13a58ed6d8315a9eee4772212c1d4d9cebe5a8b8a78ea4434f318726317d04a3f531a1ef0420cf9752605a562cfe858c46e263",
"id": "a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91",
"location": "",
"comment": "Upstream bootnode 5"
"comment": "Ethereum Foundation bootnode"
},
{
"ip": "3.11.147.67",
"ip": "51.15.116.226",
"port": 30303,
"id": "a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91",
"id": "a869b02cec167211fb4815a82941db2e7ed2936fd90e78619c53eb17753fcf0207463e3419c264e2a1dd8786de0df7e68cf99571ab8aeb7c4e51367ef186b1dd",
"location": "",
"comment": "Ethereum Foundation bootnode"
"comment": "Goerli Initiative bootnode"
},
{
"ip": "51.15.119.157",
"port": 30303,
"id": "807b37ee4816ecf407e9112224494b74dd5933625f655962d892f2f0f02d7fbbb3e2a94cf87a96609526f30c998fd71e93e2f53015c558ffc8b03eceaf30ee33",
"location": "",
"comment": "Goerli Initiative bootnode"
},
{
"ip": "51.15.119.157",
"port": 40303,
"id": "a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd",
"location": "",
"comment": "Goerli Initiative bootnode"
}
]
}
4 changes: 2 additions & 2 deletions packages/devp2p/src/eth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class ETH extends EventEmitter {
// Set forkHash and nextForkBlock
if (this._version >= 64) {
const c = this._peer._common
this._hardfork = c.hardfork() ? (c.hardfork() as string) : this._hardfork
this._hardfork = c.hardfork() ? c.hardfork() : this._hardfork
// Set latestBlock minimally to start block of fork to have some more
// accurate basis if no latestBlock is provided along status send
this._latestBlock = c.hardforkBlock(this._hardfork)
Expand Down Expand Up @@ -208,7 +208,7 @@ export class ETH extends EventEmitter {
this._latestBlock = status.latestBlock
}
const forkHashB = Buffer.from(this._forkHash.substr(2), 'hex')
const nextForkB = Buffer.from(this._nextForkBlock.toString(16), 'hex')
const nextForkB = int2buffer(this._nextForkBlock)
Copy link
Member

Choose a reason for hiding this comment

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

I don't really see how this is a fix to a bug? What is changed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am just a simple man and still not so fluent in Buffer operations after all these years 😜 . The only thing I can say here is that the old code delivered an empty Buffer, just re-tested this with Node to be sure:

> let nextForkBlock = 5
undefined
> Buffer.from(nextForkBlock.toString(16), 'hex')
<Buffer >

Copy link
Contributor

Choose a reason for hiding this comment

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

ha! here is some explanation: nodejs/node#24491 (comment)

this._status.push([forkHashB, nextForkB])
}

Expand Down
6 changes: 4 additions & 2 deletions packages/devp2p/src/rlpx/rlpx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ export class RLPx extends EventEmitter {
peer.once('close', (reason, disconnectWe) => {
if (disconnectWe) {
debug(
`disconnect from ${socket.remoteAddress}:${socket.remotePort}, reason: ${String(reason)}`
`disconnect from ${socket.remoteAddress}:${socket.remotePort}, reason: ${DISCONNECT_REASONS[reason]}`
)
} else {
debug(`${socket.remoteAddress}:${socket.remotePort} disconnect, reason: ${String(reason)}`)
debug(
`${socket.remoteAddress}:${socket.remotePort} disconnect, reason: ${DISCONNECT_REASONS[reason]}`
)
}

if (!disconnectWe && reason === DISCONNECT_REASONS.TOO_MANY_PEERS) {
Expand Down