diff --git a/package-lock.json b/package-lock.json index 8fb0c5fe17..0f04434371 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16614,14 +16614,14 @@ }, "packages/block": { "name": "@ethereumjs/block", - "version": "5.2.0", + "version": "5.3.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { @@ -16633,16 +16633,16 @@ }, "packages/blockchain": { "name": "@ethereumjs/blockchain", - "version": "7.2.0", + "version": "7.3.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/ethash": "^3.0.3", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/ethash": "^3.0.4", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" @@ -16654,24 +16654,24 @@ }, "packages/client": { "name": "@ethereumjs/client", - "version": "0.10.1", + "version": "0.10.2", "hasInstallScript": true, "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "5.2.0", - "@ethereumjs/blockchain": "7.2.0", - "@ethereumjs/common": "4.3.0", - "@ethereumjs/devp2p": "6.1.2", - "@ethereumjs/ethash": "3.0.3", - "@ethereumjs/evm": "3.0.0", - "@ethereumjs/genesis": "0.2.2", + "@ethereumjs/block": "5.3.0", + "@ethereumjs/blockchain": "7.3.0", + "@ethereumjs/common": "4.4.0", + "@ethereumjs/devp2p": "6.1.3", + "@ethereumjs/ethash": "3.0.4", + "@ethereumjs/evm": "3.1.0", + "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", - "@ethereumjs/statemanager": "2.3.0", - "@ethereumjs/trie": "6.2.0", - "@ethereumjs/tx": "5.3.0", - "@ethereumjs/util": "9.0.3", - "@ethereumjs/verkle": "^0.0.2", - "@ethereumjs/vm": "8.0.0", + "@ethereumjs/statemanager": "2.4.0", + "@ethereumjs/trie": "6.2.1", + "@ethereumjs/tx": "5.4.0", + "@ethereumjs/util": "9.1.0", + "@ethereumjs/verkle": "^0.1.0", + "@ethereumjs/vm": "8.1.0", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", "@polkadot/wasm-crypto": "^7.3.2", @@ -16784,10 +16784,10 @@ }, "packages/common": { "name": "@ethereumjs/common", - "version": "4.3.0", + "version": "4.4.0", "license": "MIT", "dependencies": { - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/util": "^9.1.0" }, "devDependencies": { "@polkadot/util": "^12.6.2", @@ -16796,12 +16796,12 @@ }, "packages/devp2p": { "name": "@ethereumjs/devp2p", - "version": "6.1.2", + "version": "6.1.3", "license": "MIT", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", @@ -16810,8 +16810,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/tx": "^5.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/tx": "^5.4.0", "@types/debug": "^4.1.9", "@types/k-bucket": "^5.0.0", "chalk": "^4.1.2", @@ -16823,17 +16823,17 @@ }, "packages/ethash": { "name": "@ethereumjs/ethash", - "version": "3.0.3", + "version": "3.0.4", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { - "@ethereumjs/common": "^4.3.0" + "@ethereumjs/common": "^4.4.0" }, "engines": { "node": ">=18" @@ -16841,13 +16841,13 @@ }, "packages/evm": { "name": "@ethereumjs/evm", - "version": "3.0.0", + "version": "3.1.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "@noble/curves": "^1.4.2", "@types/debug": "^4.1.9", "debug": "^4.3.3", @@ -16877,14 +16877,14 @@ }, "packages/genesis": { "name": "@ethereumjs/genesis", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/util": "^9.1.0" }, "devDependencies": { - "@ethereumjs/trie": "^6.2.0" + "@ethereumjs/trie": "^6.2.1" }, "engines": { "node": ">=18" @@ -16906,21 +16906,21 @@ }, "packages/statemanager": { "name": "@ethereumjs/statemanager", - "version": "2.3.0", + "version": "2.4.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "js-sdsl": "^4.1.4", "lru-cache": "10.1.0" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/genesis": "^0.2.3", "@types/debug": "^4.1.9", "rustbn-wasm": "^0.4.0", "verkle-cryptography-wasm": "^0.4.5" @@ -16928,11 +16928,11 @@ }, "packages/trie": { "name": "@ethereumjs/trie", - "version": "6.2.0", + "version": "6.2.1", "license": "MPL-2.0", "dependencies": { "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@types/readable-stream": "^2.3.13", "debug": "^4.3.4", "ethereum-cryptography": "^2.2.1", @@ -16940,7 +16940,7 @@ "readable-stream": "^3.6.0" }, "devDependencies": { - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/genesis": "^0.2.3", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", @@ -16957,12 +16957,12 @@ }, "packages/tx": { "name": "@ethereumjs/tx", - "version": "5.3.0", + "version": "5.4.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { @@ -16978,7 +16978,7 @@ }, "packages/util": { "name": "@ethereumjs/util", - "version": "9.0.3", + "version": "9.1.0", "license": "MPL-2.0", "dependencies": { "@ethereumjs/rlp": "^5.0.2", @@ -16993,12 +16993,12 @@ }, "packages/verkle": { "name": "@ethereumjs/verkle", - "version": "0.0.2", + "version": "0.1.0", "license": "MIT", "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.4", "lru-cache": "10.1.0", "verkle-cryptography-wasm": "^0.4.5" @@ -17009,18 +17009,18 @@ }, "packages/vm": { "name": "@ethereumjs/vm", - "version": "8.0.0", + "version": "8.1.0", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/blockchain": "^7.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/evm": "^3.0.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/blockchain": "^7.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/evm": "^3.1.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1" }, @@ -17044,10 +17044,10 @@ }, "packages/wallet": { "name": "@ethereumjs/wallet", - "version": "2.0.3", + "version": "2.0.4", "license": "MIT", "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "ethereum-cryptography": "^2.2.1", "js-md5": "^0.8.3", diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index 24392469be..0ea5ae46a4 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,7 +6,188 @@ 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 +## 5.3.0 - 2024-08-15 + +### Blocks with EIP-7685 Consensus Layer Requests + +Starting with this release this library supports requests to the consensus layer (see PRs [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372) and [#3393](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3393)) which have been introduced with [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) and will come into play for deposit and withdrawal requests along the upcoming [Prague](https://eips.ethereum.org/EIPS/eip-7600) hardfork. + +#### EIP-6110 Deposit Requests + +[EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) introduces deposit requests allowing beacon chain deposits being triggered from the execution layer, see PRs [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390) and [#3397](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3397). Starting with this release this library supports deposit requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +#### EIP-7002 Withdrawal Requests + +[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) introduces the possibility for validators to trigger exits and partial withdrawals via the execution layer, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385). Starting with this release this library supports withdrawal requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various withdrawal request parameters. + +#### EIP-7251 Consolidation Requests + +[EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) introduces consolidation requests allowing staked ETH from more than one validator on the beacon chain to be consolidated into one validator, triggered from the execution layer, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477). Starting with this release this library supports consolidation requests and a containing block can be instantiated as follows: + +```ts +// ./examples/7251Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Fix the block body parsing as well as save/load from blockchain, PR [#3392](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3392) +- Verkle type/interface refactoring (moved to Common package), PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- New `Block.toExecutionPayload()` method to map to the execution payload structure from the beacon chain, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Make EIP-4895 withdrawals trie check consistent with tx trie, PR [#3338](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3338) +- Rename deposit receipt to deposit request, PR [#3408](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3408) +- Enhances typing of CL requests, PR [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) +- Rename withdrawal request's `validatorPublicKey` to `validatorPubkey`, PR [#3474](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3474) + +## 5.2.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/block/README.md b/packages/block/README.md index 9d05978685..39845e15f5 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -212,6 +212,168 @@ main() **Note:** Working with blob transactions needs a manual KZG library installation and global initialization, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +### Blocks with EIP-7685 Consensus Layer Requests + +Starting with v5.3.0 this library supports requests to the consensus layer which have been introduced with [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) and will come into play for deposit and withdrawal requests along the upcoming [Prague](https://eips.ethereum.org/EIPS/eip-7600) hardfork. + +#### EIP-6110 Deposit Requests + +[EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) introduces deposit requests allowing beacon chain deposits being triggered from the execution layer. Starting with v5.3.0 this library supports deposit requests and a containing block can be instantiated as follows: + +```ts +// ./examples/6110Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Cancun, + eips: [7685, 4788], + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + +#### EIP-7002 Withdrawal Requests + +[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) introduces the possibility for validators to trigger exits and partial withdrawals via the execution layer. Starting with v5.3.0 this library supports withdrawal requests and a containing block can be instantiated as follows: + +```ts +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various withdrawal request parameters. + +#### EIP-7251 Consolidation Requests + +[EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) introduces consolidation requests allowing staked ETH from more than one validator on the beacon chain to be consolidated into one validator, triggered from the execution layer. Starting with v5.3.0 this library supports consolidation requests and a containing block can be instantiated as follows: + +```ts +// ./examples/7251Requests.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() +``` + +Have a look at the EIP for some guidance on how to use and fill in the various deposit request parameters. + ### Consensus Types The block library supports the creation as well as consensus format validation of PoW `ethash` and PoA `clique` blocks (so e.g. do specific `extraData` checks on Clique/PoA blocks). diff --git a/packages/block/examples/6110Requests.ts b/packages/block/examples/6110Requests.ts new file mode 100644 index 0000000000..6fdba01186 --- /dev/null +++ b/packages/block/examples/6110Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + DepositRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const depositRequestData = { + pubkey: randomBytes(48), + withdrawalCredentials: randomBytes(32), + amount: bytesToBigInt(randomBytes(8)), + signature: randomBytes(96), + index: bytesToBigInt(randomBytes(8)), + } + const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } deposit request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() diff --git a/packages/block/examples/7002Requests.ts b/packages/block/examples/7002Requests.ts new file mode 100644 index 0000000000..2826cf9192 --- /dev/null +++ b/packages/block/examples/7002Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + randomBytes, + WithdrawalRequest, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const withdrawalRequestData = { + sourceAddress: randomBytes(20), + validatorPubkey: randomBytes(48), + amount: bytesToBigInt(randomBytes(8)), + } + const request = WithdrawalRequest.fromRequestData( + withdrawalRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } withdrawal request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() diff --git a/packages/block/examples/7251Requests.ts b/packages/block/examples/7251Requests.ts new file mode 100644 index 0000000000..c53237cbd1 --- /dev/null +++ b/packages/block/examples/7251Requests.ts @@ -0,0 +1,42 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Block } from '@ethereumjs/block' +import { + bytesToBigInt, + ConsolidationRequest, + randomBytes, + type CLRequest, + type CLRequestType, +} from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ + chain: Chain.Mainnet, + hardfork: Hardfork.Prague, + }) + + const consolidationRequestData = { + sourceAddress: randomBytes(20), + sourcePubkey: randomBytes(48), + targetPubkey: randomBytes(48), + } + const request = ConsolidationRequest.fromRequestData( + consolidationRequestData + ) as CLRequest + const requests = [request] + const requestsRoot = await Block.genRequestsTrieRoot(requests) + + const block = Block.fromBlockData( + { + requests, + header: { requestsRoot }, + }, + { common } + ) + console.log( + `Instantiated block with ${ + block.requests?.length + } consolidation request, requestTrieValid=${await block.requestsTrieIsValid()}` + ) +} + +main() diff --git a/packages/block/package.json b/packages/block/package.json index f883e4259d..2ef6ae214c 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/block", - "version": "5.2.0", + "version": "5.3.0", "description": "Provides Block serialization and help functions", "keywords": [ "ethereum", @@ -46,11 +46,11 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { diff --git a/packages/block/src/block.ts b/packages/block/src/block.ts index 194f8185cd..330a1baba3 100644 --- a/packages/block/src/block.ts +++ b/packages/block/src/block.ts @@ -988,6 +988,12 @@ export class Block { } } + /** + * Maps the block properties to the execution payload structure from the beacon chain, + * see https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#ExecutionPayload + * + * @returns dict with the execution payload parameters with camel case naming + */ toExecutionPayload(): ExecutionPayload { const blockJson = this.toJSON() const header = blockJson.header! diff --git a/packages/block/test/eip7685block.spec.ts b/packages/block/test/eip7685block.spec.ts index 1d1962aacb..7c1c2f293a 100644 --- a/packages/block/test/eip7685block.spec.ts +++ b/packages/block/test/eip7685block.spec.ts @@ -26,7 +26,7 @@ function getRandomDepositRequest(): CLRequest { function getRandomWithdrawalRequest(): CLRequest { const withdrawalRequestData = { sourceAddress: randomBytes(20), - validatorPublicKey: randomBytes(48), + validatorPubkey: randomBytes(48), amount: bytesToBigInt(randomBytes(8)), } return WithdrawalRequest.fromRequestData(withdrawalRequestData) as CLRequest diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index c5c5d84484..78dde08dc6 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -6,7 +6,25 @@ 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). -## 7.2.0 - 2024-03-05 +## 7.3.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### Verkle Updates + +- Fix the block body parsing as well as save/load from blockchain, PR [#3392](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3392) +- Handle nil block bodies for backwards compatibility, PR [#3394](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3394) + +### Other Features + +- Support for EIP-7685 blocks containing withdrawal and/or deposit requests (see @ethereumjs/block for main documentation), PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +## 7.2.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/blockchain/README.md b/packages/blockchain/README.md index 8fbd1a09d6..abd983b066 100644 --- a/packages/blockchain/README.md +++ b/packages/blockchain/README.md @@ -180,6 +180,14 @@ The blockchain library now allows for blob transactions to be validated and incl **Note:** Working with blob transactions needs a manual KZG library installation and global initialization, see [KZG Setup](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx/README.md#kzg-setup) for instructions. +### EIP-7685 Requests Support + +This libary supports blocks including the following [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Deposit Requests (`v7.3.0`+) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Withdrawal Requests (`v7.3.0`+) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Consolidation Requests (`v7.3.0`+) + ## Browser With the breaking release round in Summer 2023 we have added hybrid ESM/CJS builds for all our libraries (see section below) and have eliminated many of the caveats which had previously prevented a frictionless browser usage. diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 180df21cc4..50507dfc36 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/blockchain", - "version": "7.2.0", + "version": "7.3.0", "description": "A module to store and interact with blocks", "keywords": [ "ethereum", @@ -46,13 +46,13 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/ethash": "^3.0.3", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/ethash": "^3.0.4", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "lru-cache": "10.1.0" diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 4af9204427..7c6ceff4d8 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -6,7 +6,50 @@ 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). -## 0.10.1 - 2024-03-05 +## 0.10.2 - 2024-08-15 + +This release comes with some RPC improvements as well as various updates to catch up for testnets preparing for the Prague hardfork as well as the Verkle tree integration. Note that for running/participating in the latest Prague and Verkle testnets it is still needed to join with a build from `master` since testnets are evolving so quickly that it is not practical to catch up with official client releases! + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- CLI option `--ignoreStatelessInvalidExecs` for Verkle debugging, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Simplify `--ignoreStatelessInvalidExecs` to just a boolean flag, PR [#3395](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3395) +- Add verkle execution support to `executeBlocks()`, PR [#3406](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3406) +- Verkle decoupling in underlying libraries, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Integrates support for [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (outdated) (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- New `--startExectionFrom` and `--startExecution` CLI options, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Add `eth_blobBaseFee` RPC endpoint, PR [#3436](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3436) +- Add support for `pending` in `eth_getTransactionCount` RPC method, PR [#3415](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3415) +- Add support for multiple sources of rlp blocks when loading with `--loadBlocksFromRlp`, PR [#3442](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3442) +- Basic Prometheus metrics support (not many metrics yet), PR [#3287](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3287) + +### Other Changes + +- ESM-only client build, PRs [#3359](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3359) and [#3414](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3414) +- Add execution api v4 handling to engine, PR [#3399](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3399) +- New mechanism to keep latest block from peers updated, PR [#3354](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3354) +- Better `--execution` flag guard, PR [#3363](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3363) +- Stricter prefixed hex typing, PR [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348) +- Update `multiaddress` dependency, PR [#3384](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3384) +- Internalize `QHeap` dependency, PR [#3451](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3451) +- Internalize `jwt-simple` dependency, PR [#3458](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3458) + +### Bugfixes + +- Fixes for the `eth_estimateGas` RPC endpoint, PR [#3416](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3416) +- Fixes tx status in `eth_getTransactionReceipt` RPC method, PR [#3435](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3435) +- Fixes the "block to payload" serialization for `getPayloadV4`, PR [#3409](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3409) +- Fix the `getPayloadV4` with a deposit tx and expected deposit requests, PR [#3410](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3410) + +## 0.10.1 - 2024-03-18 This is mainly a maintenance release coming with a few internal changes and minor bug fixes, single user-focused addition is the support for the `eth_feeHistory` RPC call. diff --git a/packages/client/README.md b/packages/client/README.md index 5eb589fe0f..929f7566c4 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -307,7 +307,7 @@ dist/bin/cli.js --d ## Metrics -The client can optionally collect metrics using the Prometheus metrics platform and expose them via an HTTP endpoint with the following CLI flags. +The client can optionally collect metrics using the [Prometheus](https://github.com/prometheus/prometheus) metrics platform and expose them via an HTTP endpoint with the following CLI flags. The current metrics that are reported by the client can be found [here](./src/util//metrics.ts). ```sh diff --git a/packages/client/package.json b/packages/client/package.json index 112e177c25..9741cae28b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/client", - "version": "0.10.1", + "version": "0.10.2", "description": "EthereumJS Execution Layer (EL) Client Implementation", "keywords": [ "ethereum", @@ -55,20 +55,20 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "5.2.0", - "@ethereumjs/blockchain": "7.2.0", - "@ethereumjs/common": "4.3.0", - "@ethereumjs/devp2p": "6.1.2", - "@ethereumjs/ethash": "3.0.3", - "@ethereumjs/evm": "3.0.0", - "@ethereumjs/genesis": "0.2.2", + "@ethereumjs/block": "5.3.0", + "@ethereumjs/blockchain": "7.3.0", + "@ethereumjs/common": "4.4.0", + "@ethereumjs/devp2p": "6.1.3", + "@ethereumjs/ethash": "3.0.4", + "@ethereumjs/evm": "3.1.0", + "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", - "@ethereumjs/statemanager": "2.3.0", - "@ethereumjs/trie": "6.2.0", - "@ethereumjs/tx": "5.3.0", - "@ethereumjs/util": "9.0.3", - "@ethereumjs/verkle": "^0.0.2", - "@ethereumjs/vm": "8.0.0", + "@ethereumjs/statemanager": "2.4.0", + "@ethereumjs/trie": "6.2.1", + "@ethereumjs/tx": "5.4.0", + "@ethereumjs/util": "9.1.0", + "@ethereumjs/verkle": "^0.1.0", + "@ethereumjs/vm": "8.1.0", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", "@polkadot/wasm-crypto": "^7.3.2", diff --git a/packages/client/src/ext/jwt-simple.ts b/packages/client/src/ext/jwt-simple.ts index 9357ef52c3..45ce840259 100644 --- a/packages/client/src/ext/jwt-simple.ts +++ b/packages/client/src/ext/jwt-simple.ts @@ -7,7 +7,7 @@ * module dependencies */ import { bytesToUtf8, utf8ToBytes } from '@ethereumjs/util' -import { base64url } from '@scure/base' +import { base64url, base64urlnopad } from '@scure/base' import crypto from 'crypto' /** @@ -121,7 +121,7 @@ const decode = function jwt_decode( // base64 decode and parse JSON const header = JSON.parse(bytesToUtf8(base64url.decode(headerSeg))) - const payload = JSON.parse(bytesToUtf8(base64url.decode(payloadSeg))) + const payload = JSON.parse(bytesToUtf8(base64urlnopad.decode(payloadSeg))) if (!noVerify) { if (!algorithm && /BEGIN( RSA)? PUBLIC KEY/.test(key.toString())) { @@ -193,7 +193,7 @@ const encode = function jwt_encode( // create segments, all segments should be base64 string const segments = [] segments.push(base64url.encode(utf8ToBytes(JSON.stringify(header)))) - segments.push(base64url.encode(utf8ToBytes(JSON.stringify(payload)))) + segments.push(base64urlnopad.encode(utf8ToBytes(JSON.stringify(payload)))) segments.push(sign(segments.join('.'), key, signingMethod, signingType)) return segments.join('.') diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 617fc94dea..9f62741271 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -6,7 +6,39 @@ 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). -## 4.3.0 - 2024-03-05 +## 4.4.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Adds support for [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (outdated) (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- Adds support for [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) Serve Historical Block Hashes from State (Prague) (see EVM for full docs) as well as the related [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709), PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Clean up access to deposit address, PR [#3411](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3411) +- Add spec test for 2935 contract code and update history storage address, PR [#3373](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3373) +- Parse deposit contract address from geth genesis for chain config, PR [#3422](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3422) + +### Bugfixes + +- BLS gas prices fixes, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) + +## 4.3.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/common/README.md b/packages/common/README.md index 1124468ef7..d0cad1bd89 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -405,11 +405,10 @@ The following EIPs are currently supported: - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -431,8 +430,14 @@ The following EIPs are currently supported: - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) ### Bootstrap Nodes diff --git a/packages/common/package.json b/packages/common/package.json index 422276764e..1df8ecbecb 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/common", - "version": "4.3.0", + "version": "4.4.0", "description": "Resources common to all Ethereum implementations", "keywords": [ "ethereum", @@ -56,7 +56,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/util": "^9.1.0" }, "devDependencies": { "@polkadot/util": "^12.6.2", diff --git a/packages/devp2p/CHANGELOG.md b/packages/devp2p/CHANGELOG.md index 17ffa2d4e5..0d87820eda 100644 --- a/packages/devp2p/CHANGELOG.md +++ b/packages/devp2p/CHANGELOG.md @@ -6,7 +6,11 @@ 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). -## 6.1.2 - 2024-03-05 +## 6.1.3 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 6.1.2 - 2024-03-18 - Fix a type error related to the `lru-cache` dependency, PR [#3285](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3285) - Downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index d14c3ccb8f..1cc3ae4049 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/devp2p", - "version": "6.1.2", + "version": "6.1.3", "description": "A JavaScript implementation of ÐΞVp2p", "keywords": [ "ethereum", @@ -57,9 +57,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", @@ -68,8 +68,8 @@ "snappyjs": "^0.6.1" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/tx": "^5.3.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/tx": "^5.4.0", "@types/debug": "^4.1.9", "@types/k-bucket": "^5.0.0", "chalk": "^4.1.2", diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index e6e3a6159c..464f316b23 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -6,7 +6,11 @@ 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). -## 3.0.3 - 2024-03-05 +## 3.0.4 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 3.0.3 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/ethash/package.json b/packages/ethash/package.json index c3eb89c7fc..d14b5156a6 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/ethash", - "version": "3.0.3", + "version": "3.0.4", "description": "An implementation of the Ethash consensus algorithm in JavaScript", "keywords": [ "ethash", @@ -45,14 +45,14 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "bigint-crypto-utils": "^3.2.2", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { - "@ethereumjs/common": "^4.3.0" + "@ethereumjs/common": "^4.4.0" }, "engines": { "node": ">=18" diff --git a/packages/evm/CHANGELOG.md b/packages/evm/CHANGELOG.md index d88163ffa6..97b05b7e15 100644 --- a/packages/evm/CHANGELOG.md +++ b/packages/evm/CHANGELOG.md @@ -6,7 +6,58 @@ 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). -## 3.0.0 - 2024-03-05 +## 3.1.0 - 2024-08-15 + +### EIP-2537 BLS Precompiles (Prague) + +Starting with this release the EVM support the BLS precompiles introduced with [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537). These precompiles run natively using the [@noble/curves](https://github.com/paulmillr/noble-curves) library (❤️ to `@paulmillr`!), see PRs [#3350](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3350) and [#3471](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3471). + +An alternative WASM implementation (using [bls-wasm](https://github.com/herumi/bls-wasm)) can be optionally used like this if needed for performance reasons: + +```ts +import { EVM, MCLBLS } from '@ethereumjs/evm' + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) +await mcl.init(mcl.BLS12_381) +const mclbls = new MCLBLS(mcl) +const evm = await EVM.create({ common, bls }) +``` + +### Verkle Dependency Decoupling + +We have relatively light-heartedly added a new `@ethereumjs/verkle` main dependency to the VM/EVM stack in the `v7.2.1` release, which added an additional burden to the bundle size by several hundred KB and additionally draws in unnecessary WASM code. Coupling with Verkle has been refactored in PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) and the direct dependency has been removed again. + +An update to this release is therefore strongly recommended even if other fixes or features are not that relevant for you right now. + +### Verkle Updates + +- Adds ability to run [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (see tx library for full documentation), see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470) +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- Fix `accessWitness` passing, PR [#3405](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3405) +- Remove the hacks to prevent account cleanups of system contracts, PR [#3418](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3418) +- Fix EIP-2935 address conversion issues, PR [#3447](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3447) + +### Other Features + +- Add support for retroactive [EIP-7610](https://eips.ethereum.org/EIPS/eip-7610), PR [#3480](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3480) +- Adds bundle visualizer (to be used with `npm run visualize:bundle`), PR [#3463](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3463) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Update `mcl-wasm` Dependency (Esbuild Issue), PR [#3461](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3461) + +### Bugfixes + +- BLS precompile fixes, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) +- Ignore precompile addresses for some target access events, PR [#3366](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3366) + +## 3.0.0 - 2024-03-18 ### New EVM.create() Async Static Constructor diff --git a/packages/evm/README.md b/packages/evm/README.md index 1537ecde9b..baf6af23ad 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -97,6 +97,59 @@ void main() Additionally this usage example shows the use of events to listen on the inner workings and procedural updates (`step` event) of the EVM. +### Precompiles + +This library support all EVM precompiles up to the `Prague` hardfork. + +The following code allows to run precompiles in isolation, e.g. for testing purposes: + +```ts +// ./examples/precompile.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EVM, getActivePrecompiles } from '@ethereumjs/evm' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) + + // Taken from test/eips/precompiles/bls/add_G1_bls.json + const data = hexToBytes( + '0x0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21' + ) + const gasLimit = BigInt(5000000) + + const evm = await EVM.create({ common }) + const precompile = getActivePrecompiles(common).get('000000000000000000000000000000000000000b')! + + const callData = { + data, + gasLimit, + common, + _EVM: evm, + } + const result = await precompile(callData) + console.log(`Precompile result:${bytesToHex(result.returnValue)}`) +} + +main() +``` + +### EIP-2537 BLS Precompiles (Prague) + +Starting with `v3.1.0` the EVM support the BLS precompiles introduced with [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537). These precompiles run natively using the [@noble/curves](https://github.com/paulmillr/noble-curves) library (❤️ to `@paulmillr`!). + +An alternative WASM implementation (using [bls-wasm](https://github.com/herumi/bls-wasm)) can be optionally used like this if needed for performance reasons: + +```ts +import { EVM, MCLBLS } from '@ethereumjs/evm' + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) +await mcl.init(mcl.BLS12_381) +const mclbls = new MCLBLS(mcl) +const evm = await EVM.create({ common, bls }) +``` + ## Examples This projects contain the following examples: @@ -218,11 +271,10 @@ Currently supported EIPs: - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -244,8 +296,14 @@ Currently supported EIPs: - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) ### WASM Crypto Support diff --git a/packages/evm/docs/interfaces/EVMOpts.md b/packages/evm/docs/interfaces/EVMOpts.md index dacab84ccd..8ae2b12c6b 100644 --- a/packages/evm/docs/interfaces/EVMOpts.md +++ b/packages/evm/docs/interfaces/EVMOpts.md @@ -67,11 +67,10 @@ Use a Common instance for EVM instantiation. - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun) - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain -- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) - Simple subroutines for the EVM (`outdated`) - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2565) - Transaction Types -- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) +- [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -93,8 +92,14 @@ Use a Common instance for EVM instantiation. - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-5656) - Supply validator deposits on chain (Prague) - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) +- [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) +- [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) +- [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) *Annotations:* diff --git a/packages/evm/examples/precompile.ts b/packages/evm/examples/precompile.ts new file mode 100644 index 0000000000..a81d746227 --- /dev/null +++ b/packages/evm/examples/precompile.ts @@ -0,0 +1,27 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EVM, getActivePrecompiles } from '@ethereumjs/evm' +import { bytesToHex, hexToBytes } from '@ethereumjs/util' + +const main = async () => { + const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Prague }) + + // Taken from test/eips/precompiles/bls/add_G1_bls.json + const data = hexToBytes( + '0x0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e100000000000000000000000000000000112b98340eee2777cc3c14163dea3ec97977ac3dc5c70da32e6e87578f44912e902ccef9efe28d4a78b8999dfbca942600000000000000000000000000000000186b28d92356c4dfec4b5201ad099dbdede3781f8998ddf929b4cd7756192185ca7b8f4ef7088f813270ac3d48868a21' + ) + const gasLimit = BigInt(5000000) + + const evm = await EVM.create({ common }) + const precompile = getActivePrecompiles(common).get('000000000000000000000000000000000000000b')! + + const callData = { + data, + gasLimit, + common, + _EVM: evm, + } + const result = await precompile(callData) + console.log(`Precompile result:${bytesToHex(result.returnValue)}`) +} + +main() diff --git a/packages/evm/package.json b/packages/evm/package.json index cabc608efd..943e301b7b 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/evm", - "version": "3.0.0", + "version": "3.1.0", "description": "JavaScript Ethereum Virtual Machine (EVM) implementation", "keywords": [ "ethereum", @@ -54,10 +54,10 @@ "visualize:bundle": "npx vite build --config=./vite.config.bundler.ts --emptyOutDir=false --outDir ." }, "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "@types/debug": "^4.1.9", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", diff --git a/packages/evm/src/types.ts b/packages/evm/src/types.ts index f423302e33..566deb2f02 100644 --- a/packages/evm/src/types.ts +++ b/packages/evm/src/types.ts @@ -181,7 +181,7 @@ export interface EVMOpts { * - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS precompiles (removed in v4.0.0, see latest v3 release) * - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost * - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2565) - Transaction Types - * - [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Save historical block hashes in state (`experimental`) + * - [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague) * - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes * - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type * - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes @@ -200,11 +200,17 @@ export interface EVMOpts { * - [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) - Supplant DIFFICULTY opcode with PREVRANDAO (Merge) * - [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) - Beacon block root in the EVM (Cancun) * - [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) - Shard Blob Transactions (Cancun) + * - [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - EOA code transactions (Prague) (`outdated`) + * - [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Osaka) * - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai) * - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier) * - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun) + * - [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague) * - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun) + * - [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable withdrawals (Prague) + * - [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Execution layer triggerable validator consolidations (Prague) * - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun) + * - [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague) * * *Annotations:* * @@ -257,7 +263,7 @@ export interface EVMOpts { customPrecompiles?: CustomPrecompile[] /** - * For the EIP-2935 BLS precompiles, the native JS `@noble/curves` + * For the EIP-2537 BLS Precompiles, the native JS `@noble/curves` * https://github.com/paulmillr/noble-curves BLS12-381 curve implementation * is used (see `noble.ts` file in the `precompiles` folder). * diff --git a/packages/genesis/CHANGELOG.md b/packages/genesis/CHANGELOG.md index cdd07f8f6f..c76dfeebcc 100644 --- a/packages/genesis/CHANGELOG.md +++ b/packages/genesis/CHANGELOG.md @@ -6,7 +6,11 @@ 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). -## 0.2.2 - 2024-03-05 +## 0.2.3 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 0.2.2 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/genesis/package.json b/packages/genesis/package.json index 85bbda42ed..d7a7929a6c 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/genesis", - "version": "0.2.2", + "version": "0.2.3", "description": "A module to provide genesis states of well known networks", "keywords": [ "ethereum", @@ -58,13 +58,13 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/util": "^9.1.0" }, "engines": { "node": ">=18" }, "devDependencies": { - "@ethereumjs/trie": "^6.2.0" + "@ethereumjs/trie": "^6.2.1" } } diff --git a/packages/statemanager/CHANGELOG.md b/packages/statemanager/CHANGELOG.md index 9d0c5069cc..64d53faf01 100644 --- a/packages/statemanager/CHANGELOG.md +++ b/packages/statemanager/CHANGELOG.md @@ -6,7 +6,30 @@ 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). -## 2.3.0 - 2024-03-05 +## 2.4.0 - 2024-08-15 + +### Verkle Updates + +- Various fixes for Kaustinen4 support (partial account integration, `getContractCodeSize()`, other), PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Missing beaconroot account verkle fix, PR [#3421](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3421) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Modify RPCStateManager `getAccount()`, PR [#3345](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3345) + +### Bugfixes + +- Fixes an issue where under certain deployment conditions wrong storage values could be provided, PR [#3434](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3434) +- Fixes statemanager empty code bug, PR [#3483](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3483) + +## 2.3.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index 821879a00e..71e5a342fd 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/statemanager", - "version": "2.3.0", + "version": "2.4.0", "description": "An Ethereum statemanager implementation", "keywords": [ "ethereum", @@ -49,18 +49,18 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1", "js-sdsl": "^4.1.4", "lru-cache": "10.1.0" }, "devDependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/genesis": "^0.2.3", "@types/debug": "^4.1.9", "rustbn-wasm": "^0.4.0", "verkle-cryptography-wasm": "^0.4.5" diff --git a/packages/trie/CHANGELOG.md b/packages/trie/CHANGELOG.md index f6d0ea01c0..d7544fb9b9 100644 --- a/packages/trie/CHANGELOG.md +++ b/packages/trie/CHANGELOG.md @@ -6,7 +6,17 @@ 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). -## 6.2.0 - 2024-03-05 +## 6.2.1 - 2024-08-15 + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Bugfixes + +- Fixes an issue in the delete operation used for unhashed tries and pruning activated which resulted in a wrong state root (bad!), PR [#3333](https://github.com/ethereumjs/ethereumjs-monorepo/issues/3333) + +## 6.2.0 - 2024-03-18 In the hope that you do not have yet integrated: we needed to remove the new more modern async trie iteration with web streams functionality (new `createAsyncReadStream()` method) introduced with the `v6.1.0` release - see PR [#3231](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3231) for context - since the related Node.js web streams API import caused relatively severe problems for all upstream libraries when being used in the browser. diff --git a/packages/trie/package.json b/packages/trie/package.json index 14d5fd38f3..911a34a7f2 100644 --- a/packages/trie/package.json +++ b/packages/trie/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/trie", - "version": "6.2.0", + "version": "6.2.1", "description": "Implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper.", "keywords": [ "merkle", @@ -54,7 +54,7 @@ }, "dependencies": { "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@types/readable-stream": "^2.3.13", "debug": "^4.3.4", "lru-cache": "10.1.0", @@ -62,7 +62,7 @@ "readable-stream": "^3.6.0" }, "devDependencies": { - "@ethereumjs/genesis": "^0.2.2", + "@ethereumjs/genesis": "^0.2.3", "@types/benchmark": "^1.0.33", "abstract-level": "^1.0.3", "level": "^8.0.0", diff --git a/packages/tx/CHANGELOG.md b/packages/tx/CHANGELOG.md index de7c0520f6..337bb865bc 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -6,7 +6,62 @@ 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.3.0 - 2024-03-05 +## 5.4.0 - 2024-08-15 + +#### EOA Code Transaction (EIP-7702) (outdated) + +This release introduces support for a non-final version of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions, see PR [#3470](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3470). This tx type allows to run code in the context of an EOA and therefore extend the functionality which can be "reached" from respectively integrated into the scope of an otherwise limited EOA account. + +The following is a simple example how to use an `EOACodeEIP7702Transaction` with one autorization list item: + +```ts +// ./examples/EOACodeTx.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x1', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common } +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).` +) +``` + +Note: Things move fast with `EIP-7702` and the released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + +### Verkle Updates + +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) + +### Other Features + +- Extend `BlobEIP4844Transaction.networkWrapperToJson()` to also include the 4844 fields, PR [#3365](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3365) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Bugfixes + +- Fix bug in generic error message regarding chain ID reporting, PR [#3386](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3386) + +## 5.3.0 - 2024-03-18 ### Full 4844 Browser Readiness diff --git a/packages/tx/README.md b/packages/tx/README.md index f205171237..7cbdc2fea5 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -102,6 +102,7 @@ This library supports the following transaction types ([EIP-2718](https://eips.e - `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), proto-danksharding) - `FeeMarketEIP1559Transaction` ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559), gas fee market) +- `EOACodeEIP7702Transaction` (experimental) ([EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), EOA code delegation) - `AccessListEIP2930Transaction` ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930), optional access lists) - `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), blob transactions) - `LegacyTransaction`, the Ethereum standard tx up to `berlin`, now referred to as legacy txs with the introduction of tx types @@ -207,6 +208,49 @@ const tx = FeeMarketEIP1559Transaction.fromTxData(txData, { common }) console.log(bytesToHex(tx.hash())) // 0x6f9ef69ccb1de1aea64e511efd6542541008ced321887937c95b03779358ec8a ``` +#### EOA Code Transaction (EIP-7702) (outdated) + +- Class: `EOACodeEIP7702Transaction` +- Activation: `prague` (or per EIP setting) +- Type: `4` + +This library suppports a non-final version of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) starting with `v5.4.0`. This tx type allows to run code in the context of an EOA and therefore extend the functionality which can be "reached" from respectively integrated into the scope of an otherwise limited EOA account. + +The following is a simple example how to use an `EOACodeEIP7702Transaction` with one autorization list item: + +```ts +// ./examples/EOACodeTx.ts + +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x1', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common } +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).` +) +``` + +Note: Things move fast with `EIP-7702` and the currently released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + #### Access List Transactions (EIP-2930) - Class: `AccessListEIP2930Transaction` diff --git a/packages/tx/examples/EOACodeTx.ts b/packages/tx/examples/EOACodeTx.ts new file mode 100644 index 0000000000..40b695109c --- /dev/null +++ b/packages/tx/examples/EOACodeTx.ts @@ -0,0 +1,26 @@ +import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { EOACodeEIP7702Transaction } from '@ethereumjs/tx' +import type { PrefixedHexString } from '@ethereumjs/util' + +const ones32 = `0x${'01'.repeat(32)}` as PrefixedHexString + +const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) +const tx = EOACodeEIP7702Transaction.fromTxData( + { + authorizationList: [ + { + chainId: '0x2', + address: `0x${'20'.repeat(20)}`, + nonce: ['0x1'], + yParity: '0x1', + r: ones32, + s: ones32, + }, + ], + }, + { common } +) + +console.log( + `EIP-7702 EOA code tx created with ${tx.authorizationList.length} authorization list item(s).` +) diff --git a/packages/tx/package.json b/packages/tx/package.json index d1ec3b5239..c7be086ddf 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/tx", - "version": "5.3.0", + "version": "5.4.0", "description": "Implementation of the various Ethereum Transaction Types", "keywords": [ "ethereum", @@ -20,11 +20,7 @@ { "name": "Alex Beregszaszi", "email": "alex@rtfs.hu", - "url": "https://github.com/axic", - "additions": 27562, - "contributions": 22, - "deletions": 42613, - "hireable": true + "url": "https://github.com/axic" } ], "type": "commonjs", @@ -57,9 +53,9 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/common": "^4.3.0", + "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "ethereum-cryptography": "^2.2.1" }, "devDependencies": { diff --git a/packages/util/CHANGELOG.md b/packages/util/CHANGELOG.md index 2e4fb43ece..8fce40b823 100644 --- a/packages/util/CHANGELOG.md +++ b/packages/util/CHANGELOG.md @@ -6,7 +6,52 @@ 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). -## 9.0.3 - 2024-03-05 +## 9.1.0 - 2024-08-15 + +### Support for Partial Accounts + +For Verkle or other contexts it can be useful to create partial accounts not containing all the account parameters. This is now supported starting with this release, see PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269): + +```ts +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) +``` + +### New `requests` Module + +This release introduces a new `requests` module (see PRs [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372), [#3393](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3393), [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) and [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477)) with various type and an abstract base class for [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) general purpose execution layer requests to the CL (Prague hardfork) as well as concrete implementations for the currently supported request types: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): `DepositRequest` (Prague Hardfork) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): `WithdrawawlRequest` (Prague Hardfork) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): `ConsolidationRequest` (Prague Hardfork) + +These request types are mainly used within the [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) library where applied usage instructions are provided in the README. + +### Verkle Updates + +- Update `kzg-wasm` to `0.4.0`, PR [#3358](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3358) +- Shift Verkle to `osaka` hardfork, PR [#3371](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3371) +- New `verkle` module with utility methods and interfaces, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) +- Rename verkle utils and refactor, PR [#3468](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3468) + +### Other Features + +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Adjust `Account.isContract()` (in Verkle context work), PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Rename deposit receipt to deposit request, PR [#3408](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3408) +- Adjust `Account.isEmpty()` to also work for partial accounts, PR [#3405](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3405) +- Enhances typing of CL requests, PR [#3398](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3398) +- Rename withdrawal request's `validatorPublicKey` to `validatorPubkey`, PR [#3474](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3474) + +## 9.0.3 - 2024-03-18 - Allow optional `trustedSetupPath` for the `initKZG()` method, PR [#3296](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3296) diff --git a/packages/util/README.md b/packages/util/README.md index c493df976b..467aa8341d 100644 --- a/packages/util/README.md +++ b/packages/util/README.md @@ -45,6 +45,20 @@ const account = Account.fromAccountData({ console.log(`Account with nonce=${account.nonce} and balance=${account.balance} created`) ``` +For Verkle or other contexts it can be useful to create partial accounts not containing all the account parameters. This is supported starting with v9.1.0: + +```ts +// ./examples/accountPartial.ts + +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) +``` + ### Module: [address](src/address.ts) Class representing an Ethereum `Address` with instantiation helpers and validation methods. @@ -127,6 +141,16 @@ KZG interface (used for 4844 blob txs), see [@ethereumjs/tx](https://github.com/ Simple map DB implementation using the `DB` interface (see above). +### Module: [requests](src/requests.ts) + +Module with various type and an abstract base class for [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) general purpose execution layer requests to the CL (Prague hardfork) as well as concrete implementations for the currently supported request types: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): `DepositRequest` (Prague Harfork) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): `WithdrawawlRequest` (Prague Hardfork) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): `ConsolidationRequest` (Prague Hardfork) + +These request types are mainly used within the [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) library where applied usage instructions are provided in the README. + ### Module: [signature](src/signature.ts) Functionality for signing, signature validation, conversion, recovery. diff --git a/packages/util/examples/accountPartial.ts b/packages/util/examples/accountPartial.ts new file mode 100644 index 0000000000..93aa9c7256 --- /dev/null +++ b/packages/util/examples/accountPartial.ts @@ -0,0 +1,7 @@ +import { Account } from '@ethereumjs/util' + +const account = Account.fromPartialAccountData({ + nonce: '0x02', + balance: '0x0384', +}) +console.log(`Partial account with nonce=${account.nonce} and balance=${account.balance} created`) diff --git a/packages/util/package.json b/packages/util/package.json index 3d0906d621..007de6071b 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/util", - "version": "9.0.3", + "version": "9.1.0", "description": "A collection of utility functions for Ethereum", "keywords": [ "ethereum", diff --git a/packages/verkle/CHANGELOG.md b/packages/verkle/CHANGELOG.md index 536f107d59..c52c3915fd 100644 --- a/packages/verkle/CHANGELOG.md +++ b/packages/verkle/CHANGELOG.md @@ -6,7 +6,22 @@ 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). -## 0.0.2 - 2024-03-05 +## 0.1.0 - 2024-08-15 + +This is the first (still experimental) Verkle library release with some basic `put()` and `get()` functionality working! 🎉 Still highly moving and evolving parts, but early experiments and feedback welcome! + +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Move tree key computation to verkle and simplify, PR [#3420](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3420) +- Rename code keccak, PR [#3426](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3426) +- Add tests for verkle bytes helper, PR [#3441](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3441) +- Verkle decoupling, PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) +- Rename verkle utils and refactor, PR [#3468](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3468) +- Optimize storage of default values in VerkleNode, PR [#3476](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3476) +- Build out trie processing, PR [#3430](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3430) +- Implement `trie.put()`, PR [#3473](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3473) +- Add `trie.del()`, PR [#3486](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3486) + +## 0.0.2 - 2024-03-18 - Fix a type error related to the `lru-cache` dependency, PR [#3285](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3285) - Downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/verkle/package.json b/packages/verkle/package.json index 84a04bc501..94c8bac71b 100644 --- a/packages/verkle/package.json +++ b/packages/verkle/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/verkle", - "version": "0.0.2", + "version": "0.1.0", "description": "Implementation of verkle trees as used in Ethereum.", "keywords": [ "verkle", @@ -55,9 +55,9 @@ "debug": "^4.3.4", "lru-cache": "10.1.0", "verkle-cryptography-wasm": "^0.4.5", - "@ethereumjs/block": "^5.2.0", + "@ethereumjs/block": "^5.3.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/util": "^9.0.3" + "@ethereumjs/util": "^9.1.0" }, "engines": { "node": ">=18" diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index 6877c0d6aa..be99d94f81 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,7 +6,54 @@ 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). -## 8.0.0 - 2024-03-05 +## 8.1.0 - 2024-08-15 + +### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) + +This library now supports `EIP-6110` deposit requests, see PR [#3390](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3390), `EIP-7002` withdrawal requests, see PR [#3385](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3385) and `EIP-7251` consolidation requests, see PR [#3477](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3477) as well as the underlying generic execution layer request logic introduced with `EIP-7685` (PR [#3372](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3372)). + +These new request types will be activated with the `Prague` hardfork, see [@ethereumjs/block](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/block) README for detailed documentation. + +### EIP-2935 Serve Historical Block Hashes from State (Prague) + +Starting with this release the VM supports [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) which stores the latest 256 block hashes in the storage of a system contract, see PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) as the major integrational PR (while work on this has already been done in previous PRs). + +This EIP will be activated along the Prague hardfork. Note that this EIP has no effect on the resolution of the `BLOCKHASH` opcode, which will be a separate activation taking place by the integration of [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) in the following Osaka hardfork. + +### Verkle Dependency Decoupling + +We have relatively light-heartedly added a new `@ethereumjs/verkle` main dependency to the VM/EVM stack in the `v7.2.1` release, which added an additional burden to the bundle size by several hundred KB and additionally draws in unnecessary WASM code. Coupling with Verkle has been refactored in PR [#3462](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3462) and the direct dependency has been removed again. + +An update to this release is therefore strongly recommended even if other fixes or features are not that relevant for you right now. + +### Verkle Updates + +- Fixes for Kaustinen4 support, PR [#3269](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3269) +- Kaustinen5 related fixes, PR [#3343](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3343) +- Kaustinen6 adjustments, `verkle-cryptography-wasm` migration, PRs [#3355](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3355) and [#3356](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3356) +- Missing beaconroot account verkle fix, PR [#3421](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3421) +- Remove the hacks to prevent account cleanups of system contracts, PR [#3418](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3418) +- Updates EIP-2935 tests with the new proposed bytecode and corresponding config, PR [#3438](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3438) +- Fix EIP-2935 address conversion issues, PR [#3447](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3447) +- Remove backfill of block hashes on EIP-2935 activation, PR [#3478](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3478) + +### Other Features + +- Add `evmOpts` to the VM opts to allow for options chaining to the underlying EVM, PR [#3481](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3481) +- Stricter prefixed hex typing, PRs [#3348](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3348), [#3427](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3427) and [#3357](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3357) (some changes removed in PR [#3382](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3382) for backwards compatibility reasons, will be reintroduced along upcoming breaking releases) + +### Other Changes + +- Removes support for [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) simple subroutines for EVM (deprecated with an alternative version integrated into EOF), PR [#3342](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3342) +- Small clean-up to `VM._emit()`, PR [#3396](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3396) +- Update `mcl-wasm` Dependency (Esbuild Issue), PR [#3461](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3461) + +### Bugfixes + +- Fix block building with blocks including CL requests, PR [#3413](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3413) +- Ensure system address is not created if it is empty, PR [#3400](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3400) + +## 8.0.0 - 2024-03-18 ### New EVM.create() Async Static Constructor / Mandatory VM.create() Constructor diff --git a/packages/vm/README.md b/packages/vm/README.md index 814a0422c4..01f37f9772 100644 --- a/packages/vm/README.md +++ b/packages/vm/README.md @@ -318,6 +318,26 @@ For a list with supported EIPs see the [@ethereumjs/evm](https://github.com/ethe This library supports the blob transaction type introduced with [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844). +### EIP-7702 EAO Code Transactions Support (outdated) + +This library support the execution of [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) EOA code transactions (see tx library for full documentation) with `runTx()` or the wrapping `runBlock()` execution methods starting with `v3.1.0`, see [this test setup](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/vm/test/api/EIPs/eip-7702.spec.ts) for a more complete example setup on how to run code from an EOA. + +Note: Things move fast with `EIP-7702` and the currently released implementation is based on [this](https://github.com/ethereum/EIPs/blob/14400434e1199c57d912082127b1d22643788d11/EIPS/eip-7702.md) commit and therefore already outdated. An up-to-date version will be released along our breaking release round planned for early September 2024. + +### EIP-7685 Requests Support + +This libary supports blocks including the following [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests: + +- [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Deposit Requests (`v7.3.0`+) +- [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Withdrawal Requests (`v7.3.0`+) +- [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Consolidation Requests (`v7.3.0`+) + +### EIP-2935 Serve Historical Block Hashes from State (Prague) + +Starting with `v8.1.0` the VM supports [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) which stores the latest 8192 block hashes in the storage of a system contract, see PR [#3475](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3475) as the major integrational PR (while work on this has already been done in previous PRs). + +This EIP will be activated along the Prague hardfork. Note that this EIP has no effect on the resolution of the `BLOCKHASH` opcode, which will be a separate activation taking place by the integration of [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) in the following Osaka hardfork. + #### Initialization To run VM/EVM related EIP-4844 functionality you have to activate the EIP in the associated `@ethereumjs/common` library: diff --git a/packages/vm/package.json b/packages/vm/package.json index 111df4c242..3ee73c8984 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "8.0.0", + "version": "8.1.0", "description": "An Ethereum VM implementation", "keywords": [ "ethereum", @@ -63,15 +63,15 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/block": "^5.2.0", - "@ethereumjs/blockchain": "^7.2.0", - "@ethereumjs/common": "^4.3.0", - "@ethereumjs/evm": "^3.0.0", + "@ethereumjs/block": "^5.3.0", + "@ethereumjs/blockchain": "^7.3.0", + "@ethereumjs/common": "^4.4.0", + "@ethereumjs/evm": "^3.1.0", "@ethereumjs/rlp": "^5.0.2", - "@ethereumjs/statemanager": "^2.3.0", - "@ethereumjs/trie": "^6.2.0", - "@ethereumjs/tx": "^5.3.0", - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/statemanager": "^2.4.0", + "@ethereumjs/trie": "^6.2.1", + "@ethereumjs/tx": "^5.4.0", + "@ethereumjs/util": "^9.1.0", "debug": "^4.3.3", "ethereum-cryptography": "^2.2.1" }, diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index 43e273a626..d155728a9b 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -6,7 +6,11 @@ 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). -## 2.0.3 - 2024-03-05 +## 2.0.4 - 2024-08-15 + +Maintenance release with downstream dependency updates, see PR [#3527](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3527) + +## 2.0.3 - 2024-03-18 Maintenance release with downstream dependency updates, see PR [#3297](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3297) diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 505e23e9a6..3b809a155a 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/wallet", - "version": "2.0.3", + "version": "2.0.4", "description": "Utilities for handling Ethereum keys", "keywords": [ "ethereum", @@ -47,7 +47,7 @@ "tsc": "../../config/cli/ts-compile.sh" }, "dependencies": { - "@ethereumjs/util": "^9.0.3", + "@ethereumjs/util": "^9.1.0", "@scure/base": "^1.1.7", "ethereum-cryptography": "^2.2.1", "js-md5": "^0.8.3",