Releases: ethereumjs/ethereumjs-monorepo
@ethereumjs/block v5.1.0
Dencun Hardfork Support
While all EIPs contained in the upcoming Dencun hardfork run pretty much stable within the EthereumJS libraries for quite some time, this is the first release round which puts all this in the official space and removes "experimental" labeling preparing for an imminent Dencun launch on the last testnets (Holesky) and mainnet activation! 🎉
Dencun hardfork on the execution side is called Cancun and can be activated within the EthereumJS libraries (default hardfork still Shanghai
) with a following common
instance:
import * as kzg from 'c-kzg'
import { Common, Chain, Hardfork } from '@ethereumjs/common'
import { initKZG } from '@ethereumjs/util'
initKZG(kzg, __dirname + '/../../client/src/trustedSetups/official.txt')
const common = new Common({
chain: Chain.Mainnet,
hardfork: Hardfork.Cancun,
customCrypto: { kzg: kzg },
})
console.log(common.customCrypto.kzg) // Should print the initialized KZG interface
Note that the kzg
initialization slightly changed from previous experimental releases and a custom KZG instance is now passed to Common
by using the customCrypto
parameter, see PR #3262.
While EIP-4844
- activating shard blob transactions - is for sure the most prominent EIP from this hardfork, enabling better scaling for the Ethereum ecosystem by providing cheaper block space for L2s, there are in total 6 EIPs contained in the Dencun hardfork. The following is an overview of which EthereumJS libraries mainly implement the various EIPs:
- EIP-1153: Transient storage opcodes (
@ethereumjs/evm
) - EIP-4788: Beacon block root in the EVM (
@ethereumjs/block
,@ethereumjs/evm
,@ethereumjs/vm
) - EIP-4844: Shard Blob Transactions (
@ethereumjs/tx
,@ethereumjs/block
,@ethereumjs/evm
) - EIP-5656: MCOPY - Memory copying instruction (
@ethereumjs/evm
) - EIP-6780: SELFDESTRUCT only in same transaction (
@ethereumjs/vm
) - EIP-7516: BLOBBASEFEE opcode (
@ethereumjs/block
,@ethereumjs/evm
)
WASM Crypto Support
With this release round there is a new way to replace the native JS crypto primitives used within the EthereumJS ecosystem by custom/other implementations in a controlled fashion, see PR #3192.
This can e.g. be used to replace time-consuming primitives like the commonly used keccak256
hash function with a more performant WASM based implementation, see @ethereumjs/common
README for some detailed guidance on how to use.
Self-Contained (and Working 🙂) README Examples
All code examples in EthereumJS
monorepo library README files are now self-contained and can be executed "out of the box" by simply copying them over and running "as is", see tracking issue #3234 for an overview. Additionally all examples can now be found in the respective library examples folder (in fact the README examples are now auto-embedded from over there). As a nice side effect all examples are now run in CI on new PRs and so do not risk to get outdated or broken over time.
Other Changes
@ethereumjs/wallet v2.0.1
- Add
fromMnemonic()
static constructor to BIP32 HD wallet, PR #192
@ethereumjs/vm v7.1.0
New EVM/VM Profiler
This releases ships with a completely new dedicated EVM/VM profiler (❤️ to Jochem for the integration) to measure how the different opcode implementations are doing, see PR #2988, #3011, #3013 and #3041.
Most of profiling is taking place in the EVM (so: the dedicated opcode profiling), see the respective README section for usage instructions and the EVM v2.1.0 CHANGELOG for latest performance gains.
The VM adds to the profiler (see new profiler
option) by adding output within the tx or block scope along runTx()
or runBlock()
runs (committing state, block rewards,...).
The VM profiler addition now also allows for running blockchain or state tests with the profiler activated, e.g. to benchmark certain extreme-case or attack scenarios, see DEVELOPER docs for usage instructions (see PR #3115).
EIP-7516 BLOBBASEFEE Opcode
This release supports EIP-7516 with a new BLOBBASEFEE
opcode added to and scheduled for the Dencun HF, see PR #3035 and #3068. The opcode returns the value of the blob base-fee of the current block it is executing in.
Dencun devnet-11 Compatibility
This release contains various fixes and spec updates related to the Dencun (Deneb/Cancun) HF and is now compatible with the specs as used in devnet-11 (October 2023).
- Update
EIP-4788
: do not use precompile anymore but use the pre-deployed bytecode, PR #2955 - Additional
EIP-4788
updates (address + modulus), PR #3068 - Update the beacon block root contract address, PR #3003
Bugfixes
- Fix block builder
london
HF transition, PR #3039
Other Changes
- Allow for users to decide if to either downlevel (so: adopt them for a short-lived scenario) state caches or not on
shallowCopy()
by adding a newdownlevelCaches
parameter (default:true
), PR #3063 - Update ethereum tests to 12.3, PR #2971
- Update ethereum tests to 12.4, PR #3052
- Reactivate selected slow tests, PR #2991
- Better error message for
runTx()
gasLimit
check to avoid confusion with EIP1559 base fee, PR #3118
@ethereumjs/util v9.0.1
Dencun devnet-11 Compatibility
This release contains various fixes and spec updates related to the Dencun (Deneb/Cancun) HF and is now compatible with the specs as used in devnet-11 (October 2023).
- Update peer dependency for
kzg
module to use the official trusted setup formainnet
, PR #3107
Other Changes
@ethereumjs/tx v5.1.0
More Type-Aligned Library Structure
This release gently introduces a backwards-compatible new/adopted library structure which is more aligned with the idea of independent tx types, bundling various functionalities together in a way that is not necessarily hierarchical, see PR #2993 and #3010.
Reused functionality (e.g. calculating the upfront-cost (getUpfrontCost()
) of an EIP-1559
-compatible tx - is internally bundled in capability files (e.g. capabilities/eip1559.ts
), which provide static call access to the respective methods.
These methods are then called and the functionality exposed by the respective methods in the tx classes, see the following example code for an FeeMarketEIP1559Transaction
:
getUpfrontCost(baseFee: bigint = BigInt(0)): bigint {
return EIP1559.getUpfrontCost(this, baseFee)
}
This makes creating additional or custom tx types and reusing of existing functionality substantially easier and makes the library substantially more robust by largely consolidating previously redundant code parts.
Dencun devnet-11 Compatibility
This release contains various fixes and spec updates related to the Dencun (Deneb/Cancun) HF and is now compatible with the specs as used in devnet-11 (October 2023).
- Update peer dependency for
kzg
module to use the official trusted setup formainnet
, PR #3107
Other Changes
@ethereumjs/trie v6.0.1
Native Support for Uint8Array Values in DBs
The trie library now allows to store values being passed as native Uint8Array
values instead of strings, see PR #3067.
This leads to a significant performance increase when dealing with larger state DBs and it is recommended to activate for new DBs by using the new valueEncoding
option.
Attention!: Switching value encoding by using this new option is not compatible with existing databases.
Debug Logging
The trie library now allows for using debug logging with the DEBUG=ethjs,trie:*
flag on the command line as already being implemented in other EthereumJS libraries, see PR #3019.
See Debugging README section for usage instructions. This comes in pretty handy if in-depth trie analysis with step-by-step following of path reads is needed.
Bugfixes
- Fix empty-root check, PR #3001
Other Changes
- New parameter
skipKeyTransform
(default:false
) for Trieput()
,del()
andbatch()
method to allow to pass in already hashed keys, PR #2950 - New
keyPrefix
option tries to store node keys with a static prefix (used upstream in thestatemanager
package to speed to storage trie reads), PR #3023 - Peformance:
findPath()
optimizations, PR #3066 - Make
null
available as type option forput()
method value, PR #3020 - Allow partial trie options for
shallowCopy()
(e.g. for a more flexible cache configuration for the trie copy), PR #3063 - Use
lock
class from@ethereumjs/util
, PR #3109 - Improve util types and handling, PR #2951
@ethereumjs/statemanager v2.1.0
New Diff-Based Code Cache
This release introduces a new code cache implementation, see PR #3022 and #3080. The new cache complements the expanded account and storage caches and now also tracks stored/deployed-code-changes along commits and reverts and so only keeps code in the cache which made it to the final state change.
The new cache is substantially more robust towards various type of revert-based attacks and grows a more-used cache over time, since never-applied values are consecutively sorted out.
Peformance Option to store Storage Keys with Prefix
This release introduces a new option prefixStorageTrieKeys
which triggers the underlying trie to store storage key values with a prefix based on the account address, see PR #3023. This significantly increases performance for consecutive storage accesses for the same account on especially larger tries, since trie node accesses get noticeably faster when performed by the underlying key-value store since values are stored close to each other.
While this option is deactivated by default it is recommended for most use cases for it to be activated. Note that this option is not backwards-compatible with existing databases and therefore can't be used if access to existing DBs needs to be guaranteed.
Bugfixes
- Fix for
dumpStorage()
forEthersStateManager
, PR #3009
Other Changes
- Allow for users to decide if to either downlevel (so: adopt them for a short-lived scenario) caches or not on
shallowCopy()
by adding a newdownlevelCaches
parameter (default:true
), PR #3063 - Return zero values for
getProof()
as0x0
, PR #3038 - Deactivate storage/account caches for cache size 0, PR #3012
@ethereumjs/rlp v5.0.1
- Fixes the RLP CLI, PR #3007
@ethereumjs/genesis v0.2.0
@ethereumjs/evm v2.1.0
New EVM Profiler / EVM Performance
This releases ships with a completely new dedicated EVM profiler (❤️ to Jochem for the integration) to measure how the different opcode implementations are doing, see PR #2988, #3011, #3013 and #3041.
See the new dedicated README section for a detailed usage instruction.
We were already able to do various performance related improvements using this tool (and we hope that you will be too) 🤩:
- Substantial stack optimizations (
PUSH
andPOPn
+30-40%,DUP
+40%), PR #3000 JUMPDEST
optimizations, PR #3000- Various EVM interpreter optimizations (overall 7-15% performance gain), PR #2996
- Memory optimizations (
MLOAD
andMSTORE
+ 10-20%), PR #3032 - Reused BigInts cache, PR #3034 and #3050
EXP
opcode optimizations (real-world 3x gain, not attack resistant), PR #3034
EIP-7516 BLOBBASEFEE Opcode
This release supports EIP-7516 with a new BLOBBASEFEE
opcode added to and scheduled for the Dencun HF, see PR #3035 and #3068. The opcode returns the value of the blob base-fee of the current block it is executing in.
Dencun devnet-11 Compatibility
This release contains various fixes and spec updates related to the Dencun (Deneb/Cancun) HF and is now compatible with the specs as used in devnet-11 (October 2023).
- Update
EIP-4788
: do not use precompile anymore but use the pre-deployed bytecode, PR #2955
Other Changes
- Add missing
debug
dependency types, PR #3072