All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog (modification: no type change headlines) and this project adheres to Semantic Versioning.
- Pinned
@ethereumjs/util
@chainsafe/ssz
dependency tov0.9.4
due to ES2021 features used inv0.10.+
causing compatibility issues, PR #2555
DEPRECATED: Release is deprecated due to broken dependencies, please update to the subsequent bugfix release version.
This release updates the underlying @ethereumjs/common
dependency version to make the library ready for the upcoming Shanghai
hardfork (scheduled for early 2023) regarding the forkHash
related fork switch logic, see PR #2521. Note that a timestamp
to trigger the Shanghai
fork update is only added to Common for the sepolia
testnet and not yet for goerli
or mainnet
.
You can instantiate a Shanghai-enabled Common instance with:
import { Common, Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Shanghai })
- Fixed DNS Discovery ENR record decoding (better connectivity, avoids loosing DNS peer suggestions), PR #2546
- Removed outdated Parity DPT ping/pong hack, PR #2538
- Improved devp2p HELLO logging message (added protocol version and client ID), PR #2538
The devp2p library is now ready to work with hardforks triggered by timestamp, which will first be applied along the Shanghai
HF, see PR #2437. This is achieved by integrating a new timestamp supporting @ethereumjs/common
library version.
One specific devp2p change is that the forkid is now calculated based on timestamps for timestamp-based HFs, see EIP-6122.
For lots of custom chains (for e.g. devnets and testnets), you might come across a Geth genesis.json config which has both config specification for the chain as well as the genesis state specification.
Common
now has a new constructor Common.fromGethGenesis()
- see PRs #2300 and #2319 - which can be used in following manner to instantiate for example a VM run or a tx with a genesis.json
based Common:
import { Common } from '@ethereumjs/common'
// Load geth genesis json file into lets say `genesisJson` and optional `chain` and `genesisHash`
const common = Common.fromGethGenesis(genesisJson, { chain: 'customChain', genesisHash })
// If you don't have `genesisHash` while initiating common, you can later configure common (for e.g.
// calculating it afterwards by using the `@ethereumjs/blockchain` package)
common.setForkHashes(genesisHash)
- Added env check (performance optimization) for DEBUG mode using
debug
package, PR #2311
Final release - tada 🎉 - of a wider breaking release round on the EthereumJS monorepo libraries, see the Beta 1 release notes for the main long change set description as well as the Beta 2, Beta 3 and Release Candidate (RC) 1 release notes for notes on some additional changes (CHANGELOG).
- Internal refactor: removed ambiguous boolean checks within conditional clauses, PR #2254
Release candidate 1 for the upcoming breaking release round on the EthereumJS monorepo libraries, see the Beta 1 release notes for the main long change set description as well as the Beta 2 and 3 release notes for notes on some additional changes (CHANGELOG).
Since this bug was so severe it gets its own section: mainnet
in the underlying @ethereumjs/common
library (Chain.Mainnet
) was accidentally not updated yet to default to the merge
HF (Hardfork.Merge
) by an undiscovered overwrite back to london
.
This has been fixed in PR #2206 and mainnet
now default to the merge
as well.
- Added
engine
field topackage.json
limiting Node versions to v14 or higher, PR #2164 - Replaced
nyc
(code coverage) configurations withc8
configurations, PR #2192 - Code formats improvements by adding various new linting rules, see Issue #1935
Beta 3 release for the upcoming breaking release round on the EthereumJS monorepo libraries, see the Beta 1 release notes for the main long change set description as well as the Beta 2 release notes for notes on some additional changes (CHANGELOG).
Since the Merge HF is getting close we have decided to directly jump on the Merge
HF (before: Istanbul
) as default in the underlying @ethereumjs/common
library and skip the London
default HF as we initially intended to set (see Beta 1 CHANGELOG), see PR #2087.
This change should not directly affect this library but might be relevant since it is not recommended to use different Common library versions between the different EthereumJS libraries.
Beta 2 release for the upcoming breaking release round on the EthereumJS monorepo libraries, see the Beta 1 release notes (CHANGELOG) for the main change set description.
The change with the biggest effect on UX since the last Beta 1 releases is for sure that we have removed default exports all accross the monorepo, see PR #2018, we even now added a new linting rule that completely disallows using.
Default exports were a common source of error and confusion when using our libraries in a CommonJS context, leading to issues like Issue #978.
Now every import is a named import and we think the long term benefits will very much outweigh the one-time hassle of some import adoptions.
Since our @ethereumjs/common library is used all accross our libraries for chain and HF instantiation this will likely be the one being the most prevalent regarding the need for some import updates.
So Common import and usage is changing from:
import Common, { Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
to:
import { Common, Chain, Hardfork } from '@ethereumjs/common'
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
Ethereum Snapshot Protocol (SNAP) support has been added in PR #1883. This allows to run the SNAP protocol as a side-protocol to the ETH protocol for exchanging state snapshots between peers.
- Added
ESLint
strict boolean expressions linting rule, PR #2030
This release is part of a larger breaking release round where all EthereumJS monorepo libraries (VM, Tx, Trie, other) get major version upgrades. This round of releases has been prepared for a long time and we are really pleased with and proud of the result, thanks to all team members and contributors who worked so hard and made this possible! 🙂 ❤️
We have gotten rid of a lot of technical debt and inconsistencies and removed unused functionality, renamed methods, improved on the API and on TypeScript typing, to name a few of the more local type of refactoring changes. There are also broader structural changes like a full transition to native JavaScript BigInt
values as well as various somewhat deep-reaching refactorings, both within a single package as well as some reaching beyond the scope of a single package. Also two completely new packages - @ethereumjs/evm
(in addition to the existing @ethereumjs/vm
package) and @ethereumjs/statemanager
- have been created, leading to a more modular Ethereum JavaScript VM.
We are very much confident that users of the libraries will greatly benefit from the changes being introduced. However - along the upgrade process - these releases require some extra attention and care since the changeset is both so big and deep reaching. We highly recommend to closely read the release notes, we have done our best to create a full picture on the changes with some special emphasis on delicate code and API parts and give some explicit guidance on how to upgrade and where problems might arise!
So, enjoy the releases (this is a first round of Beta releases, with final releases following a couple of weeks after if things go well)! 🎉
The EthereumJS Team
With this round of breaking releases the whole EthereumJS library stack removes the BN.js library and switches to use native JavaScript BigInt values for large-number operations and interactions.
This makes the libraries more secure and robust (no more BN.js v4 vs v5 incompatibilities) and generally comes with substantial performance gains for the large-number-arithmetic-intense parts of the libraries (particularly the VM).
To allow for BigInt support our build target has been updated to ES2020. We feel that some still remaining browser compatibility issues on the edges (old Safari versions e.g.) are justified by the substantial gains this step brings along.
See #1671 and #1771 for the core BigInt
transition PRs.
The above TypeScript options provide some semantic sugar like allowing to write an import like import React from "react"
instead of import * as React from "react"
, see esModuleInterop and allowSyntheticDefaultImports docs for some details.
While this is convenient, it deviates from the ESM specification and forces downstream users into using these options, which might not be desirable, see this TypeScript Semver docs section for some more detailed argumentation.
Along with the breaking releases we have therefore deactivated both of these options and you might therefore need to adapt some import statements accordingly. Note that you still can activate these options in your bundle and/or transpilation pipeline (but now you also have the option not to, which you didn't have before).
- Removed Node.js specific
assert
usage, PR #1924 - Deduplicated
keccak
andsecp256k1
library usage in favor ofethereum-cryptography
, Noble crypto library uses, PR #1947 - Replaced
hi-base32
dependency with@scure/base
from @paulmillr (Noble crypto library author), PR #1947
- Solved memory leak "DPT discovers nodes when open_slots = 0", PR #1816
- Fixed per-message debug logging, PR #1776
- ETH-LES class refactor, PR #1600
- Dependencies: deduplicated RLP import, PR #1549
- Fixed duplicated debug messages (
DEBUG
logger, seeREADME
), PR #1643
This release adds support for RLPx v5 allowing for the compression of RLPx messages with the Snappy compression algorithm as defined in EIP-706. If the connecting peer doesn't support v5, the connection falls back to v4 and does the communication without compressing the payload.
See: PRs #1399, #1442 and #1484
Per-message debugging with the debug
package has been substantially expanded and allow for a much more targeted debugging experience.
There are new debug loggers added to:
- Debug per specific
ETH
orLES
message (e.g.devp2p:eth:GET_BLOCK_HEADERS
) - Debug per disconnect reason (e.g.
devp2p:rlpx:peer:DISCONNECT:TOO_MANY_PEERS
) - Debug per peer IP address (e.g.
devp2p:3.209.45.79
) - Debug per first connected peer (
DEBUG=devp2p:FIRST_PEER
)
See: PR #1449
This release integrates a Common
library version which provides the london
HF blocks for all networks including mainnet
and is therefore the first release with finalized London HF support. For the devp2p
library this particularly means that the fork hashes for the london
HF will be correct when using eth/64 or higher.
PR #1331 added support for eth/66 and #1324 for les/4. Be sure to check out the updated peer communication examples.
Source files from the src
folder are now included in the distribution build, see PR #1301. This allows for a better debugging experience in debug tools like Chrome DevTools by having working source map references to the original sources available for inspection.
- Fixed zero Buffer forkhash bug in case no future fork known, PR #1148 commit
afd00a8
Attention! This new version is part of a series of EthereumJS releases all moving to a new scoped package name format. In this case the library is renamed as follows:
ethereumjs-devp2p
->@ethereumjs/devp2p
Please update your library references accordingly or install with:
npm i @ethereumjs/devp2p
This is the first-production ready release of this library. During our work on the EthereumJS Client we were finally able to battle-test this library in a real-world environment (so: towards mainnet
, the main official testnets like goerli
or rinkeby
as well as ephemeral testnets like yolov3
). We fixed a myriad of partly critical bugs along the way (which are extremely hard to reproduce just in a test environment) and can now fully recommend to use this library for ETH
protocol integrations up to version ETH/65
in a production setup. Note that the LES
support in the library is still outdated (but working), an update is planned (let us know if you have demand).
The ETH
protocol support has been updated to now also support versions 64
and 65
. Biggest protocol update here is ETH/64
introduced with PR #82 which adds support for selecting peers by fork ID (see associated EIP-2124). This allows for a much more differentiated chain selection and avoids connecting to peers which are on a different chain but having a shared chain history with the same blocks and the same block hashes.
ETH/65
implemented in PR #1159 adds three new message types NewPooledTransactionHashes (0x08)
, GetPooledTransactions (0x09)
and PooledTransactions (0x0a)
for a more efficient exchange on txs from the tx pool (EIP-2464).
Node discovery via DNS has been added to quickly acquire testnet (or mainnet) peers from the DNS ENR tree per EIP-1459, see PRs #1070, #1097 and #1149. This allows for easier peer discovery especially on the testnets. Peer search is randomized as being recommended in the EIP and the implementation avoids to download the entire DNS tree at once.
DNS discovery can be activated in the DPT
module with the shouldGetDnsPeers
option, in addition there is a new shouldFindNeighbours
option allowing to deactivate the classical v4 discovery process. Both discovery methods can be used in conjunction though. DNS Peer discovery can be customized/configured with additional constructor options dnsRefreshQuantity
, dnsNetworks
and dnsAddress
. See API section in the README for a description.
- Updated
goerli
bootnodes, PR #1031 maxPeers
,dpt
, andlistenPort
are now optional inRLPxOptions
, PR #1019- New
DPTOptions
interface,DPT
type improvements, PR #1029 - Improved
RLPx
disconnect reason debug output, PR #1031 LES
: unifiyETH
andLES
sendMessage()
signature by somewhat change payload semantics and pass inreqId
along, PR #1087RLPx
: limit connection refill debug logging to a restarted interval log message to not bloat logging too much, PR #1087
- Subdivided interval calls to refill
RLPx
peer connections to improve networking distribution and connection reliability, PR #1036 - Fixed an error in
DPT
not properly banning old peers and replacing with a new peer onKBucket
ping, PR #1036 - Connection reliability: distribute network traffic on
DPT
additions of new neighbour peers, PR #1036 - Fixed a critical peer data processing bug, PR #1064
- Added socket destroyed checks on peer message sending to safeguard against stream-was-destroyed error, PR #1075
DPT
: fixed undefined array access in ETH._getStatusString() on malformed ETH/64 status msgs, PR #1029
- Added dedicated browser build published to
dist.browser
topackage.json
, PR #1184 - Updated
rlp-encoding
dependency to the EthereumJSrlp
library, PR #94 RLPx
type improvements, PR #1036- Switched to
Codecov
, PR #92 - Upgraded dev deps (config 2.0, monorepo betas, typedoc), PR #93
3.0.3 - 2020-09-29
- Moved
TypeScript
type packages forlru-cache
andbl
fromdevDependencies
todependencies
, PR #90
3.0.2 - 2020-09-28
- Fixed
TypeScript
import issue causing problems when integrating the library in aTypeScript
project, PR #88 - Updated
k-bucket
library tov5
, added types from new@types/k-bucket
package from @tomonari-t, PR #88
3.0.1 - 2020-06-10
This release focuses on improving the debugging
capabilities of the library. PR #72
reduces the verbosity of the log output to cut on noise on everyday debugging. There is a new verbose
logger to retain the more verbose output (e.g. with full message bodies) which can be used like this:
DEBUG=devp2p:*,verbose node -r ts-node/register ./examples/peer-communication.ts
Other Logging Improvements
- Added number of peers to
refillConnections()
debug message - Replaced try/catch logic for EIP-8 auth check to avoid side-effects and get rid of misleading wrong-ecies-header debug output
- Moved debug output in
BanList.add()
after the set operation to get the correct size output - Added debug message for
DISCONNECT
reason from peer (this was always some constant re-debug reason, and at the end it's mostlyTOO_MANY_PEERS
) - Internalize detached logger output from the
devp2p:util
logger
Other Changes
- Refactored
Peer
class for better code readability, PR #77
There has also been a new high-level diagram added to the README
which can be used to get an overview on the structure, available loggers and the event flow of the library (PR #76).
3.0.0 - 2020-05-25
First TypeScript
release of the library, see PR #56 for all the changes and associated discussion.
All source parts of the library have been ported to TypeScript
and working with the library should now therefore be much more reliable due to the additional type safety features provided by the TypeScript
language. The API of the library remains unchanged in a JavaScript
context.
Noteworthy Changes from PR #56:
- Type additions for all method signatures and class members of all protocol components (
dpt
,eth
,les
,rlpx
) - Addition of various structuring interfaces (like PeerInfo for
DPT
message input) andenum
constructs (like MESSAGE_CODES from theETH
protocol) - Port of the examples to
TypeScript
- Port of all the test cases to
TypeScript
- Integration of the library into the common ethereumjs-config EthereumJS configuration setup (
standard
->TSLint
linting, docs withTypeDoc
,TypeScript
compilation,Prettier
formatting rules) - Lots of code cleanups and code part modernizations
Thanks @dryajov for all the great work on this! ❤
Other Updates:
- Added Node 12,13 support, upgrade from Travis to GitHub actions, PR #57
- Updated
ethereumjs-common
dependency tov1.5.1
for a bootnode update, PR #67 - Removed Node 6, 8 support, updated
secp256k1
dependency to fromv3.1.0
tov4.0.1
, PR #68 - Updated
keccak
dependency tov3.0.0
, PR #64 - Some dependency cleanup, PRs #62, #65, #58
2.5.1 - 2018-12-12
- Fix connection error by ignoring
RLPX
peers with missing tcp port, PR #45
2.5.0 - 2018-03-22
- Light client protocol (
LES/2
) implementation, PR #21 LES/2
usage example, see:examples/peer-communication-les.js
- Better test coverage for upper-layer protocols (
ETH
,LES/2
), PR #34
2.4.0 - 2018-02-28
- First release providing a reliable
ETH
connection - Fix Parity
DPT
ping echo hash bug preventing the library to connect to Parity clients, PR #32 - Fixed a bug not setting weHello in peer after sent
HELLO
msg
2.3.0 - 2018-02-27
- Fix critical
RLPX
bug leading to not processing incomingEIP-8
Auth
orAck
messages, PR #26 - Fix bug not forwarding
k-bucket
remove event throughDPT
(sopeer:removed
fromDPT
was not working), PR #27 - Fix updating
ingressMac
with wrongAuth
msg leading to divergingMac
hashes, PR #29 - Fix bug not let first
ETH
status
message emit amessage
event, PR #30 - Large rework of the test setup, additional
DPT
,RLPX
andETH
simulator tests, improving test coverage from 48% to 84%, PR #25
2.2.0 - 2017-12-07
EIP-8
compatibility- Improved debug messages
- Fixes a bug on DPT ping timeout being triggered even if pong message is received
- Only send connect event after both HELLO msgs are exchanged (fixes unreliable upper-protocol communication start)
- Connection reliability improvements for
peer-communication
example - API documentation
2.1.3 - 2017-11-09
- Dependency updates
- Improved README documentation