Skip to content

Commit

Permalink
4844 Browser Readiness Releases (#3297)
Browse files Browse the repository at this point in the history
* Add 4844-browser-readiness and KZG WASM setup instructions to tx CHANGELOG and README

* Add all CHANGELOG files

* Bump versions for block, blockchain, client and common, give internal verkle dependencies a caret range

* Bump versions for devp2p, ethash, evm and genesis

* Bump versions for statemanager, trie, tx and util

* Bump versions for verkle, vm and wallet

* Add changes from Preimage PR #3143

* Added monorepo-wide docs:build command to root package.json

* Rebuild docs

* Update README and example files

* Rebuild package-lock.json

* Add various continued work PRs to the CHANGELOG entries

* Bump EVM to v3.0.0 and VM to v8.0.0 (in-between breaking releases due to new EVM async create() constructor)

* Rebuild package-lock.json

* Add additional EVM/VM breaking release CHANGELOG notes, slight simplification of EVM.create() constructor calling

* Add additional EVM/VM breaking release README notes

* Rebuild docs

* Some TypeScript test fixes

* More CHANGELOG additions

* Update CHANGELOG files (small PRs)

* Update KZG related CHANGELOG and README entries and example code

* EVM: make main constructor protected
  • Loading branch information
holgerd77 authored Mar 18, 2024
1 parent a413006 commit 48e6a30
Show file tree
Hide file tree
Showing 130 changed files with 6,107 additions and 1,157 deletions.
150 changes: 75 additions & 75 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"checkNpmVersion": "./scripts/check-npm-version.sh",
"clean": "./config/cli/clean-root.sh",
"docs:build": "npm run docs:build --workspaces --if-present",
"e2e:inject": "node ./scripts/e2e-inject-resolutions.js",
"e2e:publish": "./scripts/e2e-publish.sh",
"e2e:resolutions": "node ./scripts/e2e-resolutions.js",
Expand Down
40 changes: 40 additions & 0 deletions packages/block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,46 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 5.2.0 - 2024-03-05

### Full 4844 Browser Readiness

#### WASM KZG

Shortly following the "Dencun Hardfork Support" release round from last month, this is now the first round of releases where the EthereumJS libraries are now fully browser compatible regarding the new 4844 functionality, see PRs [#3294](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3294) and [#3296](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3296)! 🎉

Our WASM wizard @acolytec3 has spent the last two weeks and created a WASM build of the [c-kzg](https://github.com/benjaminion/c-kzg) library which we have released under the `kzg-wasm` name on npm (and you can also use independently for other projects). See the newly created [GitHub repository](https://github.com/ethereumjs/kzg-wasm) for some library-specific documentation.

This WASM KZG library can now be used for KZG initialization (replacing the old recommended `c-kzg` initialization), see the respective [README section](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/tx/README.md#kzg-initialization) from the tx library for usage instructions (which is also accurate for the other using upstream libraries like block or EVM).

Note that `kzg-wasm` needs to be added manually to your own dependencies and the KZG initialization code needs to be adopted like the following (which you will likely want to do in most cases, so if you deal with post Dencun EVM bytecode and/or 4844 blob txs in any way):

```typescript
import { loadKZG } from 'kzg-wasm'
import { Chain, Common, Hardfork } from '@ethereumjs/common'

const kzg = await loadKZG()

// Instantiate `common`
const common = new Common({
chain: Chain.Mainnet,
hardfork: Hardfork.Cancun,
customCrypto: { kzg },
})
```

Manual addition is necessary because we did not want to bundle our libraries with WASM code by default, since some projects are then prevented from using our libraries.

Note that passing in the KZG setup file is not necessary anymore, since this is now defaulting to the setup file from the official [KZG ceremony](https://ceremony.ethereum.org/) (which is now bundled with the KZG library).

#### Trie Node.js Import Bug

Since this fits well also to be placed here relatively prominently for awareness: we had a relatively nasty bug in the `@ethereumjs/trie` library with a `Node.js` web stream import also affecting browser compatibility, see PR [#3280](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3280). This bug has been fixed along with these releases and this library now references the updated trie library version.

### Other Changes

- Fixed a bug in the `Block.fromRPC()` and `BlockHeader.fromRPC()` constructors to not parse the `parentBeaconBlockRoot` correctly, PR [#3283](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3283)

## 5.1.1 - 2024-02-08

- Hotfix release adding a missing `debug` dependency to the `@ethereumjs/trie` package (dependency), PR [#3271](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3271)
Expand Down
7 changes: 4 additions & 3 deletions packages/block/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,13 @@ To create blocks which include blob transactions you have to active EIP-4844 in
import { Common, Chain, Hardfork } from '@ethereumjs/common'
import { Block } from '@ethereumjs/block'
import { BlobEIP4844Transaction } from '@ethereumjs/tx'
import { Address, initKZG } from '@ethereumjs/util'
import * as kzg from 'c-kzg'
import { Address } from '@ethereumjs/util'
import { loadKZG } from 'kzg-wasm'
import { randomBytes } from 'crypto'

const main = async () => {
initKZG(kzg, __dirname + '/../../client/src/trustedSetups/official.txt')
const kzg = await loadKZG()

const common = new Common({
chain: Chain.Mainnet,
hardfork: Hardfork.Cancun,
Expand Down
Loading

0 comments on commit 48e6a30

Please sign in to comment.